@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,79 @@
1
+ import React from 'react';
2
+ import { ConsentOption, ConsentSettings } from '../../types/consent';
3
+ export interface ConsentBannerProps {
4
+ /**
5
+ * Array of consent options to display
6
+ */
7
+ options: ConsentOption[];
8
+ /**
9
+ * Callback function called when user saves their consent choices
10
+ */
11
+ onSave: (settings: ConsentSettings) => void;
12
+ /**
13
+ * Title displayed on the banner
14
+ * @default "We Value Your Privacy"
15
+ */
16
+ title?: string;
17
+ /**
18
+ * Description text displayed on the banner
19
+ * @default "We use cookies and similar technologies to provide our services and enhance your experience."
20
+ */
21
+ description?: string;
22
+ /**
23
+ * Text for the accept all button
24
+ * @default "Accept All"
25
+ */
26
+ acceptAllButtonText?: string;
27
+ /**
28
+ * Text for the reject all button
29
+ * @default "Reject All"
30
+ */
31
+ rejectAllButtonText?: string;
32
+ /**
33
+ * Text for the customize button
34
+ * @default "Customize"
35
+ */
36
+ customizeButtonText?: string;
37
+ /**
38
+ * Text for the save button
39
+ * @default "Save Preferences"
40
+ */
41
+ saveButtonText?: string;
42
+ /**
43
+ * Position of the banner
44
+ * @default "bottom"
45
+ */
46
+ position?: 'top' | 'bottom' | 'center';
47
+ /**
48
+ * Version of the consent form
49
+ * @default "1.0"
50
+ */
51
+ version?: string;
52
+ /**
53
+ * Whether to show the banner
54
+ * If not provided, the banner will be shown if no consent has been saved
55
+ */
56
+ show?: boolean;
57
+ /**
58
+ * Storage key for consent settings
59
+ * @default "ndpr_consent"
60
+ */
61
+ storageKey?: string;
62
+ /**
63
+ * Custom CSS class for the banner
64
+ */
65
+ className?: string;
66
+ /**
67
+ * Custom CSS class for the buttons
68
+ */
69
+ buttonClassName?: string;
70
+ /**
71
+ * Custom CSS class for the primary button
72
+ */
73
+ primaryButtonClassName?: string;
74
+ /**
75
+ * Custom CSS class for the secondary button
76
+ */
77
+ secondaryButtonClassName?: string;
78
+ }
79
+ export declare const ConsentBanner: React.FC<ConsentBannerProps>;
@@ -0,0 +1,73 @@
1
+ import React from 'react';
2
+ import { ConsentOption, ConsentSettings } from '../../types/consent';
3
+ export interface ConsentManagerProps {
4
+ /**
5
+ * Array of consent options to display
6
+ */
7
+ options: ConsentOption[];
8
+ /**
9
+ * Current consent settings
10
+ */
11
+ settings?: ConsentSettings;
12
+ /**
13
+ * Callback function called when user saves their consent choices
14
+ */
15
+ onSave: (settings: ConsentSettings) => void;
16
+ /**
17
+ * Title displayed in the manager
18
+ * @default "Manage Your Privacy Settings"
19
+ */
20
+ title?: string;
21
+ /**
22
+ * Description text displayed in the manager
23
+ * @default "Update your consent preferences at any time. Required cookies cannot be disabled as they are necessary for the website to function."
24
+ */
25
+ description?: string;
26
+ /**
27
+ * Text for the save button
28
+ * @default "Save Preferences"
29
+ */
30
+ saveButtonText?: string;
31
+ /**
32
+ * Text for the reset button
33
+ * @default "Reset to Defaults"
34
+ */
35
+ resetButtonText?: string;
36
+ /**
37
+ * Version of the consent form
38
+ * @default "1.0"
39
+ */
40
+ version?: string;
41
+ /**
42
+ * Custom CSS class for the manager
43
+ */
44
+ className?: string;
45
+ /**
46
+ * Custom CSS class for the buttons
47
+ */
48
+ buttonClassName?: string;
49
+ /**
50
+ * Custom CSS class for the primary button
51
+ */
52
+ primaryButtonClassName?: string;
53
+ /**
54
+ * Custom CSS class for the secondary button
55
+ */
56
+ secondaryButtonClassName?: string;
57
+ /**
58
+ * Whether to show a success message after saving
59
+ * @default true
60
+ */
61
+ showSuccessMessage?: boolean;
62
+ /**
63
+ * Success message to display after saving
64
+ * @default "Your preferences have been saved."
65
+ */
66
+ successMessage?: string;
67
+ /**
68
+ * Duration to show the success message (in milliseconds)
69
+ * @default 3000
70
+ */
71
+ successMessageDuration?: number;
72
+ }
73
+ export declare const ConsentManager: React.FC<ConsentManagerProps>;
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import { ConsentSettings, ConsentStorageOptions } from '../../types/consent';
3
+ export interface ConsentStorageProps {
4
+ /**
5
+ * Current consent settings
6
+ */
7
+ settings: ConsentSettings;
8
+ /**
9
+ * Storage options for consent settings
10
+ */
11
+ storageOptions?: ConsentStorageOptions;
12
+ /**
13
+ * Callback function called when settings are loaded from storage
14
+ */
15
+ onLoad?: (settings: ConsentSettings | null) => void;
16
+ /**
17
+ * Callback function called when settings are saved to storage
18
+ */
19
+ onSave?: (settings: ConsentSettings) => void;
20
+ /**
21
+ * Whether to automatically save settings to storage
22
+ * @default true
23
+ */
24
+ autoSave?: boolean;
25
+ /**
26
+ * Whether to automatically load settings from storage on mount
27
+ * @default true
28
+ */
29
+ autoLoad?: boolean;
30
+ /**
31
+ * Children to render
32
+ * Can be either React nodes or a render prop function that receives storage methods
33
+ */
34
+ children?: React.ReactNode | ((props: {
35
+ loadSettings: () => ConsentSettings | null;
36
+ saveSettings: (settings: ConsentSettings) => void;
37
+ clearSettings: () => void;
38
+ loaded: boolean;
39
+ }) => React.ReactNode);
40
+ }
41
+ export declare const ConsentStorage: ({ settings, storageOptions, onLoad, onSave, autoSave, autoLoad, children }: ConsentStorageProps) => React.ReactElement | null;
@@ -0,0 +1,70 @@
1
+ import React from 'react';
2
+ import { DPIASection } from '../../types/dpia';
3
+ export interface DPIAQuestionnaireProps {
4
+ /**
5
+ * Sections of the DPIA questionnaire
6
+ */
7
+ sections: DPIASection[];
8
+ /**
9
+ * Current answers to the questionnaire
10
+ */
11
+ answers: Record<string, any>;
12
+ /**
13
+ * Callback function called when an answer is updated
14
+ */
15
+ onAnswerChange: (questionId: string, value: any) => void;
16
+ /**
17
+ * Current section index
18
+ */
19
+ currentSectionIndex: number;
20
+ /**
21
+ * Callback function called when user navigates to the next section
22
+ */
23
+ onNextSection?: () => void;
24
+ /**
25
+ * Callback function called when user navigates to the previous section
26
+ */
27
+ onPrevSection?: () => void;
28
+ /**
29
+ * Validation errors for the current section
30
+ */
31
+ validationErrors?: Record<string, string>;
32
+ /**
33
+ * Whether the questionnaire is in read-only mode
34
+ * @default false
35
+ */
36
+ readOnly?: boolean;
37
+ /**
38
+ * Custom CSS class for the questionnaire
39
+ */
40
+ className?: string;
41
+ /**
42
+ * Custom CSS class for the buttons
43
+ */
44
+ buttonClassName?: string;
45
+ /**
46
+ * Text for the next button
47
+ * @default "Next"
48
+ */
49
+ nextButtonText?: string;
50
+ /**
51
+ * Text for the previous button
52
+ * @default "Previous"
53
+ */
54
+ prevButtonText?: string;
55
+ /**
56
+ * Text for the submit button (shown on the last section)
57
+ * @default "Submit"
58
+ */
59
+ submitButtonText?: string;
60
+ /**
61
+ * Whether to show a progress indicator
62
+ * @default true
63
+ */
64
+ showProgress?: boolean;
65
+ /**
66
+ * Current progress percentage (0-100)
67
+ */
68
+ progress?: number;
69
+ }
70
+ export declare const DPIAQuestionnaire: React.FC<DPIAQuestionnaireProps>;
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import { DPIAResult, DPIASection } from '../../types/dpia';
3
+ export interface DPIAReportProps {
4
+ /**
5
+ * The DPIA result to display
6
+ */
7
+ result: DPIAResult;
8
+ /**
9
+ * The sections of the DPIA questionnaire
10
+ */
11
+ sections: DPIASection[];
12
+ /**
13
+ * Whether to show the full report or just a summary
14
+ * @default true
15
+ */
16
+ showFullReport?: boolean;
17
+ /**
18
+ * Whether to allow printing the report
19
+ * @default true
20
+ */
21
+ allowPrint?: boolean;
22
+ /**
23
+ * Whether to allow exporting the report as PDF
24
+ * @default true
25
+ */
26
+ allowExport?: boolean;
27
+ /**
28
+ * Callback function called when the report is exported
29
+ */
30
+ onExport?: (format: 'pdf' | 'docx' | 'html') => void;
31
+ /**
32
+ * Custom CSS class for the report container
33
+ */
34
+ className?: string;
35
+ /**
36
+ * Custom CSS class for the buttons
37
+ */
38
+ buttonClassName?: string;
39
+ }
40
+ export declare const DPIAReport: React.FC<DPIAReportProps>;
@@ -0,0 +1,64 @@
1
+ import React from 'react';
2
+ export interface Step {
3
+ /**
4
+ * Unique identifier for the step
5
+ */
6
+ id: string;
7
+ /**
8
+ * Display label for the step
9
+ */
10
+ label: string;
11
+ /**
12
+ * Optional description for the step
13
+ */
14
+ description?: string;
15
+ /**
16
+ * Whether the step is completed
17
+ */
18
+ completed: boolean;
19
+ /**
20
+ * Whether the step is the current active step
21
+ */
22
+ active: boolean;
23
+ /**
24
+ * Optional icon for the step
25
+ */
26
+ icon?: React.ReactNode;
27
+ }
28
+ export interface StepIndicatorProps {
29
+ /**
30
+ * Array of steps to display
31
+ */
32
+ steps: Step[];
33
+ /**
34
+ * Callback function called when a step is clicked
35
+ */
36
+ onStepClick?: (stepId: string) => void;
37
+ /**
38
+ * Whether the steps are clickable
39
+ * @default true
40
+ */
41
+ clickable?: boolean;
42
+ /**
43
+ * Orientation of the step indicator
44
+ * @default "horizontal"
45
+ */
46
+ orientation?: 'horizontal' | 'vertical';
47
+ /**
48
+ * Custom CSS class for the container
49
+ */
50
+ className?: string;
51
+ /**
52
+ * Custom CSS class for the active step
53
+ */
54
+ activeStepClassName?: string;
55
+ /**
56
+ * Custom CSS class for completed steps
57
+ */
58
+ completedStepClassName?: string;
59
+ /**
60
+ * Custom CSS class for incomplete steps
61
+ */
62
+ incompleteStepClassName?: string;
63
+ }
64
+ export declare const StepIndicator: React.FC<StepIndicatorProps>;
@@ -0,0 +1,58 @@
1
+ import React from 'react';
2
+ import { DSRRequest, DSRStatus } from '../../types/dsr';
3
+ export interface DSRDashboardProps {
4
+ /**
5
+ * List of DSR requests to display
6
+ */
7
+ requests: DSRRequest[];
8
+ /**
9
+ * Callback function called when a request is selected
10
+ */
11
+ onSelectRequest?: (requestId: string) => void;
12
+ /**
13
+ * Callback function called when a request status is updated
14
+ */
15
+ onUpdateStatus?: (requestId: string, status: DSRStatus) => void;
16
+ /**
17
+ * Callback function called when a request is assigned
18
+ */
19
+ onAssignRequest?: (requestId: string, assignee: string) => void;
20
+ /**
21
+ * Title displayed on the dashboard
22
+ * @default "Data Subject Request Dashboard"
23
+ */
24
+ title?: string;
25
+ /**
26
+ * Description text displayed on the dashboard
27
+ * @default "Track and manage data subject requests in compliance with NDPR requirements."
28
+ */
29
+ description?: string;
30
+ /**
31
+ * Custom CSS class for the dashboard
32
+ */
33
+ className?: string;
34
+ /**
35
+ * Custom CSS class for the buttons
36
+ */
37
+ buttonClassName?: string;
38
+ /**
39
+ * Whether to show the request details
40
+ * @default true
41
+ */
42
+ showRequestDetails?: boolean;
43
+ /**
44
+ * Whether to show the request timeline
45
+ * @default true
46
+ */
47
+ showRequestTimeline?: boolean;
48
+ /**
49
+ * Whether to show the deadline alerts
50
+ * @default true
51
+ */
52
+ showDeadlineAlerts?: boolean;
53
+ /**
54
+ * List of possible assignees
55
+ */
56
+ assignees?: string[];
57
+ }
58
+ export declare const DSRDashboard: React.FC<DSRDashboardProps>;
@@ -0,0 +1,74 @@
1
+ import React from 'react';
2
+ import { RequestType } from '../../types/dsr';
3
+ export interface DSRRequestFormProps {
4
+ /**
5
+ * Array of request types that can be submitted
6
+ */
7
+ requestTypes: RequestType[];
8
+ /**
9
+ * Callback function called when form is submitted
10
+ */
11
+ onSubmit: (formData: any) => void;
12
+ /**
13
+ * Title displayed on the form
14
+ * @default "Submit a Data Subject Request"
15
+ */
16
+ title?: string;
17
+ /**
18
+ * Description text displayed on the form
19
+ * @default "Use this form to exercise your rights under the Nigeria Data Protection Regulation (NDPR)."
20
+ */
21
+ description?: string;
22
+ /**
23
+ * Text for the submit button
24
+ * @default "Submit Request"
25
+ */
26
+ submitButtonText?: string;
27
+ /**
28
+ * Custom CSS class for the form
29
+ */
30
+ className?: string;
31
+ /**
32
+ * Custom CSS class for the submit button
33
+ */
34
+ buttonClassName?: string;
35
+ /**
36
+ * Whether to show a confirmation message after submission
37
+ * @default true
38
+ */
39
+ showConfirmation?: boolean;
40
+ /**
41
+ * Confirmation message to display after submission
42
+ * @default "Your request has been submitted successfully. You will receive a confirmation email shortly."
43
+ */
44
+ confirmationMessage?: string;
45
+ /**
46
+ * Whether to require identity verification
47
+ * @default true
48
+ */
49
+ requireIdentityVerification?: boolean;
50
+ /**
51
+ * Types of identifiers accepted for verification
52
+ * @default ["email", "account", "customer_id"]
53
+ */
54
+ identifierTypes?: Array<{
55
+ id: string;
56
+ label: string;
57
+ }>;
58
+ /**
59
+ * Whether to collect additional contact information
60
+ * @default true
61
+ */
62
+ collectAdditionalContact?: boolean;
63
+ /**
64
+ * Custom labels for form fields
65
+ */
66
+ labels?: {
67
+ name?: string;
68
+ email?: string;
69
+ requestType?: string;
70
+ description?: string;
71
+ submit?: string;
72
+ };
73
+ }
74
+ export declare const DSRRequestForm: React.FC<DSRRequestFormProps>;
@@ -0,0 +1,56 @@
1
+ import React from 'react';
2
+ import { DSRRequest } from '../../types/dsr';
3
+ export interface DSRTrackerProps {
4
+ /**
5
+ * List of DSR requests to track
6
+ */
7
+ requests: DSRRequest[];
8
+ /**
9
+ * Callback function called when a request is selected
10
+ */
11
+ onSelectRequest?: (requestId: string) => void;
12
+ /**
13
+ * Title displayed on the tracker
14
+ * @default "DSR Request Tracker"
15
+ */
16
+ title?: string;
17
+ /**
18
+ * Description text displayed on the tracker
19
+ * @default "Track the status and progress of data subject requests."
20
+ */
21
+ description?: string;
22
+ /**
23
+ * Custom CSS class for the tracker
24
+ */
25
+ className?: string;
26
+ /**
27
+ * Custom CSS class for the buttons
28
+ */
29
+ buttonClassName?: string;
30
+ /**
31
+ * Whether to show the summary statistics
32
+ * @default true
33
+ */
34
+ showSummaryStats?: boolean;
35
+ /**
36
+ * Whether to show the request type breakdown
37
+ * @default true
38
+ */
39
+ showTypeBreakdown?: boolean;
40
+ /**
41
+ * Whether to show the status breakdown
42
+ * @default true
43
+ */
44
+ showStatusBreakdown?: boolean;
45
+ /**
46
+ * Whether to show the timeline chart
47
+ * @default true
48
+ */
49
+ showTimelineChart?: boolean;
50
+ /**
51
+ * Whether to show the overdue requests
52
+ * @default true
53
+ */
54
+ showOverdueRequests?: boolean;
55
+ }
56
+ export declare const DSRTracker: React.FC<DSRTrackerProps>;
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ export interface PolicyExporterProps {
3
+ /**
4
+ * The policy content to export
5
+ */
6
+ content: string;
7
+ /**
8
+ * The policy title
9
+ */
10
+ title?: string;
11
+ /**
12
+ * The organization name to include in the exported policy
13
+ */
14
+ organizationName?: string;
15
+ /**
16
+ * The last updated date to include in the exported policy
17
+ */
18
+ lastUpdated?: Date;
19
+ /**
20
+ * Callback function called when the export is complete
21
+ */
22
+ onExportComplete?: (format: string, url: string) => void;
23
+ /**
24
+ * Title displayed on the exporter
25
+ * @default "Export Privacy Policy"
26
+ */
27
+ componentTitle?: string;
28
+ /**
29
+ * Description text displayed on the exporter
30
+ * @default "Export your NDPR-compliant privacy policy in various formats."
31
+ */
32
+ description?: string;
33
+ /**
34
+ * Custom CSS class for the exporter
35
+ */
36
+ className?: string;
37
+ /**
38
+ * Custom CSS class for the buttons
39
+ */
40
+ buttonClassName?: string;
41
+ /**
42
+ * Whether to show the export history
43
+ * @default true
44
+ */
45
+ showExportHistory?: boolean;
46
+ /**
47
+ * Whether to include the NDPR compliance notice in the exported policy
48
+ * @default true
49
+ */
50
+ includeComplianceNotice?: boolean;
51
+ /**
52
+ * Whether to include the organization logo in the exported policy
53
+ * @default false
54
+ */
55
+ includeLogo?: boolean;
56
+ /**
57
+ * URL of the organization logo
58
+ */
59
+ logoUrl?: string;
60
+ /**
61
+ * Custom CSS styles for the exported policy
62
+ */
63
+ customStyles?: string;
64
+ }
65
+ export declare const PolicyExporter: React.FC<PolicyExporterProps>;
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ import { PolicySection, PolicyVariable } from '../../types/privacy';
3
+ export interface PolicyGeneratorProps {
4
+ /**
5
+ * List of policy sections
6
+ */
7
+ sections: PolicySection[];
8
+ /**
9
+ * List of policy variables
10
+ */
11
+ variables: PolicyVariable[];
12
+ /**
13
+ * Callback function called when the policy is generated
14
+ */
15
+ onGenerate: (policy: {
16
+ sections: PolicySection[];
17
+ variables: PolicyVariable[];
18
+ content: string;
19
+ }) => void;
20
+ /**
21
+ * Title displayed on the generator
22
+ * @default "NDPR Privacy Policy Generator"
23
+ */
24
+ title?: string;
25
+ /**
26
+ * Description text displayed on the generator
27
+ * @default "Generate an NDPR-compliant privacy policy for your organization."
28
+ */
29
+ description?: string;
30
+ /**
31
+ * Custom CSS class for the generator
32
+ */
33
+ className?: string;
34
+ /**
35
+ * Custom CSS class for the buttons
36
+ */
37
+ buttonClassName?: string;
38
+ /**
39
+ * Text for the generate button
40
+ * @default "Generate Policy"
41
+ */
42
+ generateButtonText?: string;
43
+ /**
44
+ * Whether to show a preview of the generated policy
45
+ * @default true
46
+ */
47
+ showPreview?: boolean;
48
+ /**
49
+ * Whether to allow editing the policy content
50
+ * @default true
51
+ */
52
+ allowEditing?: boolean;
53
+ }
54
+ export declare const PolicyGenerator: React.FC<PolicyGeneratorProps>;