@tantainnovative/ndpr-toolkit 1.0.5 → 1.0.7

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 (263) hide show
  1. package/README.md +88 -14
  2. package/dist/components/breach-notification/BreachNotificationForm.d.ts +18 -0
  3. package/dist/components/breach-notification/BreachNotificationForm.d.ts.map +1 -0
  4. package/dist/components/consent/ConsentBanner.d.ts +30 -0
  5. package/dist/components/consent/ConsentBanner.d.ts.map +1 -0
  6. package/dist/components/consent/ConsentManager.d.ts +51 -0
  7. package/dist/components/consent/ConsentManager.d.ts.map +1 -0
  8. package/dist/components/consent/ConsentSettings.d.ts +15 -0
  9. package/dist/components/consent/ConsentSettings.d.ts.map +1 -0
  10. package/dist/components/consent/unstyled/UnstyledConsentBanner.d.ts +7 -0
  11. package/dist/components/consent/unstyled/UnstyledConsentBanner.d.ts.map +1 -0
  12. package/dist/components/consent/unstyled/UnstyledConsentSettings.d.ts +7 -0
  13. package/dist/components/consent/unstyled/UnstyledConsentSettings.d.ts.map +1 -0
  14. package/dist/components/consent/unstyled/UnstyledConsentToggle.d.ts +8 -0
  15. package/dist/components/consent/unstyled/UnstyledConsentToggle.d.ts.map +1 -0
  16. package/dist/components/consent/unstyled/index.d.ts +4 -0
  17. package/dist/components/consent/unstyled/index.d.ts.map +1 -0
  18. package/dist/components/data-subject-rights/DataSubjectRequestForm.d.ts +14 -0
  19. package/dist/components/data-subject-rights/DataSubjectRequestForm.d.ts.map +1 -0
  20. package/dist/components/docs/DocLayout.d.ts +9 -0
  21. package/dist/components/docs/DocLayout.d.ts.map +1 -0
  22. package/dist/components/docs/index.d.ts +2 -0
  23. package/dist/components/docs/index.d.ts.map +1 -0
  24. package/dist/components/dpia/DPIAQuestionnaire.d.ts +9 -0
  25. package/dist/components/dpia/DPIAQuestionnaire.d.ts.map +1 -0
  26. package/dist/components/privacy-policy/PolicyGenerator.d.ts +12 -0
  27. package/dist/components/privacy-policy/PolicyGenerator.d.ts.map +1 -0
  28. package/dist/components/privacy-policy/data.d.ts +8 -0
  29. package/dist/components/privacy-policy/data.d.ts.map +1 -0
  30. package/dist/components/privacy-policy/shared/CheckboxField.d.ts +13 -0
  31. package/dist/components/privacy-policy/shared/CheckboxField.d.ts.map +1 -0
  32. package/dist/components/privacy-policy/shared/CheckboxGroup.d.ts +13 -0
  33. package/dist/components/privacy-policy/shared/CheckboxGroup.d.ts.map +1 -0
  34. package/dist/components/privacy-policy/shared/FormField.d.ts +13 -0
  35. package/dist/components/privacy-policy/shared/FormField.d.ts.map +1 -0
  36. package/dist/components/privacy-policy/shared/StepIndicator.d.ts +8 -0
  37. package/dist/components/privacy-policy/shared/StepIndicator.d.ts.map +1 -0
  38. package/dist/components/privacy-policy/steps/CustomSectionsStep.d.ts +15 -0
  39. package/dist/components/privacy-policy/steps/CustomSectionsStep.d.ts.map +1 -0
  40. package/dist/components/privacy-policy/steps/DataCollectionStep.d.ts +20 -0
  41. package/dist/components/privacy-policy/steps/DataCollectionStep.d.ts.map +1 -0
  42. package/dist/components/privacy-policy/steps/DataSharingStep.d.ts +34 -0
  43. package/dist/components/privacy-policy/steps/DataSharingStep.d.ts.map +1 -0
  44. package/dist/components/privacy-policy/steps/OrganizationInfoStep.d.ts +17 -0
  45. package/dist/components/privacy-policy/steps/OrganizationInfoStep.d.ts.map +1 -0
  46. package/dist/components/privacy-policy/steps/PolicyPreviewStep.d.ts +30 -0
  47. package/dist/components/privacy-policy/steps/PolicyPreviewStep.d.ts.map +1 -0
  48. package/dist/components/ui/Badge.d.ts +10 -0
  49. package/dist/components/ui/Badge.d.ts.map +1 -0
  50. package/dist/components/ui/Button.d.ts +11 -0
  51. package/dist/components/ui/Button.d.ts.map +1 -0
  52. package/dist/components/ui/Card.d.ts +10 -0
  53. package/dist/components/ui/Card.d.ts.map +1 -0
  54. package/dist/components/ui/Checkbox.d.ts +8 -0
  55. package/dist/components/ui/Checkbox.d.ts.map +1 -0
  56. package/dist/components/ui/FormField.d.ts +11 -0
  57. package/dist/components/ui/FormField.d.ts.map +1 -0
  58. package/dist/components/ui/Input.d.ts +6 -0
  59. package/dist/components/ui/Input.d.ts.map +1 -0
  60. package/dist/components/ui/Select.d.ts +6 -0
  61. package/dist/components/ui/Select.d.ts.map +1 -0
  62. package/dist/components/ui/TextArea.d.ts +6 -0
  63. package/dist/components/ui/TextArea.d.ts.map +1 -0
  64. package/dist/components/ui/dialog.d.ts +18 -0
  65. package/dist/components/ui/dialog.d.ts.map +1 -0
  66. package/dist/components/ui/label.d.ts +5 -0
  67. package/dist/components/ui/label.d.ts.map +1 -0
  68. package/dist/components/ui/switch.d.ts +5 -0
  69. package/dist/components/ui/switch.d.ts.map +1 -0
  70. package/dist/components/ui/tabs.d.ts +8 -0
  71. package/dist/components/ui/tabs.d.ts.map +1 -0
  72. package/dist/contexts/ConsentContext.d.ts +35 -0
  73. package/dist/contexts/ConsentContext.d.ts.map +1 -0
  74. package/dist/contexts/GenericConsentContext.d.ts +11 -0
  75. package/dist/contexts/GenericConsentContext.d.ts.map +1 -0
  76. package/dist/hooks/useConsent.d.ts +12 -0
  77. package/dist/hooks/useConsent.d.ts.map +1 -0
  78. package/dist/hooks/useConsentActions.d.ts +12 -0
  79. package/dist/hooks/useConsentActions.d.ts.map +1 -0
  80. package/dist/hooks/useConsentManager.d.ts +14 -0
  81. package/dist/hooks/useConsentManager.d.ts.map +1 -0
  82. package/dist/hooks/useConsentState.d.ts +10 -0
  83. package/dist/hooks/useConsentState.d.ts.map +1 -0
  84. package/dist/index.d.mts +256 -0
  85. package/dist/index.d.ts +24 -0
  86. package/dist/index.d.ts.map +1 -0
  87. package/dist/index.js +2 -0
  88. package/dist/index.js.map +1 -0
  89. package/dist/index.mjs +2 -0
  90. package/dist/index.mjs.map +1 -0
  91. package/dist/lib/consentService.d.ts +11 -0
  92. package/dist/lib/consentService.d.ts.map +1 -0
  93. package/dist/lib/dpiaQuestions.d.ts +3 -0
  94. package/dist/lib/dpiaQuestions.d.ts.map +1 -0
  95. package/dist/lib/requestService.d.ts +10 -0
  96. package/dist/lib/requestService.d.ts.map +1 -0
  97. package/dist/lib/utils.d.ts +3 -0
  98. package/dist/lib/utils.d.ts.map +1 -0
  99. package/dist/styles.css +38 -0
  100. package/dist/types/consent.d.ts +57 -0
  101. package/dist/types/consent.d.ts.map +1 -0
  102. package/dist/types/index.d.ts +91 -0
  103. package/dist/types/index.d.ts.map +1 -0
  104. package/dist/unstyled.d.mts +22 -0
  105. package/dist/unstyled.d.ts +2 -0
  106. package/dist/unstyled.d.ts.map +1 -0
  107. package/dist/unstyled.js +2 -0
  108. package/dist/unstyled.js.map +1 -0
  109. package/dist/unstyled.mjs +2 -0
  110. package/dist/unstyled.mjs.map +1 -0
  111. package/package.json +33 -5
  112. package/CHANGELOG.md +0 -16
  113. package/CNAME +0 -1
  114. package/CONTRIBUTING.md +0 -87
  115. package/RELEASE-NOTES-v1.0.0.md +0 -140
  116. package/RELEASE-NOTES-v1.0.1.md +0 -69
  117. package/SECURITY.md +0 -21
  118. package/components.json +0 -21
  119. package/eslint.config.mjs +0 -16
  120. package/next-env.d.ts +0 -5
  121. package/next.config.js +0 -15
  122. package/next.config.ts +0 -62
  123. package/packages/ndpr-toolkit/README.md +0 -467
  124. package/packages/ndpr-toolkit/dist/components/breach/BreachNotificationManager.d.ts +0 -62
  125. package/packages/ndpr-toolkit/dist/components/breach/BreachReportForm.d.ts +0 -66
  126. package/packages/ndpr-toolkit/dist/components/breach/BreachRiskAssessment.d.ts +0 -50
  127. package/packages/ndpr-toolkit/dist/components/breach/RegulatoryReportGenerator.d.ts +0 -94
  128. package/packages/ndpr-toolkit/dist/components/consent/ConsentBanner.d.ts +0 -79
  129. package/packages/ndpr-toolkit/dist/components/consent/ConsentManager.d.ts +0 -73
  130. package/packages/ndpr-toolkit/dist/components/consent/ConsentStorage.d.ts +0 -41
  131. package/packages/ndpr-toolkit/dist/components/dpia/DPIAQuestionnaire.d.ts +0 -70
  132. package/packages/ndpr-toolkit/dist/components/dpia/DPIAReport.d.ts +0 -40
  133. package/packages/ndpr-toolkit/dist/components/dpia/StepIndicator.d.ts +0 -64
  134. package/packages/ndpr-toolkit/dist/components/dsr/DSRDashboard.d.ts +0 -58
  135. package/packages/ndpr-toolkit/dist/components/dsr/DSRRequestForm.d.ts +0 -74
  136. package/packages/ndpr-toolkit/dist/components/dsr/DSRTracker.d.ts +0 -56
  137. package/packages/ndpr-toolkit/dist/components/policy/PolicyExporter.d.ts +0 -65
  138. package/packages/ndpr-toolkit/dist/components/policy/PolicyGenerator.d.ts +0 -54
  139. package/packages/ndpr-toolkit/dist/components/policy/PolicyPreview.d.ts +0 -71
  140. package/packages/ndpr-toolkit/dist/hooks/useBreach.d.ts +0 -97
  141. package/packages/ndpr-toolkit/dist/hooks/useConsent.d.ts +0 -63
  142. package/packages/ndpr-toolkit/dist/hooks/useDPIA.d.ts +0 -92
  143. package/packages/ndpr-toolkit/dist/hooks/useDSR.d.ts +0 -72
  144. package/packages/ndpr-toolkit/dist/hooks/usePrivacyPolicy.d.ts +0 -87
  145. package/packages/ndpr-toolkit/dist/index.d.ts +0 -31
  146. package/packages/ndpr-toolkit/dist/index.esm.js +0 -2
  147. package/packages/ndpr-toolkit/dist/index.esm.js.map +0 -1
  148. package/packages/ndpr-toolkit/dist/index.js +0 -2
  149. package/packages/ndpr-toolkit/dist/index.js.map +0 -1
  150. package/packages/ndpr-toolkit/dist/setupTests.d.ts +0 -2
  151. package/packages/ndpr-toolkit/dist/types/breach.d.ts +0 -239
  152. package/packages/ndpr-toolkit/dist/types/consent.d.ts +0 -95
  153. package/packages/ndpr-toolkit/dist/types/dpia.d.ts +0 -196
  154. package/packages/ndpr-toolkit/dist/types/dsr.d.ts +0 -162
  155. package/packages/ndpr-toolkit/dist/types/privacy.d.ts +0 -204
  156. package/packages/ndpr-toolkit/dist/utils/breach.d.ts +0 -14
  157. package/packages/ndpr-toolkit/dist/utils/consent.d.ts +0 -10
  158. package/packages/ndpr-toolkit/dist/utils/dpia.d.ts +0 -12
  159. package/packages/ndpr-toolkit/dist/utils/dsr.d.ts +0 -11
  160. package/packages/ndpr-toolkit/dist/utils/privacy.d.ts +0 -12
  161. package/packages/ndpr-toolkit/package-lock.json +0 -8197
  162. package/packages/ndpr-toolkit/package.json +0 -71
  163. package/packages/ndpr-toolkit/rollup.config.js +0 -34
  164. package/packages/ndpr-toolkit/src/components/breach/BreachNotificationManager.tsx +0 -701
  165. package/packages/ndpr-toolkit/src/components/breach/BreachReportForm.tsx +0 -631
  166. package/packages/ndpr-toolkit/src/components/breach/BreachRiskAssessment.tsx +0 -569
  167. package/packages/ndpr-toolkit/src/components/breach/RegulatoryReportGenerator.tsx +0 -496
  168. package/packages/ndpr-toolkit/src/components/consent/ConsentBanner.tsx +0 -270
  169. package/packages/ndpr-toolkit/src/components/consent/ConsentManager.tsx +0 -217
  170. package/packages/ndpr-toolkit/src/components/consent/ConsentStorage.tsx +0 -206
  171. package/packages/ndpr-toolkit/src/components/dpia/DPIAQuestionnaire.tsx +0 -342
  172. package/packages/ndpr-toolkit/src/components/dpia/DPIAReport.tsx +0 -373
  173. package/packages/ndpr-toolkit/src/components/dpia/StepIndicator.tsx +0 -174
  174. package/packages/ndpr-toolkit/src/components/dsr/DSRDashboard.tsx +0 -717
  175. package/packages/ndpr-toolkit/src/components/dsr/DSRRequestForm.tsx +0 -476
  176. package/packages/ndpr-toolkit/src/components/dsr/DSRTracker.tsx +0 -620
  177. package/packages/ndpr-toolkit/src/components/policy/PolicyExporter.tsx +0 -541
  178. package/packages/ndpr-toolkit/src/components/policy/PolicyGenerator.tsx +0 -454
  179. package/packages/ndpr-toolkit/src/components/policy/PolicyPreview.tsx +0 -333
  180. package/packages/ndpr-toolkit/src/hooks/useBreach.ts +0 -409
  181. package/packages/ndpr-toolkit/src/hooks/useConsent.ts +0 -263
  182. package/packages/ndpr-toolkit/src/hooks/useDPIA.ts +0 -457
  183. package/packages/ndpr-toolkit/src/hooks/useDSR.ts +0 -236
  184. package/packages/ndpr-toolkit/src/hooks/usePrivacyPolicy.ts +0 -428
  185. package/packages/ndpr-toolkit/src/index.ts +0 -44
  186. package/packages/ndpr-toolkit/src/setupTests.ts +0 -5
  187. package/packages/ndpr-toolkit/src/types/breach.ts +0 -283
  188. package/packages/ndpr-toolkit/src/types/consent.ts +0 -111
  189. package/packages/ndpr-toolkit/src/types/dpia.ts +0 -236
  190. package/packages/ndpr-toolkit/src/types/dsr.ts +0 -192
  191. package/packages/ndpr-toolkit/src/types/index.ts +0 -42
  192. package/packages/ndpr-toolkit/src/types/privacy.ts +0 -246
  193. package/packages/ndpr-toolkit/src/utils/breach.ts +0 -122
  194. package/packages/ndpr-toolkit/src/utils/consent.ts +0 -51
  195. package/packages/ndpr-toolkit/src/utils/dpia.ts +0 -104
  196. package/packages/ndpr-toolkit/src/utils/dsr.ts +0 -77
  197. package/packages/ndpr-toolkit/src/utils/privacy.ts +0 -100
  198. package/packages/ndpr-toolkit/tsconfig.json +0 -23
  199. package/postcss.config.mjs +0 -5
  200. package/public/NDPR TOOLKIT.svg +0 -1
  201. package/public/favicon/android-chrome-192x192.png +0 -0
  202. package/public/favicon/android-chrome-512x512.png +0 -0
  203. package/public/favicon/apple-touch-icon.png +0 -0
  204. package/public/favicon/favicon-16x16.png +0 -0
  205. package/public/favicon/favicon-32x32.png +0 -0
  206. package/public/favicon/site.webmanifest +0 -1
  207. package/public/file.svg +0 -1
  208. package/public/globe.svg +0 -1
  209. package/public/ndpr-toolkit-logo.svg +0 -108
  210. package/public/next.svg +0 -1
  211. package/public/vercel.svg +0 -1
  212. package/public/window.svg +0 -1
  213. package/src/app/accessibility.css +0 -70
  214. package/src/app/favicon.ico +0 -0
  215. package/src/app/globals.css +0 -123
  216. package/src/app/layout.tsx +0 -37
  217. package/src/app/ndpr-demos/breach/page.tsx +0 -354
  218. package/src/app/ndpr-demos/consent/page.tsx +0 -366
  219. package/src/app/ndpr-demos/dpia/page.tsx +0 -495
  220. package/src/app/ndpr-demos/dsr/page.tsx +0 -280
  221. package/src/app/ndpr-demos/page.tsx +0 -73
  222. package/src/app/ndpr-demos/policy/page.tsx +0 -771
  223. package/src/app/page.tsx +0 -452
  224. package/src/components/ErrorBoundary.tsx +0 -90
  225. package/src/components/breach-notification/BreachNotificationForm.tsx +0 -479
  226. package/src/components/consent/ConsentBanner.tsx +0 -193
  227. package/src/components/data-subject-rights/DataSubjectRequestForm.tsx +0 -530
  228. package/src/components/dpia/DPIAQuestionnaire.tsx +0 -523
  229. package/src/components/privacy-policy/PolicyGenerator.tsx +0 -1062
  230. package/src/components/privacy-policy/data.ts +0 -98
  231. package/src/components/privacy-policy/shared/CheckboxField.tsx +0 -38
  232. package/src/components/privacy-policy/shared/CheckboxGroup.tsx +0 -85
  233. package/src/components/privacy-policy/shared/FormField.tsx +0 -79
  234. package/src/components/privacy-policy/shared/StepIndicator.tsx +0 -86
  235. package/src/components/privacy-policy/steps/CustomSectionsStep.tsx +0 -361
  236. package/src/components/privacy-policy/steps/DataCollectionStep.tsx +0 -231
  237. package/src/components/privacy-policy/steps/DataSharingStep.tsx +0 -418
  238. package/src/components/privacy-policy/steps/OrganizationInfoStep.tsx +0 -202
  239. package/src/components/privacy-policy/steps/PolicyPreviewStep.tsx +0 -226
  240. package/src/components/ui/Badge.tsx +0 -46
  241. package/src/components/ui/Button.tsx +0 -59
  242. package/src/components/ui/Card.tsx +0 -92
  243. package/src/components/ui/Checkbox.tsx +0 -57
  244. package/src/components/ui/FormField.tsx +0 -50
  245. package/src/components/ui/Input.tsx +0 -38
  246. package/src/components/ui/Loading.tsx +0 -201
  247. package/src/components/ui/Select.tsx +0 -42
  248. package/src/components/ui/TextArea.tsx +0 -38
  249. package/src/components/ui/label.tsx +0 -24
  250. package/src/components/ui/switch.tsx +0 -31
  251. package/src/components/ui/tabs.tsx +0 -66
  252. package/src/hooks/useConsent.ts +0 -70
  253. package/src/hooks/useLoadingState.ts +0 -85
  254. package/src/lib/consentService.ts +0 -144
  255. package/src/lib/dpiaQuestions.ts +0 -188
  256. package/src/lib/requestService.ts +0 -79
  257. package/src/lib/sanitize.ts +0 -108
  258. package/src/lib/storage.ts +0 -222
  259. package/src/lib/utils.ts +0 -6
  260. package/src/types/html-to-docx.d.ts +0 -30
  261. package/src/types/index.ts +0 -77
  262. package/tailwind.config.ts +0 -65
  263. package/tsconfig.json +0 -41
