@tantainnovative/ndpr-toolkit 3.4.0 → 3.5.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 (188) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +80 -38
  3. package/dist/adapters.d.mts +34 -25
  4. package/dist/adapters.d.ts +34 -25
  5. package/dist/breach.d.mts +803 -44
  6. package/dist/breach.d.ts +803 -44
  7. package/dist/breach.js +2 -1
  8. package/dist/breach.mjs +2 -1
  9. package/dist/{chunk-2WH4DLV5.js → chunk-3EGQWLJ6.js} +3 -3
  10. package/dist/chunk-B4Z5MBUC.mjs +2 -0
  11. package/dist/{chunk-LSCMXAPY.mjs → chunk-CKGJK4D7.mjs} +3 -3
  12. package/dist/{chunk-XSEZDQLB.js → chunk-CKJAECGV.js} +2 -2
  13. package/dist/{chunk-AHSMDPG5.js → chunk-CPK5D5FY.js} +2 -2
  14. package/dist/{chunk-DCJK5OZT.mjs → chunk-CWHBCQGT.mjs} +2 -2
  15. package/dist/{chunk-KSERBMXW.mjs → chunk-F5TXUA4O.mjs} +3 -3
  16. package/dist/{chunk-BN77GP4W.mjs → chunk-GN5C32JB.mjs} +2 -2
  17. package/dist/{chunk-ZLSWOFAY.mjs → chunk-GRLIPT5V.mjs} +2 -2
  18. package/dist/{chunk-DUY6F3GT.mjs → chunk-H3EYBSVP.mjs} +3 -3
  19. package/dist/{chunk-MG73MOZC.mjs → chunk-I557S566.mjs} +2 -2
  20. package/dist/{chunk-QVULSG6J.mjs → chunk-ID2NYIVE.mjs} +3 -3
  21. package/dist/chunk-J5WCPZLW.js +2 -0
  22. package/dist/{chunk-4R42ZNO7.mjs → chunk-JFFOPHU3.mjs} +57 -57
  23. package/dist/{chunk-P2YV6DR3.js → chunk-LIM64IV2.js} +3 -3
  24. package/dist/chunk-LU7PKE7Y.mjs +2 -0
  25. package/dist/{chunk-HQSU7LGM.js → chunk-LWXZMKC2.js} +4 -4
  26. package/dist/{chunk-XMBSJJ5U.js → chunk-ORFC66EA.js} +3 -3
  27. package/dist/{chunk-VTITKWGX.mjs → chunk-QSVVAZVT.mjs} +2 -2
  28. package/dist/chunk-SCWNM4PC.mjs +2 -0
  29. package/dist/{chunk-EHAZIKDX.js → chunk-SKKOMFXH.js} +2 -2
  30. package/dist/{chunk-WH6ZMUOS.mjs → chunk-TUNQUVHU.mjs} +2 -2
  31. package/dist/chunk-TV4U6AIS.js +2 -0
  32. package/dist/{chunk-ZYLDLGFL.js → chunk-VIQUXWJC.js} +2 -2
  33. package/dist/{chunk-SUEGUY35.js → chunk-XIM7KMD6.js} +2 -2
  34. package/dist/{chunk-P6QAFBCV.js → chunk-XNSZ7KUH.js} +2 -2
  35. package/dist/{chunk-RNTNHVKZ.js → chunk-YPKUHSK4.js} +2 -2
  36. package/dist/{chunk-UFPSUO52.js → chunk-Z73T6MWY.js} +57 -57
  37. package/dist/consent.d.mts +648 -84
  38. package/dist/consent.d.ts +648 -84
  39. package/dist/consent.js +2 -1
  40. package/dist/consent.mjs +2 -1
  41. package/dist/core.d.mts +2049 -23
  42. package/dist/core.d.ts +2049 -23
  43. package/dist/core.js +1 -1
  44. package/dist/core.mjs +1 -1
  45. package/dist/cross-border.d.mts +470 -99
  46. package/dist/cross-border.d.ts +470 -99
  47. package/dist/cross-border.js +1 -0
  48. package/dist/cross-border.mjs +1 -0
  49. package/dist/dpia.d.mts +591 -37
  50. package/dist/dpia.d.ts +591 -37
  51. package/dist/dpia.js +1 -0
  52. package/dist/dpia.mjs +1 -0
  53. package/dist/dsr.d.mts +654 -37
  54. package/dist/dsr.d.ts +654 -37
  55. package/dist/dsr.js +2 -1
  56. package/dist/dsr.mjs +2 -1
  57. package/dist/hooks.d.mts +2174 -30
  58. package/dist/hooks.d.ts +2174 -30
  59. package/dist/hooks.js +2 -1
  60. package/dist/hooks.mjs +2 -1
  61. package/dist/index.d.mts +4428 -43
  62. package/dist/index.d.ts +4428 -43
  63. package/dist/index.js +2 -1
  64. package/dist/index.mjs +2 -1
  65. package/dist/lawful-basis.d.mts +368 -32
  66. package/dist/lawful-basis.d.ts +368 -32
  67. package/dist/lawful-basis.js +1 -0
  68. package/dist/lawful-basis.mjs +1 -0
  69. package/dist/policy.d.mts +1178 -83
  70. package/dist/policy.d.ts +1178 -83
  71. package/dist/policy.js +2 -1
  72. package/dist/policy.mjs +2 -1
  73. package/dist/presets.d.mts +1020 -114
  74. package/dist/presets.d.ts +1020 -114
  75. package/dist/presets.js +2 -1
  76. package/dist/presets.mjs +2 -1
  77. package/dist/ropa.d.mts +396 -31
  78. package/dist/ropa.d.ts +396 -31
  79. package/dist/ropa.js +2 -1
  80. package/dist/ropa.mjs +2 -1
  81. package/dist/server.d.mts +2133 -24
  82. package/dist/server.d.ts +2133 -24
  83. package/dist/server.js +1 -1
  84. package/dist/server.mjs +1 -1
  85. package/dist/unstyled.d.mts +523 -55
  86. package/dist/unstyled.d.ts +523 -55
  87. package/dist/unstyled.js +2 -1
  88. package/dist/unstyled.mjs +2 -1
  89. package/package.json +3 -3
  90. package/dist/BreachReportForm-DpRrBoxU.d.ts +0 -158
  91. package/dist/BreachReportForm-yJ2Zl6gz.d.mts +0 -158
  92. package/dist/ConsentBanner-F5ayys5K.d.mts +0 -156
  93. package/dist/ConsentBanner-VqIPophc.d.ts +0 -156
  94. package/dist/ConsentManager-C7I3PDe8.d.mts +0 -105
  95. package/dist/ConsentManager-CQ2IZtUU.d.ts +0 -105
  96. package/dist/CrossBorderTransferManager-D5Lc0e46.d.ts +0 -90
  97. package/dist/CrossBorderTransferManager-DkZhv9vD.d.mts +0 -90
  98. package/dist/DPIAQuestionnaire-VXBoWFMC.d.ts +0 -123
  99. package/dist/DPIAQuestionnaire-jkt1Veb6.d.mts +0 -123
  100. package/dist/DSRRequestForm-D8rPTNmU.d.ts +0 -146
  101. package/dist/DSRRequestForm-DRouEr9j.d.mts +0 -146
  102. package/dist/DSRTracker-Bl__d4df.d.ts +0 -163
  103. package/dist/DSRTracker-CSVDfgQQ.d.mts +0 -163
  104. package/dist/LawfulBasisTracker-CBqOxX1D.d.mts +0 -85
  105. package/dist/LawfulBasisTracker-Cg30NbDA.d.ts +0 -85
  106. package/dist/NDPRDashboard-CLJpEg0X.d.mts +0 -44
  107. package/dist/NDPRDashboard-DDWNd2Ah.d.ts +0 -44
  108. package/dist/NDPRProvider-DYFb8xEl.d.ts +0 -68
  109. package/dist/NDPRProvider-U3QNu6MA.d.mts +0 -68
  110. package/dist/PolicyExporter-Bgi6nz82.d.mts +0 -291
  111. package/dist/PolicyExporter-BnvuFncj.d.ts +0 -291
  112. package/dist/ROPAManager-BS4eB8Hw.d.mts +0 -79
  113. package/dist/ROPAManager-qxTrXLkD.d.ts +0 -79
  114. package/dist/RegulatoryReportGenerator-BUYgzTTT.d.ts +0 -282
  115. package/dist/RegulatoryReportGenerator-DwcHcEFp.d.mts +0 -282
  116. package/dist/StepIndicator-CgrlokSV.d.ts +0 -171
  117. package/dist/StepIndicator-W8S_QjgO.d.mts +0 -171
  118. package/dist/breach-B_-6lDqS.d.mts +0 -17
  119. package/dist/breach-CzXqSsaY.d.ts +0 -17
  120. package/dist/breach-Eu9byel8.d.mts +0 -185
  121. package/dist/breach-Eu9byel8.d.ts +0 -185
  122. package/dist/chunk-5X32J5IA.mjs +0 -2
  123. package/dist/chunk-7D2OIPHH.mjs +0 -2
  124. package/dist/chunk-JKKRPS4P.js +0 -2
  125. package/dist/chunk-NCOZB2WU.mjs +0 -2
  126. package/dist/chunk-RGNP45VR.js +0 -2
  127. package/dist/compliance-score-racQe_E_.d.mts +0 -115
  128. package/dist/compliance-score-racQe_E_.d.ts +0 -115
  129. package/dist/consent-CmVzqZUk.d.mts +0 -99
  130. package/dist/consent-CmVzqZUk.d.ts +0 -99
  131. package/dist/consent-audit-BdByjYlM.d.mts +0 -65
  132. package/dist/consent-audit-DhbfMR0n.d.ts +0 -65
  133. package/dist/cross-border-BBi9rZyO.d.mts +0 -54
  134. package/dist/cross-border-Dy-U9Hu6.d.ts +0 -54
  135. package/dist/cross-border-UyT00llA.d.mts +0 -141
  136. package/dist/cross-border-UyT00llA.d.ts +0 -141
  137. package/dist/docx-BxKascXN.d.ts +0 -64
  138. package/dist/docx-CV7Vsry_.d.mts +0 -64
  139. package/dist/dpia-D82hUrJe.d.ts +0 -15
  140. package/dist/dpia-DQDFw2_l.d.mts +0 -15
  141. package/dist/dpia-c9GiiOq0.d.mts +0 -137
  142. package/dist/dpia-c9GiiOq0.d.ts +0 -137
  143. package/dist/dsr-CIx5sd7e.d.ts +0 -14
  144. package/dist/dsr-XZ_HqTlA.d.mts +0 -14
  145. package/dist/dsr-yKbqX531.d.mts +0 -128
  146. package/dist/dsr-yKbqX531.d.ts +0 -128
  147. package/dist/lawful-basis-BEyI0kGg.d.ts +0 -57
  148. package/dist/lawful-basis-C2eGaoHM.d.mts +0 -57
  149. package/dist/lawful-basis-Cv1VmDLn.d.mts +0 -112
  150. package/dist/lawful-basis-Cv1VmDLn.d.ts +0 -112
  151. package/dist/locale-CxJx2tzn.d.mts +0 -25
  152. package/dist/locale-DSkrtf-c.d.ts +0 -25
  153. package/dist/policy-engine-CCUCud2T.d.ts +0 -154
  154. package/dist/policy-engine-fYSqEqSW.d.mts +0 -154
  155. package/dist/policy-sections-BYx6fEFk.d.ts +0 -56
  156. package/dist/policy-sections-Dm97Nq8m.d.mts +0 -56
  157. package/dist/policy-templates-DhLwq4R-.d.ts +0 -43
  158. package/dist/policy-templates-DwYl2329.d.mts +0 -43
  159. package/dist/privacy-Ca6te9Ir.d.mts +0 -138
  160. package/dist/privacy-Ca6te9Ir.d.ts +0 -138
  161. package/dist/ropa-BDTM06tr.d.ts +0 -152
  162. package/dist/ropa-CFHuT7jE.d.mts +0 -152
  163. package/dist/ropa-CyynscU6.d.ts +0 -51
  164. package/dist/ropa-NIgxd8uP.d.mts +0 -51
  165. package/dist/sanitize-CxxwKxAx.d.mts +0 -94
  166. package/dist/sanitize-CxxwKxAx.d.ts +0 -94
  167. package/dist/styling-BMDGQDgS.d.mts +0 -64
  168. package/dist/styling-BaoQtV06.d.ts +0 -64
  169. package/dist/types-DK2CoKOC.d.mts +0 -10
  170. package/dist/types-DK2CoKOC.d.ts +0 -10
  171. package/dist/useAdaptivePolicyWizard-BnjW4OR4.d.mts +0 -52
  172. package/dist/useAdaptivePolicyWizard-sb3m4-Zk.d.ts +0 -52
  173. package/dist/useBreach-CPr86Yan.d.mts +0 -115
  174. package/dist/useBreach-DkVXvtJK.d.ts +0 -115
  175. package/dist/useConsent-DCNkIJHR.d.mts +0 -75
  176. package/dist/useConsent-dOcELSfX.d.ts +0 -75
  177. package/dist/useCrossBorderTransfer-DixjLjN1.d.mts +0 -78
  178. package/dist/useCrossBorderTransfer-DvSq06lv.d.ts +0 -78
  179. package/dist/useDPIA-B6180UQn.d.mts +0 -109
  180. package/dist/useDPIA-CTqbNbww.d.ts +0 -109
  181. package/dist/useDSR-WvHk8_iu.d.mts +0 -85
  182. package/dist/useDSR-wH4H6hSM.d.ts +0 -85
  183. package/dist/useDefaultPrivacyPolicy-Cs2WQSYQ.d.mts +0 -162
  184. package/dist/useDefaultPrivacyPolicy-DkOqMg2e.d.ts +0 -162
  185. package/dist/useLawfulBasis-CKJ-kw84.d.mts +0 -79
  186. package/dist/useLawfulBasis-DFTmu1ca.d.ts +0 -79
  187. package/dist/useROPA-BSSU1rfx.d.ts +0 -76
  188. package/dist/useROPA-C2hjaBTz.d.mts +0 -76
