@tantainnovative/ndpr-toolkit 1.0.3 → 1.0.4

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 (156) hide show
  1. package/next-env.d.ts +5 -0
  2. package/package.json +1 -1
  3. package/.claude/settings.local.json +0 -20
  4. package/.eslintrc.json +0 -10
  5. package/.github/workflows/ci.yml +0 -36
  6. package/.github/workflows/nextjs.yml +0 -104
  7. package/.husky/commit-msg +0 -4
  8. package/.husky/pre-commit +0 -4
  9. package/.lintstagedrc.js +0 -4
  10. package/.nvmrc +0 -1
  11. package/.versionrc +0 -17
  12. package/CLAUDE.md +0 -90
  13. package/commitlint.config.js +0 -36
  14. package/eslint.config.mjs +0 -16
  15. package/jest.config.js +0 -31
  16. package/jest.setup.js +0 -15
  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/jest.config.js +0 -23
  21. package/packages/ndpr-toolkit/package-lock.json +0 -8197
  22. package/packages/ndpr-toolkit/package.json +0 -71
  23. package/packages/ndpr-toolkit/rollup.config.js +0 -34
  24. package/packages/ndpr-toolkit/src/__tests__/components/consent/ConsentBanner.test.tsx +0 -119
  25. package/packages/ndpr-toolkit/src/__tests__/components/consent/ConsentManager.test.tsx +0 -122
  26. package/packages/ndpr-toolkit/src/__tests__/components/consent/ConsentStorage.test.tsx +0 -270
  27. package/packages/ndpr-toolkit/src/__tests__/components/dsr/DSRDashboard.test.tsx +0 -199
  28. package/packages/ndpr-toolkit/src/__tests__/components/dsr/DSRRequestForm.test.tsx +0 -224
  29. package/packages/ndpr-toolkit/src/__tests__/components/dsr/DSRTracker.test.tsx +0 -104
  30. package/packages/ndpr-toolkit/src/__tests__/hooks/useConsent.test.tsx +0 -161
  31. package/packages/ndpr-toolkit/src/__tests__/hooks/useDSR.test.tsx +0 -330
  32. package/packages/ndpr-toolkit/src/__tests__/utils/breach.test.ts +0 -149
  33. package/packages/ndpr-toolkit/src/__tests__/utils/consent.test.ts +0 -88
  34. package/packages/ndpr-toolkit/src/__tests__/utils/dpia.test.ts +0 -160
  35. package/packages/ndpr-toolkit/src/__tests__/utils/dsr.test.ts +0 -110
  36. package/packages/ndpr-toolkit/src/__tests__/utils/privacy.test.ts +0 -97
  37. package/packages/ndpr-toolkit/src/components/breach/BreachNotificationManager.tsx +0 -701
  38. package/packages/ndpr-toolkit/src/components/breach/BreachReportForm.tsx +0 -631
  39. package/packages/ndpr-toolkit/src/components/breach/BreachRiskAssessment.tsx +0 -569
  40. package/packages/ndpr-toolkit/src/components/breach/RegulatoryReportGenerator.tsx +0 -496
  41. package/packages/ndpr-toolkit/src/components/consent/ConsentBanner.tsx +0 -270
  42. package/packages/ndpr-toolkit/src/components/consent/ConsentManager.tsx +0 -217
  43. package/packages/ndpr-toolkit/src/components/consent/ConsentStorage.tsx +0 -206
  44. package/packages/ndpr-toolkit/src/components/dpia/DPIAQuestionnaire.tsx +0 -342
  45. package/packages/ndpr-toolkit/src/components/dpia/DPIAReport.tsx +0 -373
  46. package/packages/ndpr-toolkit/src/components/dpia/StepIndicator.tsx +0 -174
  47. package/packages/ndpr-toolkit/src/components/dsr/DSRDashboard.tsx +0 -717
  48. package/packages/ndpr-toolkit/src/components/dsr/DSRRequestForm.tsx +0 -476
  49. package/packages/ndpr-toolkit/src/components/dsr/DSRTracker.tsx +0 -620
  50. package/packages/ndpr-toolkit/src/components/policy/PolicyExporter.tsx +0 -541
  51. package/packages/ndpr-toolkit/src/components/policy/PolicyGenerator.tsx +0 -454
  52. package/packages/ndpr-toolkit/src/components/policy/PolicyPreview.tsx +0 -333
  53. package/packages/ndpr-toolkit/src/hooks/useBreach.ts +0 -409
  54. package/packages/ndpr-toolkit/src/hooks/useConsent.ts +0 -263
  55. package/packages/ndpr-toolkit/src/hooks/useDPIA.ts +0 -457
  56. package/packages/ndpr-toolkit/src/hooks/useDSR.ts +0 -236
  57. package/packages/ndpr-toolkit/src/hooks/usePrivacyPolicy.ts +0 -428
  58. package/packages/ndpr-toolkit/src/index.ts +0 -44
  59. package/packages/ndpr-toolkit/src/setupTests.ts +0 -5
  60. package/packages/ndpr-toolkit/src/types/breach.ts +0 -283
  61. package/packages/ndpr-toolkit/src/types/consent.ts +0 -111
  62. package/packages/ndpr-toolkit/src/types/dpia.ts +0 -236
  63. package/packages/ndpr-toolkit/src/types/dsr.ts +0 -192
  64. package/packages/ndpr-toolkit/src/types/index.ts +0 -42
  65. package/packages/ndpr-toolkit/src/types/privacy.ts +0 -246
  66. package/packages/ndpr-toolkit/src/utils/breach.ts +0 -122
  67. package/packages/ndpr-toolkit/src/utils/consent.ts +0 -51
  68. package/packages/ndpr-toolkit/src/utils/dpia.ts +0 -104
  69. package/packages/ndpr-toolkit/src/utils/dsr.ts +0 -77
  70. package/packages/ndpr-toolkit/src/utils/privacy.ts +0 -100
  71. package/packages/ndpr-toolkit/tsconfig.json +0 -23
  72. package/postcss.config.mjs +0 -5
  73. package/src/__tests__/example.test.ts +0 -13
  74. package/src/__tests__/requestService.test.ts +0 -57
  75. package/src/app/accessibility.css +0 -70
  76. package/src/app/docs/components/DocLayout.tsx +0 -267
  77. package/src/app/docs/components/breach-notification/page.tsx +0 -797
  78. package/src/app/docs/components/consent-management/page.tsx +0 -576
  79. package/src/app/docs/components/data-subject-rights/page.tsx +0 -511
  80. package/src/app/docs/components/dpia-questionnaire/layout.tsx +0 -15
  81. package/src/app/docs/components/dpia-questionnaire/metadata.ts +0 -31
  82. package/src/app/docs/components/dpia-questionnaire/page.tsx +0 -666
  83. package/src/app/docs/components/hooks/page.tsx +0 -305
  84. package/src/app/docs/components/page.tsx +0 -84
  85. package/src/app/docs/components/privacy-policy-generator/page.tsx +0 -634
  86. package/src/app/docs/guides/breach-notification-process/components/BestPractices.tsx +0 -123
  87. package/src/app/docs/guides/breach-notification-process/components/ImplementationSteps.tsx +0 -328
  88. package/src/app/docs/guides/breach-notification-process/components/Introduction.tsx +0 -28
  89. package/src/app/docs/guides/breach-notification-process/components/NotificationTimeline.tsx +0 -91
  90. package/src/app/docs/guides/breach-notification-process/components/Resources.tsx +0 -118
  91. package/src/app/docs/guides/breach-notification-process/page.tsx +0 -39
  92. package/src/app/docs/guides/conducting-dpia/page.tsx +0 -593
  93. package/src/app/docs/guides/data-subject-requests/page.tsx +0 -666
  94. package/src/app/docs/guides/managing-consent/page.tsx +0 -738
  95. package/src/app/docs/guides/ndpr-compliance-checklist/components/ComplianceChecklist.tsx +0 -296
  96. package/src/app/docs/guides/ndpr-compliance-checklist/components/ImplementationTools.tsx +0 -145
  97. package/src/app/docs/guides/ndpr-compliance-checklist/components/Introduction.tsx +0 -33
  98. package/src/app/docs/guides/ndpr-compliance-checklist/components/KeyRequirements.tsx +0 -99
  99. package/src/app/docs/guides/ndpr-compliance-checklist/components/Resources.tsx +0 -159
  100. package/src/app/docs/guides/ndpr-compliance-checklist/page.tsx +0 -38
  101. package/src/app/docs/guides/page.tsx +0 -67
  102. package/src/app/docs/layout.tsx +0 -15
  103. package/src/app/docs/metadata.ts +0 -31
  104. package/src/app/docs/page.tsx +0 -572
  105. package/src/app/favicon.ico +0 -0
  106. package/src/app/globals.css +0 -123
  107. package/src/app/layout.tsx +0 -37
  108. package/src/app/ndpr-demos/breach/page.tsx +0 -354
  109. package/src/app/ndpr-demos/consent/page.tsx +0 -366
  110. package/src/app/ndpr-demos/dpia/page.tsx +0 -495
  111. package/src/app/ndpr-demos/dsr/page.tsx +0 -280
  112. package/src/app/ndpr-demos/page.tsx +0 -73
  113. package/src/app/ndpr-demos/policy/page.tsx +0 -771
  114. package/src/app/page.tsx +0 -452
  115. package/src/components/ErrorBoundary.tsx +0 -90
  116. package/src/components/breach-notification/BreachNotificationForm.tsx +0 -479
  117. package/src/components/consent/ConsentBanner.tsx +0 -159
  118. package/src/components/data-subject-rights/DataSubjectRequestForm.tsx +0 -419
  119. package/src/components/docs/DocLayout.tsx +0 -289
  120. package/src/components/docs/index.ts +0 -2
  121. package/src/components/dpia/DPIAQuestionnaire.tsx +0 -483
  122. package/src/components/privacy-policy/PolicyGenerator.tsx +0 -1062
  123. package/src/components/privacy-policy/data.ts +0 -98
  124. package/src/components/privacy-policy/shared/CheckboxField.tsx +0 -38
  125. package/src/components/privacy-policy/shared/CheckboxGroup.tsx +0 -85
  126. package/src/components/privacy-policy/shared/FormField.tsx +0 -79
  127. package/src/components/privacy-policy/shared/StepIndicator.tsx +0 -86
  128. package/src/components/privacy-policy/steps/CustomSectionsStep.tsx +0 -335
  129. package/src/components/privacy-policy/steps/DataCollectionStep.tsx +0 -231
  130. package/src/components/privacy-policy/steps/DataSharingStep.tsx +0 -418
  131. package/src/components/privacy-policy/steps/OrganizationInfoStep.tsx +0 -202
  132. package/src/components/privacy-policy/steps/PolicyPreviewStep.tsx +0 -172
  133. package/src/components/ui/Badge.tsx +0 -46
  134. package/src/components/ui/Button.tsx +0 -59
  135. package/src/components/ui/Card.tsx +0 -92
  136. package/src/components/ui/Checkbox.tsx +0 -57
  137. package/src/components/ui/FormField.tsx +0 -50
  138. package/src/components/ui/Input.tsx +0 -38
  139. package/src/components/ui/Loading.tsx +0 -201
  140. package/src/components/ui/Select.tsx +0 -42
  141. package/src/components/ui/TextArea.tsx +0 -38
  142. package/src/components/ui/label.tsx +0 -24
  143. package/src/components/ui/switch.tsx +0 -31
  144. package/src/components/ui/tabs.tsx +0 -66
  145. package/src/hooks/useConsent.ts +0 -64
  146. package/src/hooks/useLoadingState.ts +0 -85
  147. package/src/lib/consentService.ts +0 -137
  148. package/src/lib/dpiaQuestions.ts +0 -148
  149. package/src/lib/requestService.ts +0 -75
  150. package/src/lib/sanitize.ts +0 -108
  151. package/src/lib/storage.ts +0 -222
  152. package/src/lib/utils.ts +0 -6
  153. package/src/types/html-to-docx.d.ts +0 -30
  154. package/src/types/index.ts +0 -72
  155. package/tailwind.config.ts +0 -65
  156. package/tsconfig.json +0 -41
