@tantainnovative/ndpr-toolkit 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +412 -0
  2. package/dist/components/breach/BreachNotificationManager.d.ts +62 -0
  3. package/dist/components/breach/BreachReportForm.d.ts +66 -0
  4. package/dist/components/breach/BreachRiskAssessment.d.ts +50 -0
  5. package/dist/components/breach/RegulatoryReportGenerator.d.ts +94 -0
  6. package/dist/components/consent/ConsentBanner.d.ts +79 -0
  7. package/dist/components/consent/ConsentManager.d.ts +73 -0
  8. package/dist/components/consent/ConsentStorage.d.ts +41 -0
  9. package/dist/components/dpia/DPIAQuestionnaire.d.ts +70 -0
  10. package/dist/components/dpia/DPIAReport.d.ts +40 -0
  11. package/dist/components/dpia/StepIndicator.d.ts +64 -0
  12. package/dist/components/dsr/DSRDashboard.d.ts +58 -0
  13. package/dist/components/dsr/DSRRequestForm.d.ts +74 -0
  14. package/dist/components/dsr/DSRTracker.d.ts +56 -0
  15. package/dist/components/policy/PolicyExporter.d.ts +65 -0
  16. package/dist/components/policy/PolicyGenerator.d.ts +54 -0
  17. package/dist/components/policy/PolicyPreview.d.ts +71 -0
  18. package/dist/hooks/useBreach.d.ts +97 -0
  19. package/dist/hooks/useConsent.d.ts +63 -0
  20. package/dist/hooks/useDPIA.d.ts +92 -0
  21. package/dist/hooks/useDSR.d.ts +72 -0
  22. package/dist/hooks/usePrivacyPolicy.d.ts +87 -0
  23. package/dist/index.d.ts +31 -0
  24. package/dist/index.esm.js +2 -0
  25. package/dist/index.esm.js.map +1 -0
  26. package/dist/index.js +2 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/setupTests.d.ts +2 -0
  29. package/dist/types/breach.d.ts +239 -0
  30. package/dist/types/consent.d.ts +95 -0
  31. package/dist/types/dpia.d.ts +196 -0
  32. package/dist/types/dsr.d.ts +162 -0
  33. package/dist/types/privacy.d.ts +204 -0
  34. package/dist/utils/breach.d.ts +14 -0
  35. package/dist/utils/consent.d.ts +10 -0
  36. package/dist/utils/dpia.d.ts +12 -0
  37. package/dist/utils/dsr.d.ts +11 -0
  38. package/dist/utils/privacy.d.ts +12 -0
  39. package/package.json +71 -0
