@tantainnovative/ndpr-toolkit 1.0.3 → 1.0.5

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 (110) hide show
  1. package/next-env.d.ts +5 -0
  2. package/package.json +1 -1
  3. package/packages/ndpr-toolkit/dist/components/breach/BreachNotificationManager.d.ts +62 -0
  4. package/packages/ndpr-toolkit/dist/components/breach/BreachReportForm.d.ts +66 -0
  5. package/packages/ndpr-toolkit/dist/components/breach/BreachRiskAssessment.d.ts +50 -0
  6. package/packages/ndpr-toolkit/dist/components/breach/RegulatoryReportGenerator.d.ts +94 -0
  7. package/packages/ndpr-toolkit/dist/components/consent/ConsentBanner.d.ts +79 -0
  8. package/packages/ndpr-toolkit/dist/components/consent/ConsentManager.d.ts +73 -0
  9. package/packages/ndpr-toolkit/dist/components/consent/ConsentStorage.d.ts +41 -0
  10. package/packages/ndpr-toolkit/dist/components/dpia/DPIAQuestionnaire.d.ts +70 -0
  11. package/packages/ndpr-toolkit/dist/components/dpia/DPIAReport.d.ts +40 -0
  12. package/packages/ndpr-toolkit/dist/components/dpia/StepIndicator.d.ts +64 -0
  13. package/packages/ndpr-toolkit/dist/components/dsr/DSRDashboard.d.ts +58 -0
  14. package/packages/ndpr-toolkit/dist/components/dsr/DSRRequestForm.d.ts +74 -0
  15. package/packages/ndpr-toolkit/dist/components/dsr/DSRTracker.d.ts +56 -0
  16. package/packages/ndpr-toolkit/dist/components/policy/PolicyExporter.d.ts +65 -0
  17. package/packages/ndpr-toolkit/dist/components/policy/PolicyGenerator.d.ts +54 -0
  18. package/packages/ndpr-toolkit/dist/components/policy/PolicyPreview.d.ts +71 -0
  19. package/packages/ndpr-toolkit/dist/hooks/useBreach.d.ts +97 -0
  20. package/packages/ndpr-toolkit/dist/hooks/useConsent.d.ts +63 -0
  21. package/packages/ndpr-toolkit/dist/hooks/useDPIA.d.ts +92 -0
  22. package/packages/ndpr-toolkit/dist/hooks/useDSR.d.ts +72 -0
  23. package/packages/ndpr-toolkit/dist/hooks/usePrivacyPolicy.d.ts +87 -0
  24. package/packages/ndpr-toolkit/dist/index.d.ts +31 -0
  25. package/packages/ndpr-toolkit/dist/index.esm.js +2 -0
  26. package/packages/ndpr-toolkit/dist/index.esm.js.map +1 -0
  27. package/packages/ndpr-toolkit/dist/index.js +2 -0
  28. package/packages/ndpr-toolkit/dist/index.js.map +1 -0
  29. package/packages/ndpr-toolkit/dist/setupTests.d.ts +2 -0
  30. package/packages/ndpr-toolkit/dist/types/breach.d.ts +239 -0
  31. package/packages/ndpr-toolkit/dist/types/consent.d.ts +95 -0
  32. package/packages/ndpr-toolkit/dist/types/dpia.d.ts +196 -0
  33. package/packages/ndpr-toolkit/dist/types/dsr.d.ts +162 -0
  34. package/packages/ndpr-toolkit/dist/types/privacy.d.ts +204 -0
  35. package/packages/ndpr-toolkit/dist/utils/breach.d.ts +14 -0
  36. package/packages/ndpr-toolkit/dist/utils/consent.d.ts +10 -0
  37. package/packages/ndpr-toolkit/dist/utils/dpia.d.ts +12 -0
  38. package/packages/ndpr-toolkit/dist/utils/dsr.d.ts +11 -0
  39. package/packages/ndpr-toolkit/dist/utils/privacy.d.ts +12 -0
  40. package/src/components/consent/ConsentBanner.tsx +82 -48
  41. package/src/components/data-subject-rights/DataSubjectRequestForm.tsx +240 -129
  42. package/src/components/dpia/DPIAQuestionnaire.tsx +162 -122
  43. package/src/components/privacy-policy/PolicyGenerator.tsx +5 -5
  44. package/src/components/privacy-policy/steps/CustomSectionsStep.tsx +103 -77
  45. package/src/components/privacy-policy/steps/PolicyPreviewStep.tsx +117 -63
  46. package/src/hooks/useConsent.ts +16 -10
  47. package/src/lib/consentService.ts +44 -37
  48. package/src/lib/dpiaQuestions.ts +139 -99
  49. package/src/lib/requestService.ts +21 -17
  50. package/src/types/index.ts +13 -8
  51. package/.claude/settings.local.json +0 -20
  52. package/.eslintrc.json +0 -10
  53. package/.github/workflows/ci.yml +0 -36
  54. package/.github/workflows/nextjs.yml +0 -104
  55. package/.husky/commit-msg +0 -4
  56. package/.husky/pre-commit +0 -4
  57. package/.lintstagedrc.js +0 -4
  58. package/.nvmrc +0 -1
  59. package/.versionrc +0 -17
  60. package/CLAUDE.md +0 -90
  61. package/commitlint.config.js +0 -36
  62. package/jest.config.js +0 -31
  63. package/jest.setup.js +0 -15
  64. package/packages/ndpr-toolkit/jest.config.js +0 -23
  65. package/packages/ndpr-toolkit/src/__tests__/components/consent/ConsentBanner.test.tsx +0 -119
  66. package/packages/ndpr-toolkit/src/__tests__/components/consent/ConsentManager.test.tsx +0 -122
  67. package/packages/ndpr-toolkit/src/__tests__/components/consent/ConsentStorage.test.tsx +0 -270
  68. package/packages/ndpr-toolkit/src/__tests__/components/dsr/DSRDashboard.test.tsx +0 -199
  69. package/packages/ndpr-toolkit/src/__tests__/components/dsr/DSRRequestForm.test.tsx +0 -224
  70. package/packages/ndpr-toolkit/src/__tests__/components/dsr/DSRTracker.test.tsx +0 -104
  71. package/packages/ndpr-toolkit/src/__tests__/hooks/useConsent.test.tsx +0 -161
  72. package/packages/ndpr-toolkit/src/__tests__/hooks/useDSR.test.tsx +0 -330
  73. package/packages/ndpr-toolkit/src/__tests__/utils/breach.test.ts +0 -149
  74. package/packages/ndpr-toolkit/src/__tests__/utils/consent.test.ts +0 -88
  75. package/packages/ndpr-toolkit/src/__tests__/utils/dpia.test.ts +0 -160
  76. package/packages/ndpr-toolkit/src/__tests__/utils/dsr.test.ts +0 -110
  77. package/packages/ndpr-toolkit/src/__tests__/utils/privacy.test.ts +0 -97
  78. package/src/__tests__/example.test.ts +0 -13
  79. package/src/__tests__/requestService.test.ts +0 -57
  80. package/src/app/docs/components/DocLayout.tsx +0 -267
  81. package/src/app/docs/components/breach-notification/page.tsx +0 -797
  82. package/src/app/docs/components/consent-management/page.tsx +0 -576
  83. package/src/app/docs/components/data-subject-rights/page.tsx +0 -511
  84. package/src/app/docs/components/dpia-questionnaire/layout.tsx +0 -15
  85. package/src/app/docs/components/dpia-questionnaire/metadata.ts +0 -31
  86. package/src/app/docs/components/dpia-questionnaire/page.tsx +0 -666
  87. package/src/app/docs/components/hooks/page.tsx +0 -305
  88. package/src/app/docs/components/page.tsx +0 -84
  89. package/src/app/docs/components/privacy-policy-generator/page.tsx +0 -634
  90. package/src/app/docs/guides/breach-notification-process/components/BestPractices.tsx +0 -123
  91. package/src/app/docs/guides/breach-notification-process/components/ImplementationSteps.tsx +0 -328
  92. package/src/app/docs/guides/breach-notification-process/components/Introduction.tsx +0 -28
  93. package/src/app/docs/guides/breach-notification-process/components/NotificationTimeline.tsx +0 -91
  94. package/src/app/docs/guides/breach-notification-process/components/Resources.tsx +0 -118
  95. package/src/app/docs/guides/breach-notification-process/page.tsx +0 -39
  96. package/src/app/docs/guides/conducting-dpia/page.tsx +0 -593
  97. package/src/app/docs/guides/data-subject-requests/page.tsx +0 -666
  98. package/src/app/docs/guides/managing-consent/page.tsx +0 -738
  99. package/src/app/docs/guides/ndpr-compliance-checklist/components/ComplianceChecklist.tsx +0 -296
  100. package/src/app/docs/guides/ndpr-compliance-checklist/components/ImplementationTools.tsx +0 -145
  101. package/src/app/docs/guides/ndpr-compliance-checklist/components/Introduction.tsx +0 -33
  102. package/src/app/docs/guides/ndpr-compliance-checklist/components/KeyRequirements.tsx +0 -99
  103. package/src/app/docs/guides/ndpr-compliance-checklist/components/Resources.tsx +0 -159
  104. package/src/app/docs/guides/ndpr-compliance-checklist/page.tsx +0 -38
  105. package/src/app/docs/guides/page.tsx +0 -67
  106. package/src/app/docs/layout.tsx +0 -15
  107. package/src/app/docs/metadata.ts +0 -31
  108. package/src/app/docs/page.tsx +0 -572
  109. package/src/components/docs/DocLayout.tsx +0 -289
  110. package/src/components/docs/index.ts +0 -2
@@ -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
- }