@@ -1,666 +0,0 @@
1
- 'use client';
2
-
3
- import Link from 'next/link';
4
- import { DocLayout } from '../DocLayout';
5
- import { Button } from '@/components/ui/Button';
6
- import { Card, CardContent } from '@/components/ui/Card';
7
-
8
- export default function DPIAQuestionnaireDocs() {
9
- return (
10
- <DocLayout
11
- title="DPIA Questionnaire"
12
- description="Interactive questionnaire for Data Protection Impact Assessments"
13
- >
14
- <div className="flex mb-6 space-x-2">
15
- <Button asChild variant="outline" size="sm">
16
- <Link href="/ndpr-demos/dpia">
17
- View Demo
18
- </Link>
19
- </Button>
20
- <Button asChild variant="outline" size="sm">
21
- <a href="https://github.com/tantainnovative/ndpr-toolkit/tree/main/packages/ndpr-toolkit/src/components/dpia" target="_blank" rel="noopener noreferrer">
22
- View Source
23
- </a>
24
- </Button>
25
- </div>
26
-
27
- <section id="overview" className="mb-8">
28
- <h2 className="text-2xl font-bold mb-4">Overview</h2>
29
- <p className="mb-4">
30
- The DPIA Questionnaire component provides an interactive form for conducting Data Protection Impact Assessments (DPIAs)
31
- in compliance with the Nigeria Data Protection Regulation (NDPR). This component helps organizations identify and
32
- minimize data protection risks in their projects or systems.
33
- </p>
34
- <div className="bg-blue-50 dark:bg-blue-900/20 p-4 rounded-md">
35
- <h4 className="text-blue-800 dark:text-blue-200 font-medium mb-2">When to use a DPIA</h4>
36
- <p className="text-blue-700 dark:text-blue-300 text-sm mb-0">
37
- Under the NDPR, a DPIA is required when processing is likely to result in a high risk to the rights and freedoms of individuals.
38
- This includes systematic and extensive profiling, processing of special categories of data on a large scale, or systematic
39
- monitoring of public areas.
40
- </p>
41
- </div>
42
- </section>
43
-
44
- <section id="installation" className="mb-8">
45
- <h2 className="text-2xl font-bold mb-4">Installation</h2>
46
- <p className="mb-4">
47
- Install the NDPR Toolkit package which includes the DPIA Questionnaire component:
48
- </p>
49
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto mb-4">
50
- <pre><code>npm install @tantainnovative/ndpr-toolkit</code></pre>
51
- <pre><code># Or with legacy peer deps if using React 19
52
- npm install @tantainnovative/ndpr-toolkit --legacy-peer-deps</code></pre>
53
- </div>
54
- <p>
55
- Or if you&apos;re using yarn:
56
- </p>
57
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto">
58
- <pre><code>yarn add @tantainnovative/ndpr-toolkit</code></pre>
59
- <pre><code># Or with legacy peer deps if using React 19
60
- yarn add @tantainnovative/ndpr-toolkit --legacy-peer-deps</code></pre>
61
- </div>
62
- </section>
63
-
64
- <section id="usage" className="mb-8">
65
- <h2 className="text-2xl font-bold mb-4">Usage</h2>
66
- <p className="mb-4">
67
- Import and use the DPIAQuestionnaire component in your React application:
68
- </p>
69
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto">
70
- <pre><code>{`import { DPIAQuestionnaire } from '@tantainnovative/ndpr-toolkit';
71
-
72
- // Define your DPIA questions
73
- const dpiaQuestions = [
74
- {
75
- id: 'data_collection',
76
- question: 'What types of personal data will be collected?',
77
- options: [
78
- { value: 1, label: 'Basic contact information only' },
79
- { value: 2, label: 'Personal identifiers and contact information' },
80
- { value: 3, label: 'Sensitive personal data (health, biometric, etc.)' }
81
- ]
82
- },
83
- {
84
- id: 'data_volume',
85
- question: 'What is the volume of data being processed?',
86
- options: [
87
- { value: 1, label: 'Small scale (fewer than 100 data subjects)' },
88
- { value: 2, label: 'Medium scale (100-1000 data subjects)' },
89
- { value: 3, label: 'Large scale (more than 1000 data subjects)' }
90
- ]
91
- },
92
- // Add more questions as needed
93
- ];
94
-
95
- function MyDPIAForm() {
96
- const handleSubmit = (answers, projectName) => {
97
- console.log('Project Name:', projectName);
98
- console.log('DPIA Answers:', answers);
99
-
100
- // Calculate risk score or send to your backend
101
- // ...
102
- };
103
-
104
- return (
105
- <div>
106
- <h1>Data Protection Impact Assessment</h1>
107
- <DPIAQuestionnaire
108
- questions={dpiaQuestions}
109
- onSubmit={handleSubmit}
110
- />
111
- </div>
112
- );
113
- }`}</code></pre>
114
- </div>
115
- </section>
116
-
117
- <section id="props" className="mb-8">
118
- <h2 className="text-2xl font-bold mb-4">Props</h2>
119
- <div className="overflow-x-auto">
120
- <table className="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
121
- <thead className="bg-gray-50 dark:bg-gray-800">
122
- <tr>
123
- <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Name</th>
124
- <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Type</th>
125
- <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Required</th>
126
- <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Description</th>
127
- </tr>
128
- </thead>
129
- <tbody className="bg-white dark:bg-gray-900 divide-y divide-gray-200 dark:divide-gray-800">
130
- <tr>
131
- <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white"><code>questions</code></td>
132
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400"><code>DPIAQuestion[]</code></td>
133
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">Yes</td>
134
- <td className="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">Array of DPIA questions to display in the questionnaire</td>
135
- </tr>
136
- <tr>
137
- <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white"><code>onSubmit</code></td>
138
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400"><code>(answers: Record&lt;string, number&gt;, projectName: string) =&gt; void</code></td>
139
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">Yes</td>
140
- <td className="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">Callback function when user submits the assessment</td>
141
- </tr>
142
- <tr>
143
- <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white"><code>initialAnswers</code></td>
144
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400"><code>Record&lt;string, number&gt;</code></td>
145
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">No</td>
146
- <td className="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">Initial answers for the questionnaire</td>
147
- </tr>
148
- <tr>
149
- <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white"><code>initialProjectName</code></td>
150
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400"><code>string</code></td>
151
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">No</td>
152
- <td className="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">Initial project name</td>
153
- </tr>
154
- <tr>
155
- <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white"><code>className</code></td>
156
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400"><code>string</code></td>
157
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">No</td>
158
- <td className="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">Additional CSS class names</td>
159
- </tr>
160
- </tbody>
161
- </table>
162
- </div>
163
-
164
- <h3 className="text-xl font-bold mt-6 mb-4">DPIAQuestion Type</h3>
165
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto">
166
- <pre><code>{`type DPIAQuestion = {
167
- id: string;
168
- question: string;
169
- options: {
170
- value: number;
171
- label: string;
172
- }[];
173
- helpText?: string;
174
- };`}</code></pre>
175
- </div>
176
- </section>
177
-
178
- <section id="examples" className="mb-8">
179
- <h2 className="text-2xl font-bold mb-4">Examples</h2>
180
-
181
- <h3 className="text-xl font-bold mb-4">Basic Example</h3>
182
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto mb-6">
183
- <pre><code>{`import { DPIAQuestionnaire } from '@tantainnovative/ndpr-toolkit';
184
-
185
- const basicQuestions = [
186
- {
187
- id: 'q1',
188
- question: 'Does the project involve collecting personal data?',
189
- options: [
190
- { value: 1, label: 'No personal data collected' },
191
- { value: 2, label: 'Limited personal data collected' },
192
- { value: 3, label: 'Extensive personal data collected' }
193
- ]
194
- },
195
- {
196
- id: 'q2',
197
- question: 'Will the data be shared with third parties?',
198
- options: [
199
- { value: 1, label: 'No sharing with third parties' },
200
- { value: 2, label: 'Limited sharing with trusted partners' },
201
- { value: 3, label: 'Extensive sharing with multiple third parties' }
202
- ]
203
- }
204
- ];
205
-
206
- function BasicDPIA() {
207
- return (
208
- <DPIAQuestionnaire
209
- questions={basicQuestions}
210
- onSubmit={(answers, projectName) => {
211
- console.log(answers, projectName);
212
- }}
213
- />
214
- );
215
- }`}</code></pre>
216
- </div>
217
-
218
- <h3 className="text-xl font-bold mb-4">With Initial Values</h3>
219
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto mb-6">
220
- <pre><code>{`import { DPIAQuestionnaire } from '@tantainnovative/ndpr-toolkit';
221
-
222
- function DPIAWithInitialValues() {
223
- const initialAnswers = {
224
- 'q1': 2,
225
- 'q2': 1
226
- };
227
-
228
- return (
229
- <DPIAQuestionnaire
230
- questions={basicQuestions}
231
- initialAnswers={initialAnswers}
232
- initialProjectName="E-commerce Platform"
233
- onSubmit={(answers, projectName) => {
234
- console.log(answers, projectName);
235
- }}
236
- />
237
- );
238
- }`}</code></pre>
239
- </div>
240
-
241
- <h3 className="text-xl font-bold mb-4">With Risk Calculation</h3>
242
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto">
243
- <pre><code>{`import { DPIAQuestionnaire } from '@tantainnovative/ndpr-toolkit';
244
- import { useState } from 'react';
245
-
246
- function DPIAWithRiskCalculation() {
247
- const [riskScore, setRiskScore] = useState(0);
248
- const [riskLevel, setRiskLevel] = useState('');
249
- const [recommendations, setRecommendations] = useState([]);
250
-
251
- const handleSubmit = (answers, projectName) => {
252
- // Calculate total risk score
253
- const totalScore = Object.values(answers).reduce((sum, value) => sum + value, 0);
254
- const maxPossibleScore = Object.keys(answers).length * 3; // Assuming max value per question is 3
255
- const percentageScore = (totalScore / maxPossibleScore) * 100;
256
-
257
- setRiskScore(percentageScore);
258
-
259
- // Determine risk level
260
- let level = '';
261
- let recs = [];
262
-
263
- if (percentageScore < 40) {
264
- level = 'Low Risk';
265
- recs = ['Regular review of data processing activities'];
266
- } else if (percentageScore < 70) {
267
- level = 'Medium Risk';
268
- recs = [
269
- 'Implement additional security measures',
270
- 'Conduct regular staff training',
271
- 'Review data retention policies'
272
- ];
273
- } else {
274
- level = 'High Risk';
275
- recs = [
276
- 'Consult with NITDA before proceeding',
277
- 'Implement strict access controls',
278
- 'Conduct comprehensive security audit',
279
- 'Consider data minimization strategies',
280
- 'Implement regular compliance monitoring'
281
- ];
282
- }
283
-
284
- setRiskLevel(level);
285
- setRecommendations(recs);
286
- };
287
-
288
- return (
289
- <div>
290
- <DPIAQuestionnaire
291
- questions={comprehensiveQuestions}
292
- onSubmit={handleSubmit}
293
- />
294
-
295
- {riskScore > 0 && (
296
- <div className="mt-8 p-6 bg-white dark:bg-gray-800 rounded-lg shadow">
297
- <h2>DPIA Results: {riskLevel}</h2>
298
- <div className="w-full bg-gray-200 rounded-full h-2.5 mb-4">
299
- <div
300
- className={\`h-2.5 rounded-full \${
301
- riskScore < 40 ? 'bg-green-600' :
302
- riskScore < 70 ? 'bg-yellow-500' : 'bg-red-600'
303
- }\`}
304
- style={{ width: \`\${riskScore}%\` }}
305
- ></div>
306
- </div>
307
- <p>Risk Score: {riskScore.toFixed(1)}%</p>
308
-
309
- <h3 className="mt-4">Recommendations:</h3>
310
- <ul>
311
- {recommendations.map((rec, index) => (
312
- <li key={index}>{rec}</li>
313
- ))}
314
- </ul>
315
- </div>
316
- )}
317
- </div>
318
- );
319
- }`}</code></pre>
320
- </div>
321
- </section>
322
-
323
- <section id="api" className="mb-8">
324
- <h2 className="text-2xl font-bold mb-4">API Reference</h2>
325
-
326
- <h3 className="text-xl font-bold mt-8 mb-4">DPIAQuestion Interface</h3>
327
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto">
328
- <pre><code>{`export interface DPIAQuestion {
329
- /**
330
- * Unique identifier for the question
331
- */
332
- id: string;
333
-
334
- /**
335
- * The text of the question
336
- */
337
- text: string;
338
-
339
- /**
340
- * Additional guidance for answering the question
341
- */
342
- guidance?: string;
343
-
344
- /**
345
- * Type of input required for the answer
346
- */
347
- type: 'text' | 'textarea' | 'select' | 'radio' | 'checkbox' | 'scale';
348
-
349
- /**
350
- * Options for select, radio, or checkbox questions
351
- */
352
- options?: Array<{
353
- value: string;
354
- label: string;
355
- riskLevel?: 'low' | 'medium' | 'high';
356
- }>;
357
-
358
- /**
359
- * For scale questions, the minimum value
360
- */
361
- minValue?: number;
362
-
363
- /**
364
- * For scale questions, the maximum value
365
- */
366
- maxValue?: number;
367
-
368
- /**
369
- * Whether the question is required
370
- */
371
- required: boolean;
372
-
373
- /**
374
- * Risk level associated with this question
375
- */
376
- riskLevel?: 'low' | 'medium' | 'high';
377
-
378
- /**
379
- * Conditions that determine when this question should be shown
380
- */
381
- showWhen?: Array<{
382
- questionId: string;
383
- operator: 'equals' | 'contains' | 'greaterThan' | 'lessThan';
384
- value: any;
385
- }>;
386
- }`}</code></pre>
387
- </div>
388
-
389
- <h3 className="text-xl font-bold mt-8 mb-4">DPIASection Interface</h3>
390
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto">
391
- <pre><code>{`export interface DPIASection {
392
- /**
393
- * Unique identifier for the section
394
- */
395
- id: string;
396
-
397
- /**
398
- * Title of the section
399
- */
400
- title: string;
401
-
402
- /**
403
- * Description of the section
404
- */
405
- description?: string;
406
-
407
- /**
408
- * Questions in this section
409
- */
410
- questions: DPIAQuestion[];
411
-
412
- /**
413
- * Order of the section in the questionnaire
414
- */
415
- order: number;
416
- }`}</code></pre>
417
- </div>
418
-
419
- <h3 className="text-xl font-bold mt-8 mb-4">DPIARisk Interface</h3>
420
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto">
421
- <pre><code>{`export interface DPIARisk {
422
- /**
423
- * Unique identifier for the risk
424
- */
425
- id: string;
426
-
427
- /**
428
- * Description of the risk
429
- */
430
- description: string;
431
-
432
- /**
433
- * Likelihood of the risk occurring (1-5)
434
- */
435
- likelihood: number;
436
-
437
- /**
438
- * Impact if the risk occurs (1-5)
439
- */
440
- impact: number;
441
-
442
- /**
443
- * Overall risk score (likelihood * impact)
444
- */
445
- score: number;
446
-
447
- /**
448
- * Risk level based on the score
449
- */
450
- level: 'low' | 'medium' | 'high' | 'critical';
451
-
452
- /**
453
- * Measures to mitigate the risk
454
- */
455
- mitigationMeasures?: string[];
456
-
457
- /**
458
- * Whether the risk has been mitigated
459
- */
460
- mitigated: boolean;
461
-
462
- /**
463
- * Questions that identified this risk
464
- */
465
- relatedQuestionIds: string[];
466
- }`}</code></pre>
467
- </div>
468
-
469
- <h3 className="text-xl font-bold mt-8 mb-4">DPIAResult Interface</h3>
470
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto">
471
- <pre><code>{`export interface DPIAResult {
472
- /**
473
- * Unique identifier for the DPIA
474
- */
475
- id: string;
476
-
477
- /**
478
- * Title of the DPIA
479
- */
480
- title: string;
481
-
482
- /**
483
- * Description of the processing activity being assessed
484
- */
485
- processingDescription: string;
486
-
487
- /**
488
- * Timestamp when the DPIA was started
489
- */
490
- startedAt: number;
491
-
492
- /**
493
- * Timestamp when the DPIA was completed
494
- */
495
- completedAt?: number;
496
-
497
- /**
498
- * Person responsible for conducting the DPIA
499
- */
500
- assessor: {
501
- name: string;
502
- role: string;
503
- email: string;
504
- };
505
-
506
- /**
507
- * Answers to all questions in the DPIA
508
- */
509
- answers: Record<string, any>;
510
-
511
- /**
512
- * Risks identified in the DPIA
513
- */
514
- risks: DPIARisk[];
515
-
516
- /**
517
- * Overall risk level of the processing activity
518
- */
519
- overallRiskLevel: 'low' | 'medium' | 'high' | 'critical';
520
-
521
- /**
522
- * Whether the DPIA concluded that the processing can proceed
523
- */
524
- canProceed: boolean;
525
-
526
- /**
527
- * Recommendations for the processing activity
528
- */
529
- recommendations?: string[];
530
- }`}</code></pre>
531
- </div>
532
-
533
- <h3 className="text-xl font-bold mt-8 mb-4">useDPIA Hook</h3>
534
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto">
535
- <pre><code>{`// Import the hook
536
- import { useDPIA } from '@tantainnovative/ndpr-toolkit';
537
-
538
- // Use the hook in your component
539
- const {
540
- dpias, // Array of all DPIAs
541
- startDPIA, // Function to start a new DPIA
542
- updateDPIA, // Function to update an existing DPIA
543
- completeDPIA, // Function to complete a DPIA
544
- getDPIAById, // Function to get a DPIA by ID
545
- identifyRisks, // Function to identify risks based on answers
546
- assessRisk, // Function to assess a specific risk
547
- generateReport // Function to generate a DPIA report
548
- } = useDPIA();
549
-
550
- // Start a new DPIA
551
- const newDPIA = startDPIA({
552
- title: 'Customer Data Analytics Platform',
553
- processingDescription: 'Processing customer data for analytics and personalization',
554
- assessor: {
555
- name: 'Jane Smith',
556
- role: 'Data Protection Officer',
557
- email: 'jane@example.com'
558
- }
559
- });
560
-
561
- // Update DPIA with answers
562
- updateDPIA(newDPIA.id, {
563
- answers: {
564
- 'data-types': ['personal', 'behavioral'],
565
- 'data-volume': 'large',
566
- 'automated-processing': true,
567
- 'sensitive-data': false
568
- }
569
- });
570
-
571
- // Identify risks based on answers
572
- const risks = identifyRisks(newDPIA.id);
573
-
574
- // Complete the DPIA
575
- completeDPIA(newDPIA.id, {
576
- risks: risks,
577
- overallRiskLevel: 'medium',
578
- canProceed: true,
579
- conclusion: 'The processing can proceed with appropriate safeguards.',
580
- recommendations: [
581
- 'Implement data minimization practices',
582
- 'Enhance access controls',
583
- 'Conduct regular security audits'
584
- ]
585
- });
586
-
587
- // Generate a DPIA report
588
- const report = generateReport(newDPIA.id);
589
- `}</code></pre>
590
- </div>
591
- </section>
592
-
593
- <section id="best-practices" className="mb-8">
594
- <h2 className="text-2xl font-bold mb-4">Best Practices</h2>
595
- <ul className="list-disc pl-6 space-y-2">
596
- <li>
597
- <strong>Comprehensive Questions:</strong> Include questions that cover all aspects of data processing, including collection, storage, sharing, and deletion.
598
- </li>
599
- <li>
600
- <strong>Risk Scoring:</strong> Implement a risk scoring system to help identify high-risk areas that need additional mitigation measures.
601
- </li>
602
- <li>
603
- <strong>Documentation:</strong> Ensure the DPIA results are documented and stored for compliance purposes. The NDPR requires organizations to maintain records of processing activities.
604
- </li>
605
- <li>
606
- <strong>Regular Reviews:</strong> DPIAs should be reviewed periodically, especially when there are changes to the processing activities.
607
- </li>
608
- <li>
609
- <strong>Consultation:</strong> For high-risk processing, consider consulting with NITDA or a data protection expert.
610
- </li>
611
- </ul>
612
- </section>
613
-
614
- <section id="accessibility" className="mb-8">
615
- <h2 className="text-2xl font-bold mb-4">Accessibility</h2>
616
- <p className="mb-4">
617
- The DPIAQuestionnaire component is built with accessibility in mind:
618
- </p>
619
- <ul className="list-disc pl-6 space-y-2">
620
- <li>All form elements have proper labels and ARIA attributes</li>
621
- <li>Focus states are clearly visible</li>
622
- <li>Color contrast meets WCAG 2.1 AA standards</li>
623
- <li>Keyboard navigation is fully supported</li>
624
- </ul>
625
- <p className="mt-4">
626
- To ensure maximum accessibility, make sure to provide clear and descriptive question text and help text where appropriate.
627
- </p>
628
- </section>
629
-
630
- <section id="help-resources" className="mb-8">
631
- <h2 className="text-2xl font-bold mb-4">Need Help?</h2>
632
- <p className="mb-4">
633
- If you have questions about implementing the DPIA Questionnaire or need assistance with NDPR compliance, check out these resources:
634
- </p>
635
- <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
636
- <Card>
637
- <CardContent className="p-4">
638
- <h3 className="font-medium text-gray-900 dark:text-white mb-2">GitHub Issues</h3>
639
- <p className="text-gray-600 dark:text-gray-300 text-sm mb-3">
640
- Report bugs or request features on our GitHub repository.
641
- </p>
642
- <Button asChild variant="outline" size="sm">
643
- <a href="https://github.com/tantainnovative/ndpr-toolkit/issues" target="_blank" rel="noopener noreferrer">
644
- View Issues
645
- </a>
646
- </Button>
647
- </CardContent>
648
- </Card>
649
- <Card>
650
- <CardContent className="p-4">
651
- <h3 className="font-medium text-gray-900 dark:text-white mb-2">NDPR Resources</h3>
652
- <p className="text-gray-600 dark:text-gray-300 text-sm mb-3">
653
- Learn more about NDPR compliance requirements.
654
- </p>
655
- <Button asChild variant="outline" size="sm">
656
- <a href="https://nitda.gov.ng/wp-content/uploads/2020/01/NDPR-Implementation-Framework.pdf" target="_blank" rel="noopener noreferrer">
657
- NDPR Framework
658
- </a>
659
- </Button>
660
- </CardContent>
661
- </Card>
662
- </div>
663
- </section>
664
- </DocLayout>
665
- );
666
- }