@tantainnovative/ndpr-toolkit 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/README.md +447 -84
  2. package/dist/index.esm.js +2 -0
  3. package/dist/index.esm.js.map +1 -0
  4. package/dist/index.js +2 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/types/index.d.ts +35 -0
  7. package/package.json +52 -70
  8. package/CHANGELOG.md +0 -16
  9. package/CNAME +0 -1
  10. package/CONTRIBUTING.md +0 -87
  11. package/RELEASE-NOTES-v1.0.0.md +0 -140
  12. package/RELEASE-NOTES-v1.0.1.md +0 -69
  13. package/SECURITY.md +0 -21
  14. package/components.json +0 -21
  15. package/eslint.config.mjs +0 -16
  16. package/next-env.d.ts +0 -5
  17. package/next.config.js +0 -15
  18. package/next.config.ts +0 -62
  19. package/packages/ndpr-toolkit/README.md +0 -467
  20. package/packages/ndpr-toolkit/dist/index.esm.js +0 -2
  21. package/packages/ndpr-toolkit/dist/index.esm.js.map +0 -1
  22. package/packages/ndpr-toolkit/dist/index.js +0 -2
  23. package/packages/ndpr-toolkit/dist/index.js.map +0 -1
  24. package/packages/ndpr-toolkit/package-lock.json +0 -8197
  25. package/packages/ndpr-toolkit/package.json +0 -71
  26. package/packages/ndpr-toolkit/rollup.config.js +0 -34
  27. package/packages/ndpr-toolkit/src/components/breach/BreachNotificationManager.tsx +0 -701
  28. package/packages/ndpr-toolkit/src/components/breach/BreachReportForm.tsx +0 -631
  29. package/packages/ndpr-toolkit/src/components/breach/BreachRiskAssessment.tsx +0 -569
  30. package/packages/ndpr-toolkit/src/components/breach/RegulatoryReportGenerator.tsx +0 -496
  31. package/packages/ndpr-toolkit/src/components/consent/ConsentBanner.tsx +0 -270
  32. package/packages/ndpr-toolkit/src/components/consent/ConsentManager.tsx +0 -217
  33. package/packages/ndpr-toolkit/src/components/consent/ConsentStorage.tsx +0 -206
  34. package/packages/ndpr-toolkit/src/components/dpia/DPIAQuestionnaire.tsx +0 -342
  35. package/packages/ndpr-toolkit/src/components/dpia/DPIAReport.tsx +0 -373
  36. package/packages/ndpr-toolkit/src/components/dpia/StepIndicator.tsx +0 -174
  37. package/packages/ndpr-toolkit/src/components/dsr/DSRDashboard.tsx +0 -717
  38. package/packages/ndpr-toolkit/src/components/dsr/DSRRequestForm.tsx +0 -476
  39. package/packages/ndpr-toolkit/src/components/dsr/DSRTracker.tsx +0 -620
  40. package/packages/ndpr-toolkit/src/components/policy/PolicyExporter.tsx +0 -541
  41. package/packages/ndpr-toolkit/src/components/policy/PolicyGenerator.tsx +0 -454
  42. package/packages/ndpr-toolkit/src/components/policy/PolicyPreview.tsx +0 -333
  43. package/packages/ndpr-toolkit/src/hooks/useBreach.ts +0 -409
  44. package/packages/ndpr-toolkit/src/hooks/useConsent.ts +0 -263
  45. package/packages/ndpr-toolkit/src/hooks/useDPIA.ts +0 -457
  46. package/packages/ndpr-toolkit/src/hooks/useDSR.ts +0 -236
  47. package/packages/ndpr-toolkit/src/hooks/usePrivacyPolicy.ts +0 -428
  48. package/packages/ndpr-toolkit/src/index.ts +0 -44
  49. package/packages/ndpr-toolkit/src/setupTests.ts +0 -5
  50. package/packages/ndpr-toolkit/src/types/breach.ts +0 -283
  51. package/packages/ndpr-toolkit/src/types/consent.ts +0 -111
  52. package/packages/ndpr-toolkit/src/types/dpia.ts +0 -236
  53. package/packages/ndpr-toolkit/src/types/dsr.ts +0 -192
  54. package/packages/ndpr-toolkit/src/types/index.ts +0 -42
  55. package/packages/ndpr-toolkit/src/types/privacy.ts +0 -246
  56. package/packages/ndpr-toolkit/src/utils/breach.ts +0 -122
  57. package/packages/ndpr-toolkit/src/utils/consent.ts +0 -51
  58. package/packages/ndpr-toolkit/src/utils/dpia.ts +0 -104
  59. package/packages/ndpr-toolkit/src/utils/dsr.ts +0 -77
  60. package/packages/ndpr-toolkit/src/utils/privacy.ts +0 -100
  61. package/packages/ndpr-toolkit/tsconfig.json +0 -23
  62. package/postcss.config.mjs +0 -5
  63. package/public/NDPR TOOLKIT.svg +0 -1
  64. package/public/favicon/android-chrome-192x192.png +0 -0
  65. package/public/favicon/android-chrome-512x512.png +0 -0
  66. package/public/favicon/apple-touch-icon.png +0 -0
  67. package/public/favicon/favicon-16x16.png +0 -0
  68. package/public/favicon/favicon-32x32.png +0 -0
  69. package/public/favicon/site.webmanifest +0 -1
  70. package/public/file.svg +0 -1
  71. package/public/globe.svg +0 -1
  72. package/public/ndpr-toolkit-logo.svg +0 -108
  73. package/public/next.svg +0 -1
  74. package/public/vercel.svg +0 -1
  75. package/public/window.svg +0 -1
  76. package/src/app/accessibility.css +0 -70
  77. package/src/app/favicon.ico +0 -0
  78. package/src/app/globals.css +0 -123
  79. package/src/app/layout.tsx +0 -37
  80. package/src/app/ndpr-demos/breach/page.tsx +0 -354
  81. package/src/app/ndpr-demos/consent/page.tsx +0 -366
  82. package/src/app/ndpr-demos/dpia/page.tsx +0 -495
  83. package/src/app/ndpr-demos/dsr/page.tsx +0 -280
  84. package/src/app/ndpr-demos/page.tsx +0 -73
  85. package/src/app/ndpr-demos/policy/page.tsx +0 -771
  86. package/src/app/page.tsx +0 -452
  87. package/src/components/ErrorBoundary.tsx +0 -90
  88. package/src/components/breach-notification/BreachNotificationForm.tsx +0 -479
  89. package/src/components/consent/ConsentBanner.tsx +0 -193
  90. package/src/components/data-subject-rights/DataSubjectRequestForm.tsx +0 -530
  91. package/src/components/dpia/DPIAQuestionnaire.tsx +0 -523
  92. package/src/components/privacy-policy/PolicyGenerator.tsx +0 -1062
  93. package/src/components/privacy-policy/data.ts +0 -98
  94. package/src/components/privacy-policy/shared/CheckboxField.tsx +0 -38
  95. package/src/components/privacy-policy/shared/CheckboxGroup.tsx +0 -85
  96. package/src/components/privacy-policy/shared/FormField.tsx +0 -79
  97. package/src/components/privacy-policy/shared/StepIndicator.tsx +0 -86
  98. package/src/components/privacy-policy/steps/CustomSectionsStep.tsx +0 -361
  99. package/src/components/privacy-policy/steps/DataCollectionStep.tsx +0 -231
  100. package/src/components/privacy-policy/steps/DataSharingStep.tsx +0 -418
  101. package/src/components/privacy-policy/steps/OrganizationInfoStep.tsx +0 -202
  102. package/src/components/privacy-policy/steps/PolicyPreviewStep.tsx +0 -226
  103. package/src/components/ui/Badge.tsx +0 -46
  104. package/src/components/ui/Button.tsx +0 -59
  105. package/src/components/ui/Card.tsx +0 -92
  106. package/src/components/ui/Checkbox.tsx +0 -57
  107. package/src/components/ui/FormField.tsx +0 -50
  108. package/src/components/ui/Input.tsx +0 -38
  109. package/src/components/ui/Loading.tsx +0 -201
  110. package/src/components/ui/Select.tsx +0 -42
  111. package/src/components/ui/TextArea.tsx +0 -38
  112. package/src/components/ui/label.tsx +0 -24
  113. package/src/components/ui/switch.tsx +0 -31
  114. package/src/components/ui/tabs.tsx +0 -66
  115. package/src/hooks/useConsent.ts +0 -70
  116. package/src/hooks/useLoadingState.ts +0 -85
  117. package/src/lib/consentService.ts +0 -144
  118. package/src/lib/dpiaQuestions.ts +0 -188
  119. package/src/lib/requestService.ts +0 -79
  120. package/src/lib/sanitize.ts +0 -108
  121. package/src/lib/storage.ts +0 -222
  122. package/src/lib/utils.ts +0 -6
  123. package/src/types/html-to-docx.d.ts +0 -30
  124. package/src/types/index.ts +0 -77
  125. package/tailwind.config.ts +0 -65
  126. package/tsconfig.json +0 -41
  127. /package/{packages/ndpr-toolkit/dist → dist}/components/breach/BreachNotificationManager.d.ts +0 -0
  128. /package/{packages/ndpr-toolkit/dist → dist}/components/breach/BreachReportForm.d.ts +0 -0
  129. /package/{packages/ndpr-toolkit/dist → dist}/components/breach/BreachRiskAssessment.d.ts +0 -0
  130. /package/{packages/ndpr-toolkit/dist → dist}/components/breach/RegulatoryReportGenerator.d.ts +0 -0
  131. /package/{packages/ndpr-toolkit/dist → dist}/components/consent/ConsentBanner.d.ts +0 -0
  132. /package/{packages/ndpr-toolkit/dist → dist}/components/consent/ConsentManager.d.ts +0 -0
  133. /package/{packages/ndpr-toolkit/dist → dist}/components/consent/ConsentStorage.d.ts +0 -0
  134. /package/{packages/ndpr-toolkit/dist → dist}/components/dpia/DPIAQuestionnaire.d.ts +0 -0
  135. /package/{packages/ndpr-toolkit/dist → dist}/components/dpia/DPIAReport.d.ts +0 -0
  136. /package/{packages/ndpr-toolkit/dist → dist}/components/dpia/StepIndicator.d.ts +0 -0
  137. /package/{packages/ndpr-toolkit/dist → dist}/components/dsr/DSRDashboard.d.ts +0 -0
  138. /package/{packages/ndpr-toolkit/dist → dist}/components/dsr/DSRRequestForm.d.ts +0 -0
  139. /package/{packages/ndpr-toolkit/dist → dist}/components/dsr/DSRTracker.d.ts +0 -0
  140. /package/{packages/ndpr-toolkit/dist → dist}/components/policy/PolicyExporter.d.ts +0 -0
  141. /package/{packages/ndpr-toolkit/dist → dist}/components/policy/PolicyGenerator.d.ts +0 -0
  142. /package/{packages/ndpr-toolkit/dist → dist}/components/policy/PolicyPreview.d.ts +0 -0
  143. /package/{packages/ndpr-toolkit/dist → dist}/hooks/useBreach.d.ts +0 -0
  144. /package/{packages/ndpr-toolkit/dist → dist}/hooks/useConsent.d.ts +0 -0
  145. /package/{packages/ndpr-toolkit/dist → dist}/hooks/useDPIA.d.ts +0 -0
  146. /package/{packages/ndpr-toolkit/dist → dist}/hooks/useDSR.d.ts +0 -0
  147. /package/{packages/ndpr-toolkit/dist → dist}/hooks/usePrivacyPolicy.d.ts +0 -0
  148. /package/{packages/ndpr-toolkit/dist → dist}/index.d.ts +0 -0
  149. /package/{packages/ndpr-toolkit/dist → dist}/setupTests.d.ts +0 -0
  150. /package/{packages/ndpr-toolkit/dist → dist}/types/breach.d.ts +0 -0
  151. /package/{packages/ndpr-toolkit/dist → dist}/types/consent.d.ts +0 -0
  152. /package/{packages/ndpr-toolkit/dist → dist}/types/dpia.d.ts +0 -0
  153. /package/{packages/ndpr-toolkit/dist → dist}/types/dsr.d.ts +0 -0
  154. /package/{packages/ndpr-toolkit/dist → dist}/types/privacy.d.ts +0 -0
  155. /package/{packages/ndpr-toolkit/dist → dist}/utils/breach.d.ts +0 -0
  156. /package/{packages/ndpr-toolkit/dist → dist}/utils/consent.d.ts +0 -0
  157. /package/{packages/ndpr-toolkit/dist → dist}/utils/dpia.d.ts +0 -0
  158. /package/{packages/ndpr-toolkit/dist → dist}/utils/dsr.d.ts +0 -0
  159. /package/{packages/ndpr-toolkit/dist → dist}/utils/privacy.d.ts +0 -0
