@tantainnovative/ndpr-toolkit 3.5.5 → 3.6.1
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 +44 -0
- package/README.md +48 -2
- package/dist/adapters.d.mts +137 -3
- package/dist/adapters.d.ts +137 -3
- package/dist/adapters.js +1 -1
- package/dist/adapters.mjs +1 -1
- package/dist/chunk-LTPSN2SU.mjs +1 -0
- package/dist/chunk-PL4XNCQA.mjs +1 -0
- package/dist/chunk-ROTLSZMV.js +1 -0
- package/dist/chunk-RV2VMWZJ.mjs +1 -0
- package/dist/chunk-RXZFYBUJ.js +1 -0
- package/dist/chunk-SJRIOZ4K.mjs +1 -0
- package/dist/chunk-V3RYHNHN.js +1 -0
- package/dist/chunk-W7RBGZCC.js +1 -0
- package/dist/presets-consent.d.mts +139 -0
- package/dist/presets-consent.d.ts +139 -0
- package/dist/presets-consent.js +2 -0
- package/dist/presets-consent.mjs +2 -0
- package/dist/presets-dsr.d.mts +133 -0
- package/dist/presets-dsr.d.ts +133 -0
- package/dist/presets-dsr.js +2 -0
- package/dist/presets-dsr.mjs +2 -0
- package/dist/presets-policy.d.mts +203 -0
- package/dist/presets-policy.d.ts +203 -0
- package/dist/presets-policy.js +2 -0
- package/dist/presets-policy.mjs +2 -0
- package/dist/presets.d.mts +73 -0
- package/dist/presets.d.ts +73 -0
- package/dist/presets.js +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/server.d.mts +137 -3
- package/dist/server.d.ts +137 -3
- package/dist/server.js +1 -1
- package/dist/server.mjs +1 -1
- package/package.json +25 -1
- package/dist/chunk-6NXXQYQL.js +0 -1
- package/dist/chunk-NBZUZYTB.mjs +0 -1
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
declare interface ConsentBannerClassNames {
|
|
4
|
+
root?: string;
|
|
5
|
+
container?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
optionsList?: string;
|
|
9
|
+
optionItem?: string;
|
|
10
|
+
optionCheckbox?: string;
|
|
11
|
+
optionLabel?: string;
|
|
12
|
+
optionDescription?: string;
|
|
13
|
+
buttonGroup?: string;
|
|
14
|
+
acceptButton?: string;
|
|
15
|
+
rejectButton?: string;
|
|
16
|
+
customizeButton?: string;
|
|
17
|
+
saveButton?: string;
|
|
18
|
+
customizePanel?: string;
|
|
19
|
+
selectAllButton?: string;
|
|
20
|
+
/** Alias for acceptButton */
|
|
21
|
+
primaryButton?: string;
|
|
22
|
+
/** Alias for rejectButton */
|
|
23
|
+
secondaryButton?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Consent types aligned with NDPA 2023 Section 25-26
|
|
28
|
+
* Consent must be freely given, specific, informed, and unambiguous
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Represents a consent option that can be presented to users
|
|
32
|
+
*/
|
|
33
|
+
declare interface ConsentOption {
|
|
34
|
+
/** Unique identifier for the consent option */
|
|
35
|
+
id: string;
|
|
36
|
+
/** Display label for the consent option */
|
|
37
|
+
label: string;
|
|
38
|
+
/** Detailed description of what this consent option covers */
|
|
39
|
+
description: string;
|
|
40
|
+
/** Whether this consent option is required (cannot be declined) */
|
|
41
|
+
required: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* The specific purpose for which data will be processed
|
|
44
|
+
* NDPA Section 25(2) requires consent to be specific to each purpose
|
|
45
|
+
*/
|
|
46
|
+
purpose: string;
|
|
47
|
+
/**
|
|
48
|
+
* Default state of the consent option
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
defaultValue?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Categories of personal data covered by this consent option
|
|
54
|
+
*/
|
|
55
|
+
dataCategories?: string[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Represents the user's consent settings
|
|
60
|
+
*/
|
|
61
|
+
declare interface ConsentSettings {
|
|
62
|
+
/** Map of consent option IDs to boolean values indicating consent status */
|
|
63
|
+
consents: Record<string, boolean>;
|
|
64
|
+
/** Timestamp when consent was last updated */
|
|
65
|
+
timestamp: number;
|
|
66
|
+
/** Version of the consent form that was accepted */
|
|
67
|
+
version: string;
|
|
68
|
+
/** Method used to collect consent (e.g., "banner", "settings", "api") */
|
|
69
|
+
method: string;
|
|
70
|
+
/** Whether the user has actively made a choice (as opposed to default settings) */
|
|
71
|
+
hasInteracted: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* The lawful basis under which processing is conducted
|
|
74
|
+
* Required by NDPA Section 25(1)
|
|
75
|
+
*/
|
|
76
|
+
lawfulBasis?: LawfulBasisType;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Lawful basis for processing personal data per NDPA Section 25(1)
|
|
81
|
+
*/
|
|
82
|
+
declare type LawfulBasisType = 'consent' | 'contract' | 'legal_obligation' | 'vital_interests' | 'public_interest' | 'legitimate_interests';
|
|
83
|
+
|
|
84
|
+
export declare const NDPRConsent: React__default.FC<NDPRConsentProps>;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* UX copy overrides for the NDPRConsent preset. Pass any subset to
|
|
88
|
+
* replace the default text without dropping to the lower-level
|
|
89
|
+
* `<ConsentBanner>` API. Strings you omit fall back to the toolkit
|
|
90
|
+
* defaults (which already cite NDPA Section 26).
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* <NDPRConsent copy={{
|
|
94
|
+
* title: 'Cookie preferences',
|
|
95
|
+
* description: 'Acme uses cookies to keep you signed in and improve our store.',
|
|
96
|
+
* acceptAll: 'Allow all',
|
|
97
|
+
* rejectAll: 'Only essentials',
|
|
98
|
+
* }} />
|
|
99
|
+
*/
|
|
100
|
+
export declare interface NDPRConsentCopy {
|
|
101
|
+
/** Banner heading. Default: "We Value Your Privacy" */
|
|
102
|
+
title?: string;
|
|
103
|
+
/** Body paragraph under the heading. Default cites NDPA Section 26. */
|
|
104
|
+
description?: string;
|
|
105
|
+
/** Primary CTA — accepts all categories. Default: "Accept All" */
|
|
106
|
+
acceptAll?: string;
|
|
107
|
+
/** Secondary CTA — rejects all non-essential categories. Default: "Reject All" */
|
|
108
|
+
rejectAll?: string;
|
|
109
|
+
/** Tertiary CTA — opens the per-category controls. Default: "Customize" */
|
|
110
|
+
customize?: string;
|
|
111
|
+
/** Submit button on the per-category panel. Default: "Save Preferences" */
|
|
112
|
+
save?: string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export declare interface NDPRConsentProps {
|
|
116
|
+
extraOptions?: ConsentOption[];
|
|
117
|
+
options?: ConsentOption[];
|
|
118
|
+
adapter?: StorageAdapter<ConsentSettings>;
|
|
119
|
+
position?: 'top' | 'bottom' | 'center' | 'inline';
|
|
120
|
+
classNames?: ConsentBannerClassNames;
|
|
121
|
+
unstyled?: boolean;
|
|
122
|
+
onSave?: (settings: ConsentSettings) => void;
|
|
123
|
+
/**
|
|
124
|
+
* UX copy overrides — see {@link NDPRConsentCopy}. Lets you brand the
|
|
125
|
+
* banner without dropping to the lower-level `<ConsentBanner>` API.
|
|
126
|
+
*/
|
|
127
|
+
copy?: NDPRConsentCopy;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
declare interface StorageAdapter<T = unknown> {
|
|
131
|
+
/** Load persisted data. Called once on hook mount. */
|
|
132
|
+
load(): T | null | Promise<T | null>;
|
|
133
|
+
/** Persist data. Called on every state change. */
|
|
134
|
+
save(data: T): void | Promise<void>;
|
|
135
|
+
/** Clear persisted data. Called on reset. */
|
|
136
|
+
remove(): void | Promise<void>;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export { }
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';var chunkV3RYHNHN_js=require('./chunk-V3RYHNHN.js');require('./chunk-732C2EVN.js'),require('./chunk-L2VO3MEJ.js'),require('./chunk-AME4HJR4.js'),require('./chunk-RFPLZDIO.js');Object.defineProperty(exports,"NDPRConsent",{enumerable:true,get:function(){return chunkV3RYHNHN_js.a}});
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents the data submitted by the DSR request form.
|
|
5
|
+
*/
|
|
6
|
+
declare interface DSRFormSubmission {
|
|
7
|
+
/** The selected request type identifier */
|
|
8
|
+
requestType: string;
|
|
9
|
+
/** Data subject personal information */
|
|
10
|
+
dataSubject: {
|
|
11
|
+
fullName: string;
|
|
12
|
+
email: string;
|
|
13
|
+
phone?: string;
|
|
14
|
+
identifierType: string;
|
|
15
|
+
identifierValue: string;
|
|
16
|
+
};
|
|
17
|
+
/** Additional information provided for the selected request type */
|
|
18
|
+
additionalInfo?: Record<string, string | number | boolean | null>;
|
|
19
|
+
/** Timestamp (ms) when the form was submitted */
|
|
20
|
+
submittedAt: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare interface DSRRequestFormClassNames {
|
|
24
|
+
root?: string;
|
|
25
|
+
title?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
form?: string;
|
|
28
|
+
fieldGroup?: string;
|
|
29
|
+
label?: string;
|
|
30
|
+
input?: string;
|
|
31
|
+
select?: string;
|
|
32
|
+
textarea?: string;
|
|
33
|
+
submitButton?: string;
|
|
34
|
+
/** Alias for submitButton */
|
|
35
|
+
primaryButton?: string;
|
|
36
|
+
successMessage?: string;
|
|
37
|
+
/** Custom class applied when isSubmitting is true (e.g. a loading overlay) */
|
|
38
|
+
loadingOverlay?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export declare const NDPRSubjectRights: React__default.FC<NDPRSubjectRightsProps>;
|
|
42
|
+
|
|
43
|
+
export declare interface NDPRSubjectRightsProps {
|
|
44
|
+
requestTypes?: RequestType[];
|
|
45
|
+
adapter?: StorageAdapter<DSRFormSubmission>;
|
|
46
|
+
classNames?: DSRRequestFormClassNames;
|
|
47
|
+
unstyled?: boolean;
|
|
48
|
+
onSubmit?: (data: DSRFormSubmission) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Public-form mode. Use when the form should submit to your existing
|
|
51
|
+
* backend workflow instead of being state-managed by an adapter.
|
|
52
|
+
*
|
|
53
|
+
* When `submitTo` is set:
|
|
54
|
+
* - the form does NOT require an `adapter`
|
|
55
|
+
* - on submit, the toolkit POSTs the JSON-serialised `DSRFormSubmission`
|
|
56
|
+
* to this URL (with `Content-Type: application/json`)
|
|
57
|
+
* - your `onSubmit` callback still fires (after the POST resolves)
|
|
58
|
+
* - submit failures are surfaced via `onSubmitError`
|
|
59
|
+
*
|
|
60
|
+
* For more control over headers, credentials, or retry behaviour, build
|
|
61
|
+
* an `apiAdapter` (which now supports CSRF, retry, and error hooks in
|
|
62
|
+
* 3.6.0) and pass that as `adapter` instead. `submitTo` is the
|
|
63
|
+
* fire-and-forget shortcut for public forms.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* <NDPRSubjectRights submitTo="/api/dsr" />
|
|
67
|
+
*/
|
|
68
|
+
submitTo?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Fetch options for the `submitTo` POST. Useful for adding `credentials`
|
|
71
|
+
* (cookies/auth), `X-CSRF-Token`, or any other header your backend
|
|
72
|
+
* requires. Ignored unless `submitTo` is set.
|
|
73
|
+
*
|
|
74
|
+
* @default { credentials: 'same-origin' }
|
|
75
|
+
*/
|
|
76
|
+
submitOptions?: {
|
|
77
|
+
headers?: Record<string, string> | (() => Record<string, string>);
|
|
78
|
+
credentials?: RequestCredentials;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Called when a `submitTo` POST fails (network error or non-2xx
|
|
82
|
+
* response). Receives the underlying error or Response.
|
|
83
|
+
*/
|
|
84
|
+
onSubmitError?: (ctx: {
|
|
85
|
+
error?: unknown;
|
|
86
|
+
response?: Response;
|
|
87
|
+
}) => void;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Represents a type of data subject request (detailed configuration)
|
|
92
|
+
*/
|
|
93
|
+
declare interface RequestType {
|
|
94
|
+
/** Unique identifier for the request type */
|
|
95
|
+
id: string;
|
|
96
|
+
/** Display name for the request type */
|
|
97
|
+
name: string;
|
|
98
|
+
/** Description of what this request type entails */
|
|
99
|
+
description: string;
|
|
100
|
+
/**
|
|
101
|
+
* NDPA 2023 section reference for this right
|
|
102
|
+
* (e.g., "Section 34(1)(a)" for access, "Section 38" for portability).
|
|
103
|
+
* Used for display purposes only — verify the exact subsection with counsel.
|
|
104
|
+
*/
|
|
105
|
+
ndpaSection?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Estimated time to fulfill this type of request (in days)
|
|
108
|
+
* NDPA requires response within 30 days
|
|
109
|
+
*/
|
|
110
|
+
estimatedCompletionTime: number;
|
|
111
|
+
/** Whether additional information is required for this request type */
|
|
112
|
+
requiresAdditionalInfo: boolean;
|
|
113
|
+
/** Custom fields required for this request type */
|
|
114
|
+
additionalFields?: Array<{
|
|
115
|
+
id: string;
|
|
116
|
+
label: string;
|
|
117
|
+
type: 'text' | 'textarea' | 'select' | 'checkbox' | 'file';
|
|
118
|
+
options?: string[];
|
|
119
|
+
required: boolean;
|
|
120
|
+
placeholder?: string;
|
|
121
|
+
}>;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
declare interface StorageAdapter<T = unknown> {
|
|
125
|
+
/** Load persisted data. Called once on hook mount. */
|
|
126
|
+
load(): T | null | Promise<T | null>;
|
|
127
|
+
/** Persist data. Called on every state change. */
|
|
128
|
+
save(data: T): void | Promise<void>;
|
|
129
|
+
/** Clear persisted data. Called on reset. */
|
|
130
|
+
remove(): void | Promise<void>;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export { }
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents the data submitted by the DSR request form.
|
|
5
|
+
*/
|
|
6
|
+
declare interface DSRFormSubmission {
|
|
7
|
+
/** The selected request type identifier */
|
|
8
|
+
requestType: string;
|
|
9
|
+
/** Data subject personal information */
|
|
10
|
+
dataSubject: {
|
|
11
|
+
fullName: string;
|
|
12
|
+
email: string;
|
|
13
|
+
phone?: string;
|
|
14
|
+
identifierType: string;
|
|
15
|
+
identifierValue: string;
|
|
16
|
+
};
|
|
17
|
+
/** Additional information provided for the selected request type */
|
|
18
|
+
additionalInfo?: Record<string, string | number | boolean | null>;
|
|
19
|
+
/** Timestamp (ms) when the form was submitted */
|
|
20
|
+
submittedAt: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare interface DSRRequestFormClassNames {
|
|
24
|
+
root?: string;
|
|
25
|
+
title?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
form?: string;
|
|
28
|
+
fieldGroup?: string;
|
|
29
|
+
label?: string;
|
|
30
|
+
input?: string;
|
|
31
|
+
select?: string;
|
|
32
|
+
textarea?: string;
|
|
33
|
+
submitButton?: string;
|
|
34
|
+
/** Alias for submitButton */
|
|
35
|
+
primaryButton?: string;
|
|
36
|
+
successMessage?: string;
|
|
37
|
+
/** Custom class applied when isSubmitting is true (e.g. a loading overlay) */
|
|
38
|
+
loadingOverlay?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export declare const NDPRSubjectRights: React__default.FC<NDPRSubjectRightsProps>;
|
|
42
|
+
|
|
43
|
+
export declare interface NDPRSubjectRightsProps {
|
|
44
|
+
requestTypes?: RequestType[];
|
|
45
|
+
adapter?: StorageAdapter<DSRFormSubmission>;
|
|
46
|
+
classNames?: DSRRequestFormClassNames;
|
|
47
|
+
unstyled?: boolean;
|
|
48
|
+
onSubmit?: (data: DSRFormSubmission) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Public-form mode. Use when the form should submit to your existing
|
|
51
|
+
* backend workflow instead of being state-managed by an adapter.
|
|
52
|
+
*
|
|
53
|
+
* When `submitTo` is set:
|
|
54
|
+
* - the form does NOT require an `adapter`
|
|
55
|
+
* - on submit, the toolkit POSTs the JSON-serialised `DSRFormSubmission`
|
|
56
|
+
* to this URL (with `Content-Type: application/json`)
|
|
57
|
+
* - your `onSubmit` callback still fires (after the POST resolves)
|
|
58
|
+
* - submit failures are surfaced via `onSubmitError`
|
|
59
|
+
*
|
|
60
|
+
* For more control over headers, credentials, or retry behaviour, build
|
|
61
|
+
* an `apiAdapter` (which now supports CSRF, retry, and error hooks in
|
|
62
|
+
* 3.6.0) and pass that as `adapter` instead. `submitTo` is the
|
|
63
|
+
* fire-and-forget shortcut for public forms.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* <NDPRSubjectRights submitTo="/api/dsr" />
|
|
67
|
+
*/
|
|
68
|
+
submitTo?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Fetch options for the `submitTo` POST. Useful for adding `credentials`
|
|
71
|
+
* (cookies/auth), `X-CSRF-Token`, or any other header your backend
|
|
72
|
+
* requires. Ignored unless `submitTo` is set.
|
|
73
|
+
*
|
|
74
|
+
* @default { credentials: 'same-origin' }
|
|
75
|
+
*/
|
|
76
|
+
submitOptions?: {
|
|
77
|
+
headers?: Record<string, string> | (() => Record<string, string>);
|
|
78
|
+
credentials?: RequestCredentials;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Called when a `submitTo` POST fails (network error or non-2xx
|
|
82
|
+
* response). Receives the underlying error or Response.
|
|
83
|
+
*/
|
|
84
|
+
onSubmitError?: (ctx: {
|
|
85
|
+
error?: unknown;
|
|
86
|
+
response?: Response;
|
|
87
|
+
}) => void;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Represents a type of data subject request (detailed configuration)
|
|
92
|
+
*/
|
|
93
|
+
declare interface RequestType {
|
|
94
|
+
/** Unique identifier for the request type */
|
|
95
|
+
id: string;
|
|
96
|
+
/** Display name for the request type */
|
|
97
|
+
name: string;
|
|
98
|
+
/** Description of what this request type entails */
|
|
99
|
+
description: string;
|
|
100
|
+
/**
|
|
101
|
+
* NDPA 2023 section reference for this right
|
|
102
|
+
* (e.g., "Section 34(1)(a)" for access, "Section 38" for portability).
|
|
103
|
+
* Used for display purposes only — verify the exact subsection with counsel.
|
|
104
|
+
*/
|
|
105
|
+
ndpaSection?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Estimated time to fulfill this type of request (in days)
|
|
108
|
+
* NDPA requires response within 30 days
|
|
109
|
+
*/
|
|
110
|
+
estimatedCompletionTime: number;
|
|
111
|
+
/** Whether additional information is required for this request type */
|
|
112
|
+
requiresAdditionalInfo: boolean;
|
|
113
|
+
/** Custom fields required for this request type */
|
|
114
|
+
additionalFields?: Array<{
|
|
115
|
+
id: string;
|
|
116
|
+
label: string;
|
|
117
|
+
type: 'text' | 'textarea' | 'select' | 'checkbox' | 'file';
|
|
118
|
+
options?: string[];
|
|
119
|
+
required: boolean;
|
|
120
|
+
placeholder?: string;
|
|
121
|
+
}>;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
declare interface StorageAdapter<T = unknown> {
|
|
125
|
+
/** Load persisted data. Called once on hook mount. */
|
|
126
|
+
load(): T | null | Promise<T | null>;
|
|
127
|
+
/** Persist data. Called on every state change. */
|
|
128
|
+
save(data: T): void | Promise<void>;
|
|
129
|
+
/** Clear persisted data. Called on reset. */
|
|
130
|
+
remove(): void | Promise<void>;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export { }
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';var chunkRXZFYBUJ_js=require('./chunk-RXZFYBUJ.js');require('./chunk-W47OSMT6.js'),require('./chunk-UXUMYP4L.js'),require('./chunk-AME4HJR4.js'),require('./chunk-RFPLZDIO.js');Object.defineProperty(exports,"NDPRSubjectRights",{enumerable:true,get:function(){return chunkRXZFYBUJ_js.a}});
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
/** A user-defined section added to the policy outside the generated ones. */
|
|
4
|
+
declare interface CustomSection {
|
|
5
|
+
id: string;
|
|
6
|
+
title: string;
|
|
7
|
+
content: string;
|
|
8
|
+
order: number;
|
|
9
|
+
required: false;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** A logical category of personal data the organisation may collect. */
|
|
13
|
+
declare interface DataCategory {
|
|
14
|
+
/** Machine-readable identifier. */
|
|
15
|
+
id: string;
|
|
16
|
+
/** Human-readable label shown in the wizard. */
|
|
17
|
+
label: string;
|
|
18
|
+
/** Grouping for display and compliance checks. */
|
|
19
|
+
group: 'identity' | 'financial' | 'behavioral' | 'sensitive' | 'children';
|
|
20
|
+
/** Specific data points within this category. */
|
|
21
|
+
dataPoints: string[];
|
|
22
|
+
/** Whether this category is currently selected by the user. */
|
|
23
|
+
selected: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Policy engine types for the adaptive privacy policy generator.
|
|
28
|
+
* These types power the wizard-driven policy builder, compliance checker,
|
|
29
|
+
* and export functionality — all aligned with the NDPA 2023.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/** Industry verticals with sector-specific compliance requirements. */
|
|
33
|
+
declare type Industry = 'fintech' | 'healthcare' | 'ecommerce' | 'saas' | 'education' | 'government' | 'other';
|
|
34
|
+
|
|
35
|
+
export declare const NDPRPrivacyPolicy: React__default.FC<NDPRPrivacyPolicyProps>;
|
|
36
|
+
|
|
37
|
+
export declare interface NDPRPrivacyPolicyProps {
|
|
38
|
+
adapter?: StorageAdapter<PolicyDraft>;
|
|
39
|
+
onComplete?: (policy: PrivacyPolicy) => void;
|
|
40
|
+
classNames?: Record<string, string>;
|
|
41
|
+
unstyled?: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Represents organization information for a privacy policy
|
|
46
|
+
*/
|
|
47
|
+
declare interface OrganizationInfo {
|
|
48
|
+
/** Name of the organization */
|
|
49
|
+
name: string;
|
|
50
|
+
/** Website URL of the organization */
|
|
51
|
+
website: string;
|
|
52
|
+
/** Contact email for privacy inquiries */
|
|
53
|
+
privacyEmail: string;
|
|
54
|
+
/** Physical address of the organization */
|
|
55
|
+
address?: string;
|
|
56
|
+
/** Phone number for privacy inquiries */
|
|
57
|
+
privacyPhone?: string;
|
|
58
|
+
/** Name of the Data Protection Officer */
|
|
59
|
+
dpoName?: string;
|
|
60
|
+
/** Email of the Data Protection Officer */
|
|
61
|
+
dpoEmail?: string;
|
|
62
|
+
/** Industry or sector of the organization */
|
|
63
|
+
industry?: string;
|
|
64
|
+
/** NDPC registration number (if registered) */
|
|
65
|
+
ndpcRegistrationNumber?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Organisation size tiers — affects complexity of generated language. */
|
|
69
|
+
declare type OrgSize = 'startup' | 'midsize' | 'enterprise';
|
|
70
|
+
|
|
71
|
+
/** Represents an in-progress policy being built in the wizard. */
|
|
72
|
+
declare interface PolicyDraft {
|
|
73
|
+
/** Unique identifier for the draft. */
|
|
74
|
+
id: string;
|
|
75
|
+
/** The template context driving section generation. */
|
|
76
|
+
templateContext: TemplateContext;
|
|
77
|
+
/** Custom sections added by the user. */
|
|
78
|
+
customSections: CustomSection[];
|
|
79
|
+
/** Per-section content overrides keyed by section id. */
|
|
80
|
+
sectionOverrides: Record<string, string>;
|
|
81
|
+
/** Ordered list of section ids defining the final order. */
|
|
82
|
+
sectionOrder: string[];
|
|
83
|
+
/** Current wizard step (0-indexed). */
|
|
84
|
+
currentStep: number;
|
|
85
|
+
/** Timestamp of the last save. */
|
|
86
|
+
lastSavedAt: number;
|
|
87
|
+
/** The draft is always in "draft" status until finalised. */
|
|
88
|
+
status: 'draft';
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Privacy policy types aligned with NDPA 2023
|
|
93
|
+
* Privacy policies must clearly inform data subjects of their rights under the NDPA
|
|
94
|
+
*/
|
|
95
|
+
/**
|
|
96
|
+
* Represents a section in a privacy policy
|
|
97
|
+
*/
|
|
98
|
+
declare interface PolicySection {
|
|
99
|
+
/** Unique identifier for the section */
|
|
100
|
+
id: string;
|
|
101
|
+
/** Title of the section */
|
|
102
|
+
title: string;
|
|
103
|
+
/** Description of the section */
|
|
104
|
+
description?: string;
|
|
105
|
+
/** Order of the section in the policy */
|
|
106
|
+
order?: number;
|
|
107
|
+
/** Whether the section is required by NDPA */
|
|
108
|
+
required: boolean;
|
|
109
|
+
/** Template text for the section */
|
|
110
|
+
template: string;
|
|
111
|
+
/**
|
|
112
|
+
* Default content for the section (legacy field)
|
|
113
|
+
* @deprecated Use template instead
|
|
114
|
+
*/
|
|
115
|
+
defaultContent?: string;
|
|
116
|
+
/**
|
|
117
|
+
* Custom content for the section (overrides default content)
|
|
118
|
+
* @deprecated Use template instead
|
|
119
|
+
*/
|
|
120
|
+
customContent?: string;
|
|
121
|
+
/** Whether the section is included in the policy */
|
|
122
|
+
included: boolean;
|
|
123
|
+
/** Variables that can be used in the section content */
|
|
124
|
+
variables?: string[];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Represents a generated privacy policy
|
|
129
|
+
*/
|
|
130
|
+
declare interface PrivacyPolicy {
|
|
131
|
+
/** Unique identifier for the policy */
|
|
132
|
+
id: string;
|
|
133
|
+
/** Title of the policy */
|
|
134
|
+
title: string;
|
|
135
|
+
/** Template used to generate the policy */
|
|
136
|
+
templateId: string;
|
|
137
|
+
/** Organization information */
|
|
138
|
+
organizationInfo: OrganizationInfo;
|
|
139
|
+
/** Sections of the policy */
|
|
140
|
+
sections: PolicySection[];
|
|
141
|
+
/** Values for the variables used in the policy */
|
|
142
|
+
variableValues: Record<string, string>;
|
|
143
|
+
/** Effective date of the policy */
|
|
144
|
+
effectiveDate: number;
|
|
145
|
+
/** Last updated date of the policy */
|
|
146
|
+
lastUpdated: number;
|
|
147
|
+
/** Version of the policy */
|
|
148
|
+
version: string;
|
|
149
|
+
/**
|
|
150
|
+
* Applicable legal frameworks
|
|
151
|
+
*/
|
|
152
|
+
applicableFrameworks?: ('ndpa' | 'ndpr' | 'gdpr' | 'ccpa')[];
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Lawful processing purposes recognised under the NDPA. */
|
|
156
|
+
declare type ProcessingPurpose = 'service_delivery' | 'marketing' | 'analytics' | 'research' | 'legal_compliance' | 'fraud_prevention';
|
|
157
|
+
|
|
158
|
+
declare interface StorageAdapter<T = unknown> {
|
|
159
|
+
/** Load persisted data. Called once on hook mount. */
|
|
160
|
+
load(): T | null | Promise<T | null>;
|
|
161
|
+
/** Persist data. Called on every state change. */
|
|
162
|
+
save(data: T): void | Promise<void>;
|
|
163
|
+
/** Clear persisted data. Called on reset. */
|
|
164
|
+
remove(): void | Promise<void>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** Full context used to generate an adaptive privacy policy. */
|
|
168
|
+
declare interface TemplateContext {
|
|
169
|
+
/** Organisation details, extended with industry and size. */
|
|
170
|
+
org: OrganizationInfo & {
|
|
171
|
+
industry: Industry;
|
|
172
|
+
orgSize: OrgSize;
|
|
173
|
+
country: string;
|
|
174
|
+
};
|
|
175
|
+
/** Data categories the organisation collects. */
|
|
176
|
+
dataCategories: DataCategory[];
|
|
177
|
+
/** Processing purposes relevant to the organisation. */
|
|
178
|
+
purposes: ProcessingPurpose[];
|
|
179
|
+
/** Whether the organisation processes children's data. */
|
|
180
|
+
hasChildrenData: boolean;
|
|
181
|
+
/** Whether the organisation processes sensitive/special-category data. */
|
|
182
|
+
hasSensitiveData: boolean;
|
|
183
|
+
/** Whether the organisation processes financial data. */
|
|
184
|
+
hasFinancialData: boolean;
|
|
185
|
+
/** Whether data is transferred outside Nigeria. */
|
|
186
|
+
hasCrossBorderTransfer: boolean;
|
|
187
|
+
/** Whether automated decision-making or profiling is used. */
|
|
188
|
+
hasAutomatedDecisions: boolean;
|
|
189
|
+
/** Third-party processors that receive personal data. */
|
|
190
|
+
thirdPartyProcessors: ThirdPartyProcessor[];
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** A third-party entity that processes data on behalf of the organisation. */
|
|
194
|
+
declare interface ThirdPartyProcessor {
|
|
195
|
+
/** Name of the third party. */
|
|
196
|
+
name: string;
|
|
197
|
+
/** Purpose of sharing data with this processor. */
|
|
198
|
+
purpose: string;
|
|
199
|
+
/** Country where the processor is located. */
|
|
200
|
+
country: string;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export { }
|