@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,576 +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 ConsentManagementDocs() {
9
- return (
10
- <DocLayout
11
- title="Consent Management"
12
- description="NDPR-compliant consent management system for handling user consent preferences"
13
- >
14
- <div className="flex mb-6 space-x-2">
15
- <Button asChild variant="outline" size="sm">
16
- <Link href="/gdrp-demos/consent">
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/src/components/consent" 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 Consent Management component provides a complete solution for collecting, storing, and managing user consent
31
- in compliance with the Nigeria Data Protection Regulation (NDPR). It includes a customizable consent banner,
32
- preference management interface, and consent storage system.
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">NDPR Consent Requirements</h4>
36
- <p className="text-blue-700 dark:text-blue-300 text-sm mb-0">
37
- Under the NDPR, consent must be freely given, specific, informed, and unambiguous. The data subject must clearly
38
- indicate acceptance through a statement or clear affirmative action. Pre-ticked boxes or silence do not constitute valid consent.
39
- </p>
40
- </div>
41
- </section>
42
-
43
- <section id="installation" className="mb-8">
44
- <h2 className="text-2xl font-bold mb-4">Installation</h2>
45
- <p className="mb-4">
46
- Install the NDPR Toolkit package which includes the Consent Management components:
47
- </p>
48
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto mb-4">
49
- <pre><code>npm install @tantainnovative/ndpr-toolkit</code></pre>
50
- </div>
51
- <p>
52
- Or if you&apos;re using yarn:
53
- </p>
54
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto">
55
- <pre><code>yarn add @tantainnovative/ndpr-toolkit</code></pre>
56
- </div>
57
- </section>
58
-
59
- <section id="components" className="mb-8">
60
- <h2 className="text-2xl font-bold mb-4">Components</h2>
61
- <p className="mb-4">
62
- The Consent Management system includes several components that work together:
63
- </p>
64
-
65
- <div className="space-y-6">
66
- <div className="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700">
67
- <h3 className="text-xl font-bold mb-2">ConsentBanner</h3>
68
- <p className="text-gray-600 dark:text-gray-300 mb-4">
69
- A cookie consent banner that appears at the bottom of the page when a user first visits your site. Fully customizable with support for multiple consent options.
70
- </p>
71
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto">
72
- <pre><code>{`import { ConsentBanner } from '@tantainnovative/ndpr-toolkit';
73
-
74
- <ConsentBanner
75
- options={[
76
- {
77
- id: 'necessary',
78
- label: 'Necessary Cookies',
79
- description: 'Essential cookies for the website to function.',
80
- required: true
81
- },
82
- {
83
- id: 'analytics',
84
- label: 'Analytics Cookies',
85
- description: 'Cookies that help us understand how you use our website.',
86
- required: false
87
- },
88
- {
89
- id: 'marketing',
90
- label: 'Marketing Cookies',
91
- description: 'Cookies used for marketing purposes.',
92
- required: false
93
- }
94
- ]}
95
- onSave={(consents) => console.log(consents)}
96
- position="bottom"
97
- showPreferences={true}
98
- privacyPolicyUrl="/privacy-policy"
99
- />`}</code></pre>
100
- </div>
101
- </div>
102
-
103
- <div className="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700">
104
- <h3 className="text-xl font-bold mb-2">ConsentPreferences</h3>
105
- <p className="text-gray-600 dark:text-gray-300 mb-4">
106
- A detailed interface for users to manage their consent preferences after the initial consent has been given.
107
- </p>
108
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto">
109
- <pre><code>{`import { ConsentPreferences } from '@tantainnovative/ndpr-toolkit';
110
-
111
- <ConsentPreferences
112
- options={consentOptions}
113
- currentConsent={currentConsent}
114
- onSave={handleSaveConsent}
115
- onReset={handleResetConsent}
116
- />`}</code></pre>
117
- </div>
118
- </div>
119
-
120
- <div className="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700">
121
- <h3 className="text-xl font-bold mb-2">ConsentManager</h3>
122
- <p className="text-gray-600 dark:text-gray-300 mb-4">
123
- A higher-order component that manages the consent state and provides methods for checking and updating consent. Works with the useConsent hook to provide a complete consent management solution.
124
- </p>
125
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto">
126
- <pre><code>{`import { ConsentManager, useConsent } from '@tantainnovative/ndpr-toolkit';
127
-
128
- function App() {
129
- return (
130
- <ConsentManager
131
- options={[
132
- {
133
- id: 'necessary',
134
- label: 'Necessary Cookies',
135
- description: 'Essential cookies for the website to function.',
136
- required: true
137
- },
138
- {
139
- id: 'analytics',
140
- label: 'Analytics Cookies',
141
- description: 'Cookies that help us understand how you use our website.',
142
- required: false
143
- }
144
- ]}
145
- storageKey="my-app-consent"
146
- autoLoad={true}
147
- autoSave={true}
148
- >
149
- <MyApp />
150
- </ConsentManager>
151
- );
152
- }
153
-
154
- function MyApp() {
155
- const {
156
- consents,
157
- hasConsented,
158
- updateConsent,
159
- saveConsents,
160
- resetConsents
161
- } = useConsent();
162
-
163
- // Check if user has given consent for analytics
164
- if (hasConsented('analytics')) {
165
- // Initialize analytics
166
- }
167
-
168
- return (
169
- <div>
170
- {/* Your app content */}
171
- <button onClick={() => updateConsent('analytics', true)}>Enable Analytics</button>
172
- </div>
173
- );
174
- }`}</code></pre>
175
- </div>
176
- </div>
177
-
178
- <div className="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700">
179
- <h3 className="text-xl font-bold mb-2">ConsentStorage</h3>
180
- <p className="text-gray-600 dark:text-gray-300 mb-4">
181
- A component for handling the storage and retrieval of consent settings. Supports both local storage and custom storage mechanisms.
182
- </p>
183
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto">
184
- <pre><code>{`import { ConsentStorage, ConsentSettings } from '@tantainnovative/ndpr-toolkit';
185
- import { useState } from 'react';
186
-
187
- function ConsentStorageExample() {
188
- const [settings, setSettings] = useState<ConsentSettings>({
189
- necessary: true,
190
- analytics: false,
191
- marketing: false,
192
- lastUpdated: Date.now()
193
- });
194
-
195
- const handleLoad = (loadedSettings: ConsentSettings | null) => {
196
- if (loadedSettings) {
197
- setSettings(loadedSettings);
198
- }
199
- };
200
-
201
- return (
202
- <ConsentStorage
203
- settings={settings}
204
- storageOptions={{
205
- key: 'my-app-consent',
206
- storage: 'localStorage' // or 'sessionStorage' or 'cookie'
207
- }}
208
- onLoad={handleLoad}
209
- onSave={(savedSettings) => console.log('Saved:', savedSettings)}
210
- autoLoad={true}
211
- autoSave={true}
212
- >
213
- {/* Render prop pattern */}
214
- {({ loadSettings, saveSettings, clearSettings, loaded }) => (
215
- <div>
216
- <p>Consent settings loaded: {loaded ? 'Yes' : 'No'}</p>
217
- <button onClick={() => saveSettings(settings)}>Save Settings</button>
218
- <button onClick={() => clearSettings()}>Clear Settings</button>
219
- </div>
220
- )}
221
- </ConsentStorage>
222
- );
223
- }`}</code></pre>
224
- </div>
225
- </div>
226
- </div>
227
- </section>
228
-
229
- <section id="usage" className="mb-8">
230
- <h2 className="text-2xl font-bold mb-4">Usage</h2>
231
- <p className="mb-4">
232
- Here&apos;s a complete example of how to implement the consent management system in your application:
233
- </p>
234
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto">
235
- <pre><code>{`import { useState, useEffect } from 'react';
236
- import {
237
- ConsentBanner,
238
- ConsentPreferences,
239
- ConsentManager,
240
- ConsentStorage,
241
- useConsent
242
- } from '@tantainnovative/ndpr-toolkit';
243
-
244
- // Define your consent options
245
- const consentOptions = [
246
- {
247
- id: 'necessary',
248
- label: 'Necessary Cookies',
249
- description: 'Essential cookies for the website to function.',
250
- required: true
251
- },
252
- {
253
- id: 'analytics',
254
- label: 'Analytics Cookies',
255
- description: 'Cookies that help us understand how you use our website.',
256
- required: false
257
- },
258
- {
259
- id: 'marketing',
260
- label: 'Marketing Cookies',
261
- description: 'Cookies used for marketing purposes.',
262
- required: false
263
- }
264
- ];
265
-
266
- function App() {
267
- const [showPreferences, setShowPreferences] = useState(false);
268
-
269
- return (
270
- <ConsentManager
271
- options={consentOptions}
272
- storageKey="my-app-consent"
273
- >
274
- <div>
275
- {/* Your app content */}
276
- <header>
277
- <nav>
278
- {/* ... */}
279
- <button onClick={() => setShowPreferences(true)}>
280
- Cookie Preferences
281
- </button>
282
- </nav>
283
- </header>
284
-
285
- <main>
286
- {/* Your main content */}
287
- </main>
288
-
289
- {/* Cookie preferences modal */}
290
- {showPreferences && (
291
- <PreferencesModal
292
- onClose={() => setShowPreferences(false)}
293
- />
294
- )}
295
-
296
- {/* Consent banner */}
297
- <ConsentBanner
298
- options={consentOptions}
299
- position="bottom"
300
- privacyPolicyUrl="/privacy-policy"
301
- />
302
- </div>
303
- </ConsentManager>
304
- );
305
- }
306
-
307
- function PreferencesModal({ onClose }) {
308
- const {
309
- consents,
310
- updateConsent,
311
- saveConsents,
312
- resetConsents
313
- } = useConsent();
314
-
315
- const handleSave = () => {
316
- saveConsents();
317
- onClose();
318
- };
319
-
320
- return (
321
- <div className="modal">
322
- <div className="modal-content">
323
- <h2>Cookie Preferences</h2>
324
- <ConsentPreferences
325
- options={consentOptions}
326
- currentConsent={consents}
327
- onSave={handleSave}
328
- onReset={resetConsents}
329
- />
330
- <button onClick={onClose}>Cancel</button>
331
- </div>
332
- </div>
333
- );
334
- }
335
-
336
- // Example of using the useConsent hook to check consent
337
- function AnalyticsComponent() {
338
- const { hasConsented } = useConsent();
339
-
340
- useEffect(() => {
341
- if (hasConsented('analytics')) {
342
- // Initialize analytics
343
- console.log('Analytics initialized');
344
- }
345
- }, [hasConsented]);
346
-
347
- return null;
348
- }`}</code></pre>
349
- </div>
350
- </section>
351
-
352
- <section id="api" className="mb-8">
353
- <h2 className="text-2xl font-bold mb-4">API Reference</h2>
354
-
355
- <h3 className="text-xl font-bold mt-8 mb-4">ConsentBanner Props</h3>
356
- <div className="overflow-x-auto">
357
- <table className="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
358
- <thead className="bg-gray-50 dark:bg-gray-800">
359
- <tr>
360
- <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Prop</th>
361
- <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>
362
- <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Default</th>
363
- <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>
364
- </tr>
365
- </thead>
366
- <tbody className="bg-white dark:bg-gray-900 divide-y divide-gray-200 dark:divide-gray-700">
367
- <tr>
368
- <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white">options</td>
369
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">ConsentOption[]</td>
370
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">Required</td>
371
- <td className="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">Array of consent options to display</td>
372
- </tr>
373
- <tr>
374
- <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white">onSave</td>
375
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">{`({ consents: Record<string, boolean> }) => void`}</td>
376
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">Required</td>
377
- <td className="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">Callback function called when consent is saved</td>
378
- </tr>
379
- <tr>
380
- <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white">position</td>
381
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">&apos;top&apos; | &apos;bottom&apos;</td>
382
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">&apos;bottom&apos;</td>
383
- <td className="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">Position of the banner on the page</td>
384
- </tr>
385
- <tr>
386
- <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white">title</td>
387
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">string</td>
388
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">&apos;Cookie Consent&apos;</td>
389
- <td className="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">Title displayed on the banner</td>
390
- </tr>
391
- <tr>
392
- <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white">description</td>
393
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">string</td>
394
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">&apos;We use cookies...&apos;</td>
395
- <td className="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">Description text explaining the purpose of cookies</td>
396
- </tr>
397
- <tr>
398
- <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white">showPreferences</td>
399
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">boolean</td>
400
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">true</td>
401
- <td className="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">Whether to show the &quot;Preferences&quot; button</td>
402
- </tr>
403
- <tr>
404
- <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white">privacyPolicyUrl</td>
405
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">string</td>
406
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">undefined</td>
407
- <td className="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">URL to the privacy policy page</td>
408
- </tr>
409
- </tbody>
410
- </table>
411
- </div>
412
-
413
- <h3 className="text-xl font-bold mt-8 mb-4">ConsentStorage Props</h3>
414
- <div className="overflow-x-auto">
415
- <table className="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
416
- <thead className="bg-gray-50 dark:bg-gray-800">
417
- <tr>
418
- <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Prop</th>
419
- <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>
420
- <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Default</th>
421
- <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>
422
- </tr>
423
- </thead>
424
- <tbody className="bg-white dark:bg-gray-900 divide-y divide-gray-200 dark:divide-gray-700">
425
- <tr>
426
- <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white">settings</td>
427
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">ConsentSettings</td>
428
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">Required</td>
429
- <td className="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">Current consent settings to store</td>
430
- </tr>
431
- <tr>
432
- <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white">storageOptions</td>
433
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">ConsentStorageOptions</td>
434
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">{`{ storageKey: 'ndpr_consent', storageType: 'localStorage' }`}</td>
435
- <td className="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">Options for storage mechanism</td>
436
- </tr>
437
- <tr>
438
- <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white">onLoad</td>
439
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">{`(settings: ConsentSettings | null) => void`}</td>
440
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">undefined</td>
441
- <td className="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">Callback when settings are loaded</td>
442
- </tr>
443
- <tr>
444
- <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white">onSave</td>
445
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">{`(settings: ConsentSettings) => void`}</td>
446
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">undefined</td>
447
- <td className="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">Callback when settings are saved</td>
448
- </tr>
449
- <tr>
450
- <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white">autoLoad</td>
451
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">boolean</td>
452
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">true</td>
453
- <td className="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">Whether to load settings on mount</td>
454
- </tr>
455
- <tr>
456
- <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white">autoSave</td>
457
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">boolean</td>
458
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">true</td>
459
- <td className="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">Whether to save settings automatically</td>
460
- </tr>
461
- <tr>
462
- <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white">children</td>
463
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">ReactNode | Function</td>
464
- <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">undefined</td>
465
- <td className="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">React nodes or render prop function</td>
466
- </tr>
467
- </tbody>
468
- </table>
469
- </div>
470
-
471
- <h3 className="text-xl font-bold mt-8 mb-4">ConsentOption Type</h3>
472
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto">
473
- <pre><code>{`type ConsentOption = {
474
- id: string;
475
- label: string;
476
- description: string;
477
- required?: boolean;
478
- };`}</code></pre>
479
- </div>
480
-
481
- <h3 className="text-xl font-bold mt-8 mb-4">ConsentSettings Type</h3>
482
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto">
483
- <pre><code>{`type ConsentSettings = {
484
- [key: string]: boolean;
485
- lastUpdated: number;
486
- };`}</code></pre>
487
- </div>
488
-
489
- <h3 className="text-xl font-bold mt-8 mb-4">ConsentStorageOptions Type</h3>
490
- <div className="bg-gray-800 text-gray-200 p-4 rounded-md overflow-x-auto">
491
- <pre><code>{`type ConsentStorageOptions = {
492
- key: string;
493
- storage: 'localStorage' | 'sessionStorage' | 'cookie';
494
- cookieOptions?: {
495
- path?: string;
496
- domain?: string;
497
- secure?: boolean;
498
- sameSite?: 'strict' | 'lax' | 'none';
499
- maxAge?: number;
500
- };
501
- };`}</code></pre>
502
- </div>
503
- </section>
504
-
505
- <section id="best-practices" className="mb-8">
506
- <h2 className="text-2xl font-bold mb-4">Best Practices</h2>
507
- <ul className="list-disc pl-6 space-y-2">
508
- <li>
509
- <strong>Clear Language:</strong> Use clear, plain language to explain what each type of cookie does and why you&apos;re collecting the data.
510
- </li>
511
- <li>
512
- <strong>No Pre-selected Options:</strong> Don&apos;t pre-select non-essential cookies. The NDPR requires that consent is freely given and pre-selected checkboxes don&apos;t constitute valid consent.
513
- </li>
514
- <li>
515
- <strong>Easy Access to Preferences:</strong> Make it easy for users to access and update their consent preferences at any time.
516
- </li>
517
- <li>
518
- <strong>Consent Records:</strong> Keep records of when and how consent was obtained. The ConsentManager component automatically tracks consent history.
519
- </li>
520
- <li>
521
- <strong>Respect User Choices:</strong> Only activate cookies and tracking technologies when the user has given explicit consent for them.
522
- </li>
523
- </ul>
524
- </section>
525
-
526
- <section id="accessibility" className="mb-8">
527
- <h2 className="text-2xl font-bold mb-4">Accessibility</h2>
528
- <p className="mb-4">
529
- The Consent Management components are built with accessibility in mind:
530
- </p>
531
- <ul className="list-disc pl-6 space-y-2">
532
- <li>All form elements have proper labels and ARIA attributes</li>
533
- <li>Focus states are clearly visible</li>
534
- <li>Color contrast meets WCAG 2.1 AA standards</li>
535
- <li>Keyboard navigation is fully supported</li>
536
- <li>The banner is announced to screen readers when it appears</li>
537
- </ul>
538
- </section>
539
-
540
- <section id="help-resources" className="mb-8">
541
- <h2 className="text-2xl font-bold mb-4">Need Help?</h2>
542
- <p className="mb-4">
543
- If you have questions about implementing the Consent Management system or need assistance with NDPR compliance, check out these resources:
544
- </p>
545
- <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
546
- <Card>
547
- <CardContent className="p-4">
548
- <h3 className="font-medium text-gray-900 dark:text-white mb-2">GitHub Issues</h3>
549
- <p className="text-gray-600 dark:text-gray-300 text-sm mb-3">
550
- Report bugs or request features on our GitHub repository.
551
- </p>
552
- <Button asChild variant="outline" size="sm">
553
- <a href="https://github.com/tantainnovative/ndpr-toolkit/issues" target="_blank" rel="noopener noreferrer">
554
- View Issues
555
- </a>
556
- </Button>
557
- </CardContent>
558
- </Card>
559
- <Card>
560
- <CardContent className="p-4">
561
- <h3 className="font-medium text-gray-900 dark:text-white mb-2">NDPR Resources</h3>
562
- <p className="text-gray-600 dark:text-gray-300 text-sm mb-3">
563
- Learn more about NDPR compliance requirements.
564
- </p>
565
- <Button asChild variant="outline" size="sm">
566
- <a href="https://nitda.gov.ng/wp-content/uploads/2020/01/NDPR-Implementation-Framework.pdf" target="_blank" rel="noopener noreferrer">
567
- NDPR Framework
568
- </a>
569
- </Button>
570
- </CardContent>
571
- </Card>
572
- </div>
573
- </section>
574
- </DocLayout>
575
- );
576
- }