@@ -0,0 +1,2 @@
1
+ import '@testing-library/jest-dom';
2
+ import '@testing-library/jest-dom/extend-expect';
@@ -0,0 +1,239 @@
1
+ /**
2
+ * Represents a data breach category
3
+ */
4
+ export interface BreachCategory {
5
+ /**
6
+ * Unique identifier for the category
7
+ */
8
+ id: string;
9
+ /**
10
+ * Display name for the category
11
+ */
12
+ name: string;
13
+ /**
14
+ * Description of this breach category
15
+ */
16
+ description: string;
17
+ /**
18
+ * Default severity level for this category
19
+ */
20
+ defaultSeverity: 'low' | 'medium' | 'high' | 'critical';
21
+ }
22
+ /**
23
+ * Represents a data breach report
24
+ */
25
+ export interface BreachReport {
26
+ /**
27
+ * Unique identifier for the breach report
28
+ */
29
+ id: string;
30
+ /**
31
+ * Title/summary of the breach
32
+ */
33
+ title: string;
34
+ /**
35
+ * Detailed description of the breach
36
+ */
37
+ description: string;
38
+ /**
39
+ * Category of the breach
40
+ */
41
+ category: string;
42
+ /**
43
+ * Timestamp when the breach was discovered
44
+ */
45
+ discoveredAt: number;
46
+ /**
47
+ * Timestamp when the breach occurred (if known)
48
+ */
49
+ occurredAt?: number;
50
+ /**
51
+ * Timestamp when the breach was reported internally
52
+ */
53
+ reportedAt: number;
54
+ /**
55
+ * Person who reported the breach
56
+ */
57
+ reporter: {
58
+ name: string;
59
+ email: string;
60
+ department: string;
61
+ phone?: string;
62
+ };
63
+ /**
64
+ * Systems or data affected by the breach
65
+ */
66
+ affectedSystems: string[];
67
+ /**
68
+ * Types of data involved in the breach
69
+ */
70
+ dataTypes: string[];
71
+ /**
72
+ * Estimated number of data subjects affected
73
+ */
74
+ estimatedAffectedSubjects?: number;
75
+ /**
76
+ * Whether the breach is ongoing or contained
77
+ */
78
+ status: 'ongoing' | 'contained' | 'resolved';
79
+ /**
80
+ * Initial actions taken to address the breach
81
+ */
82
+ initialActions?: string;
83
+ /**
84
+ * Attachments related to the breach (e.g., screenshots, logs)
85
+ */
86
+ attachments?: Array<{
87
+ id: string;
88
+ name: string;
89
+ type: string;
90
+ url: string;
91
+ addedAt: number;
92
+ }>;
93
+ }
94
+ /**
95
+ * Represents a risk assessment for a data breach
96
+ */
97
+ export interface RiskAssessment {
98
+ /**
99
+ * Unique identifier for the risk assessment
100
+ */
101
+ id: string;
102
+ /**
103
+ * ID of the breach this assessment is for
104
+ */
105
+ breachId: string;
106
+ /**
107
+ * Timestamp when the assessment was conducted
108
+ */
109
+ assessedAt: number;
110
+ /**
111
+ * Person who conducted the assessment
112
+ */
113
+ assessor: {
114
+ name: string;
115
+ role: string;
116
+ email: string;
117
+ };
118
+ /**
119
+ * Confidentiality impact (1-5)
120
+ */
121
+ confidentialityImpact: number;
122
+ /**
123
+ * Integrity impact (1-5)
124
+ */
125
+ integrityImpact: number;
126
+ /**
127
+ * Availability impact (1-5)
128
+ */
129
+ availabilityImpact: number;
130
+ /**
131
+ * Likelihood of harm to data subjects (1-5)
132
+ */
133
+ harmLikelihood: number;
134
+ /**
135
+ * Severity of potential harm to data subjects (1-5)
136
+ */
137
+ harmSeverity: number;
138
+ /**
139
+ * Overall risk score
140
+ */
141
+ overallRiskScore: number;
142
+ /**
143
+ * Risk level based on the overall score
144
+ */
145
+ riskLevel: 'low' | 'medium' | 'high' | 'critical';
146
+ /**
147
+ * Whether the breach is likely to result in a risk to the rights and freedoms of data subjects
148
+ */
149
+ risksToRightsAndFreedoms: boolean;
150
+ /**
151
+ * Whether the breach is likely to result in a high risk to the rights and freedoms of data subjects
152
+ */
153
+ highRisksToRightsAndFreedoms: boolean;
154
+ /**
155
+ * Justification for the risk assessment
156
+ */
157
+ justification: string;
158
+ }
159
+ /**
160
+ * Represents notification requirements for a data breach
161
+ */
162
+ export interface NotificationRequirement {
163
+ /**
164
+ * Whether NITDA notification is required
165
+ */
166
+ nitdaNotificationRequired: boolean;
167
+ /**
168
+ * Deadline for NITDA notification (72 hours from discovery)
169
+ */
170
+ nitdaNotificationDeadline: number;
171
+ /**
172
+ * Whether data subject notification is required
173
+ */
174
+ dataSubjectNotificationRequired: boolean;
175
+ /**
176
+ * Justification for the notification decision
177
+ */
178
+ justification: string;
179
+ }
180
+ /**
181
+ * Represents a notification sent to NITDA
182
+ */
183
+ export interface RegulatoryNotification {
184
+ /**
185
+ * Unique identifier for the notification
186
+ */
187
+ id: string;
188
+ /**
189
+ * ID of the breach this notification is for
190
+ */
191
+ breachId: string;
192
+ /**
193
+ * Timestamp when the notification was sent
194
+ */
195
+ sentAt: number;
196
+ /**
197
+ * Method used to send the notification
198
+ */
199
+ method: 'email' | 'portal' | 'letter' | 'other';
200
+ /**
201
+ * Reference number assigned by NITDA (if available)
202
+ */
203
+ referenceNumber?: string;
204
+ /**
205
+ * Contact person at NITDA
206
+ */
207
+ nitdaContact?: {
208
+ name: string;
209
+ email: string;
210
+ phone?: string;
211
+ };
212
+ /**
213
+ * Content of the notification
214
+ */
215
+ content: string;
216
+ /**
217
+ * Attachments included with the notification
218
+ */
219
+ attachments?: Array<{
220
+ id: string;
221
+ name: string;
222
+ type: string;
223
+ url: string;
224
+ }>;
225
+ /**
226
+ * Follow-up communications with NITDA
227
+ */
228
+ followUps?: Array<{
229
+ timestamp: number;
230
+ direction: 'sent' | 'received';
231
+ content: string;
232
+ attachments?: Array<{
233
+ id: string;
234
+ name: string;
235
+ type: string;
236
+ url: string;
237
+ }>;
238
+ }>;
239
+ }
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Represents a consent option that can be presented to users
3
+ */
4
+ export interface ConsentOption {
5
+ /**
6
+ * Unique identifier for the consent option
7
+ */
8
+ id: string;
9
+ /**
10
+ * Display label for the consent option
11
+ */
12
+ label: string;
13
+ /**
14
+ * Detailed description of what this consent option covers
15
+ */
16
+ description: string;
17
+ /**
18
+ * Whether this consent option is required (cannot be declined)
19
+ */
20
+ required: boolean;
21
+ /**
22
+ * Default state of the consent option
23
+ * @default false
24
+ */
25
+ defaultValue?: boolean;
26
+ }
27
+ /**
28
+ * Represents the user's consent settings
29
+ */
30
+ export interface ConsentSettings {
31
+ /**
32
+ * Map of consent option IDs to boolean values indicating consent status
33
+ */
34
+ consents: Record<string, boolean>;
35
+ /**
36
+ * Timestamp when consent was last updated
37
+ */
38
+ timestamp: number;
39
+ /**
40
+ * Version of the consent form that was accepted
41
+ */
42
+ version: string;
43
+ /**
44
+ * Method used to collect consent (e.g., "banner", "settings", "api")
45
+ */
46
+ method: string;
47
+ /**
48
+ * Whether the user has actively made a choice (as opposed to default settings)
49
+ */
50
+ hasInteracted: boolean;
51
+ }
52
+ /**
53
+ * Represents the storage mechanism for consent settings
54
+ */
55
+ export interface ConsentStorageOptions {
56
+ /**
57
+ * Storage key for consent settings
58
+ * @default "ndpr_consent"
59
+ */
60
+ storageKey?: string;
61
+ /**
62
+ * Storage type to use
63
+ * @default "localStorage"
64
+ */
65
+ storageType?: 'localStorage' | 'sessionStorage' | 'cookie';
66
+ /**
67
+ * Cookie options (only used when storageType is "cookie")
68
+ */
69
+ cookieOptions?: {
70
+ /**
71
+ * Domain for the cookie
72
+ */
73
+ domain?: string;
74
+ /**
75
+ * Path for the cookie
76
+ * @default "/"
77
+ */
78
+ path?: string;
79
+ /**
80
+ * Expiration days for the cookie
81
+ * @default 365
82
+ */
83
+ expires?: number;
84
+ /**
85
+ * Whether the cookie should be secure
86
+ * @default true
87
+ */
88
+ secure?: boolean;
89
+ /**
90
+ * SameSite attribute for the cookie
91
+ * @default "Lax"
92
+ */
93
+ sameSite?: 'Strict' | 'Lax' | 'None';
94
+ };
95
+ }
@@ -0,0 +1,196 @@
1
+ /**
2
+ * Represents a question in the DPIA questionnaire
3
+ */
4
+ export interface DPIAQuestion {
5
+ /**
6
+ * Unique identifier for the question
7
+ */
8
+ id: string;
9
+ /**
10
+ * The text of the question
11
+ */
12
+ text: string;
13
+ /**
14
+ * Additional guidance for answering the question
15
+ */
16
+ guidance?: string;
17
+ /**
18
+ * Type of input required for the answer
19
+ */
20
+ type: 'text' | 'textarea' | 'select' | 'radio' | 'checkbox' | 'scale';
21
+ /**
22
+ * Options for select, radio, or checkbox questions
23
+ */
24
+ options?: Array<{
25
+ value: string;
26
+ label: string;
27
+ riskLevel?: 'low' | 'medium' | 'high';
28
+ }>;
29
+ /**
30
+ * For scale questions, the minimum value
31
+ */
32
+ minValue?: number;
33
+ /**
34
+ * For scale questions, the maximum value
35
+ */
36
+ maxValue?: number;
37
+ /**
38
+ * For scale questions, labels for the scale points
39
+ */
40
+ scaleLabels?: Record<number, string>;
41
+ /**
42
+ * Whether the question is required
43
+ */
44
+ required: boolean;
45
+ /**
46
+ * Risk level associated with this question
47
+ */
48
+ riskLevel?: 'low' | 'medium' | 'high';
49
+ /**
50
+ * Whether this question triggers additional questions based on the answer
51
+ */
52
+ hasDependentQuestions?: boolean;
53
+ /**
54
+ * Conditions that determine when this question should be shown
55
+ */
56
+ showWhen?: Array<{
57
+ questionId: string;
58
+ operator: 'equals' | 'contains' | 'greaterThan' | 'lessThan';
59
+ value: any;
60
+ }>;
61
+ }
62
+ /**
63
+ * Represents a section in the DPIA questionnaire
64
+ */
65
+ export interface DPIASection {
66
+ /**
67
+ * Unique identifier for the section
68
+ */
69
+ id: string;
70
+ /**
71
+ * Title of the section
72
+ */
73
+ title: string;
74
+ /**
75
+ * Description of the section
76
+ */
77
+ description?: string;
78
+ /**
79
+ * Questions in this section
80
+ */
81
+ questions: DPIAQuestion[];
82
+ /**
83
+ * Order of the section in the questionnaire
84
+ */
85
+ order: number;
86
+ }
87
+ /**
88
+ * Represents a risk identified in the DPIA
89
+ */
90
+ export interface DPIARisk {
91
+ /**
92
+ * Unique identifier for the risk
93
+ */
94
+ id: string;
95
+ /**
96
+ * Description of the risk
97
+ */
98
+ description: string;
99
+ /**
100
+ * Likelihood of the risk occurring (1-5)
101
+ */
102
+ likelihood: number;
103
+ /**
104
+ * Impact if the risk occurs (1-5)
105
+ */
106
+ impact: number;
107
+ /**
108
+ * Overall risk score (likelihood * impact)
109
+ */
110
+ score: number;
111
+ /**
112
+ * Risk level based on the score
113
+ */
114
+ level: 'low' | 'medium' | 'high' | 'critical';
115
+ /**
116
+ * Measures to mitigate the risk
117
+ */
118
+ mitigationMeasures?: string[];
119
+ /**
120
+ * Whether the risk has been mitigated
121
+ */
122
+ mitigated: boolean;
123
+ /**
124
+ * Residual risk score after mitigation
125
+ */
126
+ residualScore?: number;
127
+ /**
128
+ * Questions that identified this risk
129
+ */
130
+ relatedQuestionIds: string[];
131
+ }
132
+ /**
133
+ * Represents the result of a completed DPIA
134
+ */
135
+ export interface DPIAResult {
136
+ /**
137
+ * Unique identifier for the DPIA
138
+ */
139
+ id: string;
140
+ /**
141
+ * Title of the DPIA
142
+ */
143
+ title: string;
144
+ /**
145
+ * Description of the processing activity being assessed
146
+ */
147
+ processingDescription: string;
148
+ /**
149
+ * Timestamp when the DPIA was started
150
+ */
151
+ startedAt: number;
152
+ /**
153
+ * Timestamp when the DPIA was completed
154
+ */
155
+ completedAt?: number;
156
+ /**
157
+ * Person responsible for conducting the DPIA
158
+ */
159
+ assessor: {
160
+ name: string;
161
+ role: string;
162
+ email: string;
163
+ };
164
+ /**
165
+ * Answers to all questions in the DPIA
166
+ */
167
+ answers: Record<string, any>;
168
+ /**
169
+ * Risks identified in the DPIA
170
+ */
171
+ risks: DPIARisk[];
172
+ /**
173
+ * Overall risk level of the processing activity
174
+ */
175
+ overallRiskLevel: 'low' | 'medium' | 'high' | 'critical';
176
+ /**
177
+ * Whether the DPIA concluded that the processing can proceed
178
+ */
179
+ canProceed: boolean;
180
+ /**
181
+ * Reasons why the processing can or cannot proceed
182
+ */
183
+ conclusion: string;
184
+ /**
185
+ * Recommendations for the processing activity
186
+ */
187
+ recommendations?: string[];
188
+ /**
189
+ * Next review date for the DPIA
190
+ */
191
+ reviewDate?: number;
192
+ /**
193
+ * Version of the DPIA questionnaire used
194
+ */
195
+ version: string;
196
+ }
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Represents a type of data subject request
3
+ */
4
+ export type DSRType = 'access' | 'rectification' | 'erasure' | 'restriction' | 'portability' | 'objection';
5
+ /**
6
+ * Status of a data subject request
7
+ */
8
+ export type DSRStatus = 'pending' | 'awaitingVerification' | 'inProgress' | 'completed' | 'rejected';
9
+ /**
10
+ * Represents a type of data subject request (detailed configuration)
11
+ */
12
+ export interface RequestType {
13
+ /**
14
+ * Unique identifier for the request type
15
+ */
16
+ id: string;
17
+ /**
18
+ * Display name for the request type
19
+ */
20
+ name: string;
21
+ /**
22
+ * Description of what this request type entails
23
+ */
24
+ description: string;
25
+ /**
26
+ * Estimated time to fulfill this type of request (in days)
27
+ */
28
+ estimatedCompletionTime: number;
29
+ /**
30
+ * Whether additional information is required for this request type
31
+ */
32
+ requiresAdditionalInfo: boolean;
33
+ /**
34
+ * Custom fields required for this request type
35
+ */
36
+ additionalFields?: Array<{
37
+ id: string;
38
+ label: string;
39
+ type: 'text' | 'textarea' | 'select' | 'checkbox' | 'file';
40
+ options?: string[];
41
+ required: boolean;
42
+ placeholder?: string;
43
+ }>;
44
+ }
45
+ /**
46
+ * Legacy status of a data subject request
47
+ * @deprecated Use DSRStatus instead
48
+ */
49
+ export type RequestStatus = 'pending' | 'verifying' | 'processing' | 'completed' | 'rejected';
50
+ /**
51
+ * Represents a data subject request
52
+ */
53
+ export interface DSRRequest {
54
+ /**
55
+ * Unique identifier for the request
56
+ */
57
+ id: string;
58
+ /**
59
+ * Type of request
60
+ */
61
+ type: DSRType;
62
+ /**
63
+ * Current status of the request
64
+ */
65
+ status: DSRStatus;
66
+ /**
67
+ * Timestamp when the request was submitted
68
+ */
69
+ createdAt: number;
70
+ /**
71
+ * Timestamp when the request was last updated
72
+ */
73
+ updatedAt: number;
74
+ /**
75
+ * Timestamp when the request was completed (if applicable)
76
+ */
77
+ completedAt?: number;
78
+ /**
79
+ * Timestamp when the identity was verified (if applicable)
80
+ */
81
+ verifiedAt?: number;
82
+ /**
83
+ * Due date for responding to the request (timestamp)
84
+ */
85
+ dueDate?: number;
86
+ /**
87
+ * Description or details of the request
88
+ */
89
+ description?: string;
90
+ /**
91
+ * Data subject information
92
+ */
93
+ subject: {
94
+ /**
95
+ * Name of the data subject
96
+ */
97
+ name: string;
98
+ /**
99
+ * Email address of the data subject
100
+ */
101
+ email: string;
102
+ /**
103
+ * Phone number of the data subject (optional)
104
+ */
105
+ phone?: string;
106
+ /**
107
+ * Identifier used to verify the data subject's identity (optional)
108
+ */
109
+ identifierValue?: string;
110
+ /**
111
+ * Type of identifier used (e.g., "email", "account", "customer_id") (optional)
112
+ */
113
+ identifierType?: string;
114
+ };
115
+ /**
116
+ * Additional information provided by the data subject
117
+ */
118
+ additionalInfo?: Record<string, any>;
119
+ /**
120
+ * Notes added by staff processing the request
121
+ */
122
+ internalNotes?: Array<{
123
+ timestamp: number;
124
+ author: string;
125
+ note: string;
126
+ }>;
127
+ /**
128
+ * Verification status
129
+ */
130
+ verification?: {
131
+ /**
132
+ * Whether the identity has been verified
133
+ */
134
+ verified: boolean;
135
+ /**
136
+ * Method used for verification
137
+ */
138
+ method?: string;
139
+ /**
140
+ * Timestamp when verification was completed
141
+ */
142
+ verifiedAt?: number;
143
+ /**
144
+ * Staff member who performed the verification
145
+ */
146
+ verifiedBy?: string;
147
+ };
148
+ /**
149
+ * Reason for rejection (if status is 'rejected')
150
+ */
151
+ rejectionReason?: string;
152
+ /**
153
+ * Files attached to the request (e.g., exported data, verification documents)
154
+ */
155
+ attachments?: Array<{
156
+ id: string;
157
+ name: string;
158
+ type: string;
159
+ url: string;
160
+ addedAt: number;
161
+ }>;
162
+ }