@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,160 +0,0 @@
1
- import { assessDPIARisk } from '../../utils/dpia';
2
- import { DPIAResult, DPIARisk } from '../../types/dpia';
3
-
4
- describe('assessDPIARisk', () => {
5
- it('should correctly assess risk based on high risk data', () => {
6
- // Create a DPIA result with high risks
7
- const dpiaResult: DPIAResult = {
8
- id: '123',
9
- title: 'Test DPIA',
10
- processingDescription: 'Processing sensitive customer data',
11
- startedAt: Date.now(),
12
- assessor: {
13
- name: 'John Doe',
14
- role: 'DPO',
15
- email: 'john@example.com'
16
- },
17
- answers: {
18
- q1: 'yes',
19
- q2: 'large'
20
- },
21
- risks: [
22
- {
23
- id: 'risk_1',
24
- description: 'Processing involves sensitive personal data',
25
- likelihood: 5,
26
- impact: 5,
27
- score: 25,
28
- level: 'high',
29
- mitigated: false,
30
- relatedQuestionIds: ['q1']
31
- },
32
- {
33
- id: 'risk_2',
34
- description: 'Large volume of data being processed',
35
- likelihood: 5,
36
- impact: 5,
37
- score: 25,
38
- level: 'high',
39
- mitigated: false,
40
- relatedQuestionIds: ['q2']
41
- },
42
- {
43
- id: 'risk_3',
44
- description: 'Another high risk factor',
45
- likelihood: 5,
46
- impact: 5,
47
- score: 25,
48
- level: 'high',
49
- mitigated: false,
50
- relatedQuestionIds: ['q3']
51
- }
52
- ],
53
- overallRiskLevel: 'low', // Will be updated by the function
54
- canProceed: true, // Will be updated by the function
55
- conclusion: 'Initial conclusion',
56
- version: '1.0'
57
- };
58
-
59
- const result = assessDPIARisk(dpiaResult);
60
-
61
- expect(result.overallRiskLevel).toBe('high');
62
- expect(result.requiresConsultation).toBe(true);
63
- expect(result.canProceed).toBe(false);
64
- expect(result.recommendations.length).toBeGreaterThan(0);
65
- });
66
-
67
- it('should handle medium risk levels', () => {
68
- // Create a DPIA result with medium risks
69
- const dpiaResult: DPIAResult = {
70
- id: '456',
71
- title: 'Test DPIA',
72
- processingDescription: 'Processing customer data',
73
- startedAt: Date.now(),
74
- assessor: {
75
- name: 'Jane Smith',
76
- role: 'Privacy Officer',
77
- email: 'jane@example.com'
78
- },
79
- answers: {
80
- q1: 'no',
81
- q2: 'medium'
82
- },
83
- risks: [
84
- {
85
- id: 'risk_1',
86
- description: 'Medium volume of data being processed',
87
- likelihood: 3,
88
- impact: 3,
89
- score: 9,
90
- level: 'medium',
91
- mitigated: false,
92
- relatedQuestionIds: ['q2']
93
- },
94
- {
95
- id: 'risk_2',
96
- description: 'Another medium risk factor',
97
- likelihood: 3,
98
- impact: 3,
99
- score: 9,
100
- level: 'medium',
101
- mitigated: false,
102
- relatedQuestionIds: ['q3']
103
- }
104
- ],
105
- overallRiskLevel: 'low', // Will be updated by the function
106
- canProceed: true, // Will be updated by the function
107
- conclusion: 'Initial conclusion',
108
- version: '1.0'
109
- };
110
-
111
- const result = assessDPIARisk(dpiaResult);
112
-
113
- expect(result.overallRiskLevel).toBe('medium');
114
- expect(result.requiresConsultation).toBe(false);
115
- expect(result.canProceed).toBe(true);
116
- expect(result.recommendations.length).toBeGreaterThan(0);
117
- });
118
-
119
- it('should handle low risk levels', () => {
120
- // Create a DPIA result with no significant risks
121
- const dpiaResult: DPIAResult = {
122
- id: '789',
123
- title: 'Test DPIA',
124
- processingDescription: 'Processing minimal customer data',
125
- startedAt: Date.now(),
126
- assessor: {
127
- name: 'Alex Johnson',
128
- role: 'Compliance Manager',
129
- email: 'alex@example.com'
130
- },
131
- answers: {
132
- q1: 'Marketing purposes',
133
- q2: 'small'
134
- },
135
- risks: [
136
- {
137
- id: 'risk_1',
138
- description: 'Small volume of data being processed',
139
- likelihood: 1,
140
- impact: 1,
141
- score: 1,
142
- level: 'low',
143
- mitigated: true,
144
- relatedQuestionIds: ['q2']
145
- }
146
- ],
147
- overallRiskLevel: 'low', // Will be updated by the function
148
- canProceed: true, // Will be updated by the function
149
- conclusion: 'Initial conclusion',
150
- version: '1.0'
151
- };
152
-
153
- const result = assessDPIARisk(dpiaResult);
154
-
155
- expect(result.overallRiskLevel).toBe('low');
156
- expect(result.requiresConsultation).toBe(false);
157
- expect(result.canProceed).toBe(true);
158
- expect(result.recommendations.length).toBeGreaterThan(0);
159
- });
160
- });
@@ -1,110 +0,0 @@
1
- import { formatDSRRequest } from '../../utils/dsr';
2
- import { DSRRequest, DSRType, DSRStatus } from '../../types/dsr';
3
-
4
- describe('formatDSRRequest', () => {
5
- it('should format a DSR request correctly', () => {
6
- const request: DSRRequest = {
7
- id: '123',
8
- type: 'access',
9
- status: 'pending',
10
- createdAt: 1620000000000,
11
- updatedAt: 1620000000000,
12
- subject: {
13
- name: 'John Doe',
14
- email: 'john@example.com',
15
- phone: '1234567890'
16
- },
17
- description: 'I want to access my data'
18
- };
19
-
20
- const result = formatDSRRequest(request);
21
-
22
- expect(result.isValid).toBe(true);
23
- expect(result.formattedRequest.dataSubject.name).toBe('John Doe');
24
- expect(result.formattedRequest.requestType).toBe('access');
25
- expect(result.formattedRequest.status).toBe('pending');
26
- expect(result.formattedRequest.dataSubject.email).toBe('john@example.com');
27
- expect(result.formattedRequest.additionalInformation).toEqual({});
28
- expect(result.validationErrors.length).toBe(0);
29
- });
30
-
31
- it('should handle missing optional fields', () => {
32
- const request: DSRRequest = {
33
- id: '456',
34
- type: 'erasure',
35
- status: 'completed',
36
- createdAt: 1620000000000,
37
- updatedAt: 1620100000000,
38
- completedAt: 1620200000000,
39
- subject: {
40
- name: 'Jane Smith',
41
- email: 'jane@example.com'
42
- // phone is missing
43
- }
44
- // description is missing
45
- };
46
-
47
- const result = formatDSRRequest(request);
48
-
49
- expect(result.isValid).toBe(true);
50
- expect(result.formattedRequest.dataSubject.name).toBe('Jane Smith');
51
- expect(result.formattedRequest.requestType).toBe('erasure');
52
- expect(result.formattedRequest.status).toBe('completed');
53
- expect(result.formattedRequest.dataSubject.email).toBe('jane@example.com');
54
- expect(result.formattedRequest.dataSubject.phone).toBe('Not provided');
55
- expect(JSON.stringify(result.formattedRequest)).not.toContain('undefined');
56
- });
57
-
58
- it('should include completion date when available', () => {
59
- const request: DSRRequest = {
60
- id: '789',
61
- type: 'rectification',
62
- status: 'completed',
63
- createdAt: 1620000000000,
64
- updatedAt: 1620100000000,
65
- completedAt: 1620200000000,
66
- subject: {
67
- name: 'Bob Johnson',
68
- email: 'bob@example.com'
69
- }
70
- };
71
-
72
- const result = formatDSRRequest(request);
73
-
74
- expect(result.isValid).toBe(true);
75
- // Check that the completedAt date is properly formatted in ISO format
76
- expect(result.formattedRequest.lastUpdated).toBe(new Date(1620100000000).toISOString());
77
- expect(result.formattedRequest.dataSubject.name).toBe('Bob Johnson');
78
- expect(result.formattedRequest.requestType).toBe('rectification');
79
- expect(result.formattedRequest.status).toBe('completed');
80
- });
81
-
82
- it('should handle additional info when present', () => {
83
- const request: DSRRequest = {
84
- id: '101',
85
- type: 'portability',
86
- status: 'inProgress',
87
- createdAt: 1620000000000,
88
- updatedAt: 1620100000000,
89
- subject: {
90
- name: 'Alice Brown',
91
- email: 'alice@example.com'
92
- },
93
- additionalInfo: {
94
- format: 'CSV',
95
- timeRange: 'Last 12 months'
96
- }
97
- };
98
-
99
- const result = formatDSRRequest(request);
100
-
101
- expect(result.isValid).toBe(true);
102
- expect(result.formattedRequest.dataSubject.name).toBe('Alice Brown');
103
- expect(result.formattedRequest.requestType).toBe('portability');
104
- expect(result.formattedRequest.status).toBe('inProgress');
105
- expect(result.formattedRequest.additionalInformation).toEqual({
106
- format: 'CSV',
107
- timeRange: 'Last 12 months'
108
- });
109
- });
110
- });
@@ -1,97 +0,0 @@
1
- import { generatePolicyText } from '../../utils/privacy';
2
- import { PolicySection } from '../../types/privacy';
3
-
4
- describe('generatePolicyText', () => {
5
- it('should replace variables in templates', () => {
6
- const sections: PolicySection[] = [
7
- {
8
- id: 'introduction',
9
- title: 'Introduction',
10
- template: 'This Privacy Policy explains how {{organizationName}} collects and uses your data.',
11
- required: true,
12
- included: true
13
- },
14
- {
15
- id: 'contact',
16
- title: 'Contact Information',
17
- template: 'For questions about this policy, please contact us at {{contactEmail}}.',
18
- required: true,
19
- included: true
20
- }
21
- ];
22
-
23
- const variables = {
24
- organizationName: 'Acme Corporation',
25
- contactEmail: 'privacy@acme.com'
26
- };
27
-
28
- const result = generatePolicyText(sections, variables) as {
29
- fullText: string;
30
- sectionTexts: Record<string, string>;
31
- missingVariables: string[];
32
- };
33
-
34
- expect(result.fullText).toContain('This Privacy Policy explains how Acme Corporation collects and uses your data.');
35
- expect(result.fullText).toContain('For questions about this policy, please contact us at privacy@acme.com.');
36
- // Check the number of sections by counting keys in sectionTexts
37
- expect(Object.keys(result.sectionTexts).length).toBe(2);
38
- // Check the content of the first section
39
- expect(Object.values(result.sectionTexts)[0]).toBe('This Privacy Policy explains how Acme Corporation collects and uses your data.');
40
- });
41
-
42
- it('should skip sections that are not included', () => {
43
- const sections: PolicySection[] = [
44
- {
45
- id: 'introduction',
46
- title: 'Introduction',
47
- template: 'This is the introduction.',
48
- required: true,
49
- included: true
50
- },
51
- {
52
- id: 'optional',
53
- title: 'Optional Section',
54
- template: 'This is optional.',
55
- required: false,
56
- included: false
57
- }
58
- ];
59
-
60
- const result = generatePolicyText(sections, {}) as {
61
- fullText: string;
62
- sectionTexts: Record<string, string>;
63
- missingVariables: string[];
64
- };
65
-
66
- expect(result.fullText).toContain('This is the introduction.');
67
- expect(result.fullText).not.toContain('This is optional.');
68
- expect(Object.keys(result.sectionTexts).length).toBe(1);
69
- });
70
-
71
- it('should handle missing variables gracefully', () => {
72
- const sections: PolicySection[] = [
73
- {
74
- id: 'test',
75
- title: 'Test',
76
- template: 'Hello {{name}}, welcome to {{company}}.',
77
- required: true,
78
- included: true
79
- }
80
- ];
81
-
82
- const variables = {
83
- name: 'John'
84
- // company is missing
85
- };
86
-
87
- const result = generatePolicyText(sections, variables) as {
88
- fullText: string;
89
- sectionTexts: Record<string, string>;
90
- missingVariables: string[];
91
- };
92
-
93
- expect(result.fullText).toContain('Hello John, welcome to .');
94
- // Verify that 'company' is in the missing variables list
95
- expect(result.missingVariables).toContain('company');
96
- });
97
- });