@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,71 @@
1
+ import React from 'react';
2
+ import { PolicySection, PolicyVariable } from '../../types/privacy';
3
+ export interface PolicyPreviewProps {
4
+ /**
5
+ * The policy content to preview
6
+ */
7
+ content: string;
8
+ /**
9
+ * The policy sections
10
+ */
11
+ sections?: PolicySection[];
12
+ /**
13
+ * The policy variables
14
+ */
15
+ variables?: PolicyVariable[];
16
+ /**
17
+ * Callback function called when the policy is exported
18
+ */
19
+ onExport?: (format: 'pdf' | 'html' | 'markdown' | 'docx') => void;
20
+ /**
21
+ * Callback function called when the policy is edited
22
+ */
23
+ onEdit?: () => void;
24
+ /**
25
+ * Title displayed on the preview
26
+ * @default "Privacy Policy Preview"
27
+ */
28
+ title?: string;
29
+ /**
30
+ * Description text displayed on the preview
31
+ * @default "Preview your NDPR-compliant privacy policy before exporting."
32
+ */
33
+ description?: string;
34
+ /**
35
+ * Custom CSS class for the preview
36
+ */
37
+ className?: string;
38
+ /**
39
+ * Custom CSS class for the buttons
40
+ */
41
+ buttonClassName?: string;
42
+ /**
43
+ * Whether to show the export options
44
+ * @default true
45
+ */
46
+ showExportOptions?: boolean;
47
+ /**
48
+ * Whether to show the edit button
49
+ * @default true
50
+ */
51
+ showEditButton?: boolean;
52
+ /**
53
+ * Whether to show the table of contents
54
+ * @default true
55
+ */
56
+ showTableOfContents?: boolean;
57
+ /**
58
+ * Whether to show the policy metadata
59
+ * @default true
60
+ */
61
+ showMetadata?: boolean;
62
+ /**
63
+ * The organization name to display in the policy
64
+ */
65
+ organizationName?: string;
66
+ /**
67
+ * The last updated date to display in the policy
68
+ */
69
+ lastUpdated?: Date;
70
+ }
71
+ export declare const PolicyPreview: React.FC<PolicyPreviewProps>;
@@ -0,0 +1,97 @@
1
+ import { BreachReport, BreachCategory, RiskAssessment, NotificationRequirement, RegulatoryNotification } from '../types/breach';
2
+ interface UseBreachOptions {
3
+ /**
4
+ * Available breach categories
5
+ */
6
+ categories: BreachCategory[];
7
+ /**
8
+ * Initial breach reports
9
+ */
10
+ initialReports?: BreachReport[];
11
+ /**
12
+ * Storage key for breach data
13
+ * @default "ndpr_breach_data"
14
+ */
15
+ storageKey?: string;
16
+ /**
17
+ * Whether to use local storage to persist breach data
18
+ * @default true
19
+ */
20
+ useLocalStorage?: boolean;
21
+ /**
22
+ * Callback function called when a breach is reported
23
+ */
24
+ onReport?: (report: BreachReport) => void;
25
+ /**
26
+ * Callback function called when a risk assessment is completed
27
+ */
28
+ onAssessment?: (assessment: RiskAssessment) => void;
29
+ /**
30
+ * Callback function called when a notification is sent
31
+ */
32
+ onNotification?: (notification: RegulatoryNotification) => void;
33
+ }
34
+ interface UseBreachReturn {
35
+ /**
36
+ * All breach reports
37
+ */
38
+ reports: BreachReport[];
39
+ /**
40
+ * All risk assessments
41
+ */
42
+ assessments: RiskAssessment[];
43
+ /**
44
+ * All regulatory notifications
45
+ */
46
+ notifications: RegulatoryNotification[];
47
+ /**
48
+ * Submit a new breach report
49
+ */
50
+ reportBreach: (reportData: Omit<BreachReport, 'id' | 'reportedAt'>) => BreachReport;
51
+ /**
52
+ * Update an existing breach report
53
+ */
54
+ updateReport: (id: string, updates: Partial<BreachReport>) => BreachReport | null;
55
+ /**
56
+ * Get a breach report by ID
57
+ */
58
+ getReport: (id: string) => BreachReport | null;
59
+ /**
60
+ * Conduct a risk assessment for a breach
61
+ */
62
+ assessRisk: (breachId: string, assessmentData: Omit<RiskAssessment, 'id' | 'breachId' | 'assessedAt'>) => RiskAssessment;
63
+ /**
64
+ * Get a risk assessment for a breach
65
+ */
66
+ getAssessment: (breachId: string) => RiskAssessment | null;
67
+ /**
68
+ * Calculate notification requirements based on a risk assessment
69
+ */
70
+ calculateNotificationRequirements: (breachId: string) => NotificationRequirement | null;
71
+ /**
72
+ * Send a regulatory notification
73
+ */
74
+ sendNotification: (breachId: string, notificationData: Omit<RegulatoryNotification, 'id' | 'breachId' | 'sentAt'>) => RegulatoryNotification;
75
+ /**
76
+ * Get a regulatory notification for a breach
77
+ */
78
+ getNotification: (breachId: string) => RegulatoryNotification | null;
79
+ /**
80
+ * Get breaches that require notification within the next X hours
81
+ */
82
+ getBreachesRequiringNotification: (hoursThreshold?: number) => Array<{
83
+ report: BreachReport;
84
+ assessment: RiskAssessment;
85
+ requirements: NotificationRequirement;
86
+ hoursRemaining: number;
87
+ }>;
88
+ /**
89
+ * Clear all breach data
90
+ */
91
+ clearBreachData: () => void;
92
+ }
93
+ /**
94
+ * Hook for managing data breach notifications in compliance with NDPR
95
+ */
96
+ export declare function useBreach({ categories, initialReports, storageKey, useLocalStorage, onReport, onAssessment, onNotification }: UseBreachOptions): UseBreachReturn;
97
+ export {};
@@ -0,0 +1,63 @@
1
+ import { ConsentOption, ConsentSettings, ConsentStorageOptions } from '../types/consent';
2
+ interface UseConsentOptions {
3
+ /**
4
+ * Consent options to present to the user
5
+ */
6
+ options: ConsentOption[];
7
+ /**
8
+ * Storage options for consent settings
9
+ */
10
+ storageOptions?: ConsentStorageOptions;
11
+ /**
12
+ * Version of the consent form
13
+ * @default "1.0"
14
+ */
15
+ version?: string;
16
+ /**
17
+ * Callback function called when consent settings change
18
+ */
19
+ onChange?: (settings: ConsentSettings) => void;
20
+ }
21
+ interface UseConsentReturn {
22
+ /**
23
+ * Current consent settings
24
+ */
25
+ settings: ConsentSettings | null;
26
+ /**
27
+ * Whether consent has been given for a specific option
28
+ */
29
+ hasConsent: (optionId: string) => boolean;
30
+ /**
31
+ * Update consent settings
32
+ */
33
+ updateConsent: (consents: Record<string, boolean>) => void;
34
+ /**
35
+ * Accept all consent options
36
+ */
37
+ acceptAll: () => void;
38
+ /**
39
+ * Reject all non-required consent options
40
+ */
41
+ rejectAll: () => void;
42
+ /**
43
+ * Whether the consent banner should be shown
44
+ */
45
+ shouldShowBanner: boolean;
46
+ /**
47
+ * Whether consent settings are valid
48
+ */
49
+ isValid: boolean;
50
+ /**
51
+ * Validation errors (if any)
52
+ */
53
+ validationErrors: string[];
54
+ /**
55
+ * Reset consent settings (clear from storage)
56
+ */
57
+ resetConsent: () => void;
58
+ }
59
+ /**
60
+ * Hook for managing user consent in compliance with NDPR
61
+ */
62
+ export declare function useConsent({ options, storageOptions, version, onChange }: UseConsentOptions): UseConsentReturn;
63
+ export {};
@@ -0,0 +1,92 @@
1
+ import { DPIAQuestion, DPIASection, DPIAResult } from '../types/dpia';
2
+ interface UseDPIAOptions {
3
+ /**
4
+ * Sections of the DPIA questionnaire
5
+ */
6
+ sections: DPIASection[];
7
+ /**
8
+ * Initial answers (if resuming a DPIA)
9
+ */
10
+ initialAnswers?: Record<string, any>;
11
+ /**
12
+ * Storage key for DPIA data
13
+ * @default "ndpr_dpia_data"
14
+ */
15
+ storageKey?: string;
16
+ /**
17
+ * Whether to use local storage to persist DPIA data
18
+ * @default true
19
+ */
20
+ useLocalStorage?: boolean;
21
+ /**
22
+ * Callback function called when the DPIA is completed
23
+ */
24
+ onComplete?: (result: DPIAResult) => void;
25
+ }
26
+ interface UseDPIAReturn {
27
+ /**
28
+ * Current section index
29
+ */
30
+ currentSectionIndex: number;
31
+ /**
32
+ * Current section
33
+ */
34
+ currentSection: DPIASection | null;
35
+ /**
36
+ * All answers
37
+ */
38
+ answers: Record<string, any>;
39
+ /**
40
+ * Update an answer
41
+ */
42
+ updateAnswer: (questionId: string, value: any) => void;
43
+ /**
44
+ * Go to the next section
45
+ */
46
+ nextSection: () => boolean;
47
+ /**
48
+ * Go to the previous section
49
+ */
50
+ prevSection: () => boolean;
51
+ /**
52
+ * Go to a specific section
53
+ */
54
+ goToSection: (index: number) => boolean;
55
+ /**
56
+ * Check if the current section is valid
57
+ */
58
+ isCurrentSectionValid: () => boolean;
59
+ /**
60
+ * Get validation errors for the current section
61
+ */
62
+ getCurrentSectionErrors: () => Record<string, string>;
63
+ /**
64
+ * Check if the DPIA is complete
65
+ */
66
+ isComplete: () => boolean;
67
+ /**
68
+ * Complete the DPIA and generate a result
69
+ */
70
+ completeDPIA: (assessorInfo: {
71
+ name: string;
72
+ role: string;
73
+ email: string;
74
+ }, title: string, processingDescription: string) => DPIAResult;
75
+ /**
76
+ * Get the visible questions for the current section
77
+ */
78
+ getVisibleQuestions: () => DPIAQuestion[];
79
+ /**
80
+ * Reset the DPIA
81
+ */
82
+ resetDPIA: () => void;
83
+ /**
84
+ * Progress percentage
85
+ */
86
+ progress: number;
87
+ }
88
+ /**
89
+ * Hook for conducting Data Protection Impact Assessments in compliance with NDPR
90
+ */
91
+ export declare function useDPIA({ sections, initialAnswers, storageKey, useLocalStorage, onComplete }: UseDPIAOptions): UseDPIAReturn;
92
+ export {};
@@ -0,0 +1,72 @@
1
+ import { DSRRequest, RequestStatus, RequestType } from '../types/dsr';
2
+ interface UseDSROptions {
3
+ /**
4
+ * Initial requests to load
5
+ */
6
+ initialRequests?: DSRRequest[];
7
+ /**
8
+ * Available request types
9
+ */
10
+ requestTypes: RequestType[];
11
+ /**
12
+ * Storage key for requests
13
+ * @default "ndpr_dsr_requests"
14
+ */
15
+ storageKey?: string;
16
+ /**
17
+ * Whether to use local storage to persist requests
18
+ * @default true
19
+ */
20
+ useLocalStorage?: boolean;
21
+ /**
22
+ * Callback function called when a request is submitted
23
+ */
24
+ onSubmit?: (request: DSRRequest) => void;
25
+ /**
26
+ * Callback function called when a request is updated
27
+ */
28
+ onUpdate?: (request: DSRRequest) => void;
29
+ }
30
+ interface UseDSRReturn {
31
+ /**
32
+ * All requests
33
+ */
34
+ requests: DSRRequest[];
35
+ /**
36
+ * Submit a new request
37
+ */
38
+ submitRequest: (requestData: Omit<DSRRequest, 'id' | 'status' | 'submittedAt' | 'updatedAt' | 'estimatedCompletionDate'>) => DSRRequest;
39
+ /**
40
+ * Update an existing request
41
+ */
42
+ updateRequest: (id: string, updates: Partial<DSRRequest>) => DSRRequest | null;
43
+ /**
44
+ * Get a request by ID
45
+ */
46
+ getRequest: (id: string) => DSRRequest | null;
47
+ /**
48
+ * Get requests by status
49
+ */
50
+ getRequestsByStatus: (status: RequestStatus) => DSRRequest[];
51
+ /**
52
+ * Get requests by type
53
+ */
54
+ getRequestsByType: (type: string) => DSRRequest[];
55
+ /**
56
+ * Get the request type definition by ID
57
+ */
58
+ getRequestType: (typeId: string) => RequestType | undefined;
59
+ /**
60
+ * Format a request for display or submission
61
+ */
62
+ formatRequest: (request: DSRRequest) => Record<string, any>;
63
+ /**
64
+ * Clear all requests
65
+ */
66
+ clearRequests: () => void;
67
+ }
68
+ /**
69
+ * Hook for managing Data Subject Requests in compliance with NDPR
70
+ */
71
+ export declare function useDSR({ initialRequests, requestTypes, storageKey, useLocalStorage, onSubmit, onUpdate }: UseDSROptions): UseDSRReturn;
72
+ export {};
@@ -0,0 +1,87 @@
1
+ import { PolicyTemplate, OrganizationInfo, PrivacyPolicy } from '../types/privacy';
2
+ interface UsePrivacyPolicyOptions {
3
+ /**
4
+ * Available policy templates
5
+ */
6
+ templates: PolicyTemplate[];
7
+ /**
8
+ * Initial policy data (if editing an existing policy)
9
+ */
10
+ initialPolicy?: PrivacyPolicy;
11
+ /**
12
+ * Storage key for policy data
13
+ * @default "ndpr_privacy_policy"
14
+ */
15
+ storageKey?: string;
16
+ /**
17
+ * Whether to use local storage to persist policy data
18
+ * @default true
19
+ */
20
+ useLocalStorage?: boolean;
21
+ /**
22
+ * Callback function called when a policy is generated
23
+ */
24
+ onGenerate?: (policy: PrivacyPolicy) => void;
25
+ }
26
+ interface UsePrivacyPolicyReturn {
27
+ /**
28
+ * Current policy data
29
+ */
30
+ policy: PrivacyPolicy | null;
31
+ /**
32
+ * Selected template
33
+ */
34
+ selectedTemplate: PolicyTemplate | null;
35
+ /**
36
+ * Organization information
37
+ */
38
+ organizationInfo: OrganizationInfo;
39
+ /**
40
+ * Select a template
41
+ */
42
+ selectTemplate: (templateId: string) => boolean;
43
+ /**
44
+ * Update organization information
45
+ */
46
+ updateOrganizationInfo: (updates: Partial<OrganizationInfo>) => void;
47
+ /**
48
+ * Toggle whether a section is included in the policy
49
+ */
50
+ toggleSection: (sectionId: string, included: boolean) => void;
51
+ /**
52
+ * Update section content
53
+ */
54
+ updateSectionContent: (sectionId: string, content: string) => void;
55
+ /**
56
+ * Update variable values
57
+ */
58
+ updateVariableValue: (variable: string, value: string) => void;
59
+ /**
60
+ * Generate the policy
61
+ */
62
+ generatePolicy: () => PrivacyPolicy;
63
+ /**
64
+ * Get the generated policy text
65
+ */
66
+ getPolicyText: () => {
67
+ fullText: string;
68
+ sectionTexts: Record<string, string>;
69
+ missingVariables: string[];
70
+ };
71
+ /**
72
+ * Reset the policy
73
+ */
74
+ resetPolicy: () => void;
75
+ /**
76
+ * Check if the policy is valid
77
+ */
78
+ isValid: () => {
79
+ valid: boolean;
80
+ errors: string[];
81
+ };
82
+ }
83
+ /**
84
+ * Hook for generating NDPR-compliant privacy policies
85
+ */
86
+ export declare function usePrivacyPolicy({ templates, initialPolicy, storageKey, useLocalStorage, onGenerate }: UsePrivacyPolicyOptions): UsePrivacyPolicyReturn;
87
+ export {};
@@ -0,0 +1,31 @@
1
+ export { ConsentBanner } from './components/consent/ConsentBanner';
2
+ export { ConsentManager } from './components/consent/ConsentManager';
3
+ export { ConsentStorage } from './components/consent/ConsentStorage';
4
+ export type { ConsentOption, ConsentSettings, ConsentStorageOptions } from './types/consent';
5
+ export { DSRRequestForm } from './components/dsr/DSRRequestForm';
6
+ export { DSRDashboard } from './components/dsr/DSRDashboard';
7
+ export { DSRTracker } from './components/dsr/DSRTracker';
8
+ export type { DSRRequest, RequestType, DSRStatus, DSRType, RequestStatus } from './types/dsr';
9
+ export { DPIAQuestionnaire } from './components/dpia/DPIAQuestionnaire';
10
+ export { DPIAReport } from './components/dpia/DPIAReport';
11
+ export { StepIndicator } from './components/dpia/StepIndicator';
12
+ export type { DPIAQuestion, DPIASection, DPIAResult } from './types/dpia';
13
+ export { BreachReportForm } from './components/breach/BreachReportForm';
14
+ export { BreachRiskAssessment } from './components/breach/BreachRiskAssessment';
15
+ export { BreachNotificationManager } from './components/breach/BreachNotificationManager';
16
+ export { RegulatoryReportGenerator } from './components/breach/RegulatoryReportGenerator';
17
+ export type { BreachReport, RiskAssessment, NotificationRequirement } from './types/breach';
18
+ export { PolicyGenerator } from './components/policy/PolicyGenerator';
19
+ export { PolicyPreview } from './components/policy/PolicyPreview';
20
+ export { PolicyExporter } from './components/policy/PolicyExporter';
21
+ export type { PolicySection, PolicyTemplate, PolicyVariable, OrganizationInfo, PrivacyPolicy } from './types/privacy';
22
+ export { validateConsent } from './utils/consent';
23
+ export { formatDSRRequest } from './utils/dsr';
24
+ export { assessDPIARisk } from './utils/dpia';
25
+ export { calculateBreachSeverity } from './utils/breach';
26
+ export { generatePolicyText } from './utils/privacy';
27
+ export { useConsent } from './hooks/useConsent';
28
+ export { useDSR } from './hooks/useDSR';
29
+ export { useDPIA } from './hooks/useDPIA';
30
+ export { useBreach } from './hooks/useBreach';
31
+ export { usePrivacyPolicy } from './hooks/usePrivacyPolicy';