@tantainnovative/ndpr-toolkit 3.10.6 → 3.12.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.
- package/CHANGELOG.md +111 -0
- package/README.md +38 -24
- package/dist/adapters.d.mts +90 -4
- package/dist/adapters.d.ts +90 -4
- package/dist/breach.d.mts +13 -1
- package/dist/breach.d.ts +13 -1
- package/dist/breach.js +1 -1
- package/dist/breach.mjs +1 -1
- package/dist/{chunk-EZCGTHQV.js → chunk-4GIMXUMI.js} +3 -3
- package/dist/{chunk-HBLGN4SD.js → chunk-5AECGMEB.js} +1 -1
- package/dist/chunk-67KA345Q.mjs +1 -0
- package/dist/chunk-6OWCUDTN.mjs +1 -0
- package/dist/{chunk-4G3SRVRI.mjs → chunk-B6BRD5SL.mjs} +1 -1
- package/dist/chunk-CAFCRCTZ.mjs +1 -0
- package/dist/{chunk-VJTQXVAF.js → chunk-EHQVTFYO.js} +1 -1
- package/dist/{chunk-CNM6G5IA.js → chunk-FC3PTJFL.js} +1 -1
- package/dist/{chunk-H3IULCE3.js → chunk-HOAC5VUF.js} +1 -1
- package/dist/{chunk-H3XJV2IR.mjs → chunk-I3V3ITN7.mjs} +1 -1
- package/dist/{chunk-MPBPAEZC.mjs → chunk-IB3KSUPZ.mjs} +1 -1
- package/dist/{chunk-TAHSSITO.mjs → chunk-IHNAFXDM.mjs} +1 -1
- package/dist/chunk-IQO3SIAG.mjs +1 -0
- package/dist/{chunk-UTFBKL73.js → chunk-IRRUYR6M.js} +1 -1
- package/dist/{chunk-C7IDR2IV.js → chunk-JLQT3W3E.js} +1 -1
- package/dist/chunk-JYZOKO2W.mjs +103 -0
- package/dist/chunk-NX5MOBRI.js +1 -0
- package/dist/chunk-O2WEABB3.js +1 -0
- package/dist/chunk-OZHUINWS.js +1 -0
- package/dist/{chunk-66NQ5CVY.mjs → chunk-Q4CSVWSS.mjs} +1 -1
- package/dist/{chunk-CR2QZTGW.js → chunk-QMAVEHOR.js} +1 -1
- package/dist/{chunk-3HOXQNCH.mjs → chunk-RFXGD5NE.mjs} +1 -1
- package/dist/chunk-ROC64RLP.js +1 -0
- package/dist/{chunk-O45PKBZA.mjs → chunk-RR3KXNET.mjs} +3 -3
- package/dist/{chunk-KY6WYHWB.mjs → chunk-TN4TH3CT.mjs} +1 -1
- package/dist/chunk-VPNK7OID.mjs +1 -0
- package/dist/{chunk-O2RDZGM2.js → chunk-VUFTRKKC.js} +1 -1
- package/dist/chunk-WKUC65HL.mjs +1 -0
- package/dist/chunk-WXUXCRAJ.js +1 -0
- package/dist/chunk-YK22SYCT.js +103 -0
- package/dist/chunk-YSD2DFBR.js +6 -0
- package/dist/chunk-ZHX62QAL.mjs +6 -0
- package/dist/consent.d.mts +23 -1
- package/dist/consent.d.ts +23 -1
- package/dist/consent.js +1 -1
- package/dist/consent.mjs +1 -1
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/cross-border.d.mts +12 -1
- package/dist/cross-border.d.ts +12 -1
- package/dist/cross-border.js +1 -1
- package/dist/cross-border.mjs +1 -1
- package/dist/dpia.d.mts +16 -1
- package/dist/dpia.d.ts +16 -1
- package/dist/dpia.js +1 -1
- package/dist/dpia.mjs +1 -1
- package/dist/dsr.d.mts +21 -1
- package/dist/dsr.d.ts +21 -1
- package/dist/dsr.js +1 -1
- package/dist/dsr.mjs +1 -1
- package/dist/headless.d.mts +217 -24
- package/dist/headless.d.ts +217 -24
- package/dist/headless.js +1 -1
- package/dist/headless.mjs +1 -1
- package/dist/hooks.d.mts +217 -24
- package/dist/hooks.d.ts +217 -24
- package/dist/hooks.js +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/index.d.mts +419 -29
- package/dist/index.d.ts +419 -29
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/lawful-basis.d.mts +10 -0
- package/dist/lawful-basis.d.ts +10 -0
- package/dist/lawful-basis.js +1 -1
- package/dist/lawful-basis.mjs +1 -1
- package/dist/policy.d.mts +39 -1
- package/dist/policy.d.ts +39 -1
- package/dist/presets.js +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/ropa.d.mts +39 -3
- package/dist/ropa.d.ts +39 -3
- package/dist/ropa.js +1 -1
- package/dist/ropa.mjs +1 -1
- package/dist/server.d.mts +86 -0
- package/dist/server.d.ts +86 -0
- package/dist/server.js +1 -1
- package/dist/server.mjs +1 -1
- package/dist/styles.css +2 -0
- package/package.json +1 -1
- package/dist/chunk-3JPDTXGC.js +0 -1
- package/dist/chunk-43OQNS2J.mjs +0 -6
- package/dist/chunk-5GVMKUMP.js +0 -1
- package/dist/chunk-COD3RMTL.mjs +0 -1
- package/dist/chunk-EXEXUAF6.mjs +0 -1
- package/dist/chunk-L2BRFMVS.js +0 -1
- package/dist/chunk-MOHBL6LX.mjs +0 -1
- package/dist/chunk-PGI2LM6P.js +0 -103
- package/dist/chunk-PZRQWPWD.js +0 -1
- package/dist/chunk-RPXRPGHL.mjs +0 -1
- package/dist/chunk-RZ6GC6WN.mjs +0 -1
- package/dist/chunk-SSH4U4TJ.js +0 -6
- package/dist/chunk-WDDCKYWA.js +0 -1
- package/dist/chunk-X3GCGC3H.mjs +0 -103
- package/dist/chunk-ZQZJNKVB.mjs +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,112 @@ import { RefObject } from 'react';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare type AdequacyStatus = 'adequate' | 'inadequate' | 'pending_review' | 'unknown';
|
|
10
10
|
|
|
11
|
+
export declare interface ApiAdapterErrorContext<T = unknown> {
|
|
12
|
+
/** Which adapter operation triggered this — `load`, `save`, or `remove`. */
|
|
13
|
+
method: ApiAdapterMethod;
|
|
14
|
+
/** The endpoint URL that failed. */
|
|
15
|
+
endpoint: string;
|
|
16
|
+
/** Underlying error (for network failures / parse errors). */
|
|
17
|
+
error?: unknown;
|
|
18
|
+
/** Response object, if a response was received. */
|
|
19
|
+
response?: Response;
|
|
20
|
+
/** HTTP status code, if available. */
|
|
21
|
+
status?: number;
|
|
22
|
+
/** For `save`, the payload that failed to send. */
|
|
23
|
+
payload?: T;
|
|
24
|
+
/** Which retry attempt this is (0 = first try). Capped at `retry.attempts`. */
|
|
25
|
+
attempt: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export declare type ApiAdapterMethod = 'load' | 'save' | 'remove';
|
|
29
|
+
|
|
30
|
+
export declare interface ApiAdapterOptions<T = unknown> {
|
|
31
|
+
/**
|
|
32
|
+
* Extra HTTP headers to send with every request. Useful for `Authorization`,
|
|
33
|
+
* `X-CSRF-Token`, `X-Requested-With`, etc.
|
|
34
|
+
*
|
|
35
|
+
* Can also be a function that returns headers, which lets you read a CSRF
|
|
36
|
+
* token from the DOM/cookie at request time rather than at adapter
|
|
37
|
+
* construction time.
|
|
38
|
+
*/
|
|
39
|
+
headers?: Record<string, string> | (() => Record<string, string>);
|
|
40
|
+
/**
|
|
41
|
+
* Forwarded to fetch's `credentials` option. Defaults to `'same-origin'`
|
|
42
|
+
* (the browser default). Set to `'include'` for cross-origin endpoints
|
|
43
|
+
* that need cookies / auth.
|
|
44
|
+
*/
|
|
45
|
+
credentials?: RequestCredentials;
|
|
46
|
+
/**
|
|
47
|
+
* HTTP method override for the load operation. Defaults to `'GET'`.
|
|
48
|
+
*/
|
|
49
|
+
loadMethod?: 'GET' | 'POST';
|
|
50
|
+
/**
|
|
51
|
+
* HTTP method override for the save operation. Defaults to `'POST'`. Some
|
|
52
|
+
* REST APIs prefer `'PUT'` for upsert semantics.
|
|
53
|
+
*/
|
|
54
|
+
saveMethod?: 'POST' | 'PUT' | 'PATCH';
|
|
55
|
+
/**
|
|
56
|
+
* Transform the raw JSON response into the expected `T`. Useful for APIs
|
|
57
|
+
* that wrap responses in `{ data: ... }` or similar envelopes. Called
|
|
58
|
+
* after `res.json()`. If omitted, the parsed JSON is used as-is.
|
|
59
|
+
*/
|
|
60
|
+
unwrap?: (raw: unknown) => T | null;
|
|
61
|
+
/**
|
|
62
|
+
* Retry policy for failed requests. Defaults to no retries (preserves the
|
|
63
|
+
* pre-3.6.0 behaviour). When configured, applies to all three operations.
|
|
64
|
+
*/
|
|
65
|
+
retry?: ApiAdapterRetryConfig;
|
|
66
|
+
/**
|
|
67
|
+
* Called when a request fails (after all retries exhausted). The adapter
|
|
68
|
+
* still returns a graceful null/void result so the consuming hook
|
|
69
|
+
* doesn't crash — this hook is for telemetry, toasts, or audit logging.
|
|
70
|
+
*/
|
|
71
|
+
onError?: (ctx: ApiAdapterErrorContext<T>) => void;
|
|
72
|
+
/**
|
|
73
|
+
* Called when a request succeeds. Useful for cache invalidation,
|
|
74
|
+
* analytics, or syncing other state.
|
|
75
|
+
*/
|
|
76
|
+
onSuccess?: (ctx: ApiAdapterSuccessContext<T>) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Per-request fetch options to merge into every request. Use this for
|
|
79
|
+
* things `fetch` itself supports that aren't directly modelled above —
|
|
80
|
+
* `signal`, `mode`, `cache`, `redirect`, etc.
|
|
81
|
+
*/
|
|
82
|
+
fetchInit?: Omit<RequestInit, 'method' | 'headers' | 'body' | 'credentials'>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export declare interface ApiAdapterRetryConfig {
|
|
86
|
+
/**
|
|
87
|
+
* Number of additional attempts after the initial request. Defaults to 0
|
|
88
|
+
* (no retries). e.g. `attempts: 2` means up to 3 total requests.
|
|
89
|
+
*/
|
|
90
|
+
attempts?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Base delay in ms between attempts. Defaults to 250ms. The actual delay
|
|
93
|
+
* uses exponential backoff: `baseDelayMs * 2^attempt`.
|
|
94
|
+
*/
|
|
95
|
+
baseDelayMs?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Predicate that decides whether to retry given the failure context. By
|
|
98
|
+
* default we retry on network errors and 5xx responses, but not on 4xx
|
|
99
|
+
* (those are client errors that won't fix themselves).
|
|
100
|
+
*/
|
|
101
|
+
shouldRetry?: (ctx: ApiAdapterErrorContext<unknown>) => boolean;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export declare interface ApiAdapterSuccessContext<T = unknown> {
|
|
105
|
+
/** Which adapter operation succeeded — `load`, `save`, or `remove`. */
|
|
106
|
+
method: ApiAdapterMethod;
|
|
107
|
+
/** The endpoint URL. */
|
|
108
|
+
endpoint: string;
|
|
109
|
+
/** Response object. */
|
|
110
|
+
response: Response;
|
|
111
|
+
/** For `load` operations, the parsed (and optionally unwrapped) data. */
|
|
112
|
+
data?: T;
|
|
113
|
+
/** For `save` operations, the payload that was sent. */
|
|
114
|
+
payload?: T;
|
|
115
|
+
}
|
|
116
|
+
|
|
11
117
|
/**
|
|
12
118
|
* Appends a single audit entry to the consent audit log in localStorage.
|
|
13
119
|
* The log is append-only; existing entries are never modified.
|
|
@@ -172,7 +278,7 @@ export declare interface BreachNotificationManagerClassNames {
|
|
|
172
278
|
detailPanel?: string;
|
|
173
279
|
}
|
|
174
280
|
|
|
175
|
-
declare interface BreachNotificationManagerProps {
|
|
281
|
+
export declare interface BreachNotificationManagerProps {
|
|
176
282
|
/**
|
|
177
283
|
* List of breach reports to manage
|
|
178
284
|
*/
|
|
@@ -351,7 +457,7 @@ export declare interface BreachReportFormClassNames {
|
|
|
351
457
|
loadingOverlay?: string;
|
|
352
458
|
}
|
|
353
459
|
|
|
354
|
-
declare interface BreachReportFormProps {
|
|
460
|
+
export declare interface BreachReportFormProps {
|
|
355
461
|
/**
|
|
356
462
|
* Available breach categories
|
|
357
463
|
*/
|
|
@@ -462,7 +568,7 @@ export declare interface BreachRiskAssessmentClassNames {
|
|
|
462
568
|
primaryButton?: string;
|
|
463
569
|
}
|
|
464
570
|
|
|
465
|
-
declare interface BreachRiskAssessmentProps {
|
|
571
|
+
export declare interface BreachRiskAssessmentProps {
|
|
466
572
|
/**
|
|
467
573
|
* The breach data to assess
|
|
468
574
|
*/
|
|
@@ -703,7 +809,7 @@ export declare interface ConsentBannerClassNames {
|
|
|
703
809
|
secondaryButton?: string;
|
|
704
810
|
}
|
|
705
811
|
|
|
706
|
-
declare interface ConsentBannerProps {
|
|
812
|
+
export declare interface ConsentBannerProps {
|
|
707
813
|
/**
|
|
708
814
|
* Array of consent options to display
|
|
709
815
|
*/
|
|
@@ -844,7 +950,7 @@ export declare interface ConsentManagerClassNames {
|
|
|
844
950
|
secondaryButton?: string;
|
|
845
951
|
}
|
|
846
952
|
|
|
847
|
-
declare interface ConsentManagerProps {
|
|
953
|
+
export declare interface ConsentManagerProps {
|
|
848
954
|
/**
|
|
849
955
|
* Array of consent options to display
|
|
850
956
|
*/
|
|
@@ -1027,7 +1133,7 @@ export declare interface ConsentStorageOptions {
|
|
|
1027
1133
|
};
|
|
1028
1134
|
}
|
|
1029
1135
|
|
|
1030
|
-
declare interface ConsentStorageProps {
|
|
1136
|
+
export declare interface ConsentStorageProps {
|
|
1031
1137
|
/**
|
|
1032
1138
|
* Current consent settings
|
|
1033
1139
|
*/
|
|
@@ -1075,6 +1181,14 @@ declare interface ConsentStorageProps {
|
|
|
1075
1181
|
}) => React__default.ReactNode);
|
|
1076
1182
|
}
|
|
1077
1183
|
|
|
1184
|
+
export declare interface CookieAdapterOptions {
|
|
1185
|
+
domain?: string;
|
|
1186
|
+
path?: string;
|
|
1187
|
+
expires?: number;
|
|
1188
|
+
secure?: boolean;
|
|
1189
|
+
sameSite?: 'Strict' | 'Lax' | 'None';
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1078
1192
|
/**
|
|
1079
1193
|
* Creates a new audit entry from consent settings. If `previousSettings` is
|
|
1080
1194
|
* provided, the action is automatically determined by comparing old and new
|
|
@@ -1208,7 +1322,7 @@ export declare interface CrossBorderTransferManagerClassNames {
|
|
|
1208
1322
|
approvalStatus?: string;
|
|
1209
1323
|
}
|
|
1210
1324
|
|
|
1211
|
-
declare interface CrossBorderTransferManagerProps {
|
|
1325
|
+
export declare interface CrossBorderTransferManagerProps {
|
|
1212
1326
|
/**
|
|
1213
1327
|
* List of cross-border transfers to display
|
|
1214
1328
|
*/
|
|
@@ -1401,7 +1515,7 @@ export declare interface DPIAQuestionnaireClassNames {
|
|
|
1401
1515
|
progressBar?: string;
|
|
1402
1516
|
}
|
|
1403
1517
|
|
|
1404
|
-
declare interface DPIAQuestionnaireProps {
|
|
1518
|
+
export declare interface DPIAQuestionnaireProps {
|
|
1405
1519
|
/**
|
|
1406
1520
|
* Sections of the DPIA questionnaire
|
|
1407
1521
|
*/
|
|
@@ -1510,7 +1624,7 @@ export declare interface DPIAReportClassNames {
|
|
|
1510
1624
|
primaryButton?: string;
|
|
1511
1625
|
}
|
|
1512
1626
|
|
|
1513
|
-
declare interface DPIAReportProps {
|
|
1627
|
+
export declare interface DPIAReportProps {
|
|
1514
1628
|
/**
|
|
1515
1629
|
* The DPIA result to display
|
|
1516
1630
|
*/
|
|
@@ -1672,7 +1786,7 @@ export declare interface DSRDashboardClassNames {
|
|
|
1672
1786
|
detailPanel?: string;
|
|
1673
1787
|
}
|
|
1674
1788
|
|
|
1675
|
-
declare interface DSRDashboardProps {
|
|
1789
|
+
export declare interface DSRDashboardProps {
|
|
1676
1790
|
/**
|
|
1677
1791
|
* List of DSR requests to display
|
|
1678
1792
|
*/
|
|
@@ -1853,7 +1967,7 @@ export declare interface DSRRequestFormClassNames {
|
|
|
1853
1967
|
loadingOverlay?: string;
|
|
1854
1968
|
}
|
|
1855
1969
|
|
|
1856
|
-
declare interface DSRRequestFormProps {
|
|
1970
|
+
export declare interface DSRRequestFormProps {
|
|
1857
1971
|
/**
|
|
1858
1972
|
* Array of request types that can be submitted
|
|
1859
1973
|
*/
|
|
@@ -1959,6 +2073,34 @@ declare interface DSRRequestFormProps {
|
|
|
1959
2073
|
*/
|
|
1960
2074
|
export declare type DSRStatus = 'pending' | 'awaitingVerification' | 'inProgress' | 'completed' | 'rejected';
|
|
1961
2075
|
|
|
2076
|
+
/**
|
|
2077
|
+
* Validated DSR submission shape — matches what `<DSRRequestForm onSubmit>`
|
|
2078
|
+
* emits client-side. Use this as the typed parameter for your server-side
|
|
2079
|
+
* handler after `validateDsrSubmission` returns `valid: true`.
|
|
2080
|
+
*/
|
|
2081
|
+
export declare interface DsrSubmissionPayload {
|
|
2082
|
+
requestType: string;
|
|
2083
|
+
dataSubject: {
|
|
2084
|
+
fullName: string;
|
|
2085
|
+
email: string;
|
|
2086
|
+
phone?: string;
|
|
2087
|
+
identifierType: string;
|
|
2088
|
+
identifierValue: string;
|
|
2089
|
+
};
|
|
2090
|
+
additionalInfo?: Record<string, string | number | boolean | null>;
|
|
2091
|
+
submittedAt: number;
|
|
2092
|
+
}
|
|
2093
|
+
|
|
2094
|
+
/** Result of validating a raw DSR submission payload. */
|
|
2095
|
+
export declare interface DsrSubmissionValidationResult {
|
|
2096
|
+
/** True when the payload conforms to the DSR submission contract. */
|
|
2097
|
+
valid: boolean;
|
|
2098
|
+
/** Field-keyed error messages. Empty when `valid` is true. */
|
|
2099
|
+
errors: Record<string, string>;
|
|
2100
|
+
/** The narrowed, typed payload — only populated when `valid` is true. */
|
|
2101
|
+
data?: DsrSubmissionPayload;
|
|
2102
|
+
}
|
|
2103
|
+
|
|
1962
2104
|
/**
|
|
1963
2105
|
* DSR tracking and analytics component. Supports compliance with NDPA Part IV,
|
|
1964
2106
|
* providing summary statistics, deadline tracking, and compliance metrics for data subject requests.
|
|
@@ -1977,7 +2119,7 @@ export declare interface DSRTrackerClassNames {
|
|
|
1977
2119
|
statusBadge?: string;
|
|
1978
2120
|
}
|
|
1979
2121
|
|
|
1980
|
-
declare interface DSRTrackerProps {
|
|
2122
|
+
export declare interface DSRTrackerProps {
|
|
1981
2123
|
/**
|
|
1982
2124
|
* List of DSR requests to track
|
|
1983
2125
|
*/
|
|
@@ -2268,7 +2410,7 @@ export declare interface LawfulBasisTrackerClassNames {
|
|
|
2268
2410
|
gapAlert?: string;
|
|
2269
2411
|
}
|
|
2270
2412
|
|
|
2271
|
-
declare interface LawfulBasisTrackerProps {
|
|
2413
|
+
export declare interface LawfulBasisTrackerProps {
|
|
2272
2414
|
/**
|
|
2273
2415
|
* List of processing activities to display
|
|
2274
2416
|
*/
|
|
@@ -2868,7 +3010,7 @@ export declare interface PolicyExporterClassNames {
|
|
|
2868
3010
|
preview?: string;
|
|
2869
3011
|
}
|
|
2870
3012
|
|
|
2871
|
-
declare interface PolicyExporterProps {
|
|
3013
|
+
export declare interface PolicyExporterProps {
|
|
2872
3014
|
/**
|
|
2873
3015
|
* The policy content to export
|
|
2874
3016
|
*/
|
|
@@ -2972,7 +3114,7 @@ export declare interface PolicyGeneratorClassNames {
|
|
|
2972
3114
|
complianceNotice?: string;
|
|
2973
3115
|
}
|
|
2974
3116
|
|
|
2975
|
-
declare interface PolicyGeneratorProps {
|
|
3117
|
+
export declare interface PolicyGeneratorProps {
|
|
2976
3118
|
/**
|
|
2977
3119
|
* List of policy sections
|
|
2978
3120
|
* @default DEFAULT_POLICY_SECTIONS
|
|
@@ -3058,7 +3200,7 @@ export declare interface PolicyPreviewClassNames {
|
|
|
3058
3200
|
complianceNotice?: string;
|
|
3059
3201
|
}
|
|
3060
3202
|
|
|
3061
|
-
declare interface PolicyPreviewProps {
|
|
3203
|
+
export declare interface PolicyPreviewProps {
|
|
3062
3204
|
/**
|
|
3063
3205
|
* The policy content to preview
|
|
3064
3206
|
*/
|
|
@@ -3518,7 +3660,7 @@ export declare interface RegulatoryReportGeneratorClassNames {
|
|
|
3518
3660
|
secondaryButton?: string;
|
|
3519
3661
|
}
|
|
3520
3662
|
|
|
3521
|
-
declare interface RegulatoryReportGeneratorProps {
|
|
3663
|
+
export declare interface RegulatoryReportGeneratorProps {
|
|
3522
3664
|
/**
|
|
3523
3665
|
* The breach data to include in the report
|
|
3524
3666
|
*/
|
|
@@ -3713,7 +3855,7 @@ export declare interface ROPAManagerClassNames {
|
|
|
3713
3855
|
complianceGap?: string;
|
|
3714
3856
|
}
|
|
3715
3857
|
|
|
3716
|
-
declare interface ROPAManagerProps {
|
|
3858
|
+
export declare interface ROPAManagerProps {
|
|
3717
3859
|
/**
|
|
3718
3860
|
* The full Record of Processing Activities
|
|
3719
3861
|
*/
|
|
@@ -3856,7 +3998,7 @@ export declare interface StepIndicatorClassNames {
|
|
|
3856
3998
|
label?: string;
|
|
3857
3999
|
}
|
|
3858
4000
|
|
|
3859
|
-
declare interface StepIndicatorProps {
|
|
4001
|
+
export declare interface StepIndicatorProps {
|
|
3860
4002
|
/**
|
|
3861
4003
|
* Array of steps to display
|
|
3862
4004
|
*/
|
|
@@ -3903,7 +4045,7 @@ declare interface StepIndicatorProps {
|
|
|
3903
4045
|
unstyled?: boolean;
|
|
3904
4046
|
}
|
|
3905
4047
|
|
|
3906
|
-
declare interface StorageAdapter<T = unknown> {
|
|
4048
|
+
export declare interface StorageAdapter<T = unknown> {
|
|
3907
4049
|
/** Load persisted data. Called once on hook mount. */
|
|
3908
4050
|
load(): T | null | Promise<T | null>;
|
|
3909
4051
|
/** Persist data. Called on every state change. */
|
|
@@ -4021,6 +4163,28 @@ export declare interface TransferValidationResult {
|
|
|
4021
4163
|
warnings: string[];
|
|
4022
4164
|
}
|
|
4023
4165
|
|
|
4166
|
+
/**
|
|
4167
|
+
* Multi-step privacy-policy authoring hook that adapts the generated draft
|
|
4168
|
+
* to the supplied template context (industry, processing purposes, data
|
|
4169
|
+
* categories, processors). Auto-persists a draft via the supplied adapter
|
|
4170
|
+
* and surfaces a live compliance score against the configured rule set.
|
|
4171
|
+
*
|
|
4172
|
+
* @example
|
|
4173
|
+
* ```tsx
|
|
4174
|
+
* import { useAdaptivePolicyWizard } from '@tantainnovative/ndpr-toolkit/hooks';
|
|
4175
|
+
*
|
|
4176
|
+
* function PolicyWizard() {
|
|
4177
|
+
* const { currentStep, nextStep, policy, complianceScore } = useAdaptivePolicyWizard();
|
|
4178
|
+
* return (
|
|
4179
|
+
* <div>
|
|
4180
|
+
* <p>Step {currentStep} — compliance: {complianceScore}%</p>
|
|
4181
|
+
* <button onClick={nextStep}>Next</button>
|
|
4182
|
+
* {policy && <pre>{policy.title}</pre>}
|
|
4183
|
+
* </div>
|
|
4184
|
+
* );
|
|
4185
|
+
* }
|
|
4186
|
+
* ```
|
|
4187
|
+
*/
|
|
4024
4188
|
export declare function useAdaptivePolicyWizard(options?: UseAdaptivePolicyWizardOptions): UseAdaptivePolicyWizardReturn;
|
|
4025
4189
|
|
|
4026
4190
|
export declare interface UseAdaptivePolicyWizardOptions {
|
|
@@ -4081,7 +4245,19 @@ export declare interface UseAdaptivePolicyWizardReturn {
|
|
|
4081
4245
|
}
|
|
4082
4246
|
|
|
4083
4247
|
/**
|
|
4084
|
-
* Hook for managing data breach notifications in compliance with the NDPA (Section 40)
|
|
4248
|
+
* Hook for managing data breach notifications in compliance with the NDPA (Section 40).
|
|
4249
|
+
*
|
|
4250
|
+
* @example
|
|
4251
|
+
* ```tsx
|
|
4252
|
+
* import { useBreach } from '@tantainnovative/ndpr-toolkit/hooks';
|
|
4253
|
+
*
|
|
4254
|
+
* function BreachConsole() {
|
|
4255
|
+
* const { reports, reportBreach } = useBreach({
|
|
4256
|
+
* categories: [{ id: 'unauthorized-access', name: 'Unauthorised access', description: '' }],
|
|
4257
|
+
* });
|
|
4258
|
+
* return <p>{reports.length} breach report(s) on record.</p>;
|
|
4259
|
+
* }
|
|
4260
|
+
* ```
|
|
4085
4261
|
*/
|
|
4086
4262
|
export declare function useBreach({ categories, initialReports, adapter, storageKey, useLocalStorage, onReport, onAssessment, onNotification, }: UseBreachOptions): UseBreachReturn;
|
|
4087
4263
|
|
|
@@ -4188,14 +4364,65 @@ declare interface UseBreachReturn {
|
|
|
4188
4364
|
isLoading: boolean;
|
|
4189
4365
|
}
|
|
4190
4366
|
|
|
4367
|
+
/**
|
|
4368
|
+
* Computes an NDPA compliance score and returns a structured report
|
|
4369
|
+
* (score, rating, per-module breakdown, recommendations).
|
|
4370
|
+
*
|
|
4371
|
+
* The computation is memoised by the structural identity of `input` — passing
|
|
4372
|
+
* a fresh-but-equal object on every render is safe and does not force a recompute.
|
|
4373
|
+
*
|
|
4374
|
+
* @param options - The compliance score options.
|
|
4375
|
+
* @param options.input - A {@link ComplianceInput} snapshot summarising the
|
|
4376
|
+
* organisation's current compliance posture.
|
|
4377
|
+
* @returns A memoised {@link ComplianceReport} with overall score, rating,
|
|
4378
|
+
* module-level breakdowns, and prioritised recommendations.
|
|
4379
|
+
*
|
|
4380
|
+
* @example
|
|
4381
|
+
* ```tsx
|
|
4382
|
+
* import { useComplianceScore } from '@tantainnovative/ndpr-toolkit/hooks';
|
|
4383
|
+
*
|
|
4384
|
+
* function ComplianceBadge({ input }) {
|
|
4385
|
+
* const report = useComplianceScore({ input });
|
|
4386
|
+
* return <span>{report.overallScore}/100 — {report.rating}</span>;
|
|
4387
|
+
* }
|
|
4388
|
+
* ```
|
|
4389
|
+
*/
|
|
4191
4390
|
export declare function useComplianceScore({ input }: UseComplianceScoreOptions): ComplianceReport;
|
|
4192
4391
|
|
|
4193
4392
|
declare interface UseComplianceScoreOptions {
|
|
4393
|
+
/**
|
|
4394
|
+
* Snapshot of the organisation's compliance signals — consent settings,
|
|
4395
|
+
* DSR queue, breach log, lawful-basis register, transfers, ROPA, etc.
|
|
4396
|
+
* The hook recomputes the report whenever this input changes by value
|
|
4397
|
+
* (compared via a stable JSON key under the hood).
|
|
4398
|
+
*/
|
|
4194
4399
|
input: ComplianceInput;
|
|
4195
4400
|
}
|
|
4196
4401
|
|
|
4197
4402
|
/**
|
|
4198
|
-
* Hook for managing user consent in compliance with NDPA
|
|
4403
|
+
* Hook for managing user consent in compliance with the NDPA.
|
|
4404
|
+
*
|
|
4405
|
+
* @example
|
|
4406
|
+
* ```tsx
|
|
4407
|
+
* import { useConsent } from '@tantainnovative/ndpr-toolkit/hooks';
|
|
4408
|
+
*
|
|
4409
|
+
* function App() {
|
|
4410
|
+
* const { hasConsent, acceptAll, rejectAll, shouldShowBanner } = useConsent({
|
|
4411
|
+
* options: [
|
|
4412
|
+
* { id: 'necessary', label: 'Necessary', required: true },
|
|
4413
|
+
* { id: 'analytics', label: 'Analytics' },
|
|
4414
|
+
* ],
|
|
4415
|
+
* });
|
|
4416
|
+
* if (!shouldShowBanner) return null;
|
|
4417
|
+
* return (
|
|
4418
|
+
* <div role="dialog">
|
|
4419
|
+
* <button onClick={acceptAll}>Accept all</button>
|
|
4420
|
+
* <button onClick={rejectAll}>Reject non-essential</button>
|
|
4421
|
+
* {hasConsent('analytics') && <AnalyticsScripts />}
|
|
4422
|
+
* </div>
|
|
4423
|
+
* );
|
|
4424
|
+
* }
|
|
4425
|
+
* ```
|
|
4199
4426
|
*/
|
|
4200
4427
|
export declare function useConsent({ options, adapter, storageOptions, version, onChange, }: UseConsentOptions): UseConsentReturn;
|
|
4201
4428
|
|
|
@@ -4268,7 +4495,18 @@ declare interface UseConsentReturn {
|
|
|
4268
4495
|
}
|
|
4269
4496
|
|
|
4270
4497
|
/**
|
|
4271
|
-
* Hook for managing cross-border data transfers in compliance with NDPA Part VIII (Sections 41-43)
|
|
4498
|
+
* Hook for managing cross-border data transfers in compliance with NDPA Part VIII (Sections 41-43).
|
|
4499
|
+
*
|
|
4500
|
+
* @example
|
|
4501
|
+
* ```tsx
|
|
4502
|
+
* import { useCrossBorderTransfer } from '@tantainnovative/ndpr-toolkit/hooks';
|
|
4503
|
+
*
|
|
4504
|
+
* function TransferRegister() {
|
|
4505
|
+
* const { transfers, getSummary } = useCrossBorderTransfer();
|
|
4506
|
+
* const summary = getSummary();
|
|
4507
|
+
* return <p>{summary.totalActiveTransfers} active cross-border transfers.</p>;
|
|
4508
|
+
* }
|
|
4509
|
+
* ```
|
|
4272
4510
|
*/
|
|
4273
4511
|
export declare function useCrossBorderTransfer({ initialTransfers, adapter, storageKey, useLocalStorage, onAdd, onUpdate, onRemove, }?: UseCrossBorderTransferOptions): UseCrossBorderTransferReturn;
|
|
4274
4512
|
|
|
@@ -4414,7 +4652,22 @@ declare interface UseDefaultPrivacyPolicyOptions {
|
|
|
4414
4652
|
}
|
|
4415
4653
|
|
|
4416
4654
|
/**
|
|
4417
|
-
* Hook for conducting Data Protection Impact Assessments in compliance with the NDPA 2023
|
|
4655
|
+
* Hook for conducting Data Protection Impact Assessments in compliance with the NDPA 2023.
|
|
4656
|
+
*
|
|
4657
|
+
* @example
|
|
4658
|
+
* ```tsx
|
|
4659
|
+
* import { useDPIA } from '@tantainnovative/ndpr-toolkit/hooks';
|
|
4660
|
+
*
|
|
4661
|
+
* function DPIAWizard({ sections }) {
|
|
4662
|
+
* const { currentSection, progress, updateAnswer, nextSection } = useDPIA({ sections });
|
|
4663
|
+
* return (
|
|
4664
|
+
* <div>
|
|
4665
|
+
* <h2>{currentSection?.title} ({progress}%)</h2>
|
|
4666
|
+
* <button onClick={nextSection}>Next</button>
|
|
4667
|
+
* </div>
|
|
4668
|
+
* );
|
|
4669
|
+
* }
|
|
4670
|
+
* ```
|
|
4418
4671
|
*/
|
|
4419
4672
|
export declare function useDPIA({ sections, initialAnswers, adapter, storageKey, useLocalStorage, onComplete, }: UseDPIAOptions): UseDPIAReturn;
|
|
4420
4673
|
|
|
@@ -4517,7 +4770,27 @@ declare interface UseDPIAReturn {
|
|
|
4517
4770
|
}
|
|
4518
4771
|
|
|
4519
4772
|
/**
|
|
4520
|
-
* Hook for managing Data Subject Requests in compliance with the NDPA
|
|
4773
|
+
* Hook for managing Data Subject Requests in compliance with the NDPA.
|
|
4774
|
+
*
|
|
4775
|
+
* @example
|
|
4776
|
+
* ```tsx
|
|
4777
|
+
* import { useDSR } from '@tantainnovative/ndpr-toolkit/hooks';
|
|
4778
|
+
*
|
|
4779
|
+
* function DSRPanel() {
|
|
4780
|
+
* const { requests, submitRequest } = useDSR({
|
|
4781
|
+
* requestTypes: [
|
|
4782
|
+
* { id: 'access', name: 'Access', description: 'Request access', estimatedCompletionTime: 30 },
|
|
4783
|
+
* ],
|
|
4784
|
+
* });
|
|
4785
|
+
* return (
|
|
4786
|
+
* <ul>
|
|
4787
|
+
* {requests.map((r) => (
|
|
4788
|
+
* <li key={r.id}>{r.type} — {r.status}</li>
|
|
4789
|
+
* ))}
|
|
4790
|
+
* </ul>
|
|
4791
|
+
* );
|
|
4792
|
+
* }
|
|
4793
|
+
* ```
|
|
4521
4794
|
*/
|
|
4522
4795
|
export declare function useDSR({ initialRequests, requestTypes, adapter, storageKey, useLocalStorage, onSubmit, onUpdate, }: UseDSROptions): UseDSRReturn;
|
|
4523
4796
|
|
|
@@ -4642,6 +4915,16 @@ export declare interface UseFocusTrapOptions {
|
|
|
4642
4915
|
/**
|
|
4643
4916
|
* Hook for managing lawful basis documentation for processing activities
|
|
4644
4917
|
* in compliance with NDPA 2023 Section 25.
|
|
4918
|
+
*
|
|
4919
|
+
* @example
|
|
4920
|
+
* ```tsx
|
|
4921
|
+
* import { useLawfulBasis } from '@tantainnovative/ndpr-toolkit/hooks';
|
|
4922
|
+
*
|
|
4923
|
+
* function LawfulBasisRegistry() {
|
|
4924
|
+
* const { activities, addActivity } = useLawfulBasis();
|
|
4925
|
+
* return <p>{activities.length} processing activities documented.</p>;
|
|
4926
|
+
* }
|
|
4927
|
+
* ```
|
|
4645
4928
|
*/
|
|
4646
4929
|
export declare function useLawfulBasis({ initialActivities, adapter, storageKey, useLocalStorage, onAdd, onUpdate, onRemove, }?: UseLawfulBasisOptions): UseLawfulBasisReturn;
|
|
4647
4930
|
|
|
@@ -4722,7 +5005,23 @@ declare interface UseLawfulBasisReturn {
|
|
|
4722
5005
|
export declare function useNDPRConfig(): NDPRConfig;
|
|
4723
5006
|
|
|
4724
5007
|
/**
|
|
4725
|
-
* Hook for generating NDPA-compliant privacy policies
|
|
5008
|
+
* Hook for generating NDPA-compliant privacy policies.
|
|
5009
|
+
*
|
|
5010
|
+
* @example
|
|
5011
|
+
* ```tsx
|
|
5012
|
+
* import { usePrivacyPolicy } from '@tantainnovative/ndpr-toolkit/hooks';
|
|
5013
|
+
*
|
|
5014
|
+
* function PolicyBuilder({ templates }) {
|
|
5015
|
+
* const { policy, selectTemplate, generatePolicy } = usePrivacyPolicy({ templates });
|
|
5016
|
+
* return (
|
|
5017
|
+
* <div>
|
|
5018
|
+
* <button onClick={() => selectTemplate(templates[0].id)}>Select default</button>
|
|
5019
|
+
* <button onClick={generatePolicy}>Generate</button>
|
|
5020
|
+
* {policy && <pre>{policy.title}</pre>}
|
|
5021
|
+
* </div>
|
|
5022
|
+
* );
|
|
5023
|
+
* }
|
|
5024
|
+
* ```
|
|
4726
5025
|
*/
|
|
4727
5026
|
export declare function usePrivacyPolicy({ templates, initialPolicy, adapter, storageKey, persist, useLocalStorage, onGenerate, }: UsePrivacyPolicyOptions): UsePrivacyPolicyReturn;
|
|
4728
5027
|
|
|
@@ -4834,6 +5133,21 @@ declare interface UsePrivacyPolicyReturn {
|
|
|
4834
5133
|
*
|
|
4835
5134
|
* Provides state management and utility functions for maintaining
|
|
4836
5135
|
* a comprehensive register of all data processing activities.
|
|
5136
|
+
*
|
|
5137
|
+
* @example
|
|
5138
|
+
* ```tsx
|
|
5139
|
+
* import { useROPA } from '@tantainnovative/ndpr-toolkit/hooks';
|
|
5140
|
+
*
|
|
5141
|
+
* function ROPARegister({ initialData }) {
|
|
5142
|
+
* const { ropa, addRecord, exportCSV } = useROPA({ initialData });
|
|
5143
|
+
* return (
|
|
5144
|
+
* <div>
|
|
5145
|
+
* <p>{ropa.records.length} processing records</p>
|
|
5146
|
+
* <button onClick={() => download(exportCSV())}>Export CSV</button>
|
|
5147
|
+
* </div>
|
|
5148
|
+
* );
|
|
5149
|
+
* }
|
|
5150
|
+
* ```
|
|
4837
5151
|
*/
|
|
4838
5152
|
export declare function useROPA({ initialData, adapter, onRecordAdd, onRecordUpdate, onRecordArchive, }: UseROPAOptions): UseROPAReturn;
|
|
4839
5153
|
|
|
@@ -4884,17 +5198,38 @@ export declare interface UseROPAReturn {
|
|
|
4884
5198
|
*/
|
|
4885
5199
|
getRecord: (id: string) => ProcessingRecord | undefined;
|
|
4886
5200
|
/**
|
|
4887
|
-
* Get a summary of the ROPA including statistics
|
|
5201
|
+
* Get a summary of the ROPA including statistics.
|
|
5202
|
+
* @deprecated Use the cached `summary` field instead — it is memoised on
|
|
5203
|
+
* `ropa` so consumers don't pay the recompute cost on every call.
|
|
4888
5204
|
*/
|
|
4889
5205
|
getSummary: () => ROPASummary;
|
|
4890
5206
|
/**
|
|
4891
|
-
* Export the ROPA as a CSV string
|
|
5207
|
+
* Export the ROPA as a CSV string.
|
|
5208
|
+
* @deprecated Use the cached `csv` field instead — it is memoised on
|
|
5209
|
+
* `ropa` so consumers don't pay the recompute cost on every call.
|
|
4892
5210
|
*/
|
|
4893
5211
|
exportCSV: () => string;
|
|
4894
5212
|
/**
|
|
4895
|
-
* Identify compliance gaps across all records
|
|
5213
|
+
* Identify compliance gaps across all records.
|
|
5214
|
+
* @deprecated Use the cached `complianceGaps` field instead — it is
|
|
5215
|
+
* memoised on `ropa` so consumers don't pay the recompute cost on every call.
|
|
4896
5216
|
*/
|
|
4897
5217
|
getComplianceGaps: () => ROPAComplianceGap[];
|
|
5218
|
+
/**
|
|
5219
|
+
* Memoised ROPA summary. Recomputed only when `ropa` changes.
|
|
5220
|
+
* Prefer this over `getSummary()` to avoid redundant recomputation.
|
|
5221
|
+
*/
|
|
5222
|
+
summary: ROPASummary;
|
|
5223
|
+
/**
|
|
5224
|
+
* Memoised CSV export string. Recomputed only when `ropa` changes.
|
|
5225
|
+
* Prefer this over `exportCSV()` to avoid redundant recomputation.
|
|
5226
|
+
*/
|
|
5227
|
+
csv: string;
|
|
5228
|
+
/**
|
|
5229
|
+
* Memoised compliance gap list. Recomputed only when `ropa` changes.
|
|
5230
|
+
* Prefer this over `getComplianceGaps()` to avoid redundant recomputation.
|
|
5231
|
+
*/
|
|
5232
|
+
complianceGaps: ROPAComplianceGap[];
|
|
4898
5233
|
/**
|
|
4899
5234
|
* Whether the adapter is still loading data (relevant for async adapters)
|
|
4900
5235
|
*/
|
|
@@ -4923,6 +5258,61 @@ export declare function validateConsentOptions(options: ConsentOption[]): {
|
|
|
4923
5258
|
errors: string[];
|
|
4924
5259
|
};
|
|
4925
5260
|
|
|
5261
|
+
/**
|
|
5262
|
+
* Validate a raw DSR submission payload against the same rules
|
|
5263
|
+
* `<DSRRequestForm />` enforces client-side. Designed to be called from a
|
|
5264
|
+
* server-side handler (Next.js Route Handler, NestJS controller, Express
|
|
5265
|
+
* middleware, Cloudflare Worker) so client and server stay in sync without
|
|
5266
|
+
* the consumer hand-rolling zod / class-validator schemas.
|
|
5267
|
+
*
|
|
5268
|
+
* Defensive — accepts `unknown` and narrows. Safe to call directly on
|
|
5269
|
+
* `await request.json()`.
|
|
5270
|
+
*
|
|
5271
|
+
* @example **Next.js Route Handler**
|
|
5272
|
+
* ```ts
|
|
5273
|
+
* // app/api/dsr/route.ts
|
|
5274
|
+
* import { validateDsrSubmission } from '@tantainnovative/ndpr-toolkit/server';
|
|
5275
|
+
*
|
|
5276
|
+
* export async function POST(req: Request) {
|
|
5277
|
+
* const { valid, errors, data } = validateDsrSubmission(await req.json());
|
|
5278
|
+
* if (!valid) return Response.json({ errors }, { status: 422 });
|
|
5279
|
+
* // `data` is the typed DsrSubmissionPayload
|
|
5280
|
+
* await dsrStore.create(data);
|
|
5281
|
+
* return Response.json({ ok: true }, { status: 201 });
|
|
5282
|
+
* }
|
|
5283
|
+
* ```
|
|
5284
|
+
*
|
|
5285
|
+
* @example **Lock to specific request types**
|
|
5286
|
+
* ```ts
|
|
5287
|
+
* validateDsrSubmission(payload, {
|
|
5288
|
+
* allowedRequestTypes: ['access', 'erasure', 'rectification'],
|
|
5289
|
+
* });
|
|
5290
|
+
* ```
|
|
5291
|
+
*
|
|
5292
|
+
* @example **Skip identity verification (e.g. authenticated session)**
|
|
5293
|
+
* ```ts
|
|
5294
|
+
* validateDsrSubmission(payload, { requireIdentityVerification: false });
|
|
5295
|
+
* ```
|
|
5296
|
+
*/
|
|
5297
|
+
export declare function validateDsrSubmission(payload: unknown, options?: ValidateDsrSubmissionOptions): DsrSubmissionValidationResult;
|
|
5298
|
+
|
|
5299
|
+
/** Options for {@link validateDsrSubmission}. */
|
|
5300
|
+
export declare interface ValidateDsrSubmissionOptions {
|
|
5301
|
+
/**
|
|
5302
|
+
* Whether the data subject is required to provide an identifier
|
|
5303
|
+
* (NDPC's recommended verification step). Mirror whatever you set on
|
|
5304
|
+
* the client-side `<DSRRequestForm requireIdentityVerification>`.
|
|
5305
|
+
* @default true
|
|
5306
|
+
*/
|
|
5307
|
+
requireIdentityVerification?: boolean;
|
|
5308
|
+
/**
|
|
5309
|
+
* Allowed request types. When provided, the payload's `requestType`
|
|
5310
|
+
* must be one of these — useful for locking the server to a specific
|
|
5311
|
+
* set of supported NDPA Part VI §34-38 (plus §35, §36, §37) data-subject rights.
|
|
5312
|
+
*/
|
|
5313
|
+
allowedRequestTypes?: string[];
|
|
5314
|
+
}
|
|
5315
|
+
|
|
4926
5316
|
/**
|
|
4927
5317
|
* Validates that all required fields are present on a processing activity
|
|
4928
5318
|
* and that the lawful basis is properly documented.
|