package/dist/dsr.d.ts CHANGED
@@ -1,37 +1,654 @@
1
- import { c as DSRRequestFormProps } from './DSRRequestForm-D8rPTNmU.js';
2
- export { D as DSRFormSubmission, a as DSRRequestForm, b as DSRRequestFormClassNames } from './DSRRequestForm-D8rPTNmU.js';
3
- import { d as DSRDashboardProps, e as DSRTrackerProps } from './DSRTracker-Bl__d4df.js';
4
- export { D as DSRDashboard, a as DSRDashboardClassNames, b as DSRTracker, c as DSRTrackerClassNames } from './DSRTracker-Bl__d4df.js';
5
- import { U as UseDSRReturn } from './useDSR-wH4H6hSM.js';
6
- export { u as useDSR } from './useDSR-wH4H6hSM.js';
7
- export { f as formatDSRRequest } from './dsr-CIx5sd7e.js';
8
- import { c as RequestType, D as DSRRequest } from './dsr-yKbqX531.js';
9
- export { a as DSRStatus, b as DSRType, R as RequestStatus } from './dsr-yKbqX531.js';
10
- import * as React from 'react';
11
- import React__default from 'react';
12
- import { S as StorageAdapter } from './types-DK2CoKOC.js';
13
-
14
- interface DSRProviderProps {
15
- requestTypes: RequestType[];
16
- adapter?: StorageAdapter<DSRRequest[]>;
17
- storageKey?: string;
18
- useLocalStorage?: boolean;
19
- onSubmit?: (request: DSRRequest) => void;
20
- onUpdate?: (request: DSRRequest) => void;
21
- children: React__default.ReactNode;
22
- }
23
- declare const DSRProvider: React__default.FC<DSRProviderProps>;
24
-
25
- declare const DSR: {
26
- Provider: React.FC<DSRProviderProps>;
27
- Form: React.FC<DSRRequestFormProps>;
28
- Dashboard: React.FC<DSRDashboardProps>;
29
- Tracker: React.FC<DSRTrackerProps>;
30
- };
31
-
32
- interface DSRContextValue extends UseDSRReturn {
33
- requestTypes: RequestType[];
34
- }
35
- declare function useDSRCompound(): DSRContextValue;
36
-
37
- export { DSR, DSRProvider, type DSRProviderProps, DSRRequest, RequestType, StorageAdapter, useDSRCompound };
1
+ import * as React_2 from 'react';
2
+ import React__default from 'react';
3
+
4
+ export declare const DSR: {
5
+ Provider: React_2.FC<DSRProviderProps>;
6
+ Form: React_2.FC<DSRRequestFormProps>;
7
+ Dashboard: React_2.FC<DSRDashboardProps>;
8
+ Tracker: React_2.FC<DSRTrackerProps>;
9
+ };
10
+
11
+ declare interface DSRContextValue extends UseDSRReturn {
12
+ requestTypes: RequestType[];
13
+ }
14
+
15
+ /**
16
+ * Data Subject Request dashboard component. Supports compliance with NDPA Part IV,
17
+ * providing tools to track, manage, and respond to data subject requests within required timeframes.
18
+ */
19
+ export declare const DSRDashboard: React__default.FC<DSRDashboardProps>;
20
+
21
+ export declare interface DSRDashboardClassNames {
22
+ root?: string;
23
+ header?: string;
24
+ title?: string;
25
+ filters?: string;
26
+ requestList?: string;
27
+ requestItem?: string;
28
+ statusBadge?: string;
29
+ detailPanel?: string;
30
+ }
31
+
32
+ declare interface DSRDashboardProps {
33
+ /**
34
+ * List of DSR requests to display
35
+ */
36
+ requests: DSRRequest[];
37
+ /**
38
+ * Callback function called when a request is selected
39
+ */
40
+ onSelectRequest?: (requestId: string) => void;
41
+ /**
42
+ * Callback function called when a request status is updated
43
+ */
44
+ onUpdateStatus?: (requestId: string, status: DSRStatus) => void;
45
+ /**
46
+ * Callback function called when a request is assigned
47
+ */
48
+ onAssignRequest?: (requestId: string, assignee: string) => void;
49
+ /**
50
+ * Title displayed on the dashboard
51
+ * @default "Data Subject Request Dashboard"
52
+ */
53
+ title?: string;
54
+ /**
55
+ * Description text displayed on the dashboard
56
+ * @default "Track and manage data subject requests in compliance with NDPA Part IV requirements."
57
+ */
58
+ description?: string;
59
+ /**
60
+ * Custom CSS class for the dashboard
61
+ */
62
+ className?: string;
63
+ /**
64
+ * Custom CSS class for the buttons
65
+ */
66
+ buttonClassName?: string;
67
+ /**
68
+ * Whether to show the request details
69
+ * @default true
70
+ */
71
+ showRequestDetails?: boolean;
72
+ /**
73
+ * Whether to show the request timeline
74
+ * @default true
75
+ */
76
+ showRequestTimeline?: boolean;
77
+ /**
78
+ * Whether to show the deadline alerts
79
+ * @default true
80
+ */
81
+ showDeadlineAlerts?: boolean;
82
+ /**
83
+ * List of possible assignees
84
+ */
85
+ assignees?: string[];
86
+ /**
87
+ * Object of CSS class overrides keyed by semantic section name.
88
+ */
89
+ classNames?: DSRDashboardClassNames;
90
+ /**
91
+ * When true, all default Tailwind classes are removed so consumers
92
+ * can style from scratch using classNames.
93
+ */
94
+ unstyled?: boolean;
95
+ }
96
+
97
+ /**
98
+ * Represents the data submitted by the DSR request form.
99
+ */
100
+ export declare interface DSRFormSubmission {
101
+ /** The selected request type identifier */
102
+ requestType: string;
103
+ /** Data subject personal information */
104
+ dataSubject: {
105
+ fullName: string;
106
+ email: string;
107
+ phone?: string;
108
+ identifierType: string;
109
+ identifierValue: string;
110
+ };
111
+ /** Additional information provided for the selected request type */
112
+ additionalInfo?: Record<string, string | number | boolean | null>;
113
+ /** Timestamp (ms) when the form was submitted */
114
+ submittedAt: number;
115
+ }
116
+
117
+ export declare const DSRProvider: React__default.FC<DSRProviderProps>;
118
+
119
+ export declare interface DSRProviderProps {
120
+ requestTypes: RequestType[];
121
+ adapter?: StorageAdapter<DSRRequest[]>;
122
+ storageKey?: string;
123
+ useLocalStorage?: boolean;
124
+ onSubmit?: (request: DSRRequest) => void;
125
+ onUpdate?: (request: DSRRequest) => void;
126
+ children: React__default.ReactNode;
127
+ }
128
+
129
+ /**
130
+ * Represents a data subject request
131
+ */
132
+ export declare interface DSRRequest {
133
+ /** Unique identifier for the request */
134
+ id: string;
135
+ /** Type of request */
136
+ type: DSRType;
137
+ /** Current status of the request */
138
+ status: DSRStatus;
139
+ /** Timestamp when the request was submitted */
140
+ createdAt: number;
141
+ /** Timestamp when the request was last updated */
142
+ updatedAt: number;
143
+ /** Timestamp when the request was completed (if applicable) */
144
+ completedAt?: number;
145
+ /** Timestamp when the identity was verified (if applicable) */
146
+ verifiedAt?: number;
147
+ /**
148
+ * Due date for responding to the request (timestamp)
149
+ * NDPA requires response within 30 days of receipt
150
+ */
151
+ dueDate?: number;
152
+ /** Description or details of the request */
153
+ description?: string;
154
+ /**
155
+ * The lawful basis under which the data was originally processed
156
+ * Relevant for evaluating objection and erasure requests
157
+ */
158
+ lawfulBasis?: string;
159
+ /** Data subject information */
160
+ subject: {
161
+ name: string;
162
+ email: string;
163
+ phone?: string;
164
+ identifierValue?: string;
165
+ identifierType?: string;
166
+ };
167
+ /** Additional information provided by the data subject */
168
+ additionalInfo?: Record<string, string | number | boolean | null>;
169
+ /** Notes added by staff processing the request */
170
+ internalNotes?: Array<{
171
+ timestamp: number;
172
+ author: string;
173
+ note: string;
174
+ }>;
175
+ /** Verification status */
176
+ verification?: {
177
+ verified: boolean;
178
+ method?: string;
179
+ verifiedAt?: number;
180
+ verifiedBy?: string;
181
+ };
182
+ /** Reason for rejection (if status is 'rejected') */
183
+ rejectionReason?: string;
184
+ /** Files attached to the request */
185
+ attachments?: Array<{
186
+ id: string;
187
+ name: string;
188
+ type: string;
189
+ url: string;
190
+ addedAt: number;
191
+ }>;
192
+ /**
193
+ * Whether an extension was requested for this DSR
194
+ * NDPA allows a one-time extension of 30 days with justification
195
+ */
196
+ extensionRequested?: boolean;
197
+ /** Reason for the extension, if requested */
198
+ extensionReason?: string;
199
+ }
200
+
201
+ /**
202
+ * Data Subject Request form component. Implements NDPA Part IV, Sections 29-36
203
+ * covering data subject rights including access, rectification, erasure, and portability.
204
+ */
205
+ export declare const DSRRequestForm: React__default.FC<DSRRequestFormProps>;
206
+
207
+ export declare interface DSRRequestFormClassNames {
208
+ root?: string;
209
+ title?: string;
210
+ description?: string;
211
+ form?: string;
212
+ fieldGroup?: string;
213
+ label?: string;
214
+ input?: string;
215
+ select?: string;
216
+ textarea?: string;
217
+ submitButton?: string;
218
+ /** Alias for submitButton */
219
+ primaryButton?: string;
220
+ successMessage?: string;
221
+ /** Custom class applied when isSubmitting is true (e.g. a loading overlay) */
222
+ loadingOverlay?: string;
223
+ }
224
+
225
+ declare interface DSRRequestFormProps {
226
+ /**
227
+ * Array of request types that can be submitted
228
+ */
229
+ requestTypes: RequestType[];
230
+ /**
231
+ * Callback function called when form is submitted
232
+ */
233
+ onSubmit: (data: DSRFormSubmission) => void;
234
+ /**
235
+ * Callback function called when form validation fails
236
+ */
237
+ onValidationError?: (errors: Record<string, string>) => void;
238
+ /**
239
+ * Title displayed on the form
240
+ * @default "Submit a Data Subject Request"
241
+ */
242
+ title?: string;
243
+ /**
244
+ * Description text displayed on the form
245
+ * @default "Use this form to exercise your rights under the Nigeria Data Protection Act (NDPA), Part IV, Sections 29-36."
246
+ */
247
+ description?: string;
248
+ /**
249
+ * Text for the submit button
250
+ * @default "Submit Request"
251
+ */
252
+ submitButtonText?: string;
253
+ /**
254
+ * Custom CSS class for the form
255
+ */
256
+ className?: string;
257
+ /**
258
+ * Custom CSS class for the submit button
259
+ */
260
+ buttonClassName?: string;
261
+ /**
262
+ * Whether to show a confirmation message after submission
263
+ * @default true
264
+ */
265
+ showConfirmation?: boolean;
266
+ /**
267
+ * Confirmation message to display after submission
268
+ * @default "Your request has been submitted successfully. You will receive a confirmation email shortly."
269
+ */
270
+ confirmationMessage?: string;
271
+ /**
272
+ * Whether to require identity verification
273
+ * @default true
274
+ */
275
+ requireIdentityVerification?: boolean;
276
+ /**
277
+ * Types of identifiers accepted for verification
278
+ * @default ["email", "account", "customer_id"]
279
+ */
280
+ identifierTypes?: Array<{
281
+ id: string;
282
+ label: string;
283
+ }>;
284
+ /**
285
+ * Whether to collect additional contact information
286
+ * @default true
287
+ */
288
+ collectAdditionalContact?: boolean;
289
+ /**
290
+ * Custom labels for form fields
291
+ */
292
+ labels?: {
293
+ name?: string;
294
+ email?: string;
295
+ requestType?: string;
296
+ description?: string;
297
+ submit?: string;
298
+ };
299
+ /**
300
+ * Object of CSS class overrides keyed by semantic section name.
301
+ */
302
+ classNames?: DSRRequestFormClassNames;
303
+ /**
304
+ * When true, all default Tailwind classes are removed so consumers
305
+ * can style from scratch using classNames.
306
+ */
307
+ unstyled?: boolean;
308
+ /**
309
+ * Whether the form is currently submitting.
310
+ * When true, the submit button is disabled and shows "Submitting..." text.
311
+ */
312
+ isSubmitting?: boolean;
313
+ /**
314
+ * Default values to pre-fill form fields.
315
+ * Useful for editing existing requests or pre-populating known data.
316
+ */
317
+ defaultValues?: Partial<DSRFormSubmission>;
318
+ /**
319
+ * Callback fired when the form is reset via the Reset button.
320
+ * To fully remount the component (clearing all internal state),
321
+ * change the `key` prop from the parent.
322
+ */
323
+ onReset?: () => void;
324
+ }
325
+
326
+ /**
327
+ * Status of a data subject request
328
+ */
329
+ export declare type DSRStatus = 'pending' | 'awaitingVerification' | 'inProgress' | 'completed' | 'rejected';
330
+
331
+ /**
332
+ * Validated DSR submission shape — matches what `<DSRRequestForm onSubmit>`
333
+ * emits client-side. Use this as the typed parameter for your server-side
334
+ * handler after `validateDsrSubmission` returns `valid: true`.
335
+ */
336
+ export declare interface DsrSubmissionPayload {
337
+ requestType: string;
338
+ dataSubject: {
339
+ fullName: string;
340
+ email: string;
341
+ phone?: string;
342
+ identifierType: string;
343
+ identifierValue: string;
344
+ };
345
+ additionalInfo?: Record<string, string | number | boolean | null>;
346
+ submittedAt: number;
347
+ }
348
+
349
+ /** Result of validating a raw DSR submission payload. */
350
+ export declare interface DsrSubmissionValidationResult {
351
+ /** True when the payload conforms to the DSR submission contract. */
352
+ valid: boolean;
353
+ /** Field-keyed error messages. Empty when `valid` is true. */
354
+ errors: Record<string, string>;
355
+ /** The narrowed, typed payload — only populated when `valid` is true. */
356
+ data?: DsrSubmissionPayload;
357
+ }
358
+
359
+ /**
360
+ * DSR tracking and analytics component. Supports compliance with NDPA Part IV,
361
+ * providing summary statistics, deadline tracking, and compliance metrics for data subject requests.
362
+ */
363
+ export declare const DSRTracker: React__default.FC<DSRTrackerProps>;
364
+
365
+ export declare interface DSRTrackerClassNames {
366
+ root?: string;
367
+ header?: string;
368
+ title?: string;
369
+ stats?: string;
370
+ statCard?: string;
371
+ table?: string;
372
+ tableHeader?: string;
373
+ tableRow?: string;
374
+ statusBadge?: string;
375
+ }
376
+
377
+ declare interface DSRTrackerProps {
378
+ /**
379
+ * List of DSR requests to track
380
+ */
381
+ requests: DSRRequest[];
382
+ /**
383
+ * Callback function called when a request is selected
384
+ */
385
+ onSelectRequest?: (requestId: string) => void;
386
+ /**
387
+ * Title displayed on the tracker
388
+ * @default "DSR Request Tracker"
389
+ */
390
+ title?: string;
391
+ /**
392
+ * Description text displayed on the tracker
393
+ * @default "Track the status and progress of data subject requests as required by NDPA Part IV."
394
+ */
395
+ description?: string;
396
+ /**
397
+ * Custom CSS class for the tracker
398
+ */
399
+ className?: string;
400
+ /**
401
+ * Custom CSS class for the buttons
402
+ */
403
+ buttonClassName?: string;
404
+ /**
405
+ * Whether to show the summary statistics
406
+ * @default true
407
+ */
408
+ showSummaryStats?: boolean;
409
+ /**
410
+ * Whether to show the request type breakdown
411
+ * @default true
412
+ */
413
+ showTypeBreakdown?: boolean;
414
+ /**
415
+ * Whether to show the status breakdown
416
+ * @default true
417
+ */
418
+ showStatusBreakdown?: boolean;
419
+ /**
420
+ * Whether to show the timeline chart
421
+ * @default true
422
+ */
423
+ showTimelineChart?: boolean;
424
+ /**
425
+ * Whether to show the overdue requests
426
+ * @default true
427
+ */
428
+ showOverdueRequests?: boolean;
429
+ /**
430
+ * Object of CSS class overrides keyed by semantic section name.
431
+ */
432
+ classNames?: DSRTrackerClassNames;
433
+ /**
434
+ * When true, all default Tailwind classes are removed so consumers
435
+ * can style from scratch using classNames.
436
+ */
437
+ unstyled?: boolean;
438
+ }
439
+
440
+ /**
441
+ * Data Subject Rights types aligned with NDPA 2023 Part IV (Sections 29-36)
442
+ */
443
+ /**
444
+ * Types of data subject requests per NDPA Part IV
445
+ * - 'information': Right to be informed (Section 29)
446
+ * - 'access': Right of access (Section 30)
447
+ * - 'rectification': Right to rectification (Section 31)
448
+ * - 'erasure': Right to erasure (Section 32)
449
+ * - 'restriction': Right to restrict processing (Section 33)
450
+ * - 'portability': Right to data portability (Section 34)
451
+ * - 'objection': Right to object (Section 35)
452
+ * - 'automated_decision_making': Rights related to automated decision-making (Section 36)
453
+ */
454
+ export declare type DSRType = 'information' | 'access' | 'rectification' | 'erasure' | 'restriction' | 'portability' | 'objection' | 'automated_decision_making';
455
+
456
+ /**
457
+ * Formats a DSR request for display or submission
458
+ * @param request The DSR request to format
459
+ * @returns Formatted request data
460
+ */
461
+ export declare function formatDSRRequest(request: DSRRequest): {
462
+ formattedRequest: Record<string, unknown>;
463
+ isValid: boolean;
464
+ validationErrors: string[];
465
+ };
466
+
467
+ /**
468
+ * Legacy status of a data subject request
469
+ * @deprecated Use DSRStatus instead
470
+ */
471
+ export declare type RequestStatus = 'pending' | 'verifying' | 'processing' | 'completed' | 'rejected';
472
+
473
+ /**
474
+ * Represents a type of data subject request (detailed configuration)
475
+ */
476
+ export declare interface RequestType {
477
+ /** Unique identifier for the request type */
478
+ id: string;
479
+ /** Display name for the request type */
480
+ name: string;
481
+ /** Description of what this request type entails */
482
+ description: string;
483
+ /**
484
+ * NDPA section reference (e.g., "Section 30" for access requests)
485
+ */
486
+ ndpaSection?: string;
487
+ /**
488
+ * Estimated time to fulfill this type of request (in days)
489
+ * NDPA requires response within 30 days
490
+ */
491
+ estimatedCompletionTime: number;
492
+ /** Whether additional information is required for this request type */
493
+ requiresAdditionalInfo: boolean;
494
+ /** Custom fields required for this request type */
495
+ additionalFields?: Array<{
496
+ id: string;
497
+ label: string;
498
+ type: 'text' | 'textarea' | 'select' | 'checkbox' | 'file';
499
+ options?: string[];
500
+ required: boolean;
501
+ placeholder?: string;
502
+ }>;
503
+ }
504
+
505
+ export declare interface StorageAdapter<T = unknown> {
506
+ /** Load persisted data. Called once on hook mount. */
507
+ load(): T | null | Promise<T | null>;
508
+ /** Persist data. Called on every state change. */
509
+ save(data: T): void | Promise<void>;
510
+ /** Clear persisted data. Called on reset. */
511
+ remove(): void | Promise<void>;
512
+ }
513
+
514
+ /**
515
+ * Hook for managing Data Subject Requests in compliance with the NDPA
516
+ */
517
+ export declare function useDSR({ initialRequests, requestTypes, adapter, storageKey, useLocalStorage, onSubmit, onUpdate, }: UseDSROptions): UseDSRReturn;
518
+
519
+ export declare function useDSRCompound(): DSRContextValue;
520
+
521
+ declare interface UseDSROptions {
522
+ /**
523
+ * Initial requests to load
524
+ */
525
+ initialRequests?: DSRRequest[];
526
+ /**
527
+ * Available request types
528
+ */
529
+ requestTypes: RequestType[];
530
+ /**
531
+ * Pluggable storage adapter. When provided, takes precedence over storageKey/useLocalStorage.
532
+ */
533
+ adapter?: StorageAdapter<DSRRequest[]>;
534
+ /**
535
+ * Storage key for requests
536
+ * @default "ndpr_dsr_requests"
537
+ * @deprecated Use adapter instead
538
+ */
539
+ storageKey?: string;
540
+ /**
541
+ * Whether to use local storage to persist requests
542
+ * @default true
543
+ * @deprecated Use adapter instead
544
+ */
545
+ useLocalStorage?: boolean;
546
+ /**
547
+ * Callback function called when a request is submitted
548
+ */
549
+ onSubmit?: (request: DSRRequest) => void;
550
+ /**
551
+ * Callback function called when a request is updated
552
+ */
553
+ onUpdate?: (request: DSRRequest) => void;
554
+ }
555
+
556
+ declare interface UseDSRReturn {
557
+ /**
558
+ * All requests
559
+ */
560
+ requests: DSRRequest[];
561
+ /**
562
+ * Submit a new request
563
+ */
564
+ submitRequest: (requestData: Omit<DSRRequest, 'id' | 'status' | 'submittedAt' | 'updatedAt' | 'estimatedCompletionDate'>) => DSRRequest;
565
+ /**
566
+ * Update an existing request
567
+ */
568
+ updateRequest: (id: string, updates: Partial<DSRRequest>) => DSRRequest | null;
569
+ /**
570
+ * Get a request by ID
571
+ */
572
+ getRequest: (id: string) => DSRRequest | null;
573
+ /**
574
+ * Get requests by status
575
+ */
576
+ getRequestsByStatus: (status: RequestStatus) => DSRRequest[];
577
+ /**
578
+ * Get requests by type
579
+ */
580
+ getRequestsByType: (type: string) => DSRRequest[];
581
+ /**
582
+ * Get the request type definition by ID
583
+ */
584
+ getRequestType: (typeId: string) => RequestType | undefined;
585
+ /**
586
+ * Format a request for display or submission
587
+ */
588
+ formatRequest: (request: DSRRequest) => Record<string, unknown>;
589
+ /**
590
+ * Clear all requests
591
+ */
592
+ clearRequests: () => void;
593
+ /**
594
+ * Whether the adapter is still loading data (relevant for async adapters)
595
+ */
596
+ isLoading: boolean;
597
+ }
598
+
599
+ /**
600
+ * Validate a raw DSR submission payload against the same rules
601
+ * `<DSRRequestForm />` enforces client-side. Designed to be called from a
602
+ * server-side handler (Next.js Route Handler, NestJS controller, Express
603
+ * middleware, Cloudflare Worker) so client and server stay in sync without
604
+ * the consumer hand-rolling zod / class-validator schemas.
605
+ *
606
+ * Defensive — accepts `unknown` and narrows. Safe to call directly on
607
+ * `await request.json()`.
608
+ *
609
+ * @example **Next.js Route Handler**
610
+ * ```ts
611
+ * // app/api/dsr/route.ts
612
+ * import { validateDsrSubmission } from '@tantainnovative/ndpr-toolkit/server';
613
+ *
614
+ * export async function POST(req: Request) {
615
+ * const { valid, errors, data } = validateDsrSubmission(await req.json());
616
+ * if (!valid) return Response.json({ errors }, { status: 422 });
617
+ * // `data` is the typed DsrSubmissionPayload
618
+ * await dsrStore.create(data);
619
+ * return Response.json({ ok: true }, { status: 201 });
620
+ * }
621
+ * ```
622
+ *
623
+ * @example **Lock to specific request types**
624
+ * ```ts
625
+ * validateDsrSubmission(payload, {
626
+ * allowedRequestTypes: ['access', 'erasure', 'rectification'],
627
+ * });
628
+ * ```
629
+ *
630
+ * @example **Skip identity verification (e.g. authenticated session)**
631
+ * ```ts
632
+ * validateDsrSubmission(payload, { requireIdentityVerification: false });
633
+ * ```
634
+ */
635
+ export declare function validateDsrSubmission(payload: unknown, options?: ValidateDsrSubmissionOptions): DsrSubmissionValidationResult;
636
+
637
+ /** Options for {@link validateDsrSubmission}. */
638
+ export declare interface ValidateDsrSubmissionOptions {
639
+ /**
640
+ * Whether the data subject is required to provide an identifier
641
+ * (NDPC's recommended verification step). Mirror whatever you set on
642
+ * the client-side `<DSRRequestForm requireIdentityVerification>`.
643
+ * @default true
644
+ */
645
+ requireIdentityVerification?: boolean;
646
+ /**
647
+ * Allowed request types. When provided, the payload's `requestType`
648
+ * must be one of these — useful for locking the server to a specific
649
+ * set of supported NDPA Part IV §29-36 rights.
650
+ */
651
+ allowedRequestTypes?: string[];
652
+ }
653
+
654
+ export { }
package/dist/dsr.js CHANGED
@@ -1,2 +1,3 @@
1
- 'use strict';var chunkZYLDLGFL_js=require('./chunk-ZYLDLGFL.js'),chunkZPKVLTSX_js=require('./chunk-ZPKVLTSX.js'),chunkXSEZDQLB_js=require('./chunk-XSEZDQLB.js'),chunkJKKRPS4P_js=require('./chunk-JKKRPS4P.js');require('./chunk-I54CDQGN.js'),require('./chunk-E64TU6IU.js'),require('./chunk-ELKB2AFZ.js');var chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var R=react.createContext(null);function v(){let e=react.useContext(R);if(!e)throw new Error("DSR compound components must be wrapped in <DSR.Provider>. Example: <DSR.Provider requestTypes={...}><DSR.Form /></DSR.Provider>");return e}var s=({requestTypes:e,adapter:S,storageKey:D,useLocalStorage:d,onSubmit:u,onUpdate:n,children:i})=>{let f=chunkXSEZDQLB_js.a({requestTypes:e,adapter:S,storageKey:D,useLocalStorage:d,onSubmit:u,onUpdate:n}),x=chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},f),{requestTypes:e});return jsxRuntime.jsx(R.Provider,{value:x,children:i})};var C={Provider:s,Form:chunkZPKVLTSX_js.a,Dashboard:chunkZYLDLGFL_js.a,Tracker:chunkZYLDLGFL_js.b};Object.defineProperty(exports,"DSRDashboard",{enumerable:true,get:function(){return chunkZYLDLGFL_js.a}});Object.defineProperty(exports,"DSRTracker",{enumerable:true,get:function(){return chunkZYLDLGFL_js.b}});Object.defineProperty(exports,"DSRRequestForm",{enumerable:true,get:function(){return chunkZPKVLTSX_js.a}});Object.defineProperty(exports,"useDSR",{enumerable:true,get:function(){return chunkXSEZDQLB_js.a}});Object.defineProperty(exports,"formatDSRRequest",{enumerable:true,get:function(){return chunkJKKRPS4P_js.a}});exports.DSR=C;exports.DSRProvider=s;exports.useDSRCompound=v;//# sourceMappingURL=dsr.js.map
1
+ "use client";
2
+ 'use strict';var chunkVIQUXWJC_js=require('./chunk-VIQUXWJC.js'),chunkZPKVLTSX_js=require('./chunk-ZPKVLTSX.js'),chunkCKJAECGV_js=require('./chunk-CKJAECGV.js'),chunkJ5WCPZLW_js=require('./chunk-J5WCPZLW.js');require('./chunk-I54CDQGN.js'),require('./chunk-E64TU6IU.js'),require('./chunk-ELKB2AFZ.js');var chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var m=react.createContext(null);function P(){let e=react.useContext(m);if(!e)throw new Error("DSR compound components must be wrapped in <DSR.Provider>. Example: <DSR.Provider requestTypes={...}><DSR.Form /></DSR.Provider>");return e}var s=({requestTypes:e,adapter:S,storageKey:D,useLocalStorage:d,onSubmit:u,onUpdate:i,children:n})=>{let f=chunkCKJAECGV_js.a({requestTypes:e,adapter:S,storageKey:D,useLocalStorage:d,onSubmit:u,onUpdate:i}),x=chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},f),{requestTypes:e});return jsxRuntime.jsx(m.Provider,{value:x,children:n})};var C={Provider:s,Form:chunkZPKVLTSX_js.a,Dashboard:chunkVIQUXWJC_js.a,Tracker:chunkVIQUXWJC_js.b};Object.defineProperty(exports,"DSRDashboard",{enumerable:true,get:function(){return chunkVIQUXWJC_js.a}});Object.defineProperty(exports,"DSRTracker",{enumerable:true,get:function(){return chunkVIQUXWJC_js.b}});Object.defineProperty(exports,"DSRRequestForm",{enumerable:true,get:function(){return chunkZPKVLTSX_js.a}});Object.defineProperty(exports,"useDSR",{enumerable:true,get:function(){return chunkCKJAECGV_js.a}});Object.defineProperty(exports,"formatDSRRequest",{enumerable:true,get:function(){return chunkJ5WCPZLW_js.b}});Object.defineProperty(exports,"validateDsrSubmission",{enumerable:true,get:function(){return chunkJ5WCPZLW_js.a}});exports.DSR=C;exports.DSRProvider=s;exports.useDSRCompound=P;//# sourceMappingURL=dsr.js.map
2
3
  //# sourceMappingURL=dsr.js.map