Binary file
@@ -1,123 +0,0 @@
1
- @import "tailwindcss";
2
- @import "tw-animate-css";
3
- @import "./accessibility.css";
4
-
5
- @custom-variant dark (&:is(.dark *));
6
-
7
- @theme inline {
8
- --color-background: var(--background);
9
- --color-foreground: var(--foreground);
10
- --font-sans: var(--font-geist-sans);
11
- --font-mono: var(--font-geist-mono);
12
- --color-sidebar-ring: var(--sidebar-ring);
13
- --color-sidebar-border: var(--sidebar-border);
14
- --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
15
- --color-sidebar-accent: var(--sidebar-accent);
16
- --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
17
- --color-sidebar-primary: var(--sidebar-primary);
18
- --color-sidebar-foreground: var(--sidebar-foreground);
19
- --color-sidebar: var(--sidebar);
20
- --color-chart-5: var(--chart-5);
21
- --color-chart-4: var(--chart-4);
22
- --color-chart-3: var(--chart-3);
23
- --color-chart-2: var(--chart-2);
24
- --color-chart-1: var(--chart-1);
25
- --color-ring: var(--ring);
26
- --color-input: var(--input);
27
- --color-border: var(--border);
28
- --color-destructive: var(--destructive);
29
- --color-accent-foreground: var(--accent-foreground);
30
- --color-accent: var(--accent);
31
- --color-muted-foreground: var(--muted-foreground);
32
- --color-muted: var(--muted);
33
- --color-secondary-foreground: var(--secondary-foreground);
34
- --color-secondary: var(--secondary);
35
- --color-primary-foreground: var(--primary-foreground);
36
- --color-primary: var(--primary);
37
- --color-popover-foreground: var(--popover-foreground);
38
- --color-popover: var(--popover);
39
- --color-card-foreground: var(--card-foreground);
40
- --color-card: var(--card);
41
- --radius-sm: calc(var(--radius) - 4px);
42
- --radius-md: calc(var(--radius) - 2px);
43
- --radius-lg: var(--radius);
44
- --radius-xl: calc(var(--radius) + 4px);
45
- }
46
-
47
- :root {
48
- --radius: 0.625rem;
49
- --background: oklch(1 0 0);
50
- --foreground: oklch(0.13 0.028 261.692);
51
- --card: oklch(1 0 0);
52
- --card-foreground: oklch(0.13 0.028 261.692);
53
- --popover: oklch(1 0 0);
54
- --popover-foreground: oklch(0.13 0.028 261.692);
55
- --primary: oklch(0.21 0.034 264.665);
56
- --primary-foreground: oklch(0.985 0.002 247.839);
57
- --secondary: oklch(0.967 0.003 264.542);
58
- --secondary-foreground: oklch(0.21 0.034 264.665);
59
- --muted: oklch(0.967 0.003 264.542);
60
- --muted-foreground: oklch(0.551 0.027 264.364);
61
- --accent: oklch(0.967 0.003 264.542);
62
- --accent-foreground: oklch(0.21 0.034 264.665);
63
- --destructive: oklch(0.577 0.245 27.325);
64
- --border: oklch(0.928 0.006 264.531);
65
- --input: oklch(0.928 0.006 264.531);
66
- --ring: oklch(0.707 0.022 261.325);
67
- --chart-1: oklch(0.646 0.222 41.116);
68
- --chart-2: oklch(0.6 0.118 184.704);
69
- --chart-3: oklch(0.398 0.07 227.392);
70
- --chart-4: oklch(0.828 0.189 84.429);
71
- --chart-5: oklch(0.769 0.188 70.08);
72
- --sidebar: oklch(0.985 0.002 247.839);
73
- --sidebar-foreground: oklch(0.13 0.028 261.692);
74
- --sidebar-primary: oklch(0.21 0.034 264.665);
75
- --sidebar-primary-foreground: oklch(0.985 0.002 247.839);
76
- --sidebar-accent: oklch(0.967 0.003 264.542);
77
- --sidebar-accent-foreground: oklch(0.21 0.034 264.665);
78
- --sidebar-border: oklch(0.928 0.006 264.531);
79
- --sidebar-ring: oklch(0.707 0.022 261.325);
80
- }
81
-
82
- .dark {
83
- --background: oklch(0.13 0.028 261.692);
84
- --foreground: oklch(0.985 0.002 247.839);
85
- --card: oklch(0.21 0.034 264.665);
86
- --card-foreground: oklch(0.985 0.002 247.839);
87
- --popover: oklch(0.21 0.034 264.665);
88
- --popover-foreground: oklch(0.985 0.002 247.839);
89
- --primary: oklch(0.928 0.006 264.531);
90
- --primary-foreground: oklch(0.21 0.034 264.665);
91
- --secondary: oklch(0.278 0.033 256.848);
92
- --secondary-foreground: oklch(0.985 0.002 247.839);
93
- --muted: oklch(0.278 0.033 256.848);
94
- --muted-foreground: oklch(0.707 0.022 261.325);
95
- --accent: oklch(0.278 0.033 256.848);
96
- --accent-foreground: oklch(0.985 0.002 247.839);
97
- --destructive: oklch(0.704 0.191 22.216);
98
- --border: oklch(1 0 0 / 10%);
99
- --input: oklch(1 0 0 / 15%);
100
- --ring: oklch(0.551 0.027 264.364);
101
- --chart-1: oklch(0.488 0.243 264.376);
102
- --chart-2: oklch(0.696 0.17 162.48);
103
- --chart-3: oklch(0.769 0.188 70.08);
104
- --chart-4: oklch(0.627 0.265 303.9);
105
- --chart-5: oklch(0.645 0.246 16.439);
106
- --sidebar: oklch(0.21 0.034 264.665);
107
- --sidebar-foreground: oklch(0.985 0.002 247.839);
108
- --sidebar-primary: oklch(0.488 0.243 264.376);
109
- --sidebar-primary-foreground: oklch(0.985 0.002 247.839);
110
- --sidebar-accent: oklch(0.278 0.033 256.848);
111
- --sidebar-accent-foreground: oklch(0.985 0.002 247.839);
112
- --sidebar-border: oklch(1 0 0 / 10%);
113
- --sidebar-ring: oklch(0.551 0.027 264.364);
114
- }
115
-
116
- @layer base {
117
- * {
118
- @apply border-border outline-ring/50;
119
- }
120
- body {
121
- @apply bg-background text-foreground;
122
- }
123
- }
@@ -1,37 +0,0 @@
1
- import type { Metadata } from "next";
2
- import { Geist, Geist_Mono } from "next/font/google";
3
- import { ErrorBoundary } from "@/components/ErrorBoundary";
4
- import "./globals.css";
5
-
6
- const geistSans = Geist({
7
- variable: "--font-geist-sans",
8
- subsets: ["latin"],
9
- });
10
-
11
- const geistMono = Geist_Mono({
12
- variable: "--font-geist-mono",
13
- subsets: ["latin"],
14
- });
15
-
16
- export const metadata: Metadata = {
17
- title: "NDPR Toolkit - Nigerian Data Protection Compliance",
18
- description: "Open-source toolkit for implementing NDPR and DPA compliant features in Nigerian applications",
19
- };
20
-
21
- export default function RootLayout({
22
- children,
23
- }: Readonly<{
24
- children: React.ReactNode;
25
- }>) {
26
- return (
27
- <html lang="en">
28
- <body
29
- className={`${geistSans.variable} ${geistMono.variable} antialiased`}
30
- >
31
- <ErrorBoundary>
32
- {children}
33
- </ErrorBoundary>
34
- </body>
35
- </html>
36
- );
37
- }
@@ -1,354 +0,0 @@
1
- 'use client';
2
-
3
- import React, { useState, useEffect } from 'react';
4
- import Link from 'next/link';
5
- import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
6
- import { BreachReportForm, BreachRiskAssessment, BreachNotificationManager, BreachReport, RiskAssessment, RegulatoryReportGenerator } from '@tantainnovative/ndpr-toolkit';
7
- import { v4 as uuidv4 } from 'uuid';
8
- import { Card, CardHeader, CardTitle, CardDescription, CardContent } from '@/components/ui/Card';
9
-
10
- export default function BreachDemoPage() {
11
- const [activeTab, setActiveTab] = useState('notification');
12
- const [isClient, setIsClient] = useState(false);
13
- const [breaches, setBreaches] = useState<BreachReport[]>([]);
14
- const [riskAssessments, setRiskAssessments] = useState<RiskAssessment[]>([]);
15
- // Define interface based on documentation for regulatory notifications
16
- interface RegulatoryNotification {
17
- id: string;
18
- breachId: string;
19
- sentAt: number;
20
- method: 'email' | 'portal' | 'letter' | 'other';
21
- referenceNumber?: string;
22
- content: string;
23
- attachments?: Array<{
24
- id: string;
25
- name: string;
26
- type: string;
27
- url: string;
28
- }>;
29
- }
30
-
31
- const [regulatoryNotifications, setRegulatoryNotifications] = useState<RegulatoryNotification[]>([]);
32
- const [selectedBreach, setSelectedBreach] = useState<BreachReport | null>(null);
33
-
34
- // This effect runs only on the client side after hydration
35
- useEffect(() => {
36
- setIsClient(true);
37
-
38
- // Load sample data for demo purposes
39
- const sampleBreaches: BreachReport[] = [
40
- {
41
- id: uuidv4(),
42
- title: 'Customer Database Unauthorized Access',
43
- description: 'Unauthorized access to customer database detected through suspicious login patterns',
44
- category: 'unauthorized_access',
45
- discoveredAt: Date.now() - 5 * 24 * 60 * 60 * 1000, // 5 days ago
46
- reportedAt: Date.now() - 4 * 24 * 60 * 60 * 1000, // 4 days ago
47
- reporter: {
48
- name: 'John Smith',
49
- email: 'john@example.com',
50
- department: 'IT Security'
51
- },
52
- affectedSystems: ['customer_database', 'user_accounts'],
53
- dataTypes: ['name', 'email', 'phone', 'address'],
54
- estimatedAffectedSubjects: 1200,
55
- status: 'ongoing',
56
- initialActions: 'Access blocked, passwords reset, system isolated for investigation'
57
- },
58
- {
59
- id: uuidv4(),
60
- title: 'Employee Email Phishing Incident',
61
- description: 'Several employees clicked on phishing links potentially exposing credentials',
62
- category: 'phishing',
63
- discoveredAt: Date.now() - 10 * 24 * 60 * 60 * 1000, // 10 days ago
64
- reportedAt: Date.now() - 9 * 24 * 60 * 60 * 1000, // 9 days ago
65
- reporter: {
66
- name: 'Jane Doe',
67
- email: 'jane@example.com',
68
- department: 'HR'
69
- },
70
- affectedSystems: ['email_system', 'employee_accounts'],
71
- dataTypes: ['email credentials'],
72
- estimatedAffectedSubjects: 0, // No confirmed data exposure
73
- status: 'resolved',
74
- initialActions: 'Password resets, email scanning, blocking of malicious domains'
75
- },
76
- {
77
- id: uuidv4(),
78
- title: 'Lost Company Laptop',
79
- description: 'Employee reported company laptop lost during business travel',
80
- category: 'device_loss',
81
- discoveredAt: Date.now() - 15 * 24 * 60 * 60 * 1000, // 15 days ago
82
- reportedAt: Date.now() - 15 * 24 * 60 * 60 * 1000, // 15 days ago
83
- reporter: {
84
- name: 'Robert Johnson',
85
- email: 'robert@example.com',
86
- department: 'Sales'
87
- },
88
- affectedSystems: ['laptop_device', 'company_data'],
89
- dataTypes: ['name', 'email', 'project data'],
90
- estimatedAffectedSubjects: 50,
91
- status: 'resolved',
92
- initialActions: 'Remote wipe initiated, account passwords changed'
93
- }
94
- ];
95
-
96
- setBreaches(sampleBreaches);
97
- }, []);
98
-
99
- const handleSubmitBreach = (data: {
100
- title: string;
101
- description: string;
102
- category?: string;
103
- reporter?: {
104
- name?: string;
105
- email?: string;
106
- department?: string;
107
- };
108
- affectedSystems?: string[];
109
- dataTypes?: string[];
110
- estimatedAffectedSubjects?: number;
111
- initialActions?: string;
112
- }) => {
113
- const newBreach: BreachReport = {
114
- id: uuidv4(),
115
- title: data.title,
116
- description: data.description,
117
- category: data.category || 'other',
118
- discoveredAt: Date.now(),
119
- reportedAt: Date.now(),
120
- reporter: {
121
- name: data.reporter?.name || 'Anonymous',
122
- email: data.reporter?.email || 'anonymous@example.com',
123
- department: data.reporter?.department || 'Unknown'
124
- },
125
- affectedSystems: data.affectedSystems || [],
126
- dataTypes: data.dataTypes || [],
127
- estimatedAffectedSubjects: data.estimatedAffectedSubjects || 0,
128
- status: 'ongoing',
129
- initialActions: data.initialActions || ''
130
- };
131
-
132
- setBreaches((prev) => [newBreach, ...prev]);
133
- setActiveTab('register');
134
- };
135
-
136
- const handleUpdateBreach = (breachId: string, updates: Partial<BreachReport>) => {
137
- setBreaches((prev) =>
138
- prev.map((breach) => {
139
- if (breach.id === breachId) {
140
- return {
141
- ...breach,
142
- ...updates
143
- };
144
- }
145
- return breach;
146
- })
147
- );
148
- };
149
-
150
- const handleSelectBreach = (breachId: string) => {
151
- const breach = breaches.find((b) => b.id === breachId);
152
- setSelectedBreach(breach || null);
153
- setActiveTab('assessment');
154
- };
155
-
156
- // Add a function to handle regulatory notifications
157
- const handleGenerateReport = (breachId: string) => {
158
- if (!selectedBreach) return;
159
-
160
- // Create a sample regulatory notification based on the breach
161
- const newNotification: RegulatoryNotification = {
162
- id: uuidv4(),
163
- breachId: breachId,
164
- sentAt: Date.now(),
165
- method: 'email',
166
- content: `Notification regarding breach: ${selectedBreach.title}`,
167
- referenceNumber: `REF-${Date.now().toString().substring(0, 8)}`
168
- };
169
-
170
- // Add to notifications list
171
- setRegulatoryNotifications(prev => [...prev, newNotification]);
172
-
173
- // Update breach status
174
- handleUpdateBreach(breachId, { status: 'contained' }); // Using a valid status from the BreachReport type
175
- };
176
-
177
- if (!isClient) {
178
- return <div>Loading...</div>;
179
- }
180
-
181
- return (
182
- <div className="container mx-auto py-10">
183
- <div className="mb-6">
184
- <Link href="/ndpr-demos" className="text-blue-600 hover:underline">
185
- ← Back to NDPR Demos
186
- </Link>
187
- </div>
188
-
189
- <h1 className="text-3xl font-bold mb-8">Breach Management Demo</h1>
190
-
191
- <Tabs value={activeTab} onValueChange={setActiveTab}>
192
- <TabsList className="mb-6">
193
- <TabsTrigger value="notification">Breach Notification</TabsTrigger>
194
- <TabsTrigger value="register">Breach Register</TabsTrigger>
195
- <TabsTrigger value="assessment">Breach Assessment</TabsTrigger>
196
- </TabsList>
197
-
198
- <TabsContent value="notification" className="mt-6">
199
- <Card>
200
- <CardHeader>
201
- <CardTitle>Breach Notification Form</CardTitle>
202
- <CardDescription>
203
- This form is used to report and document data breaches within your organization.
204
- </CardDescription>
205
- </CardHeader>
206
- <CardContent>
207
- <BreachReportForm
208
- onSubmit={handleSubmitBreach}
209
- title="Report a Data Breach"
210
- categories={[
211
- { id: 'unauthorized_access', name: 'Unauthorized Access', description: 'Unauthorized access to systems or data', defaultSeverity: 'high' },
212
- { id: 'phishing', name: 'Phishing Attack', description: 'Phishing or social engineering attack', defaultSeverity: 'medium' },
213
- { id: 'device_loss', name: 'Device Loss/Theft', description: 'Loss or theft of device containing personal data', defaultSeverity: 'medium' },
214
- { id: 'malware', name: 'Malware/Ransomware', description: 'Malware or ransomware infection', defaultSeverity: 'high' },
215
- { id: 'other', name: 'Other', description: 'Other type of data breach', defaultSeverity: 'medium' }
216
- ]}
217
- />
218
- </CardContent>
219
- </Card>
220
- </TabsContent>
221
-
222
- <TabsContent value="register" className="mt-6">
223
- <Card>
224
- <CardHeader>
225
- <CardTitle>Breach Register</CardTitle>
226
- <CardDescription>
227
- This component maintains a register of all data breaches and their current status.
228
- </CardDescription>
229
- </CardHeader>
230
- <CardContent>
231
- <BreachNotificationManager
232
- breachReports={breaches}
233
- riskAssessments={riskAssessments}
234
- regulatoryNotifications={regulatoryNotifications}
235
- onSelectBreach={handleSelectBreach}
236
- onRequestAssessment={(breachId) => {
237
- handleSelectBreach(breachId);
238
- setActiveTab('assessment');
239
- }}
240
- onRequestNotification={(breachId: string) => {
241
- handleSelectBreach(breachId);
242
- // Generate a regulatory notification
243
- setTimeout(() => {
244
- if (selectedBreach) {
245
- handleGenerateReport(breachId);
246
- }
247
- }, 500);
248
- }}
249
- title="Data Breach Register"
250
- description="A record of all data breaches and security incidents affecting personal data."
251
- showBreachDetails={true}
252
- showNotificationTimeline={true}
253
- showDeadlineAlerts={true}
254
- />
255
- </CardContent>
256
- </Card>
257
- </TabsContent>
258
-
259
- <TabsContent value="assessment" className="mt-6">
260
- <Card>
261
- <CardHeader>
262
- <CardTitle>Breach Assessment</CardTitle>
263
- <CardDescription>
264
- This component helps assess the severity and impact of a data breach.
265
- </CardDescription>
266
- </CardHeader>
267
- <CardContent>
268
- {selectedBreach ? (
269
- <div className="space-y-8">
270
- <BreachRiskAssessment
271
- breachData={selectedBreach}
272
- onComplete={(assessment: RiskAssessment) => {
273
- if (selectedBreach) {
274
- // Update the breach status based on the assessment
275
- handleUpdateBreach(selectedBreach.id, {
276
- status: assessment.riskLevel === 'critical' ? 'ongoing' : 'contained',
277
- });
278
-
279
- // Store the risk assessment
280
- const newAssessment = {
281
- ...assessment,
282
- id: uuidv4(),
283
- breachId: selectedBreach.id,
284
- assessedAt: Date.now(),
285
- assessor: {
286
- name: 'Demo User',
287
- role: 'Data Protection Officer',
288
- email: 'dpo@example.com'
289
- }
290
- };
291
-
292
- setRiskAssessments(prev => {
293
- // Remove any existing assessment for this breach
294
- const filtered = prev.filter(a => a.breachId !== selectedBreach.id);
295
- // Add the new assessment
296
- return [...filtered, newAssessment];
297
- });
298
- }
299
- }}
300
- title="Breach Risk Assessment"
301
- description="Assess the severity, impact, and required actions for this data breach."
302
- className=""
303
- buttonClassName=""
304
- showBreachSummary={true}
305
- showNotificationRequirements={true}
306
- />
307
-
308
- {/* Add Regulatory Report Generator component */}
309
- <div className="mt-8 pt-8 border-t border-gray-200">
310
- <h3 className="text-lg font-medium mb-4">Generate Regulatory Report</h3>
311
- <RegulatoryReportGenerator
312
- breachData={selectedBreach}
313
- organizationInfo={{
314
- name: 'Example Company Ltd.',
315
- address: '123 Main Street, Lagos, Nigeria',
316
- dpoName: 'John Doe',
317
- dpoEmail: 'dpo@example.com',
318
- dpoPhone: '+234 123 456 7890'
319
- }}
320
- onGenerate={() => handleGenerateReport(selectedBreach.id)}
321
- />
322
- </div>
323
- </div>
324
- ) : (
325
- <div className="p-4 text-center">
326
- <p>No breach selected. Please select a breach from the Breach Register.</p>
327
- </div>
328
- )}
329
- </CardContent>
330
- </Card>
331
- </TabsContent>
332
- </Tabs>
333
-
334
- <div className="mt-10 p-4 bg-gray-100 rounded-lg">
335
- <h2 className="text-xl font-semibold mb-2">Implementation Notes</h2>
336
- <p className="mb-4">
337
- This demo showcases the breach management components from the NDPR Toolkit:
338
- </p>
339
- <ul className="list-disc pl-5 space-y-2">
340
- <li><code>BreachReportForm</code>: For reporting and documenting data breaches</li>
341
- <li><code>BreachRegister</code>: For maintaining a record of all data breaches</li>
342
- <li><code>BreachAssessment</code>: For assessing the severity and impact of breaches</li>
343
- </ul>
344
- <p className="mt-4">
345
- For detailed documentation, see the{' '}
346
- <Link href="/docs/components/breach-management" className="text-blue-600 hover:underline">
347
- Breach Management documentation
348
- </Link>
349
- .
350
- </p>
351
- </div>
352
- </div>
353
- );
354
- }