@tantainnovative/ndpr-toolkit 3.11.0 → 3.13.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 +110 -0
- package/dist/breach.d.mts +7 -1
- package/dist/breach.d.ts +7 -1
- package/dist/breach.js +1 -1
- package/dist/breach.mjs +1 -1
- package/dist/chunk-37VFK5SR.js +6 -0
- package/dist/chunk-3E4IH7CE.js +1 -0
- package/dist/chunk-3H6FYU3Z.mjs +93 -0
- package/dist/chunk-3I6FYA5C.js +103 -0
- package/dist/chunk-3SIYRGJF.js +93 -0
- package/dist/chunk-3XU6FL2I.js +1 -0
- package/dist/chunk-42JPSNVV.mjs +6 -0
- package/dist/chunk-42UJFTII.js +1 -0
- package/dist/chunk-737EMUUC.mjs +1 -0
- package/dist/chunk-7FXNGGMO.js +1 -0
- package/dist/chunk-B2EXRSYG.mjs +1 -0
- package/dist/chunk-BGV2AKT7.mjs +1 -0
- package/dist/chunk-BL5W472Q.js +1 -0
- package/dist/chunk-BPMVJOHH.mjs +1 -0
- package/dist/chunk-ELK6VFKC.mjs +2 -0
- package/dist/chunk-F5MGMNQF.js +2 -0
- package/dist/chunk-FRQFU44F.mjs +1 -0
- package/dist/{chunk-WYH3OA5L.mjs → chunk-I2ZBMR7F.mjs} +1 -1
- package/dist/chunk-J7BIJ45O.mjs +103 -0
- package/dist/{chunk-US2VGJ7I.js → chunk-KH3EQJQE.js} +1 -1
- package/dist/{chunk-IPWX5I5P.mjs → chunk-L3FR4PQE.mjs} +1 -1
- package/dist/chunk-N72RNTGP.mjs +6 -0
- package/dist/chunk-NB6SKG76.mjs +1 -0
- package/dist/chunk-NUIRMJKQ.mjs +2 -0
- package/dist/chunk-O2WEABB3.js +1 -0
- package/dist/chunk-PXDSPF5B.js +2 -0
- package/dist/chunk-QGUOFGVJ.js +2 -0
- package/dist/chunk-RBKFNCGO.mjs +1 -0
- package/dist/chunk-TTMGFC6C.js +1 -0
- package/dist/{chunk-TWJHEIQH.js → chunk-UZNWXJ2W.js} +1 -1
- package/dist/chunk-V5TZJJWU.mjs +1 -0
- package/dist/chunk-WCTFED27.js +1 -0
- package/dist/chunk-WHQ4PEYS.mjs +2 -0
- package/dist/chunk-WKUC65HL.mjs +1 -0
- package/dist/chunk-WMISQDSV.js +1 -0
- package/dist/{chunk-MTSZ7GL6.mjs → chunk-WVHMY2BV.mjs} +1 -1
- package/dist/chunk-XYGGUGTO.js +6 -0
- package/dist/chunk-YDKWD6MQ.js +1 -0
- package/dist/chunk-Z2M5VJX2.mjs +1 -0
- package/dist/{chunk-D3DVVJCT.js → chunk-ZD2W3YU2.js} +1 -1
- package/dist/chunk-ZM5DLFCZ.js +1 -0
- package/dist/chunk-ZQHGIOYP.mjs +1 -0
- package/dist/consent.js +1 -1
- package/dist/consent.mjs +1 -1
- package/dist/core.d.mts +62 -0
- package/dist/core.d.ts +62 -0
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/cross-border-lite.js +1 -1
- package/dist/cross-border-lite.mjs +1 -1
- 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/dsr.js +1 -1
- package/dist/dsr.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 +93 -4
- package/dist/index.d.ts +93 -4
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/lawful-basis-lite.js +1 -1
- package/dist/lawful-basis-lite.mjs +1 -1
- package/dist/lawful-basis.js +1 -1
- package/dist/lawful-basis.mjs +1 -1
- package/dist/policy.js +1 -1
- package/dist/policy.mjs +1 -1
- package/dist/presets-consent.js +1 -1
- package/dist/presets-consent.mjs +1 -1
- package/dist/presets-dsr.js +1 -1
- package/dist/presets-dsr.mjs +1 -1
- package/dist/presets-policy.d.mts +23 -0
- package/dist/presets-policy.d.ts +23 -0
- package/dist/presets-policy.js +1 -1
- package/dist/presets-policy.mjs +1 -1
- package/dist/presets.d.mts +230 -1
- package/dist/presets.d.ts +230 -1
- package/dist/presets.js +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/ropa-lite.js +1 -1
- package/dist/ropa-lite.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/server.d.mts +62 -0
- package/dist/server.d.ts +62 -0
- package/dist/server.js +1 -1
- package/dist/server.mjs +1 -1
- package/dist/styles.css +2 -0
- package/dist/unstyled.js +1 -1
- package/dist/unstyled.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-25TNTLHJ.mjs +0 -1
- package/dist/chunk-3JPDTXGC.js +0 -1
- package/dist/chunk-43OQNS2J.mjs +0 -6
- package/dist/chunk-5AECGMEB.js +0 -1
- package/dist/chunk-5EKQX6GM.mjs +0 -1
- package/dist/chunk-5GVMKUMP.js +0 -1
- package/dist/chunk-6GM2PBTF.js +0 -2
- package/dist/chunk-73BMSK67.js +0 -1
- package/dist/chunk-COD3RMTL.mjs +0 -1
- package/dist/chunk-EKNWO4DK.js +0 -1
- package/dist/chunk-EXEXUAF6.mjs +0 -1
- package/dist/chunk-EZCGTHQV.js +0 -6
- package/dist/chunk-FMJ6ICLJ.js +0 -1
- package/dist/chunk-G7JKRYM5.mjs +0 -1
- package/dist/chunk-GEP52QFH.mjs +0 -1
- package/dist/chunk-IB3KSUPZ.mjs +0 -1
- package/dist/chunk-JWAN5J4Y.js +0 -1
- package/dist/chunk-KY6WYHWB.mjs +0 -2
- package/dist/chunk-NDKDKDDX.js +0 -1
- package/dist/chunk-O2RDZGM2.js +0 -2
- package/dist/chunk-O45PKBZA.mjs +0 -6
- package/dist/chunk-OLEUIYE2.mjs +0 -1
- package/dist/chunk-PGI2LM6P.js +0 -103
- package/dist/chunk-PZRQWPWD.js +0 -1
- package/dist/chunk-Q4CSVWSS.mjs +0 -1
- package/dist/chunk-QMAVEHOR.js +0 -1
- package/dist/chunk-RBMLGRDN.mjs +0 -1
- package/dist/chunk-RPXRPGHL.mjs +0 -1
- package/dist/chunk-SSH4U4TJ.js +0 -6
- package/dist/chunk-TDHH7GS2.mjs +0 -2
- package/dist/chunk-WDDCKYWA.js +0 -1
- package/dist/chunk-WKTKTLMF.js +0 -1
- package/dist/chunk-X3GCGC3H.mjs +0 -103
- package/dist/chunk-XN2UYZXH.mjs +0 -93
- package/dist/chunk-YWCBI7SI.js +0 -93
- package/dist/chunk-ZQZJNKVB.mjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,116 @@
|
|
|
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.13.0](https://github.com/mr-tanta/ndpr-toolkit/compare/v3.12.0...v3.13.0) (2026-05-27)
|
|
6
|
+
|
|
7
|
+
Release 5 of 6 on the post-audit roadmap. The **deprecation-window minor** — strictly additive, but every prop alias and behavior change that 4.0 will commit to gets fired here first as a dev-mode warning. Existing 3.x consumers see no breakage; new code can adopt the canonical surface.
|
|
8
|
+
|
|
9
|
+
### i18n is real now — `useNDPRLocale` wired into 17+ components
|
|
10
|
+
|
|
11
|
+
**The big one.** The toolkit shipped 5 locale files (`en`, `yo`, `ig`, `ha`, `pcm`) and exposed `useNDPRLocale()`, but only 3 components consumed the hook (post-3.10.4: `ConsentBanner`, `DSRRequestForm`, `BreachReportForm`). The remaining ~17 components ignored the locale prop, making `<NDPRProvider locale={…}>` mostly cosmetic. The audit's B14 report called this out as a top-tier finding.
|
|
12
|
+
|
|
13
|
+
Newly wired components (each follows the prop-override → locale → English default precedence):
|
|
14
|
+
|
|
15
|
+
- **DSR**: `DSRDashboard`, `DSRTracker`
|
|
16
|
+
- **Breach**: `BreachRiskAssessment`, `BreachNotificationManager`, `RegulatoryReportGenerator`
|
|
17
|
+
- **DPIA**: `DPIAQuestionnaire` (next/prev/submit buttons), `DPIAReport` (report title)
|
|
18
|
+
- **Policy**: `PolicyGenerator`, `PolicyPreview`, `PolicyExporter`, `AdaptivePolicyWizard`
|
|
19
|
+
- **Lawful basis**: `LawfulBasisTracker` + `LawfulBasisTrackerLite`
|
|
20
|
+
- **Cross-border**: `CrossBorderTransferManager` + `CrossBorderTransferManagerLite`
|
|
21
|
+
- **ROPA**: `ROPAManager` + `ROPAManagerLite`
|
|
22
|
+
- **Consent extras**: `ConsentManager` (title/desc/save/reset)
|
|
23
|
+
- **NDPRProvider** error-boundary fallback now reads `locale.common.error`
|
|
24
|
+
|
|
25
|
+
The `NDPRLocale` type at `src/types/locale.ts` was expanded with new keys (`consent.managerTitle`, `dsr.dashboardTitle`, `breach.riskAssessmentTitle`, `policy.generatorTitle`, plus top-level `lawfulBasis`, `crossBorder`, `ropa` groups). All 5 shipped locale files got the matching translations.
|
|
26
|
+
|
|
27
|
+
**21 new i18n regression tests** (3 cases × 7 modules) confirm each component honors the locale prop. Pattern matches `ConsentBanner-i18n.test.tsx` from 3.10.4.
|
|
28
|
+
|
|
29
|
+
### Preset API harmonization (sets up 4.0 deprecation window)
|
|
30
|
+
|
|
31
|
+
- **`submitTo` / `submitOptions` / `onSubmitSuccess` / `onSubmitError`** lifted from `NDPRSubjectRights` to `NDPRBreachReport` and `NDPRDPIA`. The latter two now support the same typed POST-and-route pattern. `NDPRDPIA` posts on last-section completion; both preserve the legacy `onSubmit` / `onComplete` callbacks so existing consumers see no change.
|
|
32
|
+
- **`copy?` prop added to 6 presets** (`NDPRBreachReport`, `NDPRDPIA`, `NDPRLawfulBasis`, `NDPRCrossBorder`, `NDPRROPA`, `NDPRPrivacyPolicy`). Each ships a typed `NDPR<Name>Copy` interface, exported from `src/index.ts`. `NDPRConsent` already had this pattern; the 6 presets now match.
|
|
33
|
+
- **`description` prop added** alongside `formDescription` on `BreachReportForm` + `NDPRBreachReport`. When both set, `description` wins; when only `formDescription` is set, a one-shot dev warn says `[ndpr-toolkit/breach] BreachReportFormProps.formDescription is deprecated; rename to 'description'. Will be removed in 4.0.`
|
|
34
|
+
- **`initialData` prop added** alongside `initialActivities` on `NDPRLawfulBasis` and `initialTransfers` on `NDPRCrossBorder`. Same alias precedence + dev warn for the legacy names.
|
|
35
|
+
|
|
36
|
+
### Privacy guard on `useDSR` default storage
|
|
37
|
+
|
|
38
|
+
`useDSR()` is the admin tracker hook — its state contains OTHER PEOPLE'S PII (DSR requests submitted by data subjects). The current default writes to `localStorage` on the admin's browser, which is rarely the right place.
|
|
39
|
+
|
|
40
|
+
Added a fire-once dev-only `console.warn` when a consumer uses the default `localStorage` path without an explicit adapter:
|
|
41
|
+
|
|
42
|
+
> `[ndpr-toolkit/dsr] useDSR() is using the default localStorageAdapter, which stores DSR requests (including data subjects' PII) in the admin's browser. For production deployments, pass an explicit adapter… In 4.0, the default will switch to in-memory; localStorage will require explicit opt-in.`
|
|
43
|
+
|
|
44
|
+
### Other dev-mode deprecations (queued for removal in 4.0)
|
|
45
|
+
|
|
46
|
+
Every dev warn is guarded by `process.env.NODE_ENV !== 'production'` AND a `useRef`-based fire-once flag — production builds see no overhead, dev consoles see each warning once per component instance.
|
|
47
|
+
|
|
48
|
+
- `NDPRConsentProps.extraOptions` — one-off pattern not used by other presets. Warn fires when passed.
|
|
49
|
+
- `formDescription` on `BreachReportForm` / `NDPRBreachReport` — see above.
|
|
50
|
+
- `initialActivities` on `NDPRLawfulBasis`, `initialTransfers` on `NDPRCrossBorder` — see above.
|
|
51
|
+
|
|
52
|
+
### Deferred from the original 3.13.0 plan
|
|
53
|
+
|
|
54
|
+
- **`useConsent` generic over options array** — non-trivial type-level refactor that needs the existing tests to be re-checked. Higher value if shipped together with the 4.0 type-cleanup window; deferring there.
|
|
55
|
+
- **`useDSR.requestType` generic** — same shape, same reasoning.
|
|
56
|
+
- **`ROPAManager.updateEditingField` generic over `keyof ProcessingRecord`** — internal refactor, defer to 4.0.
|
|
57
|
+
- **`onSubmitError` discriminated union** — the current `{ error?, response? }` shape works for everyone today. Discriminated-union variant is breaking-ish (TS narrows differently); defer to 4.0.
|
|
58
|
+
- **`validate*Structured()` returning `{ field, code, message }[]`** — additive, but the new shape needs its own docs page and migration story. Defer to 4.0 alongside the validator-message harmonization.
|
|
59
|
+
- **`[ndpr-toolkit/<module>]` prefix on every utility error** — bulk-mechanical; defer (already happening organically — every dev warn we added in 3.13.0 carries the prefix).
|
|
60
|
+
- **Arabic locale + RTL CSS conversion** — defer to a focused i18n release after 4.0. The shape is now in place (`ar.ts` can be one file); the logical-property CSS conversion is its own focused chore.
|
|
61
|
+
- **French locale (`fr.ts`)** — same; one data file once the type/wiring is stable.
|
|
62
|
+
|
|
63
|
+
### Verification
|
|
64
|
+
|
|
65
|
+
- Jest: **1258 / 1258 passing** (was 1237; +21 new i18n tests)
|
|
66
|
+
- `tsc --noEmit -p tsconfig.json` clean
|
|
67
|
+
- `pnpm verify:tarball --skip-ts` clean across all 22 subpaths
|
|
68
|
+
|
|
69
|
+
## [3.12.0](https://github.com/mr-tanta/ndpr-toolkit/compare/v3.11.0...v3.12.0) (2026-05-27)
|
|
70
|
+
|
|
71
|
+
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.
|
|
72
|
+
|
|
73
|
+
### Accessibility — 6 WCAG 2.2 fixes
|
|
74
|
+
|
|
75
|
+
- **`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.
|
|
76
|
+
- **`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.
|
|
77
|
+
- **`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`.
|
|
78
|
+
- **`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"`.
|
|
79
|
+
- **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.
|
|
80
|
+
- **`DPIAQuestionnaire`** — section title heading now has `aria-live="polite"` so screen readers announce the new section title when the user clicks Next.
|
|
81
|
+
|
|
82
|
+
### Performance — 3 hot-path improvements
|
|
83
|
+
|
|
84
|
+
- **`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.
|
|
85
|
+
- **`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.
|
|
86
|
+
- **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.
|
|
87
|
+
|
|
88
|
+
Two perf items from the audit were **inspected and intentionally skipped** with documented reasons:
|
|
89
|
+
|
|
90
|
+
- `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).
|
|
91
|
+
- `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.
|
|
92
|
+
|
|
93
|
+
### Test coverage — +25 cases
|
|
94
|
+
|
|
95
|
+
Suite jumped from 1212 to **1237 / 1237 passing**. New cases target gaps the audit's B4 report flagged as critical:
|
|
96
|
+
|
|
97
|
+
- **`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.
|
|
98
|
+
- **`useComplianceScore`** (2 cases, new file) — memoisation by deep equality, recompute on inner-field change.
|
|
99
|
+
- **`NDPRDashboard` preset** (2 cases, new file) — `ComplianceInput` → score ring; degraded input lowers score.
|
|
100
|
+
- **`NDPRThemeProvider`** (2 added cases) — `mode: 'light'` sets `data-theme="light"`; empty `theme={{}}` produces no style attribute.
|
|
101
|
+
- **`assessDPIARisk`** (2 added cases) — empty-risks array → low-level; all-mitigated high-risk → `canProceed: true`.
|
|
102
|
+
- **`NDPRProvider`** (3 cases, new file) — `useNDPRConfig` returns provided config; `useNDPRLocale` merges partial overrides with English defaults; nested-provider innermost-wins.
|
|
103
|
+
- **`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.)
|
|
104
|
+
|
|
105
|
+
### Deferred from the original 3.12.0 plan
|
|
106
|
+
|
|
107
|
+
- **`/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.
|
|
108
|
+
|
|
109
|
+
### Verification
|
|
110
|
+
|
|
111
|
+
- Jest: **1237 / 1237 passing** (was 1212; +25 new tests)
|
|
112
|
+
- `tsc --noEmit -p tsconfig.json` clean
|
|
113
|
+
- `pnpm verify:tarball --skip-ts` clean across all 22 subpaths
|
|
114
|
+
|
|
5
115
|
## [3.11.0](https://github.com/mr-tanta/ndpr-toolkit/compare/v3.10.6...v3.11.0) (2026-05-27)
|
|
6
116
|
|
|
7
117
|
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.d.mts
CHANGED
|
@@ -353,9 +353,15 @@ declare interface BreachReportFormProps {
|
|
|
353
353
|
*/
|
|
354
354
|
title?: string;
|
|
355
355
|
/**
|
|
356
|
-
* Description text displayed on the form
|
|
356
|
+
* Description text displayed on the form. Canonical name in 3.13+.
|
|
357
|
+
* Takes precedence over `formDescription` if both are set.
|
|
357
358
|
* @default "Use this form to report a suspected or confirmed data breach in accordance with NDPA Section 40. All fields marked with * are required."
|
|
358
359
|
*/
|
|
360
|
+
description?: string;
|
|
361
|
+
/**
|
|
362
|
+
* @deprecated Renamed to `description`. Will be removed in 4.0.
|
|
363
|
+
* If both are set, `description` wins.
|
|
364
|
+
*/
|
|
359
365
|
formDescription?: string;
|
|
360
366
|
/**
|
|
361
367
|
* Text for the submit button
|
package/dist/breach.d.ts
CHANGED
|
@@ -353,9 +353,15 @@ declare interface BreachReportFormProps {
|
|
|
353
353
|
*/
|
|
354
354
|
title?: string;
|
|
355
355
|
/**
|
|
356
|
-
* Description text displayed on the form
|
|
356
|
+
* Description text displayed on the form. Canonical name in 3.13+.
|
|
357
|
+
* Takes precedence over `formDescription` if both are set.
|
|
357
358
|
* @default "Use this form to report a suspected or confirmed data breach in accordance with NDPA Section 40. All fields marked with * are required."
|
|
358
359
|
*/
|
|
360
|
+
description?: string;
|
|
361
|
+
/**
|
|
362
|
+
* @deprecated Renamed to `description`. Will be removed in 4.0.
|
|
363
|
+
* If both are set, `description` wins.
|
|
364
|
+
*/
|
|
359
365
|
formDescription?: string;
|
|
360
366
|
/**
|
|
361
367
|
* Text for the submit button
|
package/dist/breach.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';var
|
|
2
|
+
'use strict';var chunk3I6FYA5C_js=require('./chunk-3I6FYA5C.js'),chunkQGUOFGVJ_js=require('./chunk-QGUOFGVJ.js'),chunkEHQVTFYO_js=require('./chunk-EHQVTFYO.js'),chunk3YTAOT5O_js=require('./chunk-3YTAOT5O.js');require('./chunk-UXUMYP4L.js'),require('./chunk-ZVOIR4QH.js'),require('./chunk-AME4HJR4.js'),require('./chunk-YDKWD6MQ.js'),require('./chunk-TTMGFC6C.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:chunkQGUOFGVJ_js.a,RiskAssessment:chunk3I6FYA5C_js.a,NotificationManager:chunk3I6FYA5C_js.b,ReportGenerator:chunk3I6FYA5C_js.c};Object.defineProperty(exports,"BreachNotificationManager",{enumerable:true,get:function(){return chunk3I6FYA5C_js.b}});Object.defineProperty(exports,"BreachRiskAssessment",{enumerable:true,get:function(){return chunk3I6FYA5C_js.a}});Object.defineProperty(exports,"RegulatoryReportGenerator",{enumerable:true,get:function(){return chunk3I6FYA5C_js.c}});Object.defineProperty(exports,"BreachReportForm",{enumerable:true,get:function(){return chunkQGUOFGVJ_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-J7BIJ45O.mjs';export{b as BreachNotificationManager,a as BreachRiskAssessment,c as RegulatoryReportGenerator}from'./chunk-J7BIJ45O.mjs';import {a as a$1}from'./chunk-NUIRMJKQ.mjs';export{a as BreachReportForm}from'./chunk-NUIRMJKQ.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-ITCY2Z66.mjs';import'./chunk-SFGW37LE.mjs';import'./chunk-FRQFU44F.mjs';import'./chunk-V5TZJJWU.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};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
'use strict';var chunkZVOIR4QH_js=require('./chunk-ZVOIR4QH.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkYDKWD6MQ_js=require('./chunk-YDKWD6MQ.js'),T=require('react'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var T__default=/*#__PURE__*/_interopDefault(T);var G=({result:s,sections:c,showFullReport:g=true,allowPrint:v=true,allowExport:f=true,onExport:b,className:w="",buttonClassName:x="",classNames:h={},unstyled:k=false})=>{var I;let N=(I=chunkYDKWD6MQ_js.c().dpia.reportTitle)!=null?I:"Data Protection Impact Assessment Report",m=T.useMemo(()=>new Date().toLocaleDateString(),[]),r=(a,n)=>{let i=n?h[n]:void 0;return !i&&n==="printButton"&&(i=h.primaryButton),chunkAME4HJR4_js.a(a,i,k)},o=a=>new Date(a).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}),R=a=>{let n=s.answers[a];return n==null?"Not answered":typeof n=="boolean"?n?"Yes":"No":Array.isArray(n)?n.join(", "):String(n)},p=()=>{window.print();},u=a=>{b&&b(a);},A=a=>jsxRuntime.jsx("span",{className:r(`px-2 py-1 rounded text-xs font-medium ${{low:"ndpr-badge ndpr-badge--success",medium:"ndpr-badge ndpr-badge--warning",high:"ndpr-badge ndpr-badge--warning",critical:"ndpr-badge ndpr-badge--destructive"}[a]}`,"riskBadge"),children:a.charAt(0).toUpperCase()+a.slice(1)});return jsxRuntime.jsxs("div",{"data-ndpr-component":"dpia-report",className:`${r("bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 print:shadow-none print:p-0","root")} ${w}`,children:[jsxRuntime.jsxs("div",{className:r("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:r("ndpr-card__title","title"),children:N}),jsxRuntime.jsx("h2",{className:"text-xl ndpr-text-muted mb-4",children:s.title})]}),(v||f)&&jsxRuntime.jsxs("div",{className:"flex space-x-2 print:hidden",children:[v&&jsxRuntime.jsx("button",{onClick:p,className:`${r("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:()=>u("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:"})," ",s.assessor.name,", ",s.assessor.role]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Contact:"})," ",s.assessor.email]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Started:"})," ",o(s.startedAt)]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Completed:"})," ",s.completedAt?o(s.completedAt):"In progress"]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Next review:"})," ",s.reviewDate?o(s.reviewDate):"Not scheduled"]})]})]})]}),jsxRuntime.jsxs("div",{className:r("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:"}),A(s.overallRiskLevel)]}),jsxRuntime.jsxs("div",{className:r("mb-2","conclusion"),children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Conclusion:"})," ",s.conclusion]}),jsxRuntime.jsxs("div",{role:"status","aria-live":"polite",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Can Proceed:"})," ",s.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:s.processingDescription}),s.recommendations&&s.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:s.recommendations.map((a,n)=>jsxRuntime.jsx("li",{className:r("","recommendation"),children:a},n))})]})]})]}),jsxRuntime.jsxs("div",{className:"mb-8",children:[jsxRuntime.jsx("h2",{className:"ndpr-section-heading",children:"Identified Risks"}),s.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:r("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:s.risks.map(a=>jsxRuntime.jsxs("tr",{className:r("","riskRow"),children:[jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:a.description}),jsxRuntime.jsxs("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:[a.likelihood," / 5"]}),jsxRuntime.jsxs("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:[a.impact," / 5"]}),jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:A(a.level)}),jsxRuntime.jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:a.mitigated?jsxRuntime.jsx("span",{className:"ndpr-text-success",children:"Yes"}):jsxRuntime.jsx("span",{className:"ndpr-text-destructive",children:"No"})})]},a.id))})]})})]}),g&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"ndpr-section-heading",children:"Full Assessment Details"}),c.map(a=>{let n=a.questions.filter(i=>s.answers[i.id]!==void 0);return n.length===0?null:jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium ndpr-text-foreground mb-2",children:a.title}),jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[jsxRuntime.jsx("thead",{className:"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:n.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:R(i.id)})]},i.id))})]})})]},a.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: ",s.version]}),jsxRuntime.jsxs("p",{children:["Generated on: ",m]}),jsxRuntime.jsx("p",{className:"mt-2 italic",role:"note",children:chunkZVOIR4QH_js.a})]})]})};var Y=({steps:s,onStepClick:c,clickable:g=true,orientation:v="horizontal",className:f="",activeStepClassName:b="",completedStepClassName:w="",incompleteStepClassName:x="",classNames:h={},unstyled:k=false})=>{let d=(r,o)=>chunkAME4HJR4_js.a(r,o?h[o]:void 0,k),N=r=>{g&&c&&c(r);},m=v==="vertical";return jsxRuntime.jsx("div",{"data-ndpr-component":"dpia-step-indicator",role:"navigation","aria-label":"Step progress",className:`${d(m?"flex flex-col space-y-4":"flex items-center justify-between","root")} ${f}`,children:s.map((r,o)=>{let C=o===s.length-1,D=r.active?d(`font-medium ${b||"ndpr-text-primary"}`,"label"):r.completed?d(w||"ndpr-text-success","label"):d(x||"ndpr-card__subtitle","label"),R=r.active?d("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"):r.completed?d("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"):d("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"),p=g&&!!c;return jsxRuntime.jsxs(T__default.default.Fragment,{children:[jsxRuntime.jsxs("div",{className:d(`${m?"flex items-start":"flex flex-col items-center"} ${g?"cursor-pointer":""}`,"step"),role:p?"button":void 0,tabIndex:p?0:void 0,"aria-label":p?`Go to step ${o+1}: ${r.label}`:void 0,onClick:p?()=>N(r.id):void 0,onKeyDown:p?u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),N(r.id));}:void 0,"aria-current":r.active?"step":void 0,children:[jsxRuntime.jsx("div",{className:`
|
|
2
|
+
flex items-center justify-center
|
|
3
|
+
${m?"mr-4":""}
|
|
4
|
+
`,children:jsxRuntime.jsx("div",{className:R,children:r.icon?r.icon:r.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:o+1})})}),jsxRuntime.jsxs("div",{className:`
|
|
5
|
+
${m?"flex-1":"mt-2 text-center"}
|
|
6
|
+
`,children:[jsxRuntime.jsx("div",{className:`text-sm font-medium ${D}`,children:r.label}),r.description&&jsxRuntime.jsx("div",{className:"ndpr-form-field__hint",children:r.description})]})]}),!C&&jsxRuntime.jsx("div",{className:d(m?"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")})]},r.id)})})};exports.a=G;exports.b=Y;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkF5MGMNQF_js=require('./chunk-F5MGMNQF.js'),chunkNUOHT3LO_js=require('./chunk-NUOHT3LO.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var C=d=>{var o=d,{template:e,templateOverrides:r,initialContext:t,copy:s}=o,l=chunkRFPLZDIO_js.c(o,["template","templateOverrides","initialContext","copy"]);let n=react.useMemo(()=>{if(t)return t;if(e)return chunkNUOHT3LO_js.b(e,r)},[t,e,r]);return jsxRuntime.jsx(chunkF5MGMNQF_js.a,chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},l),{initialContext:n}))};exports.a=C;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import {c as c$1,d,b as b$1}from'./chunk-NBQQ2GN3.mjs';import {a}from'./chunk-SFGW37LE.mjs';import {c}from'./chunk-FRQFU44F.mjs';import {d as d$1,b,a as a$1}from'./chunk-ZJYULEER.mjs';import {useId,useState,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var Ee=({sections:E=c$1,variables:R=d,onGenerate:S,title:F,description:A,className:N="",buttonClassName:P="",generateButtonText:Y,showPreview:q=true,allowEditing:Q=true,classNames:t,unstyled:y=false})=>{var W,de,ae;let B=c(),Z=(W=F!=null?F:B.policy.generatorTitle)!=null?W:"NDPA Privacy Policy Generator",l=(de=A!=null?A:B.policy.generatorDescription)!=null?de:"Generate an NDPA-compliant privacy policy for your organization in accordance with NDPA Section 24.",i=(ae=Y!=null?Y:B.policy.generate)!=null?ae:"Generate Policy",m=useId(),[L,ee]=useState(E),[b$2,k]=useState(R),[g,$]=useState("sections"),[X,H]=useState(""),[U,M]=useState(""),[ne,T]=useState(false),[h,G]=useState({});useEffect(()=>{ee(E);},[E]),useEffect(()=>{k(R);},[R]);let oe=p=>{ee(c=>c.map(e=>e.id===p?b(a$1({},e),{included:!e.included}):e));},I=(p,c)=>{k(e=>e.map(d=>d.id===p?b(a$1({},d),{value:c}):d)),h[p]&&G(e=>{let d=a$1({},e);return delete d[p],d});},ie=()=>{let p={},c=true;return b$2.forEach(e=>{e.required&&!e.value&&(p[e.id]=`${e.name} is required`,c=false);}),G(p),c},re=()=>{if(!ie()){$("variables");return}let p=L.filter(d=>d.included),c=Object.fromEntries(b$2.map(d=>[d.name,d.value])),e="";p.forEach(d=>{e+=`## ${d.title}
|
|
2
|
+
|
|
3
|
+
`,e+=b$1(d.template,c),e+=`
|
|
4
|
+
|
|
5
|
+
`;}),H(e),M(e),T(true),$("preview");},V=()=>{S({sections:L,variables:b$2,content:Q?U:X});},u=()=>jsxs("div",{"data-ndpr-component":"policy-generator",className:a("ndpr-form-section",t==null?void 0:t.sectionList,y),role:"group","aria-labelledby":`${m}-sections-heading`,children:[jsx("h3",{id:`${m}-sections-heading`,className:"text-lg font-medium mb-4",children:"Select Policy Sections"}),L.map(p=>{let c=`${m}-section-${p.id}`,e=p.description?`${m}-section-desc-${p.id}`:void 0;return jsx("div",{className:a("border border-gray-200 dark:border-gray-700 rounded-md p-4",t==null?void 0:t.sectionItem,y),children:jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{id:c,type:"checkbox",checked:p.included,onChange:()=>oe(p.id),disabled:p.required,"aria-describedby":e,className:a("w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600",t==null?void 0:t.input,y)})}),jsxs("div",{className:"ml-3 text-sm",children:[jsxs("label",{htmlFor:c,className:"font-medium ndpr-text-foreground",children:[p.title," ",p.required&&jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"}),p.required&&jsx("span",{className:"sr-only",children:" (required)"})]}),p.description&&jsx("p",{id:e,className:"ndpr-text-muted mt-1",children:p.description})]})]})},p.id)}),jsx("div",{className:"mt-6",children:jsx("button",{onClick:()=>$("variables"),className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${P}`,(t==null?void 0:t.primaryButton)||(t==null?void 0:t.generateButton),y),children:"Next: Fill Variables"})})]}),f=()=>{let p={};return b$2.forEach(c=>{let e=c.id.split(".")[0];p[e]||(p[e]=[]),p[e].push(c);}),jsxs("div",{className:a("",t==null?void 0:t.form,y),children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Fill Policy Variables"}),jsx("div",{className:"ndpr-form-section",children:Object.entries(p).map(([c,e])=>{let d=L.find(r=>r.id===c);return d&&!d.included?null:jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsx("h4",{className:"font-medium text-lg mb-3",children:d?d.title:"General Information"}),jsx("div",{className:"ndpr-form-section",children:e.map(r=>{let O=`${m}-var-${r.id}`,j=r.description?`${m}-var-desc-${r.id}`:void 0,le=h[r.id]?`${m}-var-err-${r.id}`:void 0,J=[j,le].filter(Boolean).join(" ")||void 0;return jsxs("div",{children:[jsxs("label",{htmlFor:O,className:"ndpr-form-field__label",children:[r.name," ",r.required&&jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})]}),r.description&&jsx("p",{id:j,className:"text-xs ndpr-text-muted mb-2",children:r.description}),r.inputType==="textarea"?jsx("textarea",{id:O,value:r.value,onChange:_=>I(r.id,_.target.value),rows:4,className:a(`w-full px-3 py-2 border ${h[r.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,t==null?void 0:t.input,y),required:r.required,"aria-required":r.required||void 0,"aria-describedby":J,"aria-invalid":h[r.id]?true:void 0}):r.inputType==="select"&&r.options?jsxs("select",{id:O,value:r.value,onChange:_=>I(r.id,_.target.value),className:a(`w-full px-3 py-2 border ${h[r.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,t==null?void 0:t.input,y),required:r.required,"aria-required":r.required||void 0,"aria-describedby":J,"aria-invalid":h[r.id]?true:void 0,children:[jsx("option",{value:"",children:"Select an option"}),r.options.map(_=>jsx("option",{value:_,children:_},_))]}):jsx("input",{id:O,type:r.inputType,value:r.value,onChange:_=>I(r.id,_.target.value),className:a(`w-full px-3 py-2 border ${h[r.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,t==null?void 0:t.input,y),required:r.required,"aria-required":r.required||void 0,"aria-describedby":J,"aria-invalid":h[r.id]?true:void 0}),h[r.id]&&jsx("p",{id:le,role:"alert",className:"mt-1 text-sm ndpr-text-destructive dark:text-red-500",children:h[r.id]})]},r.id)})})]},c)})}),jsxs("div",{className:"mt-6 flex space-x-4",children:[jsx("button",{onClick:()=>$("sections"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${P}`,children:"Back to Sections"}),jsx("button",{onClick:re,className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${P}`,(t==null?void 0:t.primaryButton)||(t==null?void 0:t.generateButton),y),children:i})]})]})},x=()=>{let p=`${m}-policy-content`;return jsxs("div",{children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Preview Generated Policy"}),Q?jsxs("div",{className:"ndpr-form-field",children:[jsx("label",{htmlFor:p,className:"ndpr-form-field__label",children:"Edit Policy Content"}),jsx("textarea",{id:p,value:U,onChange:c=>M(c.target.value),rows:20,className:"ndpr-form-field__input ndpr-form-field__input--mono"})]}):jsx("div",{className:"ndpr-panel","aria-live":"polite",children:jsx("div",{className:"prose dark:prose-invert max-w-none",children:X.split(`
|
|
6
|
+
`).map((c,e)=>c.startsWith("## ")?jsx("h3",{className:"text-xl font-bold mt-6 mb-3",children:c.substring(3)},e):c.startsWith("### ")?jsx("h4",{className:"text-lg font-bold mt-4 mb-2",children:c.substring(4)},e):c===""?jsx("br",{},e):jsx("p",{className:"mb-2",children:c},e))})}),jsxs("div",{className:"mt-6 flex space-x-4",children:[jsx("button",{onClick:()=>$("variables"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${P}`,children:"Back to Variables"}),jsx("button",{onClick:V,className:`px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${P}`,children:"Save Policy"})]})]})},C=()=>{switch(g){case "sections":return u();case "variables":return f();case "preview":return x();default:return u()}};return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${N}`,t==null?void 0:t.root,y),children:[jsxs("div",{className:a("mb-6",t==null?void 0:t.header,y),children:[jsx("h2",{className:a("ndpr-section-heading",t==null?void 0:t.title,y),children:Z}),jsx("p",{className:a("ndpr-card__subtitle",t==null?void 0:t.description,y),children:l})]}),jsx("nav",{"aria-label":"Policy generation steps",className:"mb-8",children:jsxs("ol",{className:"flex items-center w-full",children:[jsxs("li",{className:`flex w-full items-center ${g==="sections"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsx("span",{className:`flex items-center justify-center w-8 h-8 ${g==="sections"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":g==="sections"?"step":void 0,children:"1"}),jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Sections"}),jsx("span",{className:"sr-only",children:g==="sections"?" (current step)":""})]}),jsxs("li",{className:`flex w-full items-center ${g==="variables"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsx("span",{className:`flex items-center justify-center w-8 h-8 ${g==="variables"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":g==="variables"?"step":void 0,children:"2"}),jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Variables"}),jsx("span",{className:"sr-only",children:g==="variables"?" (current step)":""})]}),jsxs("li",{className:`flex items-center ${g==="preview"?"ndpr-text-primary":"ndpr-card__subtitle"}`,children:[jsx("span",{className:`flex items-center justify-center w-8 h-8 ${g==="preview"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":g==="preview"?"step":void 0,children:"3"}),jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Preview"}),jsx("span",{className:"sr-only",children:g==="preview"?" (current step)":""})]})]})}),jsxs("div",{className:a("ndpr-alert ndpr-alert--info",t==null?void 0:t.complianceNotice,y),children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsx("p",{className:"ndpr-text-info text-sm",children:"This tool helps you generate a privacy policy that aligns with the Nigeria Data Protection Act (NDPA) 2023. While we strive to ensure compliance, we recommend having the final policy reviewed by a legal professional familiar with NDPA requirements."})]}),C()]})};var Ie=({content:E,sections:R,variables:S,onExport:F,onEdit:A,title:N,description:P,className:Y="",buttonClassName:q="",showExportOptions:Q=true,showEditButton:t=true,showTableOfContents:y=true,showMetadata:B=true,organizationName:Z,lastUpdated:l,classNames:i,unstyled:m=false})=>{var re,V;let L=c(),ee=(re=N!=null?N:L.policy.previewTitle)!=null?re:"Privacy Policy Preview",b=(V=P!=null?P:L.policy.previewDescription)!=null?V:"Preview your NDPA-compliant privacy policy before exporting.",k=useId(),[g,$]=useState("preview"),X=`${k}-tab-preview`,H=`${k}-tab-markdown`,U=`${k}-panel-preview`,M=`${k}-panel-markdown`,T=(()=>{let u=E.split(`
|
|
7
|
+
`),f=[];return u.forEach(x=>{if(x.startsWith("## ")){let C=x.substring(3).trim(),W=`${k}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;f.push({id:W,title:C,level:2});}else if(x.startsWith("### ")){let C=x.substring(4).trim(),W=`${k}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;f.push({id:W,title:C,level:3});}}),f})(),h=u=>{if(F)F(u);else if(u==="markdown"){let f=document.createElement("a"),x=new Blob([E],{type:"text/markdown"});f.href=URL.createObjectURL(x),f.download=`privacy-policy-${new Date().toISOString().split("T")[0]}.md`,document.body.appendChild(f),f.click(),document.body.removeChild(f);}},G=()=>!y||T.length===0?null:jsxs("nav",{"aria-label":"Table of contents",className:"ndpr-panel",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Table of Contents"}),jsx("ul",{className:"space-y-1",children:T.map((u,f)=>jsx("li",{style:{marginLeft:`${(u.level-2)*1.5}rem`},children:jsx("a",{href:`#${u.id}`,className:"ndpr-text-primary hover:underline",children:u.title})},f))})]}),oe=()=>B?jsxs("div",{"data-ndpr-component":"policy-preview",className:"mb-6",children:[jsx("h1",{className:"ndpr-card__title",children:Z?`${Z} Privacy Policy`:"Privacy Policy"}),jsxs("p",{className:"ndpr-form-field__hint",children:["Last Updated: ",l?l.toLocaleDateString():"N/A"]})]}):null,I=()=>jsx("div",{className:a("prose dark:prose-invert max-w-none",i==null?void 0:i.sectionContent,m),children:E.split(`
|
|
8
|
+
`).map((u,f)=>{if(u.startsWith("## ")){let x=u.substring(3).trim(),C=`${k}-${x.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsx("h3",{id:C,className:a("text-xl font-bold mt-6 mb-3",i==null?void 0:i.sectionTitle,m),children:x},f)}else if(u.startsWith("### ")){let x=u.substring(4).trim(),C=`${k}-${x.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsx("h4",{id:C,className:a("text-lg font-bold mt-4 mb-2",i==null?void 0:i.sectionTitle,m),children:x},f)}else return u===""?jsx("br",{},f):jsx("p",{className:"mb-2",children:u},f)})}),ie=()=>Q?jsxs("div",{className:"mt-6",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Export Options"}),jsxs("div",{className:"ndpr-card__footer",children:[jsx("button",{onClick:()=>h("pdf"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${q}`,children:"Export as PDF"}),jsx("button",{onClick:()=>h("docx"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${q}`,children:"Export as DOCX"}),jsx("button",{onClick:()=>h("html"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${q}`,children:"Export as HTML"}),jsx("button",{onClick:()=>h("markdown"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${q}`,children:"Export as Markdown"})]})]}):null;return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Y}`,i==null?void 0:i.root,m),children:[jsxs("div",{className:a("flex justify-between items-start mb-6",i==null?void 0:i.header,m),children:[jsxs("div",{children:[jsx("h2",{className:a("ndpr-section-heading",i==null?void 0:i.title,m),children:ee}),jsx("p",{className:a("ndpr-card__subtitle",i==null?void 0:i.description,m),children:b})]}),t&&A&&jsx("button",{onClick:A,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 ${q}`,children:"Edit Policy"})]}),jsxs("div",{className:a("ndpr-alert ndpr-alert--info",i==null?void 0:i.complianceNotice,m),children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsx("p",{className:"ndpr-text-info text-sm",children:"This privacy policy has been generated to align with the Nigeria Data Protection Act (NDPA) 2023. We recommend having the final policy reviewed by a legal professional familiar with NDPA requirements before publishing it on your website or sharing it with your users."})]}),jsx("div",{className:"mb-6 border-b border-gray-200 dark:border-gray-700",children:jsxs("div",{role:"tablist","aria-label":"Policy view options",className:"flex flex-wrap -mb-px",children:[jsx("div",{className:"mr-2",children:jsx("button",{role:"tab",id:X,"aria-selected":g==="preview","aria-controls":U,onClick:()=>$("preview"),className:`inline-block p-4 ${g==="preview"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Preview"})}),jsx("div",{className:"mr-2",children:jsx("button",{role:"tab",id:H,"aria-selected":g==="markdown","aria-controls":M,onClick:()=>$("markdown"),className:`inline-block p-4 ${g==="markdown"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Markdown"})})]})}),jsx("div",{className:a("bg-white dark:bg-gray-800 p-4 rounded-md",i==null?void 0:i.content,m),children:g==="preview"?jsxs("div",{role:"tabpanel",id:U,"aria-labelledby":X,"aria-live":"polite",children:[oe(),G(),jsx("div",{className:a("bg-gray-50 dark:bg-gray-700 p-6 rounded-md",i==null?void 0:i.section,m),children:I()})]}):jsx("div",{role:"tabpanel",id:M,"aria-labelledby":H,children:jsx("pre",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md overflow-auto whitespace-pre-wrap font-mono text-sm text-gray-800 dark:text-gray-200",children:E})})}),ie()]})};var Me=({content:E,title:R,organizationName:S,lastUpdated:F,onExportComplete:A,componentTitle:N="Export Privacy Policy",description:P,className:Y="",buttonClassName:q="",showExportHistory:Q=true,includeComplianceNotice:t=true,includeLogo:y=false,logoUrl:B,customStyles:Z,classNames:l,unstyled:i=false})=>{var p,c$1;let m=c(),L=(p=R!=null?R:m.policy.exporterTitle)!=null?p:"Privacy Policy",ee=(c$1=P!=null?P:m.policy.exporterDescription)!=null?c$1:"Export your NDPA-compliant privacy policy in various formats.",b=useId(),[k,g]=useState([]),[$,X]=useState("pdf"),[H,U]=useState(false),[M,ne]=useState(null),[T,h]=useState(""),[G,oe]=useState(""),[I,ie]=useState(""),[re,V]=useState(false),u=e=>{let d=new Date().toISOString().split("T")[0];return `${S?S.toLowerCase().replace(/[^a-z0-9]+/g,"-"):"privacy-policy"}-privacy-policy-${d}.${e.toLowerCase()}`},f=e=>T?T.endsWith(`.${e.toLowerCase()}`)?T:`${T}.${e.toLowerCase()}`:u(e),x=()=>{let e=S?`${S} ${L}`:L,d=F?F.toLocaleDateString():"N/A",r=`<!DOCTYPE html>
|
|
9
|
+
<html lang="en">
|
|
10
|
+
<head>
|
|
11
|
+
<meta charset="UTF-8">
|
|
12
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
13
|
+
<title>${e}</title>
|
|
14
|
+
<style>
|
|
15
|
+
body {
|
|
16
|
+
font-family: Arial, sans-serif;
|
|
17
|
+
line-height: 1.6;
|
|
18
|
+
color: #333;
|
|
19
|
+
max-width: 800px;
|
|
20
|
+
margin: 0 auto;
|
|
21
|
+
padding: 20px;
|
|
22
|
+
}
|
|
23
|
+
h1 {
|
|
24
|
+
font-size: 24px;
|
|
25
|
+
margin-bottom: 10px;
|
|
26
|
+
}
|
|
27
|
+
h2 {
|
|
28
|
+
font-size: 20px;
|
|
29
|
+
margin-top: 30px;
|
|
30
|
+
margin-bottom: 10px;
|
|
31
|
+
border-bottom: 1px solid #eee;
|
|
32
|
+
padding-bottom: 5px;
|
|
33
|
+
}
|
|
34
|
+
h3 {
|
|
35
|
+
font-size: 18px;
|
|
36
|
+
margin-top: 20px;
|
|
37
|
+
margin-bottom: 10px;
|
|
38
|
+
}
|
|
39
|
+
p {
|
|
40
|
+
margin-bottom: 15px;
|
|
41
|
+
}
|
|
42
|
+
.header {
|
|
43
|
+
text-align: center;
|
|
44
|
+
margin-bottom: 30px;
|
|
45
|
+
}
|
|
46
|
+
.footer {
|
|
47
|
+
margin-top: 50px;
|
|
48
|
+
text-align: center;
|
|
49
|
+
font-size: 12px;
|
|
50
|
+
color: #666;
|
|
51
|
+
border-top: 1px solid #eee;
|
|
52
|
+
padding-top: 20px;
|
|
53
|
+
}
|
|
54
|
+
.logo {
|
|
55
|
+
max-width: 200px;
|
|
56
|
+
margin-bottom: 20px;
|
|
57
|
+
}
|
|
58
|
+
.last-updated {
|
|
59
|
+
font-size: 12px;
|
|
60
|
+
color: #666;
|
|
61
|
+
margin-bottom: 30px;
|
|
62
|
+
}
|
|
63
|
+
.compliance-notice {
|
|
64
|
+
background-color: #f8f9fa;
|
|
65
|
+
border: 1px solid #e9ecef;
|
|
66
|
+
padding: 15px;
|
|
67
|
+
margin-bottom: 30px;
|
|
68
|
+
font-size: 14px;
|
|
69
|
+
}
|
|
70
|
+
${Z||""}
|
|
71
|
+
</style>
|
|
72
|
+
</head>
|
|
73
|
+
<body>
|
|
74
|
+
<div class="header">
|
|
75
|
+
${y&&B?`<img src="${B}" alt="${S||"Company"} Logo" class="logo">`:""}
|
|
76
|
+
${G?`<div class="custom-header">${G}</div>`:""}
|
|
77
|
+
<h1>${e}</h1>
|
|
78
|
+
<div class="last-updated">Last Updated: ${d}</div>
|
|
79
|
+
</div>`;t&&(r+=`
|
|
80
|
+
<div class="compliance-notice">
|
|
81
|
+
<strong>NDPA Compliance Notice:</strong> This privacy policy has been created to comply with the Nigeria Data Protection Act (NDPA) 2023.
|
|
82
|
+
It outlines how we collect, use, disclose, and protect your personal information in accordance with NDPA requirements.
|
|
83
|
+
</div>`);let O=E.replace(/^## (.*?)$/gm,"<h2>$1</h2>").replace(/^### (.*?)$/gm,"<h3>$1</h3>").replace(/\n\n/g,"</p><p>").replace(/\n/g,"<br>");return r+=`
|
|
84
|
+
<div class="content">
|
|
85
|
+
<p>${O}</p>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<div class="footer">
|
|
89
|
+
${I?`<div class="custom-footer">${I}</div>`:""}
|
|
90
|
+
<p>© ${new Date().getFullYear()} ${S||"Company"}. All rights reserved.</p>
|
|
91
|
+
</div>
|
|
92
|
+
</body>
|
|
93
|
+
</html>`,r},C=()=>d$1(null,null,function*(){U(true),ne(null);try{let e=$.toLowerCase(),d="",r;switch(e){case "pdf":let J=x();r=new Blob([J],{type:"text/html"}),d=URL.createObjectURL(r);break;case "docx":r=new Blob([E],{type:"text/plain"}),d=URL.createObjectURL(r);break;case "html":let _=x();r=new Blob([_],{type:"text/html"}),d=URL.createObjectURL(r);break;default:r=new Blob([E],{type:"text/markdown"}),d=URL.createObjectURL(r);break}let O=f(e),j=document.createElement("a");j.href=d,j.download=O,document.body.appendChild(j),j.click(),document.body.removeChild(j);let le={id:`export_${Date.now()}`,format:e,timestamp:Date.now(),url:d,filename:O};g(J=>[le,...J]),A&&A(e,d);}catch(e){console.error("[ndpr-toolkit/policy] Export failed:",e);let d=e instanceof Error&&e.message?e.message.length>200?`${e.message.slice(0,200)}\u2026`:e.message:null;ne(d?`[ndpr-toolkit/policy] Export failed: ${d}`:"[ndpr-toolkit/policy] Export failed \u2014 see the browser console for the underlying error.");}finally{U(false);}}),W=()=>{let e=[{value:"pdf",label:"PDF Document (.pdf)"},{value:"docx",label:"Word Document (.docx)"},{value:"html",label:"Web Page (.html)"},{value:"markdown",label:"Markdown (.md)"}],d=`${b}-export-format`;return jsxs("div",{"data-ndpr-component":"policy-exporter",className:a("mb-6",l==null?void 0:l.formatSelector,i),children:[jsx("label",{htmlFor:d,className:"ndpr-form-field__label",children:"Export Format"}),jsx("select",{id:d,value:$,onChange:r=>X(r.target.value),className:a("ndpr-form-field__input",l==null?void 0:l.formatOption,i),children:e.map(r=>jsx("option",{value:r.value,children:r.label},r.value))})]})},de=()=>re?jsxs("div",{className:"mb-6 space-y-4 border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("h3",{className:"text-md font-medium",children:"Advanced Export Options"}),jsx("button",{type:"button",onClick:()=>V(false),className:"ndpr-text-primary text-sm",children:"Hide Advanced Options"})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${b}-custom-filename`,className:"ndpr-form-field__label",children:"Custom Filename"}),jsx("input",{type:"text",id:`${b}-custom-filename`,value:T,onChange:e=>h(e.target.value),placeholder:u($),"aria-describedby":`${b}-custom-filename-desc`,className:"ndpr-form-field__input"}),jsx("p",{id:`${b}-custom-filename-desc`,className:"ndpr-form-field__hint",children:"Leave blank to use the default filename format."})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${b}-custom-header`,className:"ndpr-form-field__label",children:"Custom Header HTML (for HTML/PDF exports)"}),jsx("textarea",{id:`${b}-custom-header`,value:G,onChange:e=>oe(e.target.value),rows:3,placeholder:"<div>Custom header content</div>",className:"ndpr-form-field__input"})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${b}-custom-footer`,className:"ndpr-form-field__label",children:"Custom Footer HTML (for HTML/PDF exports)"}),jsx("textarea",{id:`${b}-custom-footer`,value:I,onChange:e=>ie(e.target.value),rows:3,placeholder:"<div>Custom footer content</div>",className:"ndpr-form-field__input"})]}),jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{id:`${b}-include-compliance-notice`,type:"checkbox",checked:t,onChange:e=>V(e.target.checked),"aria-describedby":`${b}-compliance-notice-desc`,className:"w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"})}),jsxs("div",{className:"ml-3 text-sm",children:[jsx("label",{htmlFor:`${b}-include-compliance-notice`,className:"font-medium ndpr-text-foreground",children:"Include NDPA Compliance Notice"}),jsx("p",{id:`${b}-compliance-notice-desc`,className:"ndpr-card__subtitle",children:"Adds a notice explaining that this policy complies with NDPA requirements."})]})]})]}):jsx("button",{type:"button",onClick:()=>V(true),className:"ndpr-text-primary text-sm mb-6",children:"Show Advanced Options"}),ae=()=>!Q||k.length===0?null:jsxs("div",{className:a("mt-6",l==null?void 0:l.preview,i),children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Export History"}),jsx("div",{className:"bg-gray-50 dark:bg-gray-700 rounded-md overflow-hidden",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-600",children:[jsx("thead",{className:"bg-gray-100 dark:bg-gray-800",children:jsxs("tr",{children:[jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Date"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Format"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Filename"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Actions"})]})}),jsx("tbody",{className:"bg-white dark:bg-gray-700 divide-y divide-gray-200 dark:divide-gray-600",children:k.map(e=>jsxs("tr",{children:[jsx("td",{className:"ndpr-table__cell",children:new Date(e.timestamp).toLocaleString()}),jsx("td",{className:"ndpr-table__cell",children:e.format.toUpperCase()}),jsx("td",{className:"ndpr-table__cell",children:e.filename}),jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:jsx("a",{href:e.url,download:e.filename,className:"ndpr-text-primary hover:text-[rgb(var(--ndpr-primary-hover))] dark:hover:text-[rgb(var(--ndpr-primary-hover))] mr-4",children:"Download"})})]},e.id))})]})})]});return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Y}`,l==null?void 0:l.root,i),children:[jsxs("div",{className:a("mb-6",l==null?void 0:l.header,i),children:[jsx("h2",{className:a("ndpr-section-heading",l==null?void 0:l.title,i),children:N}),jsx("p",{className:a("ndpr-card__subtitle",l==null?void 0:l.description,i),children:ee})]}),W(),de(),jsxs("div",{className:"mb-6",children:[jsx("button",{onClick:C,disabled:H,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 ${q} ${H?"opacity-70 cursor-not-allowed":""}`,(l==null?void 0:l.primaryButton)||(l==null?void 0:l.exportButton),i),children:H?"Exporting...":`Export as ${$.toUpperCase()}`}),M&&jsx("p",{className:"mt-2 text-sm ndpr-text-destructive dark:text-red-500",children:M})]}),jsxs("div",{className:a("ndpr-alert ndpr-alert--info",l==null?void 0:l.complianceNotice,i),children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"Export Tips"}),jsxs("ul",{className:"ndpr-text-info text-sm list-disc list-inside space-y-1",children:[jsx("li",{children:"PDF format is recommended for printing or sharing with stakeholders."}),jsx("li",{children:"HTML format is ideal for publishing on your website."}),jsx("li",{children:"DOCX format allows for further editing in Microsoft Word or similar applications."}),jsx("li",{children:"Markdown format is useful for version control systems or technical documentation."})]})]}),ae()]})};export{Ee as a,Ie as b,Me as c};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
'use strict';var chunk3YTAOT5O_js=require('./chunk-3YTAOT5O.js'),chunkZVOIR4QH_js=require('./chunk-ZVOIR4QH.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkYDKWD6MQ_js=require('./chunk-YDKWD6MQ.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var Ie=({breachData:l,initialAssessment:f={},onComplete:A,title:H,description:L,submitButtonText:$,className:q="",buttonClassName:G="",classNames:x={},unstyled:o=false,showBreachSummary:c=true,showNotificationRequirements:D=true})=>{var N,b,C;let Q=chunkYDKWD6MQ_js.c(),le=(N=H!=null?H:Q.breach.riskAssessmentTitle)!=null?N:"Breach Risk Assessment",se=(b=L!=null?L:Q.breach.riskAssessmentDescription)!=null?b:"Assess the risk level of this data breach to determine notification requirements under NDPA Section 40.",Z=(C=$!=null?$:Q.dpia.complete)!=null?C:"Complete Assessment",[E,me]=react.useState(f.confidentialityImpact||3),[v,T]=react.useState(f.integrityImpact||3),[k,U]=react.useState(f.availabilityImpact||3),[P,V]=react.useState(f.harmLikelihood||3),[_,W]=react.useState(f.harmSeverity||3),[F,Y]=react.useState(f.risksToRightsAndFreedoms!==void 0?f.risksToRightsAndFreedoms:false),[O,X]=react.useState(f.highRisksToRightsAndFreedoms!==void 0?f.highRisksToRightsAndFreedoms:false),[J,ce]=react.useState(f.justification||""),[z,I]=react.useState(0),[h,w]=react.useState("low"),[g,R]=react.useState(false),[ae,ie]=react.useState(0),[j,ne]=react.useState(0),[re,ee]=react.useState(false),[u]=react.useState(()=>Date.now());react.useEffect(()=>{let fe=E*.2+v*.1+k*.1+P*.3+_*.3;I(Number(fe.toFixed(1)));let te;fe<2?te="low":fe<3?te="medium":fe<4?te="high":te="critical",w(te),R(F||te==="high"||te==="critical");let Ne=l.discoveredAt+4320*60*1e3;ie(Ne);let Re=Date.now(),ye=(Ne-Re)/(3600*1e3);ne(Number(ye.toFixed(1)));},[E,v,k,P,_,F,l.discoveredAt]);let y=d=>new Date(d).toLocaleString(),B=d=>{d.preventDefault();let K={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:E,integrityImpact:v,availabilityImpact:k,harmLikelihood:P,harmSeverity:_,overallRiskScore:z,riskLevel:h,risksToRightsAndFreedoms:F,highRisksToRightsAndFreedoms:O,justification:J};A(K),ee(true);},t=d=>{switch(d){case 1:return "Minimal";case 2:return "Low";case 3:return "Moderate";case 4:return "High";case 5:return "Severe";default:return "Unknown"}},m=d=>jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.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"}[d]}`,x.riskBadge,o),children:d.charAt(0).toUpperCase()+d.slice(1)});return jsxRuntime.jsxs("div",{"data-ndpr-component":"breach-risk-assessment",className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${q}`,x.root,o),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",x.title,o),children:le}),jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:se}),c&&jsxRuntime.jsxs("div",{className:"ndpr-panel",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-2",children:"Breach Summary"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Title:"})," ",l.title]}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Discovered:"})," ",y(l.discoveredAt)]}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Status:"})," ",l.status.charAt(0).toUpperCase()+l.status.slice(1)]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Data Types:"})," ",l.dataTypes.join(", ")]}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Affected Systems:"})," ",l.affectedSystems.join(", ")]}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Affected Subjects:"})," ",l.estimatedAffectedSubjects||"Unknown"]})]})]})]}),re?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--info",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Assessment Results"}),jsxRuntime.jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Overall Risk Level:"})," ",m(h)]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Risk Score:"})," ",z," / 5"]}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Assessed On:"})," ",y(u)]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Risks to Rights and Freedoms:"})," ",F?"Yes":"No"]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"High Risks to Rights and Freedoms:"})," ",O?"Yes":"No"]})]})]}),jsxRuntime.jsxs("div",{className:"mt-3",children:[jsxRuntime.jsx("p",{className:"text-sm mb-1",children:jsxRuntime.jsx("span",{className:"font-medium",children:"Justification:"})}),jsxRuntime.jsx("p",{className:"text-sm bg-white dark:bg-gray-800 p-2 rounded",children:J})]})]}),D&&jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`mb-6 p-4 rounded-md ${g?j>24?"ndpr-alert ndpr-alert--warning":"ndpr-alert ndpr-alert--destructive":"ndpr-alert ndpr-alert--success"}`,x.notificationStatus,o),children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Notification Requirements"}),g?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:`text-sm font-bold mb-2 ${j>24?"ndpr-text-warning":"ndpr-text-destructive"}`,children:"NDPC Notification Required"}),jsxRuntime.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."}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Notification Deadline:"})," ",y(ae)]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Time Remaining:"})," ",jsxRuntime.jsx("span",{className:j<24?"ndpr-text-destructive font-bold":"",children:j>0?`${j} hours`:"Deadline passed"})]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Data Subject Notification:"})," ",O?"Required (NDPA Section 40(4))":"Not required unless directed by NDPC"]})]}):jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-bold mb-2 ndpr-text-success",children:"NDPC Notification Not Required"}),jsxRuntime.jsx("p",{className:"text-sm mb-2",children:"Based on this assessment, this breach does not need to be reported to the NDPC."}),jsxRuntime.jsx("p",{className:"text-sm mb-2",children:"However, the breach should still be documented internally for compliance purposes."})]}),jsxRuntime.jsxs("div",{className:"mt-3 text-sm",children:[jsxRuntime.jsx("p",{className:"font-medium",children:"Next Steps:"}),jsxRuntime.jsx("ul",{className:"list-disc pl-5 mt-1",children:g?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("li",{children:"Prepare a notification report for the NDPC"}),jsxRuntime.jsx("li",{children:"Document all aspects of the breach and your response"}),O&&jsxRuntime.jsx("li",{children:"Prepare communications for affected data subjects"}),jsxRuntime.jsx("li",{children:"Implement measures to mitigate the impact of the breach"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("li",{children:"Document the breach and this assessment in your internal records"}),jsxRuntime.jsx("li",{children:"Implement measures to prevent similar breaches in the future"}),jsxRuntime.jsx("li",{children:"Review and update security measures as needed"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>ee(false),className:chunkAME4HJR4_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${G}`,x.primaryButton||x.submitButton,o),children:"Edit Assessment"})]}):jsxRuntime.jsx("form",{onSubmit:B,children:jsxRuntime.jsxs("div",{className:"ndpr-form-section",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Impact Assessment"}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsxs("label",{htmlFor:"confidentialityImpact",className:"ndpr-form-field__label",children:["Confidentiality Impact (1-5)",jsxRuntime.jsx("span",{className:"ml-2 text-sm ndpr-text-muted",children:"How much has the confidentiality of data been compromised?"})]}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("input",{type:"range",id:"confidentialityImpact",min:"1",max:"5",step:"1",value:E,onChange:d=>me(parseInt(d.target.value)),className:chunkAME4HJR4_js.a("ndpr-form-field__range",x.slider,o)}),jsxRuntime.jsxs("span",{className:"ml-3 w-24 text-sm",children:[t(E)," (",E,")"]})]})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsxs("label",{htmlFor:"integrityImpact",className:"ndpr-form-field__label",children:["Integrity Impact (1-5)",jsxRuntime.jsx("span",{className:"ml-2 text-sm ndpr-text-muted",children:"How much has the integrity of data been compromised?"})]}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("input",{type:"range",id:"integrityImpact",min:"1",max:"5",step:"1",value:v,onChange:d=>T(parseInt(d.target.value)),className:chunkAME4HJR4_js.a("ndpr-form-field__range",x.slider,o)}),jsxRuntime.jsxs("span",{className:"ml-3 w-24 text-sm",children:[t(v)," (",v,")"]})]})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsxs("label",{htmlFor:"availabilityImpact",className:"ndpr-form-field__label",children:["Availability Impact (1-5)",jsxRuntime.jsx("span",{className:"ml-2 text-sm ndpr-text-muted",children:"How much has the availability of data or systems been compromised?"})]}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("input",{type:"range",id:"availabilityImpact",min:"1",max:"5",step:"1",value:k,onChange:d=>U(parseInt(d.target.value)),className:chunkAME4HJR4_js.a("ndpr-form-field__range",x.slider,o)}),jsxRuntime.jsxs("span",{className:"ml-3 w-24 text-sm",children:[t(k)," (",k,")"]})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Risk to Data Subjects"}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsxs("label",{htmlFor:"harmLikelihood",className:"ndpr-form-field__label",children:["Likelihood of Harm (1-5)",jsxRuntime.jsx("span",{className:"ml-2 text-sm ndpr-text-muted",children:"How likely is it that data subjects will experience harm?"})]}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("input",{type:"range",id:"harmLikelihood",min:"1",max:"5",step:"1",value:P,onChange:d=>V(parseInt(d.target.value)),className:chunkAME4HJR4_js.a("ndpr-form-field__range",x.slider,o)}),jsxRuntime.jsxs("span",{className:"ml-3 w-24 text-sm",children:[t(P)," (",P,")"]})]})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsxs("label",{htmlFor:"harmSeverity",className:"ndpr-form-field__label",children:["Severity of Harm (1-5)",jsxRuntime.jsx("span",{className:"ml-2 text-sm ndpr-text-muted",children:"How severe would the harm be to affected data subjects?"})]}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("input",{type:"range",id:"harmSeverity",min:"1",max:"5",step:"1",value:_,onChange:d=>W(parseInt(d.target.value)),className:chunkAME4HJR4_js.a("ndpr-form-field__range",x.slider,o)}),jsxRuntime.jsxs("span",{className:"ml-3 w-24 text-sm",children:[t(_)," (",_,")"]})]})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsxs("div",{className:"flex items-center mb-2",children:[jsxRuntime.jsx("input",{type:"checkbox",id:"risksToRightsAndFreedoms",checked:F,onChange:d=>Y(d.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsxRuntime.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"})]}),jsxRuntime.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."})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsxs("div",{className:"flex items-center mb-2",children:[jsxRuntime.jsx("input",{type:"checkbox",id:"highRisksToRightsAndFreedoms",checked:O,onChange:d=>X(d.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsxRuntime.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"})]}),jsxRuntime.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."})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Overall Assessment"}),jsxRuntime.jsxs("div",{className:"ndpr-panel",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Overall Risk Score:"}),jsxRuntime.jsxs("span",{className:chunkAME4HJR4_js.a("",x.riskScore,o),children:[z," / 5"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Risk Level:"}),m(h)]})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsxs("label",{htmlFor:"justification",className:"ndpr-form-field__label",children:["Justification for Assessment ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("textarea",{id:"justification",value:J,onChange:d=>ce(d.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})]})]}),jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--info",children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Breach Notification Requirements"}),jsxRuntime.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."})]}),jsxRuntime.jsx("div",{className:"mt-6",children:jsxRuntime.jsx("button",{type:"submit",className:chunkAME4HJR4_js.a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${G}`,x.primaryButton||x.submitButton,o),children:Z})})]})})]})};var je=({breachReports:l,riskAssessments:f,regulatoryNotifications:A,onSelectBreach:H,onRequestAssessment:L,onRequestNotification:$,title:q,description:G,className:x="",buttonClassName:o="",classNames:c={},unstyled:D=false,showBreachDetails:Q=true,showNotificationTimeline:le=true,showDeadlineAlerts:se=true})=>{var u,y,B;let Z=chunkYDKWD6MQ_js.c(),E=(u=q!=null?q:Z.breach.notificationManagerTitle)!=null?u:"Breach Notification Manager",me=(y=G!=null?G:Z.breach.notificationManagerDescription)!=null?y:"Manage data breach notifications and track compliance with NDPA Section 40 requirements.",[v,T]=react.useState(null),[k,U]=react.useState(l),[P,V]=react.useState("all"),[_,W]=react.useState(""),[F,Y]=react.useState("discoveredAt"),[O,X]=react.useState("desc");react.useEffect(()=>{let t=[...l];if(P!=="all"&&(t=t.filter(m=>m.status===P)),_){let m=_.toLowerCase();t=t.filter(N=>N.title.toLowerCase().includes(m)||N.description.toLowerCase().includes(m)||N.affectedSystems.some(b=>b.toLowerCase().includes(m))||N.dataTypes.some(b=>b.toLowerCase().includes(m)));}t.sort((m,N)=>{let b=0;switch(F){case "title":b=m.title.localeCompare(N.title);break;case "discoveredAt":b=m.discoveredAt-N.discoveredAt;break;case "status":b=m.status.localeCompare(N.status);break;case "riskLevel":let C=f.find(ue=>ue.breachId===m.id),d=f.find(ue=>ue.breachId===N.id),K=(C==null?void 0:C.riskLevel)||"unknown",pe=(d==null?void 0:d.riskLevel)||"unknown";b=K.localeCompare(pe);break;default:b=m.discoveredAt-N.discoveredAt;}return O==="asc"?b:-b}),U(t);},[l,P,_,F,O,f]),react.useEffect(()=>{k.length>0&&(v&&k.some(m=>m.id===v)||T(k[0].id));},[k,v]);let J=t=>{T(t),H&&H(t);},ce=()=>{v&&L&&L(v);},z=()=>{v&&$&&$(v);},I=t=>new Date(t).toLocaleString(),h=v?l.find(t=>t.id===v):null,w=v?f.find(t=>t.breachId===v):null,g=v?A.find(t=>t.breachId===v):null,R=h?ae(h,w):null;function ae(t,m){let N=chunk3YTAOT5O_js.a(t,m||void 0),b=t.discoveredAt+N.timeframeHours*60*60*1e3;return {ndpcNotificationRequired:N.notificationRequired,ndpcNotificationDeadline:b,dataSubjectNotificationRequired:(m==null?void 0:m.highRisksToRightsAndFreedoms)||false,justification:N.justification}}function ie(t){let m=Date.now(),N=(t-m)/(3600*1e3);return Number(N.toFixed(1))}let j=t=>t?jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.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,ne=t=>jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.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)}),re=()=>{if(!h||!R)return null;if(!R.ndpcNotificationRequired)return jsxRuntime.jsxs("div",{"data-ndpr-component":"breach-notification-manager",className:"ndpr-alert ndpr-alert--success",children:[jsxRuntime.jsx("p",{className:"text-sm ndpr-text-success font-medium",children:"Notification Not Required"}),jsxRuntime.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 jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--success",children:[jsxRuntime.jsx("p",{className:"text-sm ndpr-text-success font-medium",children:"Notification Sent"}),jsxRuntime.jsxs("p",{className:"text-xs ndpr-text-success mt-1",children:["Notification was sent to the NDPC on ",I(g.sentAt),"."]})]});let t=ie(R.ndpcNotificationDeadline);return t<=0?jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--destructive",children:[jsxRuntime.jsx("p",{className:"text-sm ndpr-text-destructive font-medium",children:"Notification Deadline Passed"}),jsxRuntime.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?jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--destructive",children:[jsxRuntime.jsx("p",{className:"text-sm ndpr-text-destructive font-medium",children:"Urgent: Notification Due Soon"}),jsxRuntime.jsxs("p",{className:"text-xs ndpr-text-destructive mt-1",children:["Only ",t," hours remaining until the NDPC notification deadline."]})]}):jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--warning",children:[jsxRuntime.jsx("p",{className:"text-sm ndpr-text-warning font-medium",children:"Notification Required"}),jsxRuntime.jsxs("p",{className:"text-xs ndpr-text-warning mt-1",children:["NDPC notification is required by ",I(R.ndpcNotificationDeadline)," (",t," hours remaining)."]})]})},ee=()=>{if(!h)return null;let t=[{title:"Breach Discovered",date:h.discoveredAt,completed:true,description:`Breach was discovered on ${I(h.discoveredAt)}.`},{title:"Risk Assessment",date:w==null?void 0:w.assessedAt,completed:!!w,description:w?`Risk assessment completed on ${I(w.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 ${I(g.sentAt)}.`:`Notification must be sent to the NDPC by ${I(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."}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("mt-6",c.timeline,D),children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Notification Timeline"}),jsxRuntime.jsx("ol",{className:"relative border-l border-gray-200 dark:border-gray-700",children:t.map((m,N)=>jsxRuntime.jsxs("li",{className:chunkAME4HJR4_js.a("mb-6 ml-4",c.timelineStep,D),children:[jsxRuntime.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"}`}),jsxRuntime.jsx("time",{className:"mb-1 text-sm font-normal leading-none ndpr-text-muted",children:m.date?I(m.date):"Pending"}),jsxRuntime.jsx("h4",{className:"ndpr-section-heading",children:m.title}),jsxRuntime.jsx("p",{className:"ndpr-form-field__hint",children:m.description})]},N))})]})};return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${x}`,c.root,D),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("",c.header,D),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",c.title,D),children:E}),jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:me})]}),jsxRuntime.jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-3 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"statusFilter",className:"ndpr-form-field__label",children:"Status Filter"}),jsxRuntime.jsxs("select",{id:"statusFilter",value:P,onChange:t=>V(t.target.value),className:"ndpr-form-field__input",children:[jsxRuntime.jsx("option",{value:"all",children:"All Statuses"}),jsxRuntime.jsx("option",{value:"ongoing",children:"Ongoing"}),jsxRuntime.jsx("option",{value:"contained",children:"Contained"}),jsxRuntime.jsx("option",{value:"resolved",children:"Resolved"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"sortBy",className:"ndpr-form-field__label",children:"Sort By"}),jsxRuntime.jsxs("select",{id:"sortBy",value:F,onChange:t=>Y(t.target.value),className:"ndpr-form-field__input",children:[jsxRuntime.jsx("option",{value:"discoveredAt",children:"Discovery Date"}),jsxRuntime.jsx("option",{value:"title",children:"Title"}),jsxRuntime.jsx("option",{value:"status",children:"Status"}),jsxRuntime.jsx("option",{value:"riskLevel",children:"Risk Level"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"searchTerm",className:"ndpr-form-field__label",children:"Search"}),jsxRuntime.jsx("input",{type:"text",id:"searchTerm",value:_,onChange:t=>W(t.target.value),placeholder:"Search breaches...",className:"ndpr-form-field__input"})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[jsxRuntime.jsxs("div",{className:"md:col-span-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Breach Reports"}),k.length===0?jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:"No breach reports found."}):jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("space-y-2 max-h-96 overflow-y-auto pr-2",c.breachList,D),children:k.map(t=>{let m=f.find(d=>d.breachId===t.id),N=A.find(d=>d.breachId===t.id),b=ae(t,m),C=null;if(b!=null&&b.ndpcNotificationRequired)if(N)C=jsxRuntime.jsx("span",{className:"text-xs ndpr-text-success",children:"Notified"});else {let d=ie(b.ndpcNotificationDeadline);d<=0?C=jsxRuntime.jsx("span",{className:"text-xs ndpr-text-destructive font-bold",children:"Overdue"}):d<=24?C=jsxRuntime.jsx("span",{className:"text-xs ndpr-text-destructive",children:"Urgent"}):C=jsxRuntime.jsx("span",{className:"text-xs ndpr-text-warning",children:"Required"});}else C=jsxRuntime.jsx("span",{className:"text-xs ndpr-text-success",children:"Not Required"});return jsxRuntime.jsxs("div",{role:"button",tabIndex:0,"aria-label":`View breach ${t.title}`,"aria-selected":v===t.id,className:chunkAME4HJR4_js.a(`p-3 rounded-md cursor-pointer ${v===t.id?"ndpr-alert ndpr-alert--info":"ndpr-panel"}`,c.breachItem,D),onClick:()=>J(t.id),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),J(t.id));},children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsxRuntime.jsx("h4",{className:"font-medium text-sm",children:t.title}),ne(t.status)]}),jsxRuntime.jsxs("p",{className:"text-xs ndpr-text-muted mb-1",children:["Discovered: ",new Date(t.discoveredAt).toLocaleDateString()]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center mt-2",children:[jsxRuntime.jsx("div",{children:m&&j(m.riskLevel)}),jsxRuntime.jsx("div",{children:C})]})]},t.id)})})]}),jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("md:col-span-2",c.detailPanel,D),children:h?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:h.title}),ne(h.status)]}),se&&jsxRuntime.jsx("div",{className:"ndpr-form-field",children:re()}),Q&&jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Discovered:"})," ",I(h.discoveredAt)]}),h.occurredAt&&jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Occurred:"})," ",I(h.occurredAt)]}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Reporter:"})," ",h.reporter.name]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Affected Systems:"})," ",h.affectedSystems.join(", ")]}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Data Types:"})," ",h.dataTypes.join(", ")]}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Affected Subjects:"})," ",h.estimatedAffectedSubjects||"Unknown"]})]})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsx("p",{className:"ndpr-text-sm ndpr-font-medium",children:"Description:"}),jsxRuntime.jsx("p",{className:"ndpr-panel",children:h.description})]}),h.initialActions&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"ndpr-text-sm ndpr-font-medium",children:"Initial Actions Taken:"}),jsxRuntime.jsx("p",{className:"ndpr-panel",children:h.initialActions})]})]}),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Risk Assessment"}),w?jsxRuntime.jsxs("div",{className:"ndpr-panel",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-2",children:[jsxRuntime.jsx("p",{className:"ndpr-text-sm ndpr-font-medium",children:"Risk Level:"}),j(w.riskLevel)]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Risk Score:"})," ",w.overallRiskScore," / 5"]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Risks to Rights and Freedoms:"})," ",w.risksToRightsAndFreedoms?"Yes":"No"]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"High Risks to Rights and Freedoms:"})," ",w.highRisksToRightsAndFreedoms?"Yes":"No"]}),jsxRuntime.jsx("p",{className:"text-sm mb-1",children:jsxRuntime.jsx("span",{className:"font-medium",children:"Justification:"})}),jsxRuntime.jsx("p",{className:"text-xs ndpr-text-muted bg-white dark:bg-gray-800 p-2 rounded-md",children:w.justification})]}):jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--warning",children:[jsxRuntime.jsx("p",{className:"text-sm ndpr-text-warning",children:"Risk assessment has not been conducted yet."}),jsxRuntime.jsx("button",{onClick:ce,className:`mt-2 px-3 py-1 text-xs bg-yellow-600 text-white rounded hover:bg-yellow-700 ${o}`,children:"Conduct Risk Assessment"})]})]}),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Notification Status"}),g?jsxRuntime.jsxs("div",{className:"ndpr-panel",children:[jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Notification Sent:"})," ",I(g.sentAt)]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Method:"})," ",g.method.charAt(0).toUpperCase()+g.method.slice(1)]}),g.referenceNumber&&jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Reference Number:"})," ",g.referenceNumber]}),(g.ndpcContact||g.nitdaContact)&&jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"NDPC Contact:"})," ",(B=g.ndpcContact||g.nitdaContact)==null?void 0:B.name]})]}):jsxRuntime.jsx("div",{children:R!=null&&R.ndpcNotificationRequired?jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--warning",children:[jsxRuntime.jsx("p",{className:"text-sm ndpr-text-warning",children:"NDPC notification is required but has not been sent yet."}),jsxRuntime.jsx("button",{onClick:z,className:`mt-2 px-3 py-1 text-xs bg-yellow-600 text-white rounded hover:bg-yellow-700 ${o}`,children:"Generate Notification"})]}):jsxRuntime.jsx("div",{className:"ndpr-alert ndpr-alert--success",children:jsxRuntime.jsx("p",{className:"text-sm ndpr-text-success",children:"NDPC notification is not required for this breach."})})})]}),le&&ee()]}):jsxRuntime.jsx("div",{className:"ndpr-empty-state",children:jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:"Select a breach to view details"})})})]})]})};var Ye=({breachData:l,assessmentData:f,organizationInfo:A,onGenerate:H,title:L,description:$,generateButtonText:q,className:G="",buttonClassName:x="",classNames:o={},unstyled:c=false,showPreview:D=true,allowEditing:Q=true,allowDownload:le=true,downloadFormat:se="pdf"})=>{var re,ee;let Z=chunkYDKWD6MQ_js.c(),E=(re=L!=null?L:Z.breach.regulatoryReportTitle)!=null?re:"Generate NDPC Notification Report",me=(ee=$!=null?$:Z.breach.regulatoryReportDescription)!=null?ee:"Generate a report for submission to the NDPC in compliance with NDPA Section 40 breach notification requirements.",v=q!=null?q:"Generate Report",[T,k]=react.useState(""),[U,P]=react.useState(""),[V,_]=react.useState(""),[W,F]=react.useState(""),[Y,O]=react.useState("email"),[X,J]=react.useState(""),[ce,z]=react.useState(""),[I,h]=react.useState(false),[w,g]=react.useState(false);react.useEffect(()=>{let u=ae();k(u),h(true);},[l,f,A]);let R=u=>new Date(u).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}),ae=()=>{var N,b,C,d,K,pe;let y=new Date().toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}),B=((N=l.dpoContact)==null?void 0:N.name)||A.dpoName,t=((b=l.dpoContact)==null?void 0:b.email)||A.dpoEmail,m=((C=l.dpoContact)==null?void 0:C.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: ${B}
|
|
20
|
+
Email: ${t}
|
|
21
|
+
${m?`Phone: ${m}`:""}
|
|
22
|
+
|
|
23
|
+
BREACH DETAILS
|
|
24
|
+
-------------
|
|
25
|
+
Breach Title: ${l.title}
|
|
26
|
+
Date Discovered: ${R(l.discoveredAt)}
|
|
27
|
+
${l.occurredAt?`Date Occurred: ${R(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
|
+
${((d=l.dataSubjectCategories)==null?void 0:d.join(", "))||"[Not specified \u2014 required by NDPC]"}
|
|
42
|
+
|
|
43
|
+
Approximate Number of Data Subjects Affected:
|
|
44
|
+
${(K=l.estimatedAffectedSubjects)!=null?K:"Unknown"}
|
|
45
|
+
|
|
46
|
+
Approximate Number of Personal Data Records Concerned (Section 40(2)):
|
|
47
|
+
${(pe=l.approximateRecordCount)!=null?pe:"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
|
+
${chunkZVOIR4QH_js.b}
|
|
94
|
+
`},ie=u=>{u.preventDefault();let y={id:`notification_${Date.now()}`,breachId:l.id,sentAt:Date.now(),method:Y,referenceNumber:X||void 0,ndpcContact:U?{name:U,email:V,phone:W||void 0}:void 0,content:T,attachments:[]};H(y),g(true);},j=()=>{let u,y,B;switch(se){case "html":{u="text/html",y="html",B=`<!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>${T.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}</body>
|
|
103
|
+
</html>`;break}case "pdf":u="text/plain",y="pdf.txt",B=T;break;case "docx":u="text/plain",y="docx.txt",B=T;break;default:u="text/plain",y="txt",B=T;}let t=document.createElement("a"),m=new Blob([B],{type:u});t.href=URL.createObjectURL(m),t.download=`NDPC_Breach_Notification_${new Date().toISOString().split("T")[0]}.${y}`,document.body.appendChild(t),t.click(),document.body.removeChild(t);},ne=()=>[{value:"email",label:"Email"},{value:"portal",label:"NDPC Portal"},{value:"letter",label:"Formal Letter"},{value:"other",label:"Other"}].map(y=>jsxRuntime.jsx("option",{value:y.value,children:y.label},y.value));return jsxRuntime.jsxs("div",{"data-ndpr-component":"regulatory-report-generator",className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${G}`,o.root,c),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("",o.header,c),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",o.title,c),children:E}),jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:me})]}),w?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--success",children:[jsxRuntime.jsx("h3",{className:"text-lg font-bold ndpr-text-success mb-2",children:"Report Generated Successfully"}),jsxRuntime.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."})]}),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Submission Details"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:chunkAME4HJR4_js.a("ndpr-text-sm",o.field,c),children:[jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.a("font-medium",o.fieldLabel,c),children:"Method:"})," ",jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.a("",o.fieldValue,c),children:Y.charAt(0).toUpperCase()+Y.slice(1)})]}),U&&jsxRuntime.jsxs("p",{className:chunkAME4HJR4_js.a("ndpr-text-sm",o.field,c),children:[jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.a("font-medium",o.fieldLabel,c),children:"Contact Name:"})," ",jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.a("",o.fieldValue,c),children:U})]}),V&&jsxRuntime.jsxs("p",{className:chunkAME4HJR4_js.a("ndpr-text-sm",o.field,c),children:[jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.a("font-medium",o.fieldLabel,c),children:"Contact Email:"})," ",jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.a("",o.fieldValue,c),children:V})]}),W&&jsxRuntime.jsxs("p",{className:chunkAME4HJR4_js.a("ndpr-text-sm",o.field,c),children:[jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.a("font-medium",o.fieldLabel,c),children:"Contact Phone:"})," ",jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.a("",o.fieldValue,c),children:W})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:chunkAME4HJR4_js.a("ndpr-text-sm",o.field,c),children:[jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.a("font-medium",o.fieldLabel,c),children:"Date Generated:"})," ",jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.a("",o.fieldValue,c),children:R(Date.now())})]}),jsxRuntime.jsxs("p",{className:chunkAME4HJR4_js.a("ndpr-text-sm",o.field,c),children:[jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.a("font-medium",o.fieldLabel,c),children:"Breach ID:"})," ",jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.a("",o.fieldValue,c),children:l.id})]}),X&&jsxRuntime.jsxs("p",{className:chunkAME4HJR4_js.a("ndpr-text-sm",o.field,c),children:[jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.a("font-medium",o.fieldLabel,c),children:"Reference Number:"})," ",jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.a("",o.fieldValue,c),children:X})]})]})]})]}),D&&jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Report Preview"}),jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("ndpr-panel",o.reportPreview,c),children:jsxRuntime.jsx("pre",{className:"whitespace-pre-wrap text-sm font-mono text-gray-800 dark:text-gray-200",children:T})})]}),jsxRuntime.jsxs("div",{className:"ndpr-card__footer",children:[le&&jsxRuntime.jsxs("button",{onClick:j,className:chunkAME4HJR4_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${x}`,o.secondaryButton||o.downloadButton,c),children:["Download Report (",se.toUpperCase(),")"]}),jsxRuntime.jsx("button",{onClick:()=>g(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 ${x}`,children:"Edit Report"})]})]}):jsxRuntime.jsx("form",{onSubmit:ie,children:jsxRuntime.jsxs("div",{className:"ndpr-form-section",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Notification Method"}),jsxRuntime.jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"method",className:"ndpr-form-field__label",children:["Method of Submission ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("select",{id:"method",value:Y,onChange:u=>O(u.target.value),className:"ndpr-form-field__input",required:true,children:ne()})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"referenceNumber",className:"ndpr-form-field__label",children:"Reference Number (if available)"}),jsxRuntime.jsx("input",{type:"text",id:"referenceNumber",value:X,onChange:u=>J(u.target.value),placeholder:"e.g. NDPC/BR/2024/001",className:"ndpr-form-field__input"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"NDPC Contact (if known)"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"contactName",className:"ndpr-form-field__label",children:"Contact Name"}),jsxRuntime.jsx("input",{type:"text",id:"contactName",value:U,onChange:u=>P(u.target.value),className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"contactEmail",className:"ndpr-form-field__label",children:"Contact Email"}),jsxRuntime.jsx("input",{type:"email",id:"contactEmail",value:V,onChange:u=>_(u.target.value),className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"contactPhone",className:"ndpr-form-field__label",children:"Contact Phone"}),jsxRuntime.jsx("input",{type:"tel",id:"contactPhone",value:W,onChange:u=>F(u.target.value),className:"ndpr-form-field__input"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Additional Information"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"additionalInfo",className:"ndpr-form-field__label",children:"Additional Information to Include"}),jsxRuntime.jsx("textarea",{id:"additionalInfo",value:ce,onChange:u=>z(u.target.value),rows:3,placeholder:"Any additional information you want to include in the report",className:"ndpr-form-field__input"})]})]}),Q&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Report Content"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"reportContent",className:"ndpr-form-field__label",children:["Edit Report Content ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("textarea",{id:"reportContent",value:T,onChange:u=>k(u.target.value),rows:20,className:"ndpr-form-field__input ndpr-form-field__input--mono",required:true})]})]}),jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--info",children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Breach Notification Requirements"}),jsxRuntime.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."}),jsxRuntime.jsx("p",{className:"ndpr-text-muted text-xs mt-2 italic",role:"note",children:chunkZVOIR4QH_js.a})]}),jsxRuntime.jsx("div",{className:"mt-6",children:jsxRuntime.jsx("button",{type:"submit",className:chunkAME4HJR4_js.a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${x}`,o.primaryButton||o.generateButton,c),children:v})})]})})]})};exports.a=Ie;exports.b=je;exports.c=Ye;
|