@@ -1,222 +0,0 @@
1
- "use client";
2
-
3
- /**
4
- * Safe localStorage wrapper with error handling
5
- */
6
- export class SafeStorage {
7
- private static isStorageAvailable(): boolean {
8
- if (typeof window === "undefined") return false;
9
-
10
- try {
11
- const testKey = "__storage_test__";
12
- window.localStorage.setItem(testKey, "test");
13
- window.localStorage.removeItem(testKey);
14
- return true;
15
- } catch {
16
- return false;
17
- }
18
- }
19
-
20
- static getItem<T = unknown>(key: string, defaultValue?: T): T | null {
21
- if (!this.isStorageAvailable()) {
22
- console.warn("localStorage is not available");
23
- return defaultValue ?? null;
24
- }
25
-
26
- try {
27
- const item = window.localStorage.getItem(key);
28
- if (item === null) return defaultValue ?? null;
29
-
30
- // Try to parse as JSON, otherwise return as string
31
- try {
32
- return JSON.parse(item) as T;
33
- } catch {
34
- return item as unknown as T;
35
- }
36
- } catch (error) {
37
- console.error(`Error reading from localStorage: ${key}`, error);
38
- return defaultValue ?? null;
39
- }
40
- }
41
-
42
- static setItem(key: string, value: unknown): boolean {
43
- if (!this.isStorageAvailable()) {
44
- console.warn("localStorage is not available");
45
- return false;
46
- }
47
-
48
- try {
49
- const serialized =
50
- typeof value === "string" ? value : JSON.stringify(value);
51
- window.localStorage.setItem(key, serialized);
52
- return true;
53
- } catch (error) {
54
- if (error instanceof Error) {
55
- if (error.name === "QuotaExceededError") {
56
- console.error("localStorage quota exceeded");
57
- // Try to clear old data
58
- this.clearOldData();
59
- // Retry once
60
- try {
61
- const serialized =
62
- typeof value === "string" ? value : JSON.stringify(value);
63
- window.localStorage.setItem(key, serialized);
64
- return true;
65
- } catch {
66
- console.error("Failed to save after clearing old data");
67
- return false;
68
- }
69
- }
70
- }
71
- console.error(`Error writing to localStorage: ${key}`, error);
72
- return false;
73
- }
74
- }
75
-
76
- static removeItem(key: string): boolean {
77
- if (!this.isStorageAvailable()) {
78
- console.warn("localStorage is not available");
79
- return false;
80
- }
81
-
82
- try {
83
- window.localStorage.removeItem(key);
84
- return true;
85
- } catch (error) {
86
- console.error(`Error removing from localStorage: ${key}`, error);
87
- return false;
88
- }
89
- }
90
-
91
- static clear(): boolean {
92
- if (!this.isStorageAvailable()) {
93
- console.warn("localStorage is not available");
94
- return false;
95
- }
96
-
97
- try {
98
- window.localStorage.clear();
99
- return true;
100
- } catch (error) {
101
- console.error("Error clearing localStorage", error);
102
- return false;
103
- }
104
- }
105
-
106
- /**
107
- * Get storage size in bytes
108
- */
109
- static getStorageSize(): number {
110
- if (!this.isStorageAvailable()) return 0;
111
-
112
- let size = 0;
113
- try {
114
- for (const key in window.localStorage) {
115
- if (window.localStorage.hasOwnProperty(key)) {
116
- size += window.localStorage[key].length + key.length;
117
- }
118
- }
119
- } catch (error) {
120
- console.error("Error calculating storage size", error);
121
- }
122
- return size;
123
- }
124
-
125
- /**
126
- * Clear old data based on timestamp
127
- * Removes items older than specified days
128
- */
129
- static clearOldData(daysOld: number = 30): void {
130
- if (!this.isStorageAvailable()) return;
131
-
132
- const cutoffTime = Date.now() - daysOld * 24 * 60 * 60 * 1000;
133
- const keysToRemove: string[] = [];
134
-
135
- try {
136
- for (const key in window.localStorage) {
137
- if (window.localStorage.hasOwnProperty(key)) {
138
- try {
139
- const item = window.localStorage.getItem(key);
140
- if (item) {
141
- const parsed = JSON.parse(item);
142
- if (parsed.timestamp && parsed.timestamp < cutoffTime) {
143
- keysToRemove.push(key);
144
- }
145
- }
146
- } catch {
147
- // If parsing fails, skip this item
148
- }
149
- }
150
- }
151
-
152
- // Remove old items
153
- keysToRemove.forEach((key) => this.removeItem(key));
154
- } catch (error) {
155
- console.error("Error clearing old data", error);
156
- }
157
- }
158
-
159
- /**
160
- * Wrapper for data with timestamp
161
- */
162
- static setItemWithTimestamp(key: string, value: unknown): boolean {
163
- const wrappedData = {
164
- data: value,
165
- timestamp: Date.now(),
166
- };
167
- return this.setItem(key, wrappedData);
168
- }
169
-
170
- /**
171
- * Get item with timestamp check
172
- */
173
- static getItemWithTimestamp<T = unknown>(
174
- key: string,
175
- maxAge?: number,
176
- ): T | null {
177
- const wrapped = this.getItem<{ data: T; timestamp: number }>(key);
178
- if (!wrapped) return null;
179
-
180
- if (maxAge && wrapped.timestamp) {
181
- const age = Date.now() - wrapped.timestamp;
182
- if (age > maxAge) {
183
- this.removeItem(key);
184
- return null;
185
- }
186
- }
187
-
188
- return wrapped.data;
189
- }
190
- }
191
-
192
- // Retry decorator for storage operations
193
- export function withRetry<T extends (...args: unknown[]) => unknown>(
194
- fn: T,
195
- maxRetries: number = 3,
196
- delay: number = 100,
197
- ): T {
198
- return ((...args: Parameters<T>) => {
199
- let lastError: Error | null = null;
200
-
201
- for (let i = 0; i < maxRetries; i++) {
202
- try {
203
- return fn(...args);
204
- } catch (error) {
205
- lastError = error as Error;
206
- if (i < maxRetries - 1) {
207
- // Wait before retrying
208
- const waitTime = delay * Math.pow(2, i); // Exponential backoff
209
- const start = Date.now();
210
- while (Date.now() - start < waitTime) {
211
- // Busy wait
212
- }
213
- }
214
- }
215
- }
216
-
217
- throw lastError;
218
- }) as T;
219
- }
220
-
221
- // Export a default instance
222
- export const storage = SafeStorage;
package/src/lib/utils.ts DELETED
@@ -1,6 +0,0 @@
1
- import { clsx, type ClassValue } from "clsx"
2
- import { twMerge } from "tailwind-merge"
3
-
4
- export function cn(...inputs: ClassValue[]) {
5
- return twMerge(clsx(inputs))
6
- }
@@ -1,30 +0,0 @@
1
- declare module 'html-to-docx' {
2
- export default function htmlToDocx(
3
- htmlString: string,
4
- options?: {
5
- title?: string;
6
- margin?: {
7
- top?: number;
8
- right?: number;
9
- bottom?: number;
10
- left?: number;
11
- };
12
- header?: {
13
- default?: string;
14
- first?: string;
15
- even?: string;
16
- };
17
- footer?: {
18
- default?: string;
19
- first?: string;
20
- even?: string;
21
- };
22
- pageNumber?: boolean;
23
- orientation?: 'portrait' | 'landscape';
24
- font?: {
25
- family?: string;
26
- size?: number;
27
- };
28
- }
29
- ): Promise<Buffer>;
30
- }
@@ -1,77 +0,0 @@
1
- // Re-export all types from the package
2
- // This ensures consistency between the main app and the package
3
- export * from "@tantainnovative/ndpr-toolkit";
4
- import type { DSRStatus, DSRType } from "@tantainnovative/ndpr-toolkit";
5
-
6
- // Additional app-specific types that extend the package types
7
- export interface AppConfig {
8
- apiUrl?: string;
9
- environment: "development" | "staging" | "production";
10
- features: {
11
- consent: boolean;
12
- dsr: boolean;
13
- dpia: boolean;
14
- breach: boolean;
15
- privacy: boolean;
16
- };
17
- }
18
-
19
- // Legacy type aliases for backward compatibility
20
- // These map old type names to new ones from the package
21
- export type RequestStatus = DSRStatus;
22
- export type RequestType = DSRType;
23
-
24
- // Re-export specific types that might have different names
25
- export type {
26
- ConsentOption,
27
- BreachReport,
28
- RiskAssessment,
29
- NotificationRequirement,
30
- RegulatoryNotification,
31
- DSRRequest as DataSubjectRequest,
32
- DSRStatus,
33
- DSRType,
34
- PrivacyPolicy,
35
- PolicySection,
36
- PolicyTemplate,
37
- PolicyVariable,
38
- OrganizationInfo,
39
- DPIAQuestion as RiskAssessmentQuestion,
40
- DPIASection,
41
- DPIAResult,
42
- } from "@tantainnovative/ndpr-toolkit";
43
-
44
- // Define ConsentType locally since it's not exported from the package
45
- export type ConsentType =
46
- | "necessary"
47
- | "functional"
48
- | "analytics"
49
- | "marketing"
50
- | "preferences";
51
-
52
- // Define BreachSeverity type
53
- export type BreachSeverity = "low" | "medium" | "high" | "critical";
54
-
55
- // Define missing types that are not exported from the package
56
- export interface ConsentRecord {
57
- id: string;
58
- userId?: string;
59
- consents: Record<string, boolean>;
60
- timestamp: Date;
61
- ipAddress?: string;
62
- userAgent?: string;
63
- version: string;
64
- }
65
-
66
- export interface ConsentHistoryEntry {
67
- timestamp: Date;
68
- consents: Record<string, boolean>;
69
- action: "granted" | "revoked" | "updated";
70
- ipAddress?: string;
71
- userAgent?: string;
72
- version: string;
73
- }
74
-
75
- export interface ConsentPreferences {
76
- [key: string]: boolean;
77
- }
@@ -1,65 +0,0 @@
1
- import type { Config } from "tailwindcss";
2
-
3
- const config: Config = {
4
- darkMode: ["class", '[data-theme="dark"]'],
5
- content: [
6
- "./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
7
- "./src/components/**/*.{js,ts,jsx,tsx,mdx}",
8
- "./src/app/**/*.{js,ts,jsx,tsx,mdx}",
9
- ],
10
- theme: {
11
- container: {
12
- center: true,
13
- padding: "2rem",
14
- screens: {
15
- "2xl": "1400px",
16
- },
17
- },
18
- extend: {
19
- colors: {
20
- border: "var(--border)",
21
- input: "var(--input)",
22
- ring: "var(--ring)",
23
- background: "var(--background)",
24
- foreground: "var(--foreground)",
25
- primary: {
26
- DEFAULT: "var(--primary)",
27
- foreground: "var(--primary-foreground)",
28
- },
29
- secondary: {
30
- DEFAULT: "var(--secondary)",
31
- foreground: "var(--secondary-foreground)",
32
- },
33
- destructive: {
34
- DEFAULT: "var(--destructive)",
35
- foreground: "var(--destructive-foreground, var(--foreground))",
36
- },
37
- muted: {
38
- DEFAULT: "var(--muted)",
39
- foreground: "var(--muted-foreground)",
40
- },
41
- accent: {
42
- DEFAULT: "var(--accent)",
43
- foreground: "var(--accent-foreground)",
44
- },
45
- popover: {
46
- DEFAULT: "var(--popover)",
47
- foreground: "var(--popover-foreground)",
48
- },
49
- card: {
50
- DEFAULT: "var(--card)",
51
- foreground: "var(--card-foreground)",
52
- },
53
- },
54
- borderRadius: {
55
- lg: "var(--radius-lg)",
56
- md: "var(--radius-md)",
57
- sm: "var(--radius-sm)",
58
- xl: "var(--radius-xl)",
59
- },
60
- },
61
- },
62
- plugins: [],
63
- };
64
-
65
- export default config;
package/tsconfig.json DELETED
@@ -1,41 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2017",
4
- "lib": [
5
- "dom",
6
- "dom.iterable",
7
- "esnext"
8
- ],
9
- "allowJs": true,
10
- "skipLibCheck": true,
11
- "strict": true,
12
- "noEmit": true,
13
- "esModuleInterop": true,
14
- "module": "esnext",
15
- "moduleResolution": "bundler",
16
- "resolveJsonModule": true,
17
- "isolatedModules": true,
18
- "jsx": "preserve",
19
- "incremental": true,
20
- "plugins": [
21
- {
22
- "name": "next"
23
- }
24
- ],
25
- "paths": {
26
- "@/*": [
27
- "./src/*"
28
- ]
29
- }
30
- },
31
- "include": [
32
- "**/*.ts",
33
- "**/*.tsx",
34
- ".next/types/**/*.ts",
35
- "next-env.d.ts",
36
- "out/types/**/*.ts"
37
- ],
38
- "exclude": [
39
- "node_modules"
40
- ]
41
- }