@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.
- package/README.md +412 -0
- package/dist/components/breach/BreachNotificationManager.d.ts +62 -0
- package/dist/components/breach/BreachReportForm.d.ts +66 -0
- package/dist/components/breach/BreachRiskAssessment.d.ts +50 -0
- package/dist/components/breach/RegulatoryReportGenerator.d.ts +94 -0
- package/dist/components/consent/ConsentBanner.d.ts +79 -0
- package/dist/components/consent/ConsentManager.d.ts +73 -0
- package/dist/components/consent/ConsentStorage.d.ts +41 -0
- package/dist/components/dpia/DPIAQuestionnaire.d.ts +70 -0
- package/dist/components/dpia/DPIAReport.d.ts +40 -0
- package/dist/components/dpia/StepIndicator.d.ts +64 -0
- package/dist/components/dsr/DSRDashboard.d.ts +58 -0
- package/dist/components/dsr/DSRRequestForm.d.ts +74 -0
- package/dist/components/dsr/DSRTracker.d.ts +56 -0
- package/dist/components/policy/PolicyExporter.d.ts +65 -0
- package/dist/components/policy/PolicyGenerator.d.ts +54 -0
- package/dist/components/policy/PolicyPreview.d.ts +71 -0
- package/dist/hooks/useBreach.d.ts +97 -0
- package/dist/hooks/useConsent.d.ts +63 -0
- package/dist/hooks/useDPIA.d.ts +92 -0
- package/dist/hooks/useDSR.d.ts +72 -0
- package/dist/hooks/usePrivacyPolicy.d.ts +87 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/setupTests.d.ts +2 -0
- package/dist/types/breach.d.ts +239 -0
- package/dist/types/consent.d.ts +95 -0
- package/dist/types/dpia.d.ts +196 -0
- package/dist/types/dsr.d.ts +162 -0
- package/dist/types/privacy.d.ts +204 -0
- package/dist/utils/breach.d.ts +14 -0
- package/dist/utils/consent.d.ts +10 -0
- package/dist/utils/dpia.d.ts +12 -0
- package/dist/utils/dsr.d.ts +11 -0
- package/dist/utils/privacy.d.ts +12 -0
- package/package.json +71 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a section in a privacy policy
|
|
3
|
+
*/
|
|
4
|
+
export interface PolicySection {
|
|
5
|
+
/**
|
|
6
|
+
* Unique identifier for the section
|
|
7
|
+
*/
|
|
8
|
+
id: string;
|
|
9
|
+
/**
|
|
10
|
+
* Title of the section
|
|
11
|
+
*/
|
|
12
|
+
title: string;
|
|
13
|
+
/**
|
|
14
|
+
* Description of the section
|
|
15
|
+
*/
|
|
16
|
+
description?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Order of the section in the policy
|
|
19
|
+
*/
|
|
20
|
+
order?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Whether the section is required by NDPR
|
|
23
|
+
*/
|
|
24
|
+
required: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Template text for the section
|
|
27
|
+
*/
|
|
28
|
+
template: string;
|
|
29
|
+
/**
|
|
30
|
+
* Default content for the section (legacy field)
|
|
31
|
+
* @deprecated Use template instead
|
|
32
|
+
*/
|
|
33
|
+
defaultContent?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Custom content for the section (overrides default content)
|
|
36
|
+
* @deprecated Use template instead
|
|
37
|
+
*/
|
|
38
|
+
customContent?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Whether the section is included in the policy
|
|
41
|
+
*/
|
|
42
|
+
included: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Variables that can be used in the section content
|
|
45
|
+
*/
|
|
46
|
+
variables?: string[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Represents a privacy policy template
|
|
50
|
+
*/
|
|
51
|
+
export interface PolicyTemplate {
|
|
52
|
+
/**
|
|
53
|
+
* Unique identifier for the template
|
|
54
|
+
*/
|
|
55
|
+
id: string;
|
|
56
|
+
/**
|
|
57
|
+
* Name of the template
|
|
58
|
+
*/
|
|
59
|
+
name: string;
|
|
60
|
+
/**
|
|
61
|
+
* Description of the template
|
|
62
|
+
*/
|
|
63
|
+
description: string;
|
|
64
|
+
/**
|
|
65
|
+
* Type of organization the template is designed for
|
|
66
|
+
*/
|
|
67
|
+
organizationType: 'business' | 'nonprofit' | 'government' | 'educational';
|
|
68
|
+
/**
|
|
69
|
+
* Sections included in the template
|
|
70
|
+
*/
|
|
71
|
+
sections: PolicySection[];
|
|
72
|
+
/**
|
|
73
|
+
* Variables used across the template
|
|
74
|
+
*/
|
|
75
|
+
variables: Record<string, {
|
|
76
|
+
name: string;
|
|
77
|
+
description: string;
|
|
78
|
+
required: boolean;
|
|
79
|
+
defaultValue?: string;
|
|
80
|
+
}>;
|
|
81
|
+
/**
|
|
82
|
+
* Version of the template
|
|
83
|
+
*/
|
|
84
|
+
version: string;
|
|
85
|
+
/**
|
|
86
|
+
* Last updated date of the template
|
|
87
|
+
*/
|
|
88
|
+
lastUpdated: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Represents organization information for a privacy policy
|
|
92
|
+
*/
|
|
93
|
+
export interface OrganizationInfo {
|
|
94
|
+
/**
|
|
95
|
+
* Name of the organization
|
|
96
|
+
*/
|
|
97
|
+
name: string;
|
|
98
|
+
/**
|
|
99
|
+
* Website URL of the organization
|
|
100
|
+
*/
|
|
101
|
+
website: string;
|
|
102
|
+
/**
|
|
103
|
+
* Contact email for privacy inquiries
|
|
104
|
+
*/
|
|
105
|
+
privacyEmail: string;
|
|
106
|
+
/**
|
|
107
|
+
* Physical address of the organization
|
|
108
|
+
*/
|
|
109
|
+
address?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Phone number for privacy inquiries
|
|
112
|
+
*/
|
|
113
|
+
privacyPhone?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Name of the Data Protection Officer (if applicable)
|
|
116
|
+
*/
|
|
117
|
+
dpoName?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Email of the Data Protection Officer (if applicable)
|
|
120
|
+
*/
|
|
121
|
+
dpoEmail?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Industry or sector of the organization
|
|
124
|
+
*/
|
|
125
|
+
industry?: string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Represents a variable in a privacy policy
|
|
129
|
+
*/
|
|
130
|
+
export interface PolicyVariable {
|
|
131
|
+
/**
|
|
132
|
+
* Unique identifier for the variable
|
|
133
|
+
*/
|
|
134
|
+
id: string;
|
|
135
|
+
/**
|
|
136
|
+
* Name of the variable as it appears in the template
|
|
137
|
+
*/
|
|
138
|
+
name: string;
|
|
139
|
+
/**
|
|
140
|
+
* Description of the variable
|
|
141
|
+
*/
|
|
142
|
+
description: string;
|
|
143
|
+
/**
|
|
144
|
+
* Default value for the variable
|
|
145
|
+
*/
|
|
146
|
+
defaultValue?: string;
|
|
147
|
+
/**
|
|
148
|
+
* Current value of the variable
|
|
149
|
+
*/
|
|
150
|
+
value: string;
|
|
151
|
+
/**
|
|
152
|
+
* Type of input for the variable
|
|
153
|
+
*/
|
|
154
|
+
inputType: 'text' | 'textarea' | 'email' | 'url' | 'date' | 'select';
|
|
155
|
+
/**
|
|
156
|
+
* Options for select inputs
|
|
157
|
+
*/
|
|
158
|
+
options?: string[];
|
|
159
|
+
/**
|
|
160
|
+
* Whether the variable is required
|
|
161
|
+
*/
|
|
162
|
+
required: boolean;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Represents a generated privacy policy
|
|
166
|
+
*/
|
|
167
|
+
export interface PrivacyPolicy {
|
|
168
|
+
/**
|
|
169
|
+
* Unique identifier for the policy
|
|
170
|
+
*/
|
|
171
|
+
id: string;
|
|
172
|
+
/**
|
|
173
|
+
* Title of the policy
|
|
174
|
+
*/
|
|
175
|
+
title: string;
|
|
176
|
+
/**
|
|
177
|
+
* Template used to generate the policy
|
|
178
|
+
*/
|
|
179
|
+
templateId: string;
|
|
180
|
+
/**
|
|
181
|
+
* Organization information
|
|
182
|
+
*/
|
|
183
|
+
organizationInfo: OrganizationInfo;
|
|
184
|
+
/**
|
|
185
|
+
* Sections of the policy
|
|
186
|
+
*/
|
|
187
|
+
sections: PolicySection[];
|
|
188
|
+
/**
|
|
189
|
+
* Values for the variables used in the policy
|
|
190
|
+
*/
|
|
191
|
+
variableValues: Record<string, string>;
|
|
192
|
+
/**
|
|
193
|
+
* Effective date of the policy
|
|
194
|
+
*/
|
|
195
|
+
effectiveDate: number;
|
|
196
|
+
/**
|
|
197
|
+
* Last updated date of the policy
|
|
198
|
+
*/
|
|
199
|
+
lastUpdated: number;
|
|
200
|
+
/**
|
|
201
|
+
* Version of the policy
|
|
202
|
+
*/
|
|
203
|
+
version: string;
|
|
204
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BreachReport, RiskAssessment } from '../types/breach';
|
|
2
|
+
/**
|
|
3
|
+
* Calculates the severity of a data breach based on various factors
|
|
4
|
+
* @param report The breach report
|
|
5
|
+
* @param assessment The risk assessment (if available)
|
|
6
|
+
* @returns The calculated severity and notification requirements
|
|
7
|
+
*/
|
|
8
|
+
export declare function calculateBreachSeverity(report: BreachReport, assessment?: RiskAssessment): {
|
|
9
|
+
severityLevel: 'low' | 'medium' | 'high' | 'critical';
|
|
10
|
+
notificationRequired: boolean;
|
|
11
|
+
urgentNotificationRequired: boolean;
|
|
12
|
+
timeframeHours: number;
|
|
13
|
+
justification: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ConsentSettings } from '../types/consent';
|
|
2
|
+
/**
|
|
3
|
+
* Validates consent settings to ensure they meet NDPR requirements
|
|
4
|
+
* @param settings The consent settings to validate
|
|
5
|
+
* @returns An object containing validation result and any error messages
|
|
6
|
+
*/
|
|
7
|
+
export declare function validateConsent(settings: ConsentSettings): {
|
|
8
|
+
valid: boolean;
|
|
9
|
+
errors: string[];
|
|
10
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DPIAResult } from '../types/dpia';
|
|
2
|
+
/**
|
|
3
|
+
* Assesses the risk level of a DPIA based on the identified risks
|
|
4
|
+
* @param dpiaResult The DPIA result containing risks to assess
|
|
5
|
+
* @returns Assessment result with overall risk level and recommendations
|
|
6
|
+
*/
|
|
7
|
+
export declare function assessDPIARisk(dpiaResult: DPIAResult): {
|
|
8
|
+
overallRiskLevel: 'low' | 'medium' | 'high' | 'critical';
|
|
9
|
+
requiresConsultation: boolean;
|
|
10
|
+
canProceed: boolean;
|
|
11
|
+
recommendations: string[];
|
|
12
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DSRRequest } from '../types/dsr';
|
|
2
|
+
/**
|
|
3
|
+
* Formats a DSR request for display or submission
|
|
4
|
+
* @param request The DSR request to format
|
|
5
|
+
* @returns Formatted request data
|
|
6
|
+
*/
|
|
7
|
+
export declare function formatDSRRequest(request: DSRRequest): {
|
|
8
|
+
formattedRequest: Record<string, any>;
|
|
9
|
+
isValid: boolean;
|
|
10
|
+
validationErrors: string[];
|
|
11
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PolicySection, OrganizationInfo } from '../types/privacy';
|
|
2
|
+
/**
|
|
3
|
+
* Generates policy text by replacing variables in a template with organization-specific values
|
|
4
|
+
* @param sectionsOrTemplate The policy sections or template string to generate text for
|
|
5
|
+
* @param organizationInfoOrVariables The organization information or variable map to use for replacement
|
|
6
|
+
* @returns The generated policy text or an object with the generated text and metadata
|
|
7
|
+
*/
|
|
8
|
+
export declare function generatePolicyText(sectionsOrTemplate: PolicySection[] | string, organizationInfoOrVariables: OrganizationInfo | Record<string, string>): string | {
|
|
9
|
+
fullText: string;
|
|
10
|
+
sectionTexts: Record<string, string>;
|
|
11
|
+
missingVariables: string[];
|
|
12
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tantainnovative/ndpr-toolkit",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A comprehensive toolkit for implementing NDPR-compliant features in web applications",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.esm.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "rollup -c",
|
|
13
|
+
"dev": "rollup -c -w",
|
|
14
|
+
"test": "jest",
|
|
15
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
16
|
+
"prepublishOnly": "npm run build"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"ndpr",
|
|
20
|
+
"data-protection",
|
|
21
|
+
"privacy",
|
|
22
|
+
"compliance",
|
|
23
|
+
"nigeria",
|
|
24
|
+
"consent",
|
|
25
|
+
"dpia",
|
|
26
|
+
"data-subject-rights",
|
|
27
|
+
"breach-notification"
|
|
28
|
+
],
|
|
29
|
+
"author": "Tanta Innovative",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/tantainnovative/ndpr-toolkit"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"react": "^18.0.0",
|
|
40
|
+
"react-dom": "^18.0.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@rollup/plugin-commonjs": "^22.0.0",
|
|
44
|
+
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
45
|
+
"@rollup/plugin-typescript": "^8.3.2",
|
|
46
|
+
"@testing-library/jest-dom": "^5.17.0",
|
|
47
|
+
"@testing-library/react": "^13.4.0",
|
|
48
|
+
"@testing-library/react-hooks": "^8.0.1",
|
|
49
|
+
"@testing-library/user-event": "^14.6.1",
|
|
50
|
+
"@types/jest": "^28.1.6",
|
|
51
|
+
"@types/react": "^18.0.0",
|
|
52
|
+
"@types/react-dom": "^18.0.0",
|
|
53
|
+
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
|
54
|
+
"@typescript-eslint/parser": "^5.27.0",
|
|
55
|
+
"eslint": "^8.16.0",
|
|
56
|
+
"eslint-plugin-react": "^7.30.0",
|
|
57
|
+
"eslint-plugin-react-hooks": "^4.5.0",
|
|
58
|
+
"identity-obj-proxy": "^3.0.0",
|
|
59
|
+
"jest": "^28.1.0",
|
|
60
|
+
"jest-environment-jsdom": "^28.1.3",
|
|
61
|
+
"react-test-renderer": "^18.2.0",
|
|
62
|
+
"rollup": "^2.75.5",
|
|
63
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
64
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
65
|
+
"ts-jest": "^28.0.8",
|
|
66
|
+
"typescript": "^4.7.2"
|
|
67
|
+
},
|
|
68
|
+
"dependencies": {
|
|
69
|
+
"tslib": "^2.4.0"
|
|
70
|
+
}
|
|
71
|
+
}
|