@tantainnovative/ndpr-toolkit 3.4.1 → 3.5.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 +19 -0
- package/dist/adapters.d.mts +34 -25
- package/dist/adapters.d.ts +34 -25
- package/dist/breach.d.mts +803 -44
- package/dist/breach.d.ts +803 -44
- package/dist/breach.js +1 -1
- package/dist/breach.mjs +1 -1
- package/dist/{chunk-ASLMPY54.js → chunk-3EGQWLJ6.js} +3 -3
- package/dist/chunk-B4Z5MBUC.mjs +2 -0
- package/dist/{chunk-LSCMXAPY.mjs → chunk-CKGJK4D7.mjs} +3 -3
- package/dist/{chunk-XSEZDQLB.js → chunk-CKJAECGV.js} +2 -2
- package/dist/{chunk-AHSMDPG5.js → chunk-CPK5D5FY.js} +2 -2
- package/dist/{chunk-DCJK5OZT.mjs → chunk-CWHBCQGT.mjs} +2 -2
- package/dist/{chunk-MLOWRZXO.mjs → chunk-F5TXUA4O.mjs} +3 -3
- package/dist/{chunk-BN77GP4W.mjs → chunk-GN5C32JB.mjs} +2 -2
- package/dist/{chunk-ZLSWOFAY.mjs → chunk-GRLIPT5V.mjs} +2 -2
- package/dist/{chunk-DUY6F3GT.mjs → chunk-H3EYBSVP.mjs} +3 -3
- package/dist/{chunk-NFJ4CB63.mjs → chunk-ID2NYIVE.mjs} +3 -3
- package/dist/chunk-J5WCPZLW.js +2 -0
- package/dist/{chunk-P2YV6DR3.js → chunk-LIM64IV2.js} +3 -3
- package/dist/chunk-LU7PKE7Y.mjs +2 -0
- package/dist/{chunk-HQSU7LGM.js → chunk-LWXZMKC2.js} +4 -4
- package/dist/{chunk-4BOEFDDE.js → chunk-ORFC66EA.js} +3 -3
- package/dist/{chunk-VTITKWGX.mjs → chunk-QSVVAZVT.mjs} +2 -2
- package/dist/chunk-SCWNM4PC.mjs +2 -0
- package/dist/{chunk-EHAZIKDX.js → chunk-SKKOMFXH.js} +2 -2
- package/dist/{chunk-WH6ZMUOS.mjs → chunk-TUNQUVHU.mjs} +2 -2
- package/dist/chunk-TV4U6AIS.js +2 -0
- package/dist/{chunk-ZYLDLGFL.js → chunk-VIQUXWJC.js} +2 -2
- package/dist/{chunk-SUEGUY35.js → chunk-XIM7KMD6.js} +2 -2
- package/dist/{chunk-P6QAFBCV.js → chunk-XNSZ7KUH.js} +2 -2
- package/dist/consent.d.mts +648 -84
- package/dist/consent.d.ts +648 -84
- package/dist/consent.js +1 -1
- package/dist/consent.mjs +1 -1
- package/dist/core.d.mts +2049 -23
- package/dist/core.d.ts +2049 -23
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/cross-border.d.mts +470 -99
- package/dist/cross-border.d.ts +470 -99
- package/dist/dpia.d.mts +591 -37
- package/dist/dpia.d.ts +591 -37
- package/dist/dsr.d.mts +654 -37
- package/dist/dsr.d.ts +654 -37
- package/dist/dsr.js +1 -1
- package/dist/dsr.mjs +1 -1
- package/dist/hooks.d.mts +2174 -30
- package/dist/hooks.d.ts +2174 -30
- package/dist/hooks.js +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/index.d.mts +4428 -43
- package/dist/index.d.ts +4428 -43
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/lawful-basis.d.mts +368 -32
- package/dist/lawful-basis.d.ts +368 -32
- package/dist/policy.d.mts +1178 -83
- package/dist/policy.d.ts +1178 -83
- package/dist/policy.js +1 -1
- package/dist/policy.mjs +1 -1
- package/dist/presets.d.mts +1020 -114
- package/dist/presets.d.ts +1020 -114
- package/dist/presets.js +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/ropa.d.mts +396 -31
- package/dist/ropa.d.ts +396 -31
- package/dist/ropa.js +1 -1
- package/dist/ropa.mjs +1 -1
- package/dist/server.d.mts +2133 -24
- package/dist/server.d.ts +2133 -24
- package/dist/server.js +1 -1
- package/dist/server.mjs +1 -1
- package/dist/unstyled.d.mts +523 -55
- package/dist/unstyled.d.ts +523 -55
- package/dist/unstyled.js +1 -1
- package/dist/unstyled.mjs +1 -1
- package/package.json +3 -3
- package/dist/BreachReportForm-DpRrBoxU.d.ts +0 -158
- package/dist/BreachReportForm-yJ2Zl6gz.d.mts +0 -158
- package/dist/ConsentBanner-F5ayys5K.d.mts +0 -156
- package/dist/ConsentBanner-VqIPophc.d.ts +0 -156
- package/dist/ConsentManager-C7I3PDe8.d.mts +0 -105
- package/dist/ConsentManager-CQ2IZtUU.d.ts +0 -105
- package/dist/CrossBorderTransferManager-D5Lc0e46.d.ts +0 -90
- package/dist/CrossBorderTransferManager-DkZhv9vD.d.mts +0 -90
- package/dist/DPIAQuestionnaire-VXBoWFMC.d.ts +0 -123
- package/dist/DPIAQuestionnaire-jkt1Veb6.d.mts +0 -123
- package/dist/DSRRequestForm-D8rPTNmU.d.ts +0 -146
- package/dist/DSRRequestForm-DRouEr9j.d.mts +0 -146
- package/dist/DSRTracker-Bl__d4df.d.ts +0 -163
- package/dist/DSRTracker-CSVDfgQQ.d.mts +0 -163
- package/dist/LawfulBasisTracker-CBqOxX1D.d.mts +0 -85
- package/dist/LawfulBasisTracker-Cg30NbDA.d.ts +0 -85
- package/dist/NDPRDashboard-CLJpEg0X.d.mts +0 -44
- package/dist/NDPRDashboard-DDWNd2Ah.d.ts +0 -44
- package/dist/NDPRProvider-DYFb8xEl.d.ts +0 -68
- package/dist/NDPRProvider-U3QNu6MA.d.mts +0 -68
- package/dist/PolicyExporter-Bgi6nz82.d.mts +0 -291
- package/dist/PolicyExporter-BnvuFncj.d.ts +0 -291
- package/dist/ROPAManager-BS4eB8Hw.d.mts +0 -79
- package/dist/ROPAManager-qxTrXLkD.d.ts +0 -79
- package/dist/RegulatoryReportGenerator-BUYgzTTT.d.ts +0 -282
- package/dist/RegulatoryReportGenerator-DwcHcEFp.d.mts +0 -282
- package/dist/StepIndicator-CgrlokSV.d.ts +0 -171
- package/dist/StepIndicator-W8S_QjgO.d.mts +0 -171
- package/dist/breach-B_-6lDqS.d.mts +0 -17
- package/dist/breach-CzXqSsaY.d.ts +0 -17
- package/dist/breach-Eu9byel8.d.mts +0 -185
- package/dist/breach-Eu9byel8.d.ts +0 -185
- package/dist/chunk-2L7BSG7G.mjs +0 -2
- package/dist/chunk-5X32J5IA.mjs +0 -2
- package/dist/chunk-7D2OIPHH.mjs +0 -2
- package/dist/chunk-JKKRPS4P.js +0 -2
- package/dist/chunk-UHTJ6UFW.js +0 -2
- package/dist/compliance-score-racQe_E_.d.mts +0 -115
- package/dist/compliance-score-racQe_E_.d.ts +0 -115
- package/dist/consent-CmVzqZUk.d.mts +0 -99
- package/dist/consent-CmVzqZUk.d.ts +0 -99
- package/dist/consent-audit-BdByjYlM.d.mts +0 -65
- package/dist/consent-audit-DhbfMR0n.d.ts +0 -65
- package/dist/cross-border-BBi9rZyO.d.mts +0 -54
- package/dist/cross-border-Dy-U9Hu6.d.ts +0 -54
- package/dist/cross-border-UyT00llA.d.mts +0 -141
- package/dist/cross-border-UyT00llA.d.ts +0 -141
- package/dist/docx-4n8g4zul.d.mts +0 -64
- package/dist/docx-VvcTLYZM.d.ts +0 -64
- package/dist/dpia-D82hUrJe.d.ts +0 -15
- package/dist/dpia-DQDFw2_l.d.mts +0 -15
- package/dist/dpia-c9GiiOq0.d.mts +0 -137
- package/dist/dpia-c9GiiOq0.d.ts +0 -137
- package/dist/dsr-CIx5sd7e.d.ts +0 -14
- package/dist/dsr-XZ_HqTlA.d.mts +0 -14
- package/dist/dsr-yKbqX531.d.mts +0 -128
- package/dist/dsr-yKbqX531.d.ts +0 -128
- package/dist/lawful-basis-BEyI0kGg.d.ts +0 -57
- package/dist/lawful-basis-C2eGaoHM.d.mts +0 -57
- package/dist/lawful-basis-Cv1VmDLn.d.mts +0 -112
- package/dist/lawful-basis-Cv1VmDLn.d.ts +0 -112
- package/dist/locale-CxJx2tzn.d.mts +0 -25
- package/dist/locale-DSkrtf-c.d.ts +0 -25
- package/dist/policy-engine-5qTfp2z4.d.mts +0 -174
- package/dist/policy-engine-DzPxskOK.d.ts +0 -174
- package/dist/policy-sections-9tCb7VU7.d.ts +0 -56
- package/dist/policy-sections-CBWcJv-R.d.mts +0 -56
- package/dist/policy-templates-DhLwq4R-.d.ts +0 -43
- package/dist/policy-templates-DwYl2329.d.mts +0 -43
- package/dist/privacy-Ca6te9Ir.d.mts +0 -138
- package/dist/privacy-Ca6te9Ir.d.ts +0 -138
- package/dist/ropa-BDTM06tr.d.ts +0 -152
- package/dist/ropa-CFHuT7jE.d.mts +0 -152
- package/dist/ropa-CyynscU6.d.ts +0 -51
- package/dist/ropa-NIgxd8uP.d.mts +0 -51
- package/dist/sanitize-CxxwKxAx.d.mts +0 -94
- package/dist/sanitize-CxxwKxAx.d.ts +0 -94
- package/dist/styling-BMDGQDgS.d.mts +0 -64
- package/dist/styling-BaoQtV06.d.ts +0 -64
- package/dist/types-DK2CoKOC.d.mts +0 -10
- package/dist/types-DK2CoKOC.d.ts +0 -10
- package/dist/useAdaptivePolicyWizard-BSLyltzZ.d.mts +0 -52
- package/dist/useAdaptivePolicyWizard-CL7C7MTZ.d.ts +0 -52
- package/dist/useBreach-CPr86Yan.d.mts +0 -115
- package/dist/useBreach-DkVXvtJK.d.ts +0 -115
- package/dist/useConsent-DCNkIJHR.d.mts +0 -75
- package/dist/useConsent-dOcELSfX.d.ts +0 -75
- package/dist/useCrossBorderTransfer-DixjLjN1.d.mts +0 -78
- package/dist/useCrossBorderTransfer-DvSq06lv.d.ts +0 -78
- package/dist/useDPIA-B6180UQn.d.mts +0 -109
- package/dist/useDPIA-CTqbNbww.d.ts +0 -109
- package/dist/useDSR-WvHk8_iu.d.mts +0 -85
- package/dist/useDSR-wH4H6hSM.d.ts +0 -85
- package/dist/useDefaultPrivacyPolicy-Cs2WQSYQ.d.mts +0 -162
- package/dist/useDefaultPrivacyPolicy-DkOqMg2e.d.ts +0 -162
- package/dist/useLawfulBasis-CKJ-kw84.d.mts +0 -79
- package/dist/useLawfulBasis-DFTmu1ca.d.ts +0 -79
- package/dist/useROPA-BSSU1rfx.d.ts +0 -76
- package/dist/useROPA-C2hjaBTz.d.mts +0 -76
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Breach notification types aligned with NDPA 2023 Section 40
|
|
3
|
-
* Data controllers must notify the NDPC within 72 hours of becoming aware of a breach
|
|
4
|
-
* Data subjects must be notified without undue delay when breach is likely to result in high risk
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Represents a data breach category
|
|
8
|
-
*/
|
|
9
|
-
interface BreachCategory {
|
|
10
|
-
/** Unique identifier for the category */
|
|
11
|
-
id: string;
|
|
12
|
-
/** Display name for the category */
|
|
13
|
-
name: string;
|
|
14
|
-
/** Description of this breach category */
|
|
15
|
-
description: string;
|
|
16
|
-
/** Default severity level for this category */
|
|
17
|
-
defaultSeverity: 'low' | 'medium' | 'high' | 'critical';
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Represents a data breach report
|
|
21
|
-
*/
|
|
22
|
-
interface BreachReport {
|
|
23
|
-
/** Unique identifier for the breach report */
|
|
24
|
-
id: string;
|
|
25
|
-
/** Title/summary of the breach */
|
|
26
|
-
title: string;
|
|
27
|
-
/** Detailed description of the breach */
|
|
28
|
-
description: string;
|
|
29
|
-
/** Category of the breach */
|
|
30
|
-
category: string;
|
|
31
|
-
/** Timestamp when the breach was discovered */
|
|
32
|
-
discoveredAt: number;
|
|
33
|
-
/** Timestamp when the breach occurred (if known) */
|
|
34
|
-
occurredAt?: number;
|
|
35
|
-
/** Timestamp when the breach was reported internally */
|
|
36
|
-
reportedAt: number;
|
|
37
|
-
/** Person who reported the breach */
|
|
38
|
-
reporter: {
|
|
39
|
-
name: string;
|
|
40
|
-
email: string;
|
|
41
|
-
department: string;
|
|
42
|
-
phone?: string;
|
|
43
|
-
};
|
|
44
|
-
/** Systems or data affected by the breach */
|
|
45
|
-
affectedSystems: string[];
|
|
46
|
-
/** Types of data involved in the breach */
|
|
47
|
-
dataTypes: string[];
|
|
48
|
-
/** Whether sensitive personal data is involved (NDPA Section 27) */
|
|
49
|
-
involvesSensitiveData?: boolean;
|
|
50
|
-
/** Estimated number of data subjects affected */
|
|
51
|
-
estimatedAffectedSubjects?: number;
|
|
52
|
-
/** Whether the breach is ongoing or contained */
|
|
53
|
-
status: 'ongoing' | 'contained' | 'resolved';
|
|
54
|
-
/** Initial actions taken to address the breach */
|
|
55
|
-
initialActions?: string;
|
|
56
|
-
/** Attachments related to the breach */
|
|
57
|
-
attachments?: Array<{
|
|
58
|
-
id: string;
|
|
59
|
-
name: string;
|
|
60
|
-
type: string;
|
|
61
|
-
url: string;
|
|
62
|
-
addedAt: number;
|
|
63
|
-
}>;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Represents a risk assessment for a data breach
|
|
67
|
-
*/
|
|
68
|
-
interface RiskAssessment {
|
|
69
|
-
/** Unique identifier for the risk assessment */
|
|
70
|
-
id: string;
|
|
71
|
-
/** ID of the breach this assessment is for */
|
|
72
|
-
breachId: string;
|
|
73
|
-
/** Timestamp when the assessment was conducted */
|
|
74
|
-
assessedAt: number;
|
|
75
|
-
/** Person who conducted the assessment */
|
|
76
|
-
assessor: {
|
|
77
|
-
name: string;
|
|
78
|
-
role: string;
|
|
79
|
-
email: string;
|
|
80
|
-
};
|
|
81
|
-
/** Confidentiality impact (1-5) */
|
|
82
|
-
confidentialityImpact: number;
|
|
83
|
-
/** Integrity impact (1-5) */
|
|
84
|
-
integrityImpact: number;
|
|
85
|
-
/** Availability impact (1-5) */
|
|
86
|
-
availabilityImpact: number;
|
|
87
|
-
/** Likelihood of harm to data subjects (1-5) */
|
|
88
|
-
harmLikelihood: number;
|
|
89
|
-
/** Severity of potential harm to data subjects (1-5) */
|
|
90
|
-
harmSeverity: number;
|
|
91
|
-
/** Overall risk score */
|
|
92
|
-
overallRiskScore: number;
|
|
93
|
-
/** Risk level based on the overall score */
|
|
94
|
-
riskLevel: 'low' | 'medium' | 'high' | 'critical';
|
|
95
|
-
/** Whether the breach is likely to result in a risk to rights and freedoms */
|
|
96
|
-
risksToRightsAndFreedoms: boolean;
|
|
97
|
-
/** Whether the breach is likely to result in a high risk to rights and freedoms */
|
|
98
|
-
highRisksToRightsAndFreedoms: boolean;
|
|
99
|
-
/** Justification for the risk assessment */
|
|
100
|
-
justification: string;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Represents notification requirements for a data breach per NDPA Section 40
|
|
104
|
-
*/
|
|
105
|
-
interface NotificationRequirement {
|
|
106
|
-
/**
|
|
107
|
-
* Whether NDPC notification is required
|
|
108
|
-
* Per NDPA Section 40, notification to NDPC is required for all breaches
|
|
109
|
-
* that pose a risk to data subjects' rights and freedoms
|
|
110
|
-
*/
|
|
111
|
-
ndpcNotificationRequired: boolean;
|
|
112
|
-
/**
|
|
113
|
-
* Deadline for NDPC notification (72 hours from discovery)
|
|
114
|
-
* NDPA Section 40(1)
|
|
115
|
-
*/
|
|
116
|
-
ndpcNotificationDeadline: number;
|
|
117
|
-
/**
|
|
118
|
-
* Whether data subject notification is required
|
|
119
|
-
* Per NDPA Section 40(4), required when breach is likely to result in
|
|
120
|
-
* high risk to rights and freedoms of data subjects
|
|
121
|
-
*/
|
|
122
|
-
dataSubjectNotificationRequired: boolean;
|
|
123
|
-
/** Justification for the notification decision */
|
|
124
|
-
justification: string;
|
|
125
|
-
/**
|
|
126
|
-
* @deprecated Use ndpcNotificationRequired instead. Kept for backward compatibility.
|
|
127
|
-
*/
|
|
128
|
-
nitdaNotificationRequired?: boolean;
|
|
129
|
-
/**
|
|
130
|
-
* @deprecated Use ndpcNotificationDeadline instead. Kept for backward compatibility.
|
|
131
|
-
*/
|
|
132
|
-
nitdaNotificationDeadline?: number;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Represents a notification sent to the NDPC (Nigeria Data Protection Commission)
|
|
136
|
-
*/
|
|
137
|
-
interface RegulatoryNotification {
|
|
138
|
-
/** Unique identifier for the notification */
|
|
139
|
-
id: string;
|
|
140
|
-
/** ID of the breach this notification is for */
|
|
141
|
-
breachId: string;
|
|
142
|
-
/** Timestamp when the notification was sent */
|
|
143
|
-
sentAt: number;
|
|
144
|
-
/** Method used to send the notification */
|
|
145
|
-
method: 'email' | 'portal' | 'letter' | 'other';
|
|
146
|
-
/** Reference number assigned by the NDPC (if available) */
|
|
147
|
-
referenceNumber?: string;
|
|
148
|
-
/** Contact person at the NDPC */
|
|
149
|
-
ndpcContact?: {
|
|
150
|
-
name: string;
|
|
151
|
-
email: string;
|
|
152
|
-
phone?: string;
|
|
153
|
-
};
|
|
154
|
-
/** Content of the notification */
|
|
155
|
-
content: string;
|
|
156
|
-
/** Attachments included with the notification */
|
|
157
|
-
attachments?: Array<{
|
|
158
|
-
id: string;
|
|
159
|
-
name: string;
|
|
160
|
-
type: string;
|
|
161
|
-
url: string;
|
|
162
|
-
}>;
|
|
163
|
-
/** Follow-up communications with the NDPC */
|
|
164
|
-
followUps?: Array<{
|
|
165
|
-
timestamp: number;
|
|
166
|
-
direction: 'sent' | 'received';
|
|
167
|
-
content: string;
|
|
168
|
-
attachments?: Array<{
|
|
169
|
-
id: string;
|
|
170
|
-
name: string;
|
|
171
|
-
type: string;
|
|
172
|
-
url: string;
|
|
173
|
-
}>;
|
|
174
|
-
}>;
|
|
175
|
-
/**
|
|
176
|
-
* @deprecated Use ndpcContact instead. Kept for backward compatibility.
|
|
177
|
-
*/
|
|
178
|
-
nitdaContact?: {
|
|
179
|
-
name: string;
|
|
180
|
-
email: string;
|
|
181
|
-
phone?: string;
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export type { BreachCategory as B, NotificationRequirement as N, RegulatoryNotification as R, BreachReport as a, RiskAssessment as b };
|
package/dist/chunk-2L7BSG7G.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {b as b$1,e}from'./chunk-LSCMXAPY.mjs';import {a as a$1}from'./chunk-6WIP33TW.mjs';import {b,a}from'./chunk-WWT2ZSNU.mjs';import {useRef,useState,useEffect,useCallback}from'react';function H(e,s){return s?a$1(e):{load:()=>null,save:()=>{},remove:()=>{}}}function N({templates:e,initialPolicy:s,adapter:P,storageKey:l="ndpr_privacy_policy",useLocalStorage:m=true,onGenerate:T}){let w=P!=null?P:H(l,m),c=useRef(w);c.current=w;let[r,f]=useState(s||null),[o,p]=useState(null),[y,E]=useState({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),[A,O]=useState(true),D=useRef(e);D.current=e,useEffect(()=>{if(s){O(false);return}let t=false;try{let n=c.current.load(),i=a=>{if(a){if(f(a),a.templateId){let g=D.current.find(b=>b.id===a.templateId);g&&p(g);}a.organizationInfo&&E(a.organizationInfo);}O(!1);};n instanceof Promise?n.then(a=>{t||i(a);},()=>{t||O(!1);}):i(n);}catch(n){t||O(false);}return ()=>{t=true;}},[s]);let q=t=>{Promise.resolve(c.current.save(t)).catch(n=>{console.warn("[ndpr-toolkit] Failed to save policy:",n);});},_=useCallback(t=>{let n=e.find(b=>b.id===t);if(!n)return false;p(n);let i=n.sections.map(b$1=>b(a({},b$1),{customContent:void 0})),a$1={};Object.keys(n.variables).forEach(b=>{a$1[b]=n.variables[b].defaultValue||"";});let g=Date.now();return f({id:"policy_"+g+"_"+Math.random().toString(36).substr(2,9),title:"",templateId:n.id,organizationInfo:y,sections:i,variableValues:a$1,effectiveDate:g,lastUpdated:g,version:"1.0"}),true},[e,y]),C=useCallback(t=>{E(n=>a(a({},n),t));},[]),k=useCallback((t,n)=>{o&&(r?f(i=>i&&b(a({},i),{sections:i.sections.map(a$1=>a$1.id===t?b(a({},a$1),{included:n}):a$1)})):p(i=>i&&b(a({},i),{sections:i.sections.map(a$1=>a$1.id===t?b(a({},a$1),{included:n}):a$1)})));},[o,r]),j=useCallback((t,n)=>{o&&(r?f(i=>i&&b(a({},i),{sections:i.sections.map(a$1=>a$1.id===t?b(a({},a$1),{customContent:n}):a$1)})):p(i=>i&&b(a({},i),{sections:i.sections.map(a$1=>a$1.id===t?b(a({},a$1),{customContent:n}):a$1)})));},[o,r]),I=useCallback((t,n)=>{r&&f(i=>i&&b(a({},i),{variableValues:b(a({},i.variableValues),{[t]:n})}));},[r]),F=()=>"policy_"+Date.now()+"_"+Math.random().toString(36).substr(2,9),M=useCallback(()=>{if(!o)return null;let t=Date.now(),n={id:(r==null?void 0:r.id)||F(),title:`Privacy Policy for ${y.name}`,templateId:o.id,organizationInfo:y,sections:o.sections.map(i=>{var a$1;return b(a({},i),{customContent:(a$1=r==null?void 0:r.sections.find(g=>g.id===i.id))==null?void 0:a$1.customContent})}),variableValues:(r==null?void 0:r.variableValues)||{},effectiveDate:t,lastUpdated:t,version:"1.0"};return f(n),q(n),T&&T(n),n},[o,r,y,T]),$=useCallback(()=>{if(!r)return {fullText:"",sectionTexts:{},missingVariables:[]};let t=b$1(r.sections,r.organizationInfo);return typeof t=="string"?{fullText:t,sectionTexts:{full:t},missingVariables:[]}:t},[r]),B=useCallback(()=>{f(null),p(null),E({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),Promise.resolve(c.current.remove()).catch(t=>{console.warn("[ndpr-toolkit] Failed to remove policy:",t);});},[]),G=useCallback(()=>{let t=[];if(o||t.push("No template selected"),y.name||t.push("Organization name is required"),y.website||t.push("Organization website is required"),y.privacyEmail||t.push("Privacy contact email is required"),o){let n=o.sections.filter(a=>a.required),i=(r==null?void 0:r.sections.filter(a=>a.included))||[];n.forEach(a=>{i.some(g=>g.id===a.id)||t.push(`Required section "${a.title}" must be included`);});}return o&&r&&Object.entries(o.variables).forEach(([n,i])=>{i.required&&!r.variableValues[n]&&t.push(`Required variable "${i.name}" must have a value`);}),{valid:t.length===0,errors:t}},[o,y,r]);return {policy:r,selectedTemplate:o,organizationInfo:y,selectTemplate:_,updateOrganizationInfo:C,toggleSection:k,updateSectionContent:j,updateVariableValue:I,generatePolicy:M,getPolicyText:$,resetPolicy:B,isValid:G,isLoading:A}}var x="default-business";function J(e){return e.toLocaleDateString("en-NG",{day:"numeric",month:"long",year:"numeric"})}function Q(e$1){let{sections:s,variables:P}=e(),l={};return e$1&&(e$1.name&&(l.orgName=e$1.name),e$1.email&&(l.privacyEmail=e$1.email),e$1.website&&(l.website=e$1.website),e$1.address&&(l.address=e$1.address),e$1.industry&&(l.industry=e$1.industry),e$1.dpoName&&(l.dpoName=e$1.dpoName),e$1.dpoEmail&&(l.dpoEmail=e$1.dpoEmail)),l.effectiveDate||(l.effectiveDate=J(new Date)),{id:x,name:"Default Business Policy",description:"NDPA-compliant privacy policy template for businesses.",organizationType:"business",sections:s,variables:Object.fromEntries(P.map(m=>[m.name,{name:m.name,description:m.description,required:m.required,defaultValue:l[m.name]||m.value||void 0}])),version:"1.0",lastUpdated:Date.now(),ndpaCompliant:true}}function W(e){if(!e)return {};let s={};return e.name&&(s.name=e.name),e.email&&(s.privacyEmail=e.email),e.website&&(s.website=e.website),e.address&&(s.address=e.address),e.industry&&(s.industry=e.industry),e.dpoName&&(s.dpoName=e.dpoName),e.dpoEmail&&(s.dpoEmail=e.dpoEmail),s}function se(e={}){let{orgInfo:s,autoGenerate:P=true,storageKey:l,useLocalStorage:m,adapter:T}=e,w=useRef(null);w.current===null&&(w.current=Q(s));let c=N({templates:[w.current],adapter:T,storageKey:l,useLocalStorage:m}),r=useRef(false),f=useRef(false);return useEffect(()=>{if(!P||c.isLoading||r.current)return;if(!T&&m!==false&&typeof window!="undefined"&&typeof window.localStorage!="undefined")try{if(window.localStorage.getItem(l!=null?l:"ndpr_privacy_policy")){r.current=!0,f.current=!0;return}}catch(y){}if(c.policy){r.current=true,f.current=true;return}r.current=true;let p=W(s);Object.keys(p).length>0&&c.updateOrganizationInfo(p),c.selectedTemplate||c.selectTemplate(x);},[P,c.isLoading]),useEffect(()=>{var p;if(!P||f.current||!r.current||!c.selectedTemplate)return;let o=(p=s==null?void 0:s.name)!=null?p:"";o&&c.organizationInfo.name!==o||(f.current=true,c.generatePolicy());},[P,c.selectedTemplate,c.organizationInfo]),c}export{N as a,se as b};//# sourceMappingURL=chunk-2L7BSG7G.mjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-2L7BSG7G.mjs.map
|
package/dist/chunk-5X32J5IA.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-7D2OIPHH.mjs';import {a}from'./chunk-AYKLAEOU.mjs';import {useState,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var oe=({requests:w,onSelectRequest:P,onUpdateStatus:I,onAssignRequest:V,title:H="Data Subject Request Dashboard",description:X="Track and manage data subject requests in compliance with NDPA Part IV requirements.",className:J="",buttonClassName:F="",showRequestDetails:Y=true,showRequestTimeline:z=true,showDeadlineAlerts:B=true,assignees:i=[],classNames:l,unstyled:k=false})=>{let[y,f]=useState(null),[D,O]=useState(w),[j,M]=useState("all"),[C,T]=useState("all"),[A,_]=useState(""),[$,G]=useState("createdAt"),[U,Z]=useState("desc"),[S,Q]=useState("");useEffect(()=>{let e=[...w];if(j!=="all"&&(e=e.filter(r=>r.status===j)),C!=="all"&&(e=e.filter(r=>r.type===C)),A){let r=A.toLowerCase();e=e.filter(p=>p.subject.name.toLowerCase().includes(r)||p.subject.email.toLowerCase().includes(r)||p.description&&p.description.toLowerCase().includes(r));}e.sort((r,p)=>{let h=0;switch($){case "createdAt":h=r.createdAt-p.createdAt;break;case "dueDate":h=(r.dueDate||0)-(p.dueDate||0);break;case "type":h=r.type.localeCompare(p.type);break;case "status":h=r.status.localeCompare(p.status);break;default:h=r.createdAt-p.createdAt;}return U==="asc"?h:-h}),O(e);},[w,j,C,A,$,U]),useEffect(()=>{D.length>0&&(y&&D.some(r=>r.id===y)||f(D[0].id));},[D,y]);let E=e=>{f(e),P&&P(e);},L=e=>{y&&I&&I(y,e);},W=()=>{y&&S&&V&&(V(y,S),Q(""));},R=e=>new Date(e).toLocaleDateString(),q=e=>{let r=Date.now(),p=(e-r)/(1440*60*1e3);return Math.ceil(p)},m=y?w.find(e=>e.id===y):null,t=e=>{let r={information:"bg-teal-100 text-teal-800 dark:bg-teal-900 dark:text-teal-200",access:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",rectification:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",erasure:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",restriction:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",portability:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",objection:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",automated_decision_making:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200"},p={information:"Information",access:"Access",rectification:"Rectification",erasure:"Erasure",restriction:"Restriction",portability:"Portability",objection:"Objection",automated_decision_making:"Automated Decision-Making"};return jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${r[e]}`,children:p[e]})},s=e=>jsx("span",{className:a(`px-2 py-1 rounded text-xs font-medium ${{pending:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",inProgress:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",completed:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",rejected:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",awaitingVerification:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200"}[e]}`,l==null?void 0:l.statusBadge,k),children:e==="inProgress"?"In Progress":e==="awaitingVerification"?"Awaiting Verification":e.charAt(0).toUpperCase()+e.slice(1)}),g=e=>{if(!e.dueDate)return null;let r=q(e.dueDate);return r<=0?jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-md",role:"alert","aria-live":"polite",children:[jsx("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium",children:"Deadline Passed"}),jsx("p",{className:"text-xs text-red-700 dark:text-red-300 mt-1",children:"The response deadline has passed. Immediate action is required."})]}):r<=3?jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-md",role:"alert","aria-live":"polite",children:[jsx("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium",children:"Urgent: Deadline Approaching"}),jsxs("p",{className:"text-xs text-red-700 dark:text-red-300 mt-1",children:["Only ",r," day",r!==1?"s":""," remaining until the response deadline."]})]}):r<=7?jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md","aria-live":"polite",children:[jsx("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 font-medium",children:"Deadline Approaching"}),jsxs("p",{className:"text-xs text-yellow-700 dark:text-yellow-300 mt-1",children:[r," days remaining until the response deadline."]})]}):jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-md","aria-live":"polite",children:[jsx("p",{className:"text-sm text-green-800 dark:text-green-200 font-medium",children:"Deadline Tracking"}),jsxs("p",{className:"text-xs text-green-700 dark:text-green-300 mt-1",children:[r," days remaining until the response deadline."]})]})},x=e=>{let r=[{title:"Request Received",date:e.createdAt,completed:true,description:`Request was received on ${R(e.createdAt)}.`}];return e.verifiedAt?r.push({title:"Identity Verified",date:e.verifiedAt,completed:true,description:`Data subject's identity was verified on ${R(e.verifiedAt)}.`}):e.status==="awaitingVerification"&&r.push({title:"Identity Verification",date:Date.now(),completed:false,description:"Awaiting verification of data subject's identity."}),(e.status==="inProgress"||e.status==="completed"||e.status==="rejected")&&r.push({title:"Processing Started",date:e.updatedAt,completed:true,description:`Request processing started on ${R(e.updatedAt)}.`}),e.status==="completed"?r.push({title:"Request Completed",date:e.completedAt||Date.now(),completed:true,description:`Request was completed on ${R(e.completedAt||Date.now())}.`}):e.status==="rejected"&&r.push({title:"Request Rejected",date:e.completedAt||Date.now(),completed:true,description:`Request was rejected on ${R(e.completedAt||Date.now())}.${e.rejectionReason?` Reason: ${e.rejectionReason}`:""}`}),e.dueDate&&r.push({title:"Response Deadline",date:e.dueDate,completed:Date.now()>e.dueDate,description:`Response is due by ${R(e.dueDate)}.`}),jsxs("div",{className:"mt-6",children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Request Timeline"}),jsx("ol",{className:"relative border-l border-gray-200 dark:border-gray-700",children:r.map((p,h)=>jsxs("li",{className:"mb-6 ml-4",children:[jsx("div",{className:`absolute w-3 h-3 rounded-full mt-1.5 -left-1.5 border ${p.completed?"bg-green-500 border-green-500 dark:border-green-500":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700"}`}),jsx("time",{className:"mb-1 text-sm font-normal leading-none text-gray-600 dark:text-gray-500",children:p.date?R(p.date):"Pending"}),jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:p.title}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:p.description})]},h))})]})},o=()=>[{value:"all",label:"All Types"},{value:"information",label:"Information (NDPA Section 29)"},{value:"access",label:"Access (NDPA Section 30)"},{value:"rectification",label:"Rectification (NDPA Section 31)"},{value:"erasure",label:"Erasure (NDPA Section 32)"},{value:"restriction",label:"Restriction (NDPA Section 33)"},{value:"portability",label:"Portability (NDPA Section 34)"},{value:"objection",label:"Objection (NDPA Section 35)"},{value:"automated_decision_making",label:"Automated Decision-Making (NDPA Section 36)"}].map(r=>jsx("option",{value:r.value,children:r.label},r.value)),u=()=>[{value:"all",label:"All Statuses"},{value:"pending",label:"Pending"},{value:"awaitingVerification",label:"Awaiting Verification"},{value:"inProgress",label:"In Progress"},{value:"completed",label:"Completed"},{value:"rejected",label:"Rejected"}].map(r=>jsx("option",{value:r.value,children:r.label},r.value)),v=()=>[{value:"pending",label:"Pending"},{value:"awaitingVerification",label:"Awaiting Verification"},{value:"inProgress",label:"In Progress"},{value:"completed",label:"Completed"},{value:"rejected",label:"Rejected"}].map(r=>jsx("option",{value:r.value,children:r.label},r.value));return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${J}`,l==null?void 0:l.root,k),children:[jsxs("div",{className:a("",l==null?void 0:l.header,k),children:[jsx("h2",{className:a("text-xl font-bold mb-2",l==null?void 0:l.title,k),children:H}),jsx("p",{className:"mb-6 text-gray-600 dark:text-gray-300",children:X})]}),jsxs("div",{className:a("mb-6 grid grid-cols-1 md:grid-cols-4 gap-4",l==null?void 0:l.filters,k),children:[jsxs("div",{children:[jsx("label",{htmlFor:"statusFilter",className:"block text-sm font-medium mb-1",children:"Status Filter"}),jsx("select",{id:"statusFilter",value:j,onChange:e=>M(e.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:u()})]}),jsxs("div",{children:[jsx("label",{htmlFor:"typeFilter",className:"block text-sm font-medium mb-1",children:"Request Type Filter"}),jsx("select",{id:"typeFilter",value:C,onChange:e=>T(e.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:o()})]}),jsxs("div",{children:[jsx("label",{htmlFor:"sortBy",className:"block text-sm font-medium mb-1",children:"Sort By"}),jsxs("select",{id:"sortBy",value:$,onChange:e=>G(e.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:[jsx("option",{value:"createdAt",children:"Date Received"}),jsx("option",{value:"dueDate",children:"Due Date"}),jsx("option",{value:"type",children:"Request Type"}),jsx("option",{value:"status",children:"Status"})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"searchTerm",className:"block text-sm font-medium mb-1",children:"Search"}),jsx("input",{type:"text",id:"searchTerm",value:A,onChange:e=>_(e.target.value),placeholder:"Search requests...",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[jsxs("div",{className:"md:col-span-1",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"DSR Requests"}),D.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data subject requests found."}):jsx("div",{className:a("space-y-2 max-h-96 overflow-y-auto pr-2",l==null?void 0:l.requestList,k),children:D.map(e=>{let r=e.dueDate?q(e.dueDate):null,p=null;return r!==null&&(r<=0?p=jsx("span",{className:"text-xs text-red-600 dark:text-red-400 font-bold",children:"Overdue"}):r<=3?p=jsx("span",{className:"text-xs text-red-600 dark:text-red-400",children:"Urgent"}):r<=7&&(p=jsx("span",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:"Soon"}))),jsxs("div",{role:"button",tabIndex:0,"aria-label":`View request from ${e.subject.name}`,"aria-selected":y===e.id,className:a(`p-3 rounded-md cursor-pointer ${y===e.id?"bg-[rgb(var(--ndpr-primary)/0.05)] dark:bg-[rgb(var(--ndpr-primary)/0.1)] border border-[rgb(var(--ndpr-primary)/0.2)] dark:border-[rgb(var(--ndpr-primary)/0.3)]":"bg-gray-50 dark:bg-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600"}`,l==null?void 0:l.requestItem,k),onClick:()=>E(e.id),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),E(e.id));},children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx("h4",{className:"font-medium text-sm",children:e.subject.name}),t(e.type)]}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:e.subject.email}),jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:["Received: ",R(e.createdAt)]}),jsxs("div",{className:"flex justify-between items-center mt-2",children:[jsx("div",{children:s(e.status)}),jsx("div",{children:p})]})]},e.id)})})]}),jsx("div",{className:a("md:col-span-2",l==null?void 0:l.detailPanel,k),children:m?jsxs("div",{children:[jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsx("h3",{className:"text-lg font-medium",children:m.subject.name}),jsxs("div",{className:"flex space-x-2",children:[t(m.type),s(m.status)]})]}),B&&m.dueDate&&jsx("div",{className:"mb-4",children:g(m)}),Y&&jsxs("div",{className:"mb-6",children:[jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[jsxs("div",{children:[jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Email:"})," ",m.subject.email]}),m.subject.phone&&jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Phone:"})," ",m.subject.phone]}),jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Received:"})," ",R(m.createdAt)]})]}),jsxs("div",{children:[jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Request Type:"})," ",{information:"Information",access:"Access",rectification:"Rectification",erasure:"Erasure",restriction:"Restriction",portability:"Portability",objection:"Objection",automated_decision_making:"Automated Decision-Making"}[m.type]||m.type]}),jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Status:"})," ",m.status==="inProgress"?"In Progress":m.status==="awaitingVerification"?"Awaiting Verification":m.status.charAt(0).toUpperCase()+m.status.slice(1)]}),m.dueDate&&jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Due Date:"})," ",R(m.dueDate)]})]})]}),m.description&&jsxs("div",{className:"mb-4",children:[jsx("p",{className:"text-sm font-medium",children:"Request Details:"}),jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-700 p-2 rounded-md mt-1",children:m.description})]}),m.additionalInfo&&jsxs("div",{children:[jsx("p",{className:"text-sm font-medium",children:"Additional Information:"}),jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-700 p-2 rounded-md mt-1",children:typeof m.additionalInfo=="object"?JSON.stringify(m.additionalInfo,null,2):String(m.additionalInfo||"No additional information provided")})]})]}),jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("h3",{id:"update-status-heading",className:"text-md font-medium mb-2",children:"Update Status"}),jsxs("div",{className:"flex space-x-2",children:[jsx("select",{"aria-label":"Update request status",value:m.status,onChange:e=>L(e.target.value),className:"flex-grow px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:v()}),jsx("button",{onClick:()=>L(m.status),"aria-label":"Apply status update",className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${F}`,children:"Update"})]})]}),i.length>0&&jsxs("div",{children:[jsx("h3",{id:"assign-request-heading",className:"text-md font-medium mb-2",children:"Assign Request"}),jsxs("div",{className:"flex space-x-2",children:[jsxs("select",{"aria-label":"Select assignee",value:S,onChange:e=>Q(e.target.value),className:"flex-grow px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:[jsx("option",{value:"",children:"Select Assignee"}),i.map(e=>jsx("option",{value:e,children:e},e))]}),jsx("button",{onClick:W,disabled:!S,"aria-label":"Assign request to selected person",className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] disabled:bg-gray-300 disabled:text-gray-500 ${F}`,children:"Assign"})]})]})]}),jsxs("div",{className:"mb-6",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Request Summary"}),jsx("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-md",children:jsx("pre",{className:"whitespace-pre-wrap text-sm font-mono text-gray-800 dark:text-gray-200",children:jsx("pre",{children:JSON.stringify(a$1(m),null,2)})})})]}),z&&x(m)]}):jsx("div",{className:"flex items-center justify-center h-64 bg-gray-50 dark:bg-gray-700 rounded-md",children:jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Select a request to view details"})})})]})]})};var ue=({requests:w,onSelectRequest:P,title:I="DSR Request Tracker",description:V="Track the status and progress of data subject requests as required by NDPA Part IV.",className:H="",buttonClassName:X="",showSummaryStats:J=true,showTypeBreakdown:F=true,showStatusBreakdown:Y=true,showTimelineChart:z=true,showOverdueRequests:B=true,classNames:i,unstyled:l=false})=>{let[k,y]=useState("30days"),[f,D]=useState(w),[O,j]=useState([]),[M,C]=useState([]);useEffect(()=>{let t=Date.now(),s;switch(k){case "7days":s=w.filter(o=>t-o.createdAt<=10080*60*1e3);break;case "30days":s=w.filter(o=>t-o.createdAt<=720*60*60*1e3);break;case "90days":s=w.filter(o=>t-o.createdAt<=2160*60*60*1e3);break;default:s=[...w];}D(s);let g=s.filter(o=>o.dueDate&&t>o.dueDate&&o.status!=="completed"&&o.status!=="rejected");j(g);let x=s.filter(o=>o.dueDate&&t<o.dueDate&&o.dueDate-t<=10080*60*1e3&&o.status!=="completed"&&o.status!=="rejected");C(x);},[w,k]);let T=t=>{P&&P(t);},A=t=>new Date(t).toLocaleDateString(),_=t=>{let s=Date.now(),g=(t-s)/(1440*60*1e3);return Math.ceil(g)},$=()=>{let t=f.filter(g=>g.status==="completed"&&g.completedAt&&g.createdAt);if(t.length===0)return null;let s=t.reduce((g,x)=>{let o=((x.completedAt||0)-x.createdAt)/864e5;return g+o},0);return Number((s/t.length).toFixed(1))},G=()=>{let t=f.filter(g=>(g.status==="completed"||g.status==="rejected")&&g.completedAt&&g.dueDate);if(t.length===0)return null;let s=t.filter(g=>(g.completedAt||0)<=(g.dueDate||0));return Math.round(s.length/t.length*100)},U=()=>{let t={};return f.forEach(s=>{t[s.type]=(t[s.type]||0)+1;}),{information:t.information||0,access:t.access||0,rectification:t.rectification||0,erasure:t.erasure||0,restriction:t.restriction||0,portability:t.portability||0,objection:t.objection||0,automated_decision_making:t.automated_decision_making||0}},Z=()=>{let t={};return f.forEach(s=>{t[s.status]=(t[s.status]||0)+1;}),{pending:t.pending||0,awaitingVerification:t.awaitingVerification||0,inProgress:t.inProgress||0,completed:t.completed||0,rejected:t.rejected||0}},S=t=>{let s={information:"bg-teal-100 text-teal-800 dark:bg-teal-900 dark:text-teal-200",access:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",rectification:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",erasure:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",restriction:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",portability:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",objection:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",automated_decision_making:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200"},g={information:"Information",access:"Access",rectification:"Rectification",erasure:"Erasure",restriction:"Restriction",portability:"Portability",objection:"Objection",automated_decision_making:"Automated Decision-Making"};return jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${s[t]}`,children:g[t]})},E=()=>{let t=f.length,s=f.filter(u=>u.status!=="completed"&&u.status!=="rejected").length;f.filter(u=>u.status==="completed"||u.status==="rejected").length;let x=$(),o=G();return jsxs("div",{className:a("grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",i==null?void 0:i.stats,l),children:[jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",i==null?void 0:i.statCard,l),children:[jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Total Requests"}),jsx("p",{className:"text-2xl font-bold",children:t})]}),jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",i==null?void 0:i.statCard,l),children:[jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Pending Requests"}),jsx("p",{className:"text-2xl font-bold",children:s})]}),jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",i==null?void 0:i.statCard,l),children:[jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Avg. Response Time"}),jsx("p",{className:"text-2xl font-bold",children:x!==null?`${x} days`:"N/A"})]}),jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",i==null?void 0:i.statCard,l),children:[jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Compliance Rate"}),jsx("p",{className:"text-2xl font-bold",children:o!==null?`${o}%`:"N/A"})]})]})},L=()=>{let t=U(),s=f.length,g=Object.entries(t).sort(([,x],[,o])=>o-x).map(([x])=>x);return jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",i==null?void 0:i.table,l),children:[jsx("h3",{className:a("text-lg font-medium mb-4",i==null?void 0:i.tableHeader,l),children:"Request Types"}),s===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data available for the selected timeframe."}):jsx("div",{className:"space-y-4",children:g.map(x=>{let o=t[x],u=Math.round(o/s*100);return jsxs("div",{children:[jsxs("div",{className:"flex justify-between items-center mb-1",children:[jsxs("div",{className:"flex items-center",children:[S(x),jsxs("span",{className:"ml-2 text-sm",children:[o," requests"]})]}),jsxs("span",{className:"text-sm font-medium",children:[u,"%"]})]}),jsx("div",{className:"w-full bg-gray-200 dark:bg-gray-600 rounded-full h-2.5",children:jsx("div",{className:"bg-[rgb(var(--ndpr-primary))] h-2.5 rounded-full",style:{width:`${u}%`}})})]},x)})})]})},W=()=>{let t=Z(),s=f.length,g=["pending","awaitingVerification","inProgress","completed","rejected"],x={pending:"bg-yellow-500",awaitingVerification:"bg-purple-500",inProgress:"bg-blue-500",completed:"bg-green-500",rejected:"bg-red-500"};return jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",i==null?void 0:i.table,l),children:[jsx("h3",{className:a("text-lg font-medium mb-4",i==null?void 0:i.tableHeader,l),children:"Request Status"}),s===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data available for the selected timeframe."}):jsxs("div",{children:[jsx("div",{className:"flex h-4 mb-2",children:g.map(o=>{let u=t[o],v=u/s*100;return v>0?jsx("div",{className:`${x[o]} first:rounded-l-full last:rounded-r-full`,style:{width:`${v}%`},title:`${o}: ${u} (${Math.round(v)}%)`},o):null})}),jsx("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-2 mt-4",children:g.map(o=>{let u=t[o],v=Math.round(u/s*100);return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:`w-3 h-3 rounded-full ${x[o]} mr-2`}),jsxs("div",{children:[jsx("p",{className:"text-xs font-medium",children:o==="inProgress"?"In Progress":o==="awaitingVerification"?"Awaiting Verification":o.charAt(0).toUpperCase()+o.slice(1)}),jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:[u," (",v,"%)"]})]})]},o)})})]})]})},R=()=>{let t={};f.forEach(u=>{let v=new Date(u.createdAt),e=`${v.getFullYear()}-${String(v.getMonth()+1).padStart(2,"0")}`;t[e]=(t[e]||0)+1;});let g=Object.keys(t).sort().slice(-6),x=Math.max(...Object.values(t).filter(u=>u>0),1),o=u=>{let[v,e]=u.split("-");return `${e}/${v.slice(2)}`};return jsxs("div",{className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Request Timeline"}),g.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data available for the selected timeframe."}):jsxs("div",{className:"h-40",children:[jsx("div",{className:"flex h-32 items-end justify-between space-x-2",children:g.map(u=>{let v=t[u],e=`${v/x*100}%`;return jsx("div",{className:"flex flex-col items-center flex-1",children:jsx("div",{className:"w-full bg-[rgb(var(--ndpr-primary))] rounded-t",style:{height:e},title:`${o(u)}: ${v} requests`})},u)})}),jsx("div",{className:"flex justify-between mt-2",children:g.map(u=>jsx("div",{className:"text-xs text-center",children:o(u)},u))})]})]})},q=()=>jsxs("div",{className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6","aria-live":"polite",children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Overdue Requests"}),O.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No overdue requests."}):jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:O.map(t=>jsxs("div",{role:"button",tabIndex:0,"aria-label":`View overdue request from ${t.subject.name}`,className:a("p-3 bg-red-50 dark:bg-red-900/20 rounded-md cursor-pointer hover:bg-red-100 dark:hover:bg-red-900/30",i==null?void 0:i.tableRow,l),onClick:()=>T(t.id),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),T(t.id));},children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx("h4",{className:"font-medium text-sm",children:t.subject.name}),S(t.type)]}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:t.subject.email}),jsxs("div",{className:"flex justify-between items-center",children:[jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:["Due: ",A(t.dueDate||0)]}),jsxs("p",{className:"text-xs font-bold text-red-600 dark:text-red-400",children:["Overdue by ",Math.abs(_(t.dueDate||0))," days"]})]})]},t.id))})]}),m=()=>jsxs("div",{className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6","aria-live":"polite",children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Upcoming Deadlines"}),M.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No upcoming deadlines in the next 7 days."}):jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:M.map(t=>{let s=_(t.dueDate||0);return jsxs("div",{role:"button",tabIndex:0,"aria-label":`View upcoming deadline for ${t.subject.name}`,className:a("p-3 bg-yellow-50 dark:bg-yellow-900/20 rounded-md cursor-pointer hover:bg-yellow-100 dark:hover:bg-yellow-900/30",i==null?void 0:i.tableRow,l),onClick:()=>T(t.id),onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),T(t.id));},children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx("h4",{className:"font-medium text-sm",children:t.subject.name}),S(t.type)]}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:t.subject.email}),jsxs("div",{className:"flex justify-between items-center",children:[jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:["Due: ",A(t.dueDate||0)]}),jsxs("p",{className:`text-xs font-bold ${s<=3?"text-red-600 dark:text-red-400":"text-yellow-600 dark:text-yellow-400"}`,children:["Due in ",s," days"]})]})]},t.id)})})]});return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${H}`,i==null?void 0:i.root,l),children:[jsxs("div",{className:a("flex flex-col md:flex-row md:justify-between md:items-center mb-6",i==null?void 0:i.header,l),children:[jsxs("div",{children:[jsx("h2",{className:a("text-xl font-bold mb-2",i==null?void 0:i.title,l),children:I}),jsx("p",{className:"text-gray-600 dark:text-gray-300",children:V})]}),jsxs("div",{className:"mt-4 md:mt-0",children:[jsx("label",{htmlFor:"timeframe",className:"block text-sm font-medium mb-1",children:"Timeframe"}),jsxs("select",{id:"timeframe",value:k,onChange:t=>y(t.target.value),className:"px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:[jsx("option",{value:"7days",children:"Last 7 Days"}),jsx("option",{value:"30days",children:"Last 30 Days"}),jsx("option",{value:"90days",children:"Last 90 Days"}),jsx("option",{value:"all",children:"All Time"})]})]})]}),J&&E(),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[jsxs("div",{children:[F&&L(),Y&&W()]}),jsxs("div",{children:[z&&R(),B&&q(),B&&m()]})]})]})};export{oe as a,ue as b};//# sourceMappingURL=chunk-5X32J5IA.mjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-5X32J5IA.mjs.map
|
package/dist/chunk-7D2OIPHH.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function o(i){var a,d;let t=[];return i.id||t.push("Request ID is required"),i.type||t.push("Request type is required"),i.status||t.push("Request status is required"),i.createdAt||t.push("Creation timestamp is required"),(a=i.subject)!=null&&a.name||t.push("Data subject name is required"),(d=i.subject)!=null&&d.email||t.push("Data subject email is required"),{formattedRequest:{requestId:i.id,requestType:i.type,status:i.status,createdDate:new Date(i.createdAt).toISOString(),lastUpdated:i.updatedAt?new Date(i.updatedAt).toISOString():void 0,dueDate:i.dueDate?new Date(i.dueDate).toISOString():void 0,dataSubject:i.subject?{name:i.subject.name,email:i.subject.email,phone:i.subject.phone||"Not provided",identifier:{type:i.subject.identifierType||"Not specified",value:i.subject.identifierValue||"Not provided"}}:void 0,additionalInformation:i.additionalInfo||{},verificationStatus:i.verification?`${i.verification.verified?"Verified":"Not verified"}${i.verification.method?` via ${i.verification.method}`:""}`:"Pending verification",attachments:i.attachments?i.attachments.map(e=>({name:e.name,type:e.type,addedOn:new Date(e.addedAt).toISOString()})):[]},isValid:t.length===0,validationErrors:t}}export{o as a};//# sourceMappingURL=chunk-7D2OIPHH.mjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-7D2OIPHH.mjs.map
|
package/dist/chunk-JKKRPS4P.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';function o(i){var a,d;let t=[];return i.id||t.push("Request ID is required"),i.type||t.push("Request type is required"),i.status||t.push("Request status is required"),i.createdAt||t.push("Creation timestamp is required"),(a=i.subject)!=null&&a.name||t.push("Data subject name is required"),(d=i.subject)!=null&&d.email||t.push("Data subject email is required"),{formattedRequest:{requestId:i.id,requestType:i.type,status:i.status,createdDate:new Date(i.createdAt).toISOString(),lastUpdated:i.updatedAt?new Date(i.updatedAt).toISOString():void 0,dueDate:i.dueDate?new Date(i.dueDate).toISOString():void 0,dataSubject:i.subject?{name:i.subject.name,email:i.subject.email,phone:i.subject.phone||"Not provided",identifier:{type:i.subject.identifierType||"Not specified",value:i.subject.identifierValue||"Not provided"}}:void 0,additionalInformation:i.additionalInfo||{},verificationStatus:i.verification?`${i.verification.verified?"Verified":"Not verified"}${i.verification.method?` via ${i.verification.method}`:""}`:"Pending verification",attachments:i.attachments?i.attachments.map(e=>({name:e.name,type:e.type,addedOn:new Date(e.addedAt).toISOString()})):[]},isValid:t.length===0,validationErrors:t}}exports.a=o;//# sourceMappingURL=chunk-JKKRPS4P.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-JKKRPS4P.js.map
|
package/dist/chunk-UHTJ6UFW.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkP2YV6DR3_js=require('./chunk-P2YV6DR3.js'),chunkELKB2AFZ_js=require('./chunk-ELKB2AFZ.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react');function H(e,s){return s?chunkELKB2AFZ_js.a(e):{load:()=>null,save:()=>{},remove:()=>{}}}function N({templates:e,initialPolicy:s,adapter:P,storageKey:l="ndpr_privacy_policy",useLocalStorage:m=true,onGenerate:T}){let w=P!=null?P:H(l,m),c=react.useRef(w);c.current=w;let[r,f]=react.useState(s||null),[o,p]=react.useState(null),[y,E]=react.useState({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),[A,O]=react.useState(true),D=react.useRef(e);D.current=e,react.useEffect(()=>{if(s){O(false);return}let t=false;try{let n=c.current.load(),i=a=>{if(a){if(f(a),a.templateId){let g=D.current.find(b=>b.id===a.templateId);g&&p(g);}a.organizationInfo&&E(a.organizationInfo);}O(!1);};n instanceof Promise?n.then(a=>{t||i(a);},()=>{t||O(!1);}):i(n);}catch(n){t||O(false);}return ()=>{t=true;}},[s]);let q=t=>{Promise.resolve(c.current.save(t)).catch(n=>{console.warn("[ndpr-toolkit] Failed to save policy:",n);});},_=react.useCallback(t=>{let n=e.find(b=>b.id===t);if(!n)return false;p(n);let i=n.sections.map(b=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},b),{customContent:void 0})),a={};Object.keys(n.variables).forEach(b=>{a[b]=n.variables[b].defaultValue||"";});let g=Date.now();return f({id:"policy_"+g+"_"+Math.random().toString(36).substr(2,9),title:"",templateId:n.id,organizationInfo:y,sections:i,variableValues:a,effectiveDate:g,lastUpdated:g,version:"1.0"}),true},[e,y]),C=react.useCallback(t=>{E(n=>chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},n),t));},[]),k=react.useCallback((t,n)=>{o&&(r?f(i=>i&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{sections:i.sections.map(a=>a.id===t?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{included:n}):a)})):p(i=>i&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{sections:i.sections.map(a=>a.id===t?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{included:n}):a)})));},[o,r]),j=react.useCallback((t,n)=>{o&&(r?f(i=>i&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{sections:i.sections.map(a=>a.id===t?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{customContent:n}):a)})):p(i=>i&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{sections:i.sections.map(a=>a.id===t?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{customContent:n}):a)})));},[o,r]),I=react.useCallback((t,n)=>{r&&f(i=>i&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{variableValues:chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i.variableValues),{[t]:n})}));},[r]),F=()=>"policy_"+Date.now()+"_"+Math.random().toString(36).substr(2,9),M=react.useCallback(()=>{if(!o)return null;let t=Date.now(),n={id:(r==null?void 0:r.id)||F(),title:`Privacy Policy for ${y.name}`,templateId:o.id,organizationInfo:y,sections:o.sections.map(i=>{var a;return chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{customContent:(a=r==null?void 0:r.sections.find(g=>g.id===i.id))==null?void 0:a.customContent})}),variableValues:(r==null?void 0:r.variableValues)||{},effectiveDate:t,lastUpdated:t,version:"1.0"};return f(n),q(n),T&&T(n),n},[o,r,y,T]),$=react.useCallback(()=>{if(!r)return {fullText:"",sectionTexts:{},missingVariables:[]};let t=chunkP2YV6DR3_js.b(r.sections,r.organizationInfo);return typeof t=="string"?{fullText:t,sectionTexts:{full:t},missingVariables:[]}:t},[r]),B=react.useCallback(()=>{f(null),p(null),E({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),Promise.resolve(c.current.remove()).catch(t=>{console.warn("[ndpr-toolkit] Failed to remove policy:",t);});},[]),G=react.useCallback(()=>{let t=[];if(o||t.push("No template selected"),y.name||t.push("Organization name is required"),y.website||t.push("Organization website is required"),y.privacyEmail||t.push("Privacy contact email is required"),o){let n=o.sections.filter(a=>a.required),i=(r==null?void 0:r.sections.filter(a=>a.included))||[];n.forEach(a=>{i.some(g=>g.id===a.id)||t.push(`Required section "${a.title}" must be included`);});}return o&&r&&Object.entries(o.variables).forEach(([n,i])=>{i.required&&!r.variableValues[n]&&t.push(`Required variable "${i.name}" must have a value`);}),{valid:t.length===0,errors:t}},[o,y,r]);return {policy:r,selectedTemplate:o,organizationInfo:y,selectTemplate:_,updateOrganizationInfo:C,toggleSection:k,updateSectionContent:j,updateVariableValue:I,generatePolicy:M,getPolicyText:$,resetPolicy:B,isValid:G,isLoading:A}}var x="default-business";function J(e){return e.toLocaleDateString("en-NG",{day:"numeric",month:"long",year:"numeric"})}function Q(e){let{sections:s,variables:P}=chunkP2YV6DR3_js.e(),l={};return e&&(e.name&&(l.orgName=e.name),e.email&&(l.privacyEmail=e.email),e.website&&(l.website=e.website),e.address&&(l.address=e.address),e.industry&&(l.industry=e.industry),e.dpoName&&(l.dpoName=e.dpoName),e.dpoEmail&&(l.dpoEmail=e.dpoEmail)),l.effectiveDate||(l.effectiveDate=J(new Date)),{id:x,name:"Default Business Policy",description:"NDPA-compliant privacy policy template for businesses.",organizationType:"business",sections:s,variables:Object.fromEntries(P.map(m=>[m.name,{name:m.name,description:m.description,required:m.required,defaultValue:l[m.name]||m.value||void 0}])),version:"1.0",lastUpdated:Date.now(),ndpaCompliant:true}}function W(e){if(!e)return {};let s={};return e.name&&(s.name=e.name),e.email&&(s.privacyEmail=e.email),e.website&&(s.website=e.website),e.address&&(s.address=e.address),e.industry&&(s.industry=e.industry),e.dpoName&&(s.dpoName=e.dpoName),e.dpoEmail&&(s.dpoEmail=e.dpoEmail),s}function se(e={}){let{orgInfo:s,autoGenerate:P=true,storageKey:l,useLocalStorage:m,adapter:T}=e,w=react.useRef(null);w.current===null&&(w.current=Q(s));let c=N({templates:[w.current],adapter:T,storageKey:l,useLocalStorage:m}),r=react.useRef(false),f=react.useRef(false);return react.useEffect(()=>{if(!P||c.isLoading||r.current)return;if(!T&&m!==false&&typeof window!="undefined"&&typeof window.localStorage!="undefined")try{if(window.localStorage.getItem(l!=null?l:"ndpr_privacy_policy")){r.current=!0,f.current=!0;return}}catch(y){}if(c.policy){r.current=true,f.current=true;return}r.current=true;let p=W(s);Object.keys(p).length>0&&c.updateOrganizationInfo(p),c.selectedTemplate||c.selectTemplate(x);},[P,c.isLoading]),react.useEffect(()=>{var p;if(!P||f.current||!r.current||!c.selectedTemplate)return;let o=(p=s==null?void 0:s.name)!=null?p:"";o&&c.organizationInfo.name!==o||(f.current=true,c.generatePolicy());},[P,c.selectedTemplate,c.organizationInfo]),c}exports.a=N;exports.b=se;//# sourceMappingURL=chunk-UHTJ6UFW.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-UHTJ6UFW.js.map
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compliance Score Engine
|
|
3
|
-
*
|
|
4
|
-
* Evaluates an organisation's NDPA compliance posture across eight modules and
|
|
5
|
-
* returns a scored, rated report with per-module breakdowns and sorted
|
|
6
|
-
* recommendations.
|
|
7
|
-
*
|
|
8
|
-
* Pure utility — zero React dependency.
|
|
9
|
-
*/
|
|
10
|
-
type ComplianceRating = 'excellent' | 'good' | 'needs-work' | 'critical';
|
|
11
|
-
type RecommendationPriority = 'critical' | 'high' | 'medium' | 'low';
|
|
12
|
-
type EffortLevel = 'low' | 'medium' | 'high';
|
|
13
|
-
interface RegulatoryReference {
|
|
14
|
-
section: string;
|
|
15
|
-
title: string;
|
|
16
|
-
url?: string;
|
|
17
|
-
}
|
|
18
|
-
interface Recommendation {
|
|
19
|
-
module: string;
|
|
20
|
-
key: string;
|
|
21
|
-
label: string;
|
|
22
|
-
priority: RecommendationPriority;
|
|
23
|
-
effort: EffortLevel;
|
|
24
|
-
recommendation: string;
|
|
25
|
-
ndpaSection: string;
|
|
26
|
-
}
|
|
27
|
-
interface ModuleScore {
|
|
28
|
-
/** Module name (e.g. "consent") */
|
|
29
|
-
name: string;
|
|
30
|
-
/** Raw module score 0-100 */
|
|
31
|
-
score: number;
|
|
32
|
-
/** Maximum possible score for this module (always 100) */
|
|
33
|
-
maxScore: number;
|
|
34
|
-
/** Weighted contribution to the overall score */
|
|
35
|
-
weightedScore: number;
|
|
36
|
-
/** NDPA sections this module maps to */
|
|
37
|
-
ndpaSections: string[];
|
|
38
|
-
/** Gaps found — list of human-readable gap descriptions */
|
|
39
|
-
gaps: string[];
|
|
40
|
-
}
|
|
41
|
-
interface ComplianceReport {
|
|
42
|
-
/** Overall compliance score, 0–100 */
|
|
43
|
-
score: number;
|
|
44
|
-
/** Rating bucket */
|
|
45
|
-
rating: ComplianceRating;
|
|
46
|
-
/** Per-module breakdown keyed by module name */
|
|
47
|
-
modules: Record<string, ModuleScore>;
|
|
48
|
-
/** Recommendations sorted by priority (critical first) */
|
|
49
|
-
recommendations: Recommendation[];
|
|
50
|
-
/** Top-level regulatory references */
|
|
51
|
-
regulatoryReferences: RegulatoryReference[];
|
|
52
|
-
/** ISO date of when the report was generated */
|
|
53
|
-
generatedAt: string;
|
|
54
|
-
}
|
|
55
|
-
interface ComplianceInput {
|
|
56
|
-
consent: {
|
|
57
|
-
hasConsentMechanism: boolean;
|
|
58
|
-
hasPurposeSpecification: boolean;
|
|
59
|
-
hasWithdrawalMechanism: boolean;
|
|
60
|
-
hasMinorProtection: boolean;
|
|
61
|
-
consentRecordsRetained: boolean;
|
|
62
|
-
};
|
|
63
|
-
dsr: {
|
|
64
|
-
hasRequestMechanism: boolean;
|
|
65
|
-
supportsAccess: boolean;
|
|
66
|
-
supportsRectification: boolean;
|
|
67
|
-
supportsErasure: boolean;
|
|
68
|
-
supportsPortability: boolean;
|
|
69
|
-
supportsObjection: boolean;
|
|
70
|
-
/** Expected max response time in days (>30 counts as a gap) */
|
|
71
|
-
responseTimelineDays: number;
|
|
72
|
-
};
|
|
73
|
-
dpia: {
|
|
74
|
-
conductedForHighRisk: boolean;
|
|
75
|
-
documentedRisks: boolean;
|
|
76
|
-
mitigationMeasures: boolean;
|
|
77
|
-
};
|
|
78
|
-
breach: {
|
|
79
|
-
hasNotificationProcess: boolean;
|
|
80
|
-
notifiesWithin72Hours: boolean;
|
|
81
|
-
hasRiskAssessment: boolean;
|
|
82
|
-
hasRecordKeeping: boolean;
|
|
83
|
-
};
|
|
84
|
-
policy: {
|
|
85
|
-
hasPrivacyPolicy: boolean;
|
|
86
|
-
isPubliclyAccessible: boolean;
|
|
87
|
-
/** ISO date string (YYYY-MM-DD); >13 months old counts as a gap */
|
|
88
|
-
lastUpdated: string;
|
|
89
|
-
coversAllSections: boolean;
|
|
90
|
-
};
|
|
91
|
-
lawfulBasis: {
|
|
92
|
-
documentedForAllProcessing: boolean;
|
|
93
|
-
hasLegitimateInterestAssessment: boolean;
|
|
94
|
-
};
|
|
95
|
-
crossBorder: {
|
|
96
|
-
hasTransferMechanisms: boolean;
|
|
97
|
-
adequacyAssessed: boolean;
|
|
98
|
-
ndpcApprovalObtained: boolean;
|
|
99
|
-
};
|
|
100
|
-
ropa: {
|
|
101
|
-
maintained: boolean;
|
|
102
|
-
includesAllProcessing: boolean;
|
|
103
|
-
/** ISO date string (YYYY-MM-DD); >6 months since review counts as a gap */
|
|
104
|
-
lastReviewed: string;
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Evaluate an organisation's NDPA compliance across all modules.
|
|
109
|
-
*
|
|
110
|
-
* @param input - Compliance input object
|
|
111
|
-
* @returns ComplianceReport with overall score, per-module breakdown, and sorted recommendations
|
|
112
|
-
*/
|
|
113
|
-
declare function getComplianceScore(input: ComplianceInput): ComplianceReport;
|
|
114
|
-
|
|
115
|
-
export { type ComplianceInput as C, type EffortLevel as E, type ModuleScore as M, type Recommendation as R, type ComplianceRating as a, type ComplianceReport as b, type RecommendationPriority as c, type RegulatoryReference as d, getComplianceScore as g };
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compliance Score Engine
|
|
3
|
-
*
|
|
4
|
-
* Evaluates an organisation's NDPA compliance posture across eight modules and
|
|
5
|
-
* returns a scored, rated report with per-module breakdowns and sorted
|
|
6
|
-
* recommendations.
|
|
7
|
-
*
|
|
8
|
-
* Pure utility — zero React dependency.
|
|
9
|
-
*/
|
|
10
|
-
type ComplianceRating = 'excellent' | 'good' | 'needs-work' | 'critical';
|
|
11
|
-
type RecommendationPriority = 'critical' | 'high' | 'medium' | 'low';
|
|
12
|
-
type EffortLevel = 'low' | 'medium' | 'high';
|
|
13
|
-
interface RegulatoryReference {
|
|
14
|
-
section: string;
|
|
15
|
-
title: string;
|
|
16
|
-
url?: string;
|
|
17
|
-
}
|
|
18
|
-
interface Recommendation {
|
|
19
|
-
module: string;
|
|
20
|
-
key: string;
|
|
21
|
-
label: string;
|
|
22
|
-
priority: RecommendationPriority;
|
|
23
|
-
effort: EffortLevel;
|
|
24
|
-
recommendation: string;
|
|
25
|
-
ndpaSection: string;
|
|
26
|
-
}
|
|
27
|
-
interface ModuleScore {
|
|
28
|
-
/** Module name (e.g. "consent") */
|
|
29
|
-
name: string;
|
|
30
|
-
/** Raw module score 0-100 */
|
|
31
|
-
score: number;
|
|
32
|
-
/** Maximum possible score for this module (always 100) */
|
|
33
|
-
maxScore: number;
|
|
34
|
-
/** Weighted contribution to the overall score */
|
|
35
|
-
weightedScore: number;
|
|
36
|
-
/** NDPA sections this module maps to */
|
|
37
|
-
ndpaSections: string[];
|
|
38
|
-
/** Gaps found — list of human-readable gap descriptions */
|
|
39
|
-
gaps: string[];
|
|
40
|
-
}
|
|
41
|
-
interface ComplianceReport {
|
|
42
|
-
/** Overall compliance score, 0–100 */
|
|
43
|
-
score: number;
|
|
44
|
-
/** Rating bucket */
|
|
45
|
-
rating: ComplianceRating;
|
|
46
|
-
/** Per-module breakdown keyed by module name */
|
|
47
|
-
modules: Record<string, ModuleScore>;
|
|
48
|
-
/** Recommendations sorted by priority (critical first) */
|
|
49
|
-
recommendations: Recommendation[];
|
|
50
|
-
/** Top-level regulatory references */
|
|
51
|
-
regulatoryReferences: RegulatoryReference[];
|
|
52
|
-
/** ISO date of when the report was generated */
|
|
53
|
-
generatedAt: string;
|
|
54
|
-
}
|
|
55
|
-
interface ComplianceInput {
|
|
56
|
-
consent: {
|
|
57
|
-
hasConsentMechanism: boolean;
|
|
58
|
-
hasPurposeSpecification: boolean;
|
|
59
|
-
hasWithdrawalMechanism: boolean;
|
|
60
|
-
hasMinorProtection: boolean;
|
|
61
|
-
consentRecordsRetained: boolean;
|
|
62
|
-
};
|
|
63
|
-
dsr: {
|
|
64
|
-
hasRequestMechanism: boolean;
|
|
65
|
-
supportsAccess: boolean;
|
|
66
|
-
supportsRectification: boolean;
|
|
67
|
-
supportsErasure: boolean;
|
|
68
|
-
supportsPortability: boolean;
|
|
69
|
-
supportsObjection: boolean;
|
|
70
|
-
/** Expected max response time in days (>30 counts as a gap) */
|
|
71
|
-
responseTimelineDays: number;
|
|
72
|
-
};
|
|
73
|
-
dpia: {
|
|
74
|
-
conductedForHighRisk: boolean;
|
|
75
|
-
documentedRisks: boolean;
|
|
76
|
-
mitigationMeasures: boolean;
|
|
77
|
-
};
|
|
78
|
-
breach: {
|
|
79
|
-
hasNotificationProcess: boolean;
|
|
80
|
-
notifiesWithin72Hours: boolean;
|
|
81
|
-
hasRiskAssessment: boolean;
|
|
82
|
-
hasRecordKeeping: boolean;
|
|
83
|
-
};
|
|
84
|
-
policy: {
|
|
85
|
-
hasPrivacyPolicy: boolean;
|
|
86
|
-
isPubliclyAccessible: boolean;
|
|
87
|
-
/** ISO date string (YYYY-MM-DD); >13 months old counts as a gap */
|
|
88
|
-
lastUpdated: string;
|
|
89
|
-
coversAllSections: boolean;
|
|
90
|
-
};
|
|
91
|
-
lawfulBasis: {
|
|
92
|
-
documentedForAllProcessing: boolean;
|
|
93
|
-
hasLegitimateInterestAssessment: boolean;
|
|
94
|
-
};
|
|
95
|
-
crossBorder: {
|
|
96
|
-
hasTransferMechanisms: boolean;
|
|
97
|
-
adequacyAssessed: boolean;
|
|
98
|
-
ndpcApprovalObtained: boolean;
|
|
99
|
-
};
|
|
100
|
-
ropa: {
|
|
101
|
-
maintained: boolean;
|
|
102
|
-
includesAllProcessing: boolean;
|
|
103
|
-
/** ISO date string (YYYY-MM-DD); >6 months since review counts as a gap */
|
|
104
|
-
lastReviewed: string;
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Evaluate an organisation's NDPA compliance across all modules.
|
|
109
|
-
*
|
|
110
|
-
* @param input - Compliance input object
|
|
111
|
-
* @returns ComplianceReport with overall score, per-module breakdown, and sorted recommendations
|
|
112
|
-
*/
|
|
113
|
-
declare function getComplianceScore(input: ComplianceInput): ComplianceReport;
|
|
114
|
-
|
|
115
|
-
export { type ComplianceInput as C, type EffortLevel as E, type ModuleScore as M, type Recommendation as R, type ComplianceRating as a, type ComplianceReport as b, type RecommendationPriority as c, type RegulatoryReference as d, getComplianceScore as g };
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Consent types aligned with NDPA 2023 Section 25-26
|
|
3
|
-
* Consent must be freely given, specific, informed, and unambiguous
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Represents a consent option that can be presented to users
|
|
7
|
-
*/
|
|
8
|
-
interface ConsentOption {
|
|
9
|
-
/** Unique identifier for the consent option */
|
|
10
|
-
id: string;
|
|
11
|
-
/** Display label for the consent option */
|
|
12
|
-
label: string;
|
|
13
|
-
/** Detailed description of what this consent option covers */
|
|
14
|
-
description: string;
|
|
15
|
-
/** Whether this consent option is required (cannot be declined) */
|
|
16
|
-
required: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* The specific purpose for which data will be processed
|
|
19
|
-
* NDPA Section 25(2) requires consent to be specific to each purpose
|
|
20
|
-
*/
|
|
21
|
-
purpose: string;
|
|
22
|
-
/**
|
|
23
|
-
* Default state of the consent option
|
|
24
|
-
* @default false
|
|
25
|
-
*/
|
|
26
|
-
defaultValue?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Categories of personal data covered by this consent option
|
|
29
|
-
*/
|
|
30
|
-
dataCategories?: string[];
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Represents the user's consent settings
|
|
34
|
-
*/
|
|
35
|
-
interface ConsentSettings {
|
|
36
|
-
/** Map of consent option IDs to boolean values indicating consent status */
|
|
37
|
-
consents: Record<string, boolean>;
|
|
38
|
-
/** Timestamp when consent was last updated */
|
|
39
|
-
timestamp: number;
|
|
40
|
-
/** Version of the consent form that was accepted */
|
|
41
|
-
version: string;
|
|
42
|
-
/** Method used to collect consent (e.g., "banner", "settings", "api") */
|
|
43
|
-
method: string;
|
|
44
|
-
/** Whether the user has actively made a choice (as opposed to default settings) */
|
|
45
|
-
hasInteracted: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* The lawful basis under which processing is conducted
|
|
48
|
-
* Required by NDPA Section 25(1)
|
|
49
|
-
*/
|
|
50
|
-
lawfulBasis?: LawfulBasisType;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Lawful basis for processing personal data per NDPA Section 25(1)
|
|
54
|
-
*/
|
|
55
|
-
type LawfulBasisType = 'consent' | 'contract' | 'legal_obligation' | 'vital_interests' | 'public_interest' | 'legitimate_interests';
|
|
56
|
-
/**
|
|
57
|
-
* Represents the storage mechanism for consent settings
|
|
58
|
-
*/
|
|
59
|
-
interface ConsentStorageOptions {
|
|
60
|
-
/**
|
|
61
|
-
* Storage key for consent settings
|
|
62
|
-
* @default "ndpr_consent"
|
|
63
|
-
*/
|
|
64
|
-
storageKey?: string;
|
|
65
|
-
/**
|
|
66
|
-
* Storage type to use
|
|
67
|
-
* @default "localStorage"
|
|
68
|
-
*/
|
|
69
|
-
storageType?: 'localStorage' | 'sessionStorage' | 'cookie';
|
|
70
|
-
/**
|
|
71
|
-
* Cookie options (only used when storageType is "cookie")
|
|
72
|
-
*/
|
|
73
|
-
cookieOptions?: {
|
|
74
|
-
/** Domain for the cookie */
|
|
75
|
-
domain?: string;
|
|
76
|
-
/**
|
|
77
|
-
* Path for the cookie
|
|
78
|
-
* @default "/"
|
|
79
|
-
*/
|
|
80
|
-
path?: string;
|
|
81
|
-
/**
|
|
82
|
-
* Expiration days for the cookie
|
|
83
|
-
* @default 365
|
|
84
|
-
*/
|
|
85
|
-
expires?: number;
|
|
86
|
-
/**
|
|
87
|
-
* Whether the cookie should be secure
|
|
88
|
-
* @default true
|
|
89
|
-
*/
|
|
90
|
-
secure?: boolean;
|
|
91
|
-
/**
|
|
92
|
-
* SameSite attribute for the cookie
|
|
93
|
-
* @default "Lax"
|
|
94
|
-
*/
|
|
95
|
-
sameSite?: 'Strict' | 'Lax' | 'None';
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export type { ConsentOption as C, LawfulBasisType as L, ConsentSettings as a, ConsentStorageOptions as b };
|