@tantainnovative/ndpr-toolkit 5.1.1 → 5.1.2
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 +24 -0
- package/README.md +1 -1
- package/dist/breach.js +1 -1
- package/dist/breach.mjs +1 -1
- package/dist/{chunk-BRJKIF7E.mjs → chunk-2ASQQYJR.mjs} +1 -1
- package/dist/{chunk-3SIYRGJF.js → chunk-2MGLU3FY.js} +3 -3
- package/dist/{chunk-CSE36REY.js → chunk-2OSZT7KI.js} +1 -1
- package/dist/{chunk-MAD7QYRK.js → chunk-37VR2MXL.js} +1 -1
- package/dist/{chunk-3H6FYU3Z.mjs → chunk-5E56KT7E.mjs} +1 -1
- package/dist/{chunk-V5TZJJWU.mjs → chunk-5LJ652AH.mjs} +1 -1
- package/dist/{chunk-F5MGMNQF.js → chunk-6KQADEFS.js} +1 -1
- package/dist/{chunk-D2UWB5OI.js → chunk-6MO3GS3B.js} +1 -1
- package/dist/{chunk-WPH6CJDL.mjs → chunk-6UGLAVRM.mjs} +1 -1
- package/dist/{chunk-TTMGFC6C.js → chunk-7563FVMY.js} +1 -1
- package/dist/{chunk-SBSYHCPK.mjs → chunk-AS2M5OTX.mjs} +1 -1
- package/dist/chunk-BHUJWWCO.js +1 -0
- package/dist/{chunk-42UJFTII.js → chunk-C32TMS75.js} +1 -1
- package/dist/{chunk-6A6VI7ZP.mjs → chunk-C77CRJLD.mjs} +1 -1
- package/dist/{chunk-3I6FYA5C.js → chunk-C7OOUURS.js} +1 -1
- package/dist/{chunk-BPMVJOHH.mjs → chunk-CNCEP66F.mjs} +1 -1
- package/dist/{chunk-WCTFED27.js → chunk-DRQURLN5.js} +1 -1
- package/dist/{chunk-L3FR4PQE.mjs → chunk-EAV4BZKO.mjs} +1 -1
- package/dist/{chunk-J7BIJ45O.mjs → chunk-EF5CLD4V.mjs} +1 -1
- package/dist/{chunk-4FXRJH37.js → chunk-ERCGW2DJ.js} +1 -1
- package/dist/{chunk-UZNWXJ2W.js → chunk-FRHFIEWZ.js} +1 -1
- package/dist/{chunk-ELK6VFKC.mjs → chunk-HDPXARLC.mjs} +1 -1
- package/dist/{chunk-I2ZBMR7F.mjs → chunk-HMKXK23C.mjs} +1 -1
- package/dist/{chunk-YDKWD6MQ.js → chunk-I5ZDNSX5.js} +1 -1
- package/dist/{chunk-RDALAH3Y.js → chunk-JVMHWM3I.js} +1 -1
- package/dist/{chunk-PSPYIRIF.mjs → chunk-KUI5W44P.mjs} +1 -1
- package/dist/{chunk-6YFPDGNB.js → chunk-LP5KXMBY.js} +1 -1
- package/dist/{chunk-N72RNTGP.mjs → chunk-MIQQYXTE.mjs} +1 -1
- package/dist/{chunk-WVHMY2BV.mjs → chunk-OLTLB5MP.mjs} +1 -1
- package/dist/{chunk-FRQFU44F.mjs → chunk-PHA3YMFO.mjs} +1 -1
- package/dist/{chunk-ZD2W3YU2.js → chunk-PXUX4FYM.js} +1 -1
- package/dist/{chunk-37VFK5SR.js → chunk-QG72X7G4.js} +1 -1
- package/dist/{chunk-NBOJ2KGN.mjs → chunk-RW7V7DDR.mjs} +1 -1
- package/dist/{chunk-3E4IH7CE.js → chunk-SMEZAQNJ.js} +1 -1
- package/dist/{chunk-B2EXRSYG.mjs → chunk-TWWGNFPF.mjs} +1 -1
- package/dist/{chunk-ASEUTU45.js → chunk-TYR5PFYD.js} +1 -1
- package/dist/{chunk-KH3EQJQE.js → chunk-VEWLYTRA.js} +1 -1
- package/dist/{chunk-63WM5PHZ.js → chunk-VTBHDHYK.js} +1 -1
- package/dist/{chunk-DK7P5JEG.mjs → chunk-WLZTATLL.mjs} +1 -1
- package/dist/chunk-XAB5C2JG.mjs +1 -0
- package/dist/{chunk-7RBO42IW.mjs → chunk-YX7DEHPA.mjs} +1 -1
- package/dist/{chunk-ZQHGIOYP.mjs → chunk-YZHEEGGK.mjs} +1 -1
- package/dist/consent.js +1 -1
- package/dist/consent.mjs +1 -1
- package/dist/core.d.mts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/cross-border-lite.d.mts +1 -1
- package/dist/cross-border-lite.d.ts +1 -1
- package/dist/cross-border-lite.js +1 -1
- package/dist/cross-border-lite.mjs +1 -1
- package/dist/cross-border.js +1 -1
- package/dist/cross-border.mjs +1 -1
- package/dist/dpia.js +1 -1
- package/dist/dpia.mjs +1 -1
- package/dist/dsr.js +1 -1
- package/dist/dsr.mjs +1 -1
- package/dist/headless.d.mts +1 -1
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +1 -1
- package/dist/headless.mjs +1 -1
- package/dist/hooks.d.mts +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/index.d.mts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/lawful-basis-lite.d.mts +1 -1
- package/dist/lawful-basis-lite.d.ts +1 -1
- package/dist/lawful-basis-lite.js +1 -1
- package/dist/lawful-basis-lite.mjs +1 -1
- package/dist/lawful-basis.d.mts +1 -1
- package/dist/lawful-basis.d.ts +1 -1
- package/dist/lawful-basis.js +1 -1
- package/dist/lawful-basis.mjs +1 -1
- package/dist/policy.d.mts +5 -4
- package/dist/policy.d.ts +5 -4
- package/dist/policy.js +1 -1
- package/dist/policy.mjs +1 -1
- package/dist/presets-consent.js +1 -1
- package/dist/presets-consent.mjs +1 -1
- package/dist/presets-dsr.js +1 -1
- package/dist/presets-dsr.mjs +1 -1
- package/dist/presets-policy.d.mts +1 -1
- package/dist/presets-policy.d.ts +1 -1
- package/dist/presets-policy.js +1 -1
- package/dist/presets-policy.mjs +1 -1
- package/dist/presets.d.mts +2 -2
- package/dist/presets.d.ts +2 -2
- package/dist/presets.js +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/ropa-lite.js +1 -1
- package/dist/ropa-lite.mjs +1 -1
- package/dist/ropa.js +1 -1
- package/dist/ropa.mjs +1 -1
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +1 -1
- package/dist/server.mjs +1 -1
- package/dist/unstyled.js +1 -1
- package/dist/unstyled.mjs +1 -1
- package/package.json +8 -4
- package/dist/chunk-FC3PTJFL.js +0 -1
- package/dist/chunk-IQO3SIAG.mjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [5.1.2](https://github.com/mr-tanta/ndpr-toolkit/compare/v5.1.1...v5.1.2) (2026-05-28)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **site:** add real NDPA privacy policy page; fix site-wide OG image ([7c4938e](https://github.com/mr-tanta/ndpr-toolkit/commit/7c4938e9b4fb0098aa3ceb92dd9b656a5cc4e8e6))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* align NDPA section citations with the Act's Arrangement of Sections ([69ea70c](https://github.com/mr-tanta/ndpr-toolkit/commit/69ea70c0d39ea7836ba1d54e04ae864368459c6b))
|
|
16
|
+
* correct dead npm URL, stale SEO version, and broken doc links ([ceec6de](https://github.com/mr-tanta/ndpr-toolkit/commit/ceec6dee15954829876a0799ce7c87def5b0bf0b))
|
|
17
|
+
* correct wrong NDPA section labels in shipped components ([bcf223c](https://github.com/mr-tanta/ndpr-toolkit/commit/bcf223ca847e71e346df53b7f31d253729711ddf))
|
|
18
|
+
* **deps:** patch dev/example advisories and make overrides work under pnpm 11 ([d2e868f](https://github.com/mr-tanta/ndpr-toolkit/commit/d2e868fcb03c39beff35d48d37930f610a2d414b))
|
|
19
|
+
* **docs:** correct component API-reference tables and samples to match v5.1.1 ([6d1c0d2](https://github.com/mr-tanta/ndpr-toolkit/commit/6d1c0d2b6d154508d5df0544cb5a129e5c2d4fda))
|
|
20
|
+
* **docs:** correct NDPA 2023 section citations in compliance-score weights table ([c132aa0](https://github.com/mr-tanta/ndpr-toolkit/commit/c132aa05d5181ab3f9a147fee8d5323ff6cea68b))
|
|
21
|
+
* **docs:** drop stale v3 framing and correct locale count ([fd2d346](https://github.com/mr-tanta/ndpr-toolkit/commit/fd2d3466dad7b6f19aa1f3d16a6382d4f371f794))
|
|
22
|
+
* **docs:** sweep renamed/removed APIs out of current guides and demos ([04149e3](https://github.com/mr-tanta/ndpr-toolkit/commit/04149e3f8c52e59865abd8d042b2168fda38d1c0))
|
|
23
|
+
* **examples:** astro demo requires Node 22.12+ for astro 6 ([b70baf1](https://github.com/mr-tanta/ndpr-toolkit/commit/b70baf1a6f9ff5f26d284dfeceb089731dac121d))
|
|
24
|
+
* **examples:** bump SSR demos to patched astro 6 / vite 6 stack ([32a06f3](https://github.com/mr-tanta/ndpr-toolkit/commit/32a06f306fd9b7cf2d417bd3ff3c23c7820fc6c1))
|
|
25
|
+
* **landing/docs:** correct broken code samples and stale references ([cc246a2](https://github.com/mr-tanta/ndpr-toolkit/commit/cc246a25bfba9cb212ee6ea517b43709e220735f))
|
|
26
|
+
* **landing:** correct stale version branding and wrong stats ([a7965bc](https://github.com/mr-tanta/ndpr-toolkit/commit/a7965bc1cfc35a50a79e0445165f15e0919803a6))
|
|
27
|
+
* standardize privacy-policy generator citation on NDPA Section 27 ([cc92ec5](https://github.com/mr-tanta/ndpr-toolkit/commit/cc92ec5eaabd4907ecf8b2d61133e7a39e6e8c87))
|
|
28
|
+
|
|
5
29
|
## [5.1.1](https://github.com/mr-tanta/ndpr-toolkit/compare/v5.1.0...v5.1.1) (2026-05-28)
|
|
6
30
|
|
|
7
31
|
Completes the jspdf security fix from 5.1.0.
|
package/README.md
CHANGED
|
@@ -474,7 +474,7 @@ Detects Next.js (App Router or Pages Router) or Express, prompts for your ORM (P
|
|
|
474
474
|
| `src/express/` | Full NDPR router with consent, DSR, breach, ROPA routes |
|
|
475
475
|
| `src/nextjs/app-router/middleware.ts` | Next.js consent gate middleware |
|
|
476
476
|
|
|
477
|
-
Copy the files you need into your project. [Browse the recipes →](https://github.com/
|
|
477
|
+
Copy the files you need into your project. [Browse the recipes →](https://github.com/mr-tanta/ndpr-toolkit/tree/main/packages/ndpr-recipes)
|
|
478
478
|
|
|
479
479
|
---
|
|
480
480
|
|
package/dist/breach.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';var
|
|
2
|
+
'use strict';var chunkC7OOUURS_js=require('./chunk-C7OOUURS.js'),chunk6MO3GS3B_js=require('./chunk-6MO3GS3B.js'),chunkEHQVTFYO_js=require('./chunk-EHQVTFYO.js'),chunk3YTAOT5O_js=require('./chunk-3YTAOT5O.js');require('./chunk-UXUMYP4L.js'),require('./chunk-ZVOIR4QH.js'),require('./chunk-AME4HJR4.js'),require('./chunk-I5ZDNSX5.js'),require('./chunk-7563FVMY.js'),require('./chunk-VWED6UTN.js');var chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var c=react.createContext(null);function P(){let e=react.useContext(c);if(!e)throw new Error("Breach compound components must be wrapped in <Breach.Provider>. Example: <Breach.Provider categories={...}><Breach.ReportForm /></Breach.Provider>");return e}var p=({categories:e,adapter:m,storageKey:h,useLocalStorage:B,initialReports:f,onReport:R,onAssessment:x,onNotification:u,children:d})=>{let y=chunkEHQVTFYO_js.a({categories:e,adapter:m,storageKey:h,useLocalStorage:B,initialReports:f,onReport:R,onAssessment:x,onNotification:u}),l=chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},y),{categories:e});return jsxRuntime.jsx(c.Provider,{value:l,children:d})};var A={Provider:p,ReportForm:chunk6MO3GS3B_js.a,RiskAssessment:chunkC7OOUURS_js.a,NotificationManager:chunkC7OOUURS_js.b,ReportGenerator:chunkC7OOUURS_js.c};Object.defineProperty(exports,"BreachNotificationManager",{enumerable:true,get:function(){return chunkC7OOUURS_js.b}});Object.defineProperty(exports,"BreachRiskAssessment",{enumerable:true,get:function(){return chunkC7OOUURS_js.a}});Object.defineProperty(exports,"RegulatoryReportGenerator",{enumerable:true,get:function(){return chunkC7OOUURS_js.c}});Object.defineProperty(exports,"BreachReportForm",{enumerable:true,get:function(){return chunk6MO3GS3B_js.a}});Object.defineProperty(exports,"useBreach",{enumerable:true,get:function(){return chunkEHQVTFYO_js.a}});Object.defineProperty(exports,"calculateBreachSeverity",{enumerable:true,get:function(){return chunk3YTAOT5O_js.a}});exports.Breach=A;exports.BreachProvider=p;exports.useBreachCompound=P;
|
package/dist/breach.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {c as c$1,b,a}from'./chunk-
|
|
2
|
+
import {c as c$1,b,a}from'./chunk-EF5CLD4V.mjs';export{b as BreachNotificationManager,a as BreachRiskAssessment,c as RegulatoryReportGenerator}from'./chunk-EF5CLD4V.mjs';import {a as a$1}from'./chunk-WLZTATLL.mjs';export{a as BreachReportForm}from'./chunk-WLZTATLL.mjs';import {a as a$2}from'./chunk-RFXGD5NE.mjs';export{a as useBreach}from'./chunk-RFXGD5NE.mjs';export{a as calculateBreachSeverity}from'./chunk-WTGKZX7J.mjs';import'./chunk-EWVK45Z3.mjs';import'./chunk-ITCY2Z66.mjs';import'./chunk-SFGW37LE.mjs';import'./chunk-PHA3YMFO.mjs';import'./chunk-5LJ652AH.mjs';import'./chunk-DBZSN4WP.mjs';import {b as b$1,a as a$3}from'./chunk-ZJYULEER.mjs';import {createContext,useContext}from'react';import {jsx}from'react/jsx-runtime';var c=createContext(null);function P(){let e=useContext(c);if(!e)throw new Error("Breach compound components must be wrapped in <Breach.Provider>. Example: <Breach.Provider categories={...}><Breach.ReportForm /></Breach.Provider>");return e}var p=({categories:e,adapter:m,storageKey:h,useLocalStorage:B,initialReports:f,onReport:R,onAssessment:x,onNotification:u,children:d})=>{let y=a$2({categories:e,adapter:m,storageKey:h,useLocalStorage:B,initialReports:f,onReport:R,onAssessment:x,onNotification:u}),l=b$1(a$3({},y),{categories:e});return jsx(c.Provider,{value:l,children:d})};var A={Provider:p,ReportForm:a$1,RiskAssessment:a,NotificationManager:b,ReportGenerator:c$1};export{A as Breach,p as BreachProvider,P as useBreachCompound};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b,d,a as a$1,c as c$1}from'./chunk-XP5PL6K7.mjs';import {a as a$2}from'./chunk-SFGW37LE.mjs';import {c}from'./chunk-FRQFU44F.mjs';import {a,b as b$1}from'./chunk-ZJYULEER.mjs';import {useState,useMemo,useEffect,useCallback}from'react';import {jsx,jsxs}from'react/jsx-runtime';var $=[{value:"consent",label:"Consent (Section 25(1)(a))"},{value:"contract",label:"Contract (Section 25(1)(b))"},{value:"legal_obligation",label:"Legal Obligation (Section 25(1)(c))"},{value:"vital_interests",label:"Vital Interests (Section 25(1)(d))"},{value:"public_interest",label:"Public Interest (Section 25(1)(e))"},{value:"legitimate_interests",label:"Legitimate Interests (Section 25(1)(f))"}],de=[{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"archived",label:"Archived"}],$e=[{value:"data_subject",label:"Directly from Data Subject"},{value:"third_party",label:"Third Party"},{value:"public_source",label:"Public Source"},{value:"other",label:"Other"}],He={active:"ndpr-badge ndpr-badge--success",inactive:"ndpr-badge ndpr-badge--warning",archived:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"},Ve={active:"Active",inactive:"Inactive",archived:"Archived"},Ge={consent:"Consent",contract:"Contract",legal_obligation:"Legal Obligation",vital_interests:"Vital Interests",public_interest:"Public Interest",legitimate_interests:"Legitimate Interests"};function Je(){let o=Date.now();return {id:`proc_${o}_${Math.random().toString(36).substring(2,11)}`,name:"",description:"",controllerDetails:{name:"",contact:"",address:""},lawfulBasis:"consent",lawfulBasisJustification:"",purposes:[],dataCategories:[],dataSubjectCategories:[],recipients:[],retentionPeriod:"",securityMeasures:[],dataSource:"data_subject",dpiaRequired:false,automatedDecisionMaking:false,status:"active",createdAt:o,updatedAt:o}}function oe(o){return o?new Date(o).toLocaleDateString():"N/A"}var Ye=({ropa:o,onAdd:D,onUpdate:y,onArchive:S,title:B,description:I,className:le="",buttonClassName:F="",classNames:e,unstyled:n})=>{var N,ee;let H=c(),pe=(N=B!=null?B:H.ropa.title)!=null?N:"Record of Processing Activities (ROPA)",ce=(ee=I!=null?I:H.ropa.description)!=null?ee:"Maintain a comprehensive record of all data processing activities as required by the NDPA accountability principle.",[f,b$2]=useState("list"),[w,ue]=useState(""),[P,se]=useState("all"),[k,ge]=useState("all"),[l,h]=useState(null),[V,C]=useState([]),[L,G]=useState(""),[E,J]=useState(""),[M,z]=useState(""),[O,W]=useState(""),[T,K]=useState(""),[j,Q]=useState(""),[q,X]=useState(""),g=useMemo(()=>b(o),[o]),_=useMemo(()=>d(o),[o]),Y=useMemo(()=>{let r=[...o.records];if(P!=="all"&&(r=r.filter(a=>a.status===P)),k!=="all"&&(r=r.filter(a=>a.lawfulBasis===k)),w){let a=w.toLowerCase();r=r.filter(p=>p.name.toLowerCase().includes(a)||p.description.toLowerCase().includes(a)||p.dataCategories.some(m=>m.toLowerCase().includes(a))||p.department&&p.department.toLowerCase().includes(a));}return r},[o.records,P,k,w]);useEffect(()=>{l&&(G(l.purposes.join(", ")),J(l.dataCategories.join(", ")),z((l.sensitiveDataCategories||[]).join(", ")),W(l.dataSubjectCategories.join(", ")),K(l.recipients.join(", ")),Q(l.securityMeasures.join(", ")),X((l.systemsUsed||[]).join(", ")));},[l==null?void 0:l.id]);let me=useCallback(()=>{let r=Je();r.controllerDetails.name=o.organizationName,r.controllerDetails.contact=o.organizationContact,r.controllerDetails.address=o.organizationAddress,o.ndpcRegistrationNumber&&(r.controllerDetails.registrationNumber=o.ndpcRegistrationNumber),o.dpoDetails&&(r.controllerDetails.dpoContact=o.dpoDetails.email),h(r),C([]),b$2("form");},[o.organizationName,o.organizationContact,o.organizationAddress,o.ndpcRegistrationNumber,o.dpoDetails]),ve=useCallback(r=>{h(a({},r)),C([]),b$2("form");},[]),v=r=>r.split(",").map(a=>a.trim()).filter(a=>a.length>0),fe=useCallback(()=>{if(!l)return;let r=b$1(a({},l),{purposes:v(L),dataCategories:v(E),sensitiveDataCategories:v(M),dataSubjectCategories:v(O),recipients:v(T),securityMeasures:v(j),systemsUsed:v(q),updatedAt:Date.now()});r.sensitiveDataCategories&&r.sensitiveDataCategories.length===0&&(r.sensitiveDataCategories=void 0),r.systemsUsed&&r.systemsUsed.length===0&&(r.systemsUsed=void 0);let a$2=a$1(r);if(!a$2.valid){C(a$2.errors);return}o.records.find(m=>m.id===r.id)?y==null||y(r.id,r):D==null||D(r),h(null),C([]),b$2("list");},[l,L,E,M,O,T,j,q,o.records,y,D]),be=useCallback(r=>{S==null||S(r);},[S]),he=useCallback(()=>{let r=c$1(o),a=new Blob([r],{type:"text/csv;charset=utf-8;"}),p=URL.createObjectURL(a),m=document.createElement("a");m.href=p,m.download=`ropa_${o.organizationName.replace(/\s+/g,"_").toLowerCase()}_${new Date().toISOString().slice(0,10)}.csv`,m.click(),setTimeout(()=>URL.revokeObjectURL(p),100);},[o]),Z=useCallback(()=>{h(null),C([]),b$2("list");},[]),u=useCallback((r,a$1)=>{h(p=>p&&b$1(a({},p),{[r]:a$1}));},[]),U=useCallback((r,a$1)=>{h(p=>p&&b$1(a({},p),{controllerDetails:b$1(a({},p.controllerDetails),{[r]:a$1})}));},[]),_e=useCallback(r=>!!r.nextReviewDate&&r.nextReviewDate<=Date.now(),[]),xe=useCallback(r=>{ue(r.target.value);},[]),Ce=useCallback(r=>{se(r.target.value);},[]),Re=useCallback(r=>{ge(r.target.value);},[]),De=useCallback(r=>{G(r.target.value);},[]),ye=useCallback(r=>{J(r.target.value);},[]),Se=useCallback(r=>{z(r.target.value);},[]),we=useCallback(r=>{W(r.target.value);},[]),Pe=useCallback(r=>{K(r.target.value);},[]),ke=useCallback(r=>{Q(r.target.value);},[]),Ae=useCallback(r=>{X(r.target.value);},[]),Be=useCallback(()=>b$2("list"),[]),Ie=useCallback(()=>b$2("summary"),[]),Fe=useCallback(r=>jsx("span",{className:a$2(`px-2 py-1 rounded text-xs font-medium ${He[r]}`,e==null?void 0:e.statusBadge,n),children:Ve[r]}),[e==null?void 0:e.statusBadge,n]),Le=useCallback(r=>jsx("span",{className:"ndpr-badge ndpr-badge--info",children:Ge[r]}),[]),Ee=()=>jsxs("div",{className:a$2("mb-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md",e==null?void 0:e.orgInfo,n),children:[jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium ndpr-text-muted",children:"Organization"}),jsx("p",{className:"ndpr-section-heading",children:o.organizationName})]}),o.dpoDetails&&jsxs("div",{children:[jsx("p",{className:"text-sm font-medium ndpr-text-muted",children:"Data Protection Officer"}),jsx("p",{className:"ndpr-section-heading",children:o.dpoDetails.name}),jsx("p",{className:"ndpr-form-field__hint",children:o.dpoDetails.email})]}),o.ndpcRegistrationNumber&&jsxs("div",{children:[jsx("p",{className:"text-sm font-medium ndpr-text-muted",children:"NDPC Registration No."}),jsx("p",{className:"ndpr-section-heading",children:o.ndpcRegistrationNumber})]})]}),jsxs("div",{className:"mt-2 text-xs ndpr-text-muted",children:["Version ",o.version," | Last Updated: ",oe(o.lastUpdated)]})]}),Me=()=>jsxs("div",{className:a$2("mb-6",e==null?void 0:e.summary,n),children:[jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4",children:[jsxs("div",{className:a$2("p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:g.totalRecords}),jsx("p",{className:"text-xs ndpr-text-info",children:"Total Records"})]}),jsxs("div",{className:a$2("p-4 bg-green-50 dark:bg-green-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-success",children:g.activeRecords}),jsx("p",{className:"text-xs ndpr-text-success",children:"Active"})]}),jsxs("div",{className:a$2("p-4 bg-purple-50 dark:bg-purple-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:g.crossBorderRecords}),jsx("p",{className:"text-xs ndpr-text-info",children:"Cross-Border"})]}),jsxs("div",{className:a$2("p-4 bg-orange-50 dark:bg-orange-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-warning",children:_.length}),jsx("p",{className:"text-xs ndpr-text-warning",children:"Records with Gaps"})]})]}),jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 mb-4",children:[jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"By Lawful Basis"}),$.map(r=>jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:r.label.split(" (")[0]}),jsx("span",{className:"font-medium",children:g.byLawfulBasis[r.value]||0})]},r.value))]}),jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"Risk Indicators"}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"Sensitive Data"}),jsx("span",{className:"font-medium",children:g.sensitiveDataRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"DPIA Required"}),jsx("span",{className:"font-medium",children:g.dpiaRequiredRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"Automated Decisions"}),jsx("span",{className:"font-medium",children:g.automatedDecisionRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"Due for Review"}),jsx("span",{className:`font-medium ${g.recordsDueForReview.length>0?"ndpr-text-destructive":""}`,children:g.recordsDueForReview.length})]})]}),g.topDepartments.length>0&&jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"Top Departments"}),g.topDepartments.slice(0,5).map(r=>jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:r.department}),jsx("span",{className:"font-medium",children:r.count})]},r.department))]})]}),_.length>0&&jsxs("div",{className:a$2("p-3 bg-red-50 dark:bg-red-900/20 rounded-md",e==null?void 0:e.complianceGap,n),role:"status","aria-live":"polite",children:[jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-2",children:"Compliance Gaps Detected"}),_.slice(0,5).map(r=>jsxs("div",{className:"mb-2",children:[jsx("p",{className:"text-xs font-medium ndpr-text-destructive",children:r.recordName}),jsx("ul",{className:"list-disc list-inside",children:r.gaps.map((a,p)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:a},p))})]},r.recordId)),_.length>5&&jsxs("p",{className:"text-xs ndpr-text-destructive mt-1",children:["...and ",_.length-5," more record(s) with gaps."]})]})]}),Oe=()=>jsxs("div",{children:[jsxs("div",{className:"mb-4 grid grid-cols-1 md:grid-cols-4 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"ropaSearch",className:"ndpr-form-field__label",children:"Search"}),jsx("input",{type:"text",id:"ropaSearch",value:w,onChange:xe,placeholder:"Search records...",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"ropaStatusFilter",className:"ndpr-form-field__label",children:"Status"}),jsxs("select",{id:"ropaStatusFilter",value:P,onChange:Ce,className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:[jsx("option",{value:"all",children:"All Statuses"}),de.map(r=>jsx("option",{value:r.value,children:r.label},r.value))]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"ropaBasisFilter",className:"ndpr-form-field__label",children:"Lawful Basis"}),jsxs("select",{id:"ropaBasisFilter",value:k,onChange:Re,className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:[jsx("option",{value:"all",children:"All Bases"}),$.map(r=>jsx("option",{value:r.value,children:r.label.split(" (")[0]},r.value))]})]}),jsxs("div",{className:"flex items-end space-x-2",children:[jsx("button",{onClick:me,className:a$2(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm ${F}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),n),children:"Add Record"}),jsx("button",{onClick:he,"aria-label":"Export ROPA records as CSV",className:a$2(`px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700 text-sm ${F}`,(e==null?void 0:e.secondaryButton)||(e==null?void 0:e.exportButton),n),children:"Export CSV"})]})]}),Y.length===0?jsx("p",{className:"ndpr-empty-state",children:"No processing records found."}):jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:a$2("w-full text-sm text-left",e==null?void 0:e.table,n),children:[jsx("thead",{className:a$2("ndpr-table__head",e==null?void 0:e.tableHeader,n),children:jsxs("tr",{children:[jsx("th",{className:"ndpr-table__cell",children:"Name"}),jsx("th",{className:"ndpr-table__cell",children:"Lawful Basis"}),jsx("th",{className:"ndpr-table__cell",children:"Data Categories"}),jsx("th",{className:"ndpr-table__cell",children:"Status"}),jsx("th",{className:"ndpr-table__cell",children:"Last Reviewed"}),jsx("th",{className:"ndpr-table__cell",children:"Actions"})]})}),jsx("tbody",{children:Y.map(r=>{let a=_e(r),p=_.some(m=>m.recordId===r.id);return jsxs("tr",{className:a$2(`border-b dark:border-gray-600 ${a?"bg-red-50 dark:bg-red-900/10":p?"bg-yellow-50 dark:bg-yellow-900/10":"bg-white dark:bg-gray-800"} hover:bg-gray-50 dark:hover:bg-gray-700`,e==null?void 0:e.tableRow,n),children:[jsx("td",{className:"ndpr-table__cell",children:jsxs("div",{children:[jsx("p",{className:"font-medium",children:r.name}),r.department&&jsx("p",{className:"ndpr-form-field__hint",children:r.department}),a&&jsx("span",{className:"text-xs ndpr-text-destructive font-medium",children:"Review Overdue"})]})}),jsx("td",{className:"ndpr-table__cell",children:Le(r.lawfulBasis)}),jsx("td",{className:"ndpr-table__cell",children:jsx("p",{className:"text-xs ndpr-text-muted max-w-xs truncate",children:r.dataCategories.join(", ")})}),jsx("td",{className:"ndpr-table__cell",children:Fe(r.status)}),jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:oe(r.lastReviewedAt)}),jsx("td",{className:"ndpr-table__cell",children:jsxs("div",{className:"ndpr-card__footer",children:[jsx("button",{onClick:()=>ve(r),"aria-label":`Edit record: ${r.name}`,className:"ndpr-text-primary hover:underline text-xs",children:"Edit"}),r.status!=="archived"&&jsx("button",{onClick:()=>be(r.id),"aria-label":`Archive record: ${r.name}`,className:"ndpr-text-muted hover:underline text-xs",children:"Archive"})]})})]},r.id)})})]})})]}),Te=useMemo(()=>l?!o.records.find(r=>r.id===l.id):true,[l,o.records]),je=()=>{if(!l)return null;let r=Te;return jsxs("div",{"data-ndpr-component":"ropa-manager",className:a$2("",e==null?void 0:e.form,n),children:[jsxs("div",{className:a$2("flex justify-between items-center mb-4",e==null?void 0:e.header,n),children:[jsx("h3",{className:"ndpr-section-heading",children:r?"Add Processing Record":"Edit Processing Record"}),jsx("button",{onClick:Z,className:"ndpr-button ndpr-button--ghost ndpr-button--sm",children:"Cancel"})]}),V.length>0&&jsxs("div",{className:"ndpr-alert ndpr-alert--destructive",role:"status","aria-live":"polite",children:[jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-1",children:"Please fix the following errors:"}),jsx("ul",{className:"list-disc list-inside",children:V.map((a,p)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:a},p))})]}),jsxs("div",{className:"ndpr-form-section",children:[jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Basic Information"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"recordName",className:"ndpr-form-field__label",children:"Activity Name *"}),jsx("input",{type:"text",id:"recordName",value:l.name,onChange:a=>u("name",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Customer Account Management"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recordDepartment",className:"ndpr-form-field__label",children:"Department"}),jsx("input",{type:"text",id:"recordDepartment",value:l.department||"",onChange:a=>u("department",a.target.value||void 0),className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Marketing"})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"recordDescription",className:"ndpr-form-field__label",children:"Description *"}),jsx("textarea",{id:"recordDescription",value:l.description,onChange:a=>u("description",a.target.value),rows:3,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Describe what personal data processing is performed..."})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recordStatus",className:"ndpr-form-field__label",children:"Status *"}),jsx("select",{id:"recordStatus",value:l.status,onChange:a=>u("status",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:de.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Controller Details"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"controllerName",className:"ndpr-form-field__label",children:"Controller Name *"}),jsx("input",{type:"text",id:"controllerName",value:l.controllerDetails.name,onChange:a=>U("name",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"controllerContact",className:"ndpr-form-field__label",children:"Controller Contact *"}),jsx("input",{type:"text",id:"controllerContact",value:l.controllerDetails.contact,onChange:a=>U("contact",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"controllerAddress",className:"ndpr-form-field__label",children:"Controller Address *"}),jsx("input",{type:"text",id:"controllerAddress",value:l.controllerDetails.address,onChange:a=>U("address",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Lawful Basis (NDPA Section 25)"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"lawfulBasis",className:"ndpr-form-field__label",children:"Lawful Basis *"}),jsx("select",{id:"lawfulBasis",value:l.lawfulBasis,onChange:a=>u("lawfulBasis",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:$.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxs("div",{children:[jsx("label",{htmlFor:"lawfulBasisJustification",className:"ndpr-form-field__label",children:"Justification *"}),jsx("textarea",{id:"lawfulBasisJustification",value:l.lawfulBasisJustification,onChange:a=>u("lawfulBasisJustification",a.target.value),rows:2,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Explain why this lawful basis applies..."})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Data Details"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"purposes",className:"ndpr-form-field__label",children:"Purposes * (comma-separated)"}),jsx("input",{type:"text",id:"purposes",value:L,onChange:De,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Account management, Service delivery"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataCategories",className:"ndpr-form-field__label",children:"Data Categories * (comma-separated)"}),jsx("input",{type:"text",id:"dataCategories",value:E,onChange:ye,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Name, Email, Phone number"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"sensitiveData",className:"ndpr-form-field__label",children:"Sensitive Data Categories (comma-separated)"}),jsx("input",{type:"text",id:"sensitiveData",value:M,onChange:Se,className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Health data, Biometric data"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"subjectCategories",className:"ndpr-form-field__label",children:"Data Subject Categories * (comma-separated)"}),jsx("input",{type:"text",id:"subjectCategories",value:O,onChange:we,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Customers, Employees"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recipients",className:"ndpr-form-field__label",children:"Recipients * (comma-separated)"}),jsx("input",{type:"text",id:"recipients",value:T,onChange:Pe,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Payment processors, Cloud service providers"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataSource",className:"ndpr-form-field__label",children:"Data Source *"}),jsx("select",{id:"dataSource",value:l.dataSource,onChange:a=>u("dataSource",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:$e.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),l.dataSource==="third_party"&&jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"thirdPartyDetails",className:"ndpr-form-field__label",children:"Third-Party Source Details *"}),jsx("input",{type:"text",id:"thirdPartyDetails",value:l.thirdPartySourceDetails||"",onChange:a=>u("thirdPartySourceDetails",a.target.value||void 0),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Describe the third-party data source..."})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Retention and Security"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"retentionPeriod",className:"ndpr-form-field__label",children:"Retention Period *"}),jsx("input",{type:"text",id:"retentionPeriod",value:l.retentionPeriod,onChange:a=>u("retentionPeriod",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., 5 years after account closure"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"retentionJustification",className:"ndpr-form-field__label",children:"Retention Justification"}),jsx("input",{type:"text",id:"retentionJustification",value:l.retentionJustification||"",onChange:a=>u("retentionJustification",a.target.value||void 0),className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Why this retention period is necessary..."})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"securityMeasures",className:"ndpr-form-field__label",children:"Security Measures * (comma-separated)"}),jsx("input",{type:"text",id:"securityMeasures",value:j,onChange:ke,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Encryption at rest, Access controls, Audit logging"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"systemsUsed",className:"ndpr-form-field__label",children:"Systems Used (comma-separated)"}),jsx("input",{type:"text",id:"systemsUsed",value:q,onChange:Ae,className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., CRM, ERP, Cloud Storage"})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Risk Indicators"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",id:"dpiaRequired",checked:l.dpiaRequired,onChange:a=>u("dpiaRequired",a.target.checked),className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:"dpiaRequired",className:"ndpr-text-sm ndpr-font-medium",children:"DPIA Required"})]}),l.dpiaRequired&&jsxs("div",{children:[jsx("label",{htmlFor:"dpiaReference",className:"ndpr-form-field__label",children:"DPIA Reference *"}),jsx("input",{type:"text",id:"dpiaReference",value:l.dpiaReference||"",onChange:a=>u("dpiaReference",a.target.value||void 0),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Reference to the completed DPIA"})]}),jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",id:"automatedDecisionMaking",checked:l.automatedDecisionMaking,onChange:a=>u("automatedDecisionMaking",a.target.checked),className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:"automatedDecisionMaking",className:"ndpr-text-sm ndpr-font-medium",children:"Automated Decision-Making"})]}),l.automatedDecisionMaking&&jsxs("div",{children:[jsx("label",{htmlFor:"automatedDecisionMakingDetails",className:"ndpr-form-field__label",children:"Automated Decision-Making Details *"}),jsx("textarea",{id:"automatedDecisionMakingDetails",value:l.automatedDecisionMakingDetails||"",onChange:a=>u("automatedDecisionMakingDetails",a.target.value||void 0),rows:2,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Describe the automated decision-making process..."})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Review Schedule"}),jsx("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:jsxs("div",{children:[jsx("label",{htmlFor:"nextReviewDate",className:"ndpr-form-field__label",children:"Next Review Date"}),jsx("input",{type:"date",id:"nextReviewDate",value:l.nextReviewDate?new Date(l.nextReviewDate).toISOString().slice(0,10):"",onChange:a=>u("nextReviewDate",a.target.value?new Date(a.target.value).getTime():void 0),className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]})})]}),jsxs("div",{className:"flex justify-end space-x-3",children:[jsx("button",{onClick:Z,className:"ndpr-button ndpr-button--secondary ndpr-button--sm",children:"Cancel"}),jsx("button",{onClick:fe,className:a$2(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm ${F}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),n),children:r?"Add Record":"Save Changes"})]})]})]})},qe=()=>jsxs("div",{className:"ndpr-section-divider ndpr-text-sm",children:[jsx("button",{onClick:Be,className:`pb-2 text-sm font-medium ${f==="list"?"border-b-2 border-[rgb(var(--ndpr-primary))] ndpr-text-primary":"ndpr-text-muted hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Processing Records"}),jsx("button",{onClick:Ie,className:`pb-2 text-sm font-medium ${f==="summary"?"border-b-2 border-[rgb(var(--ndpr-primary))] ndpr-text-primary":"ndpr-text-muted hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Compliance Summary"})]});return jsxs("div",{className:a$2(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${le}`,e==null?void 0:e.root,n),children:[jsx("h2",{className:a$2("ndpr-section-heading",e==null?void 0:e.title,n),children:pe}),jsx("p",{className:"ndpr-card__subtitle",children:ce}),Ee(),f!=="form"&&qe(),f==="list"&&Oe(),f==="summary"&&Me(),f==="form"&&je()]})};export{Ye as a};
|
|
1
|
+
import {b,d,a as a$1,c as c$1}from'./chunk-XP5PL6K7.mjs';import {a as a$2}from'./chunk-SFGW37LE.mjs';import {c}from'./chunk-PHA3YMFO.mjs';import {a,b as b$1}from'./chunk-ZJYULEER.mjs';import {useState,useMemo,useEffect,useCallback}from'react';import {jsx,jsxs}from'react/jsx-runtime';var $=[{value:"consent",label:"Consent (Section 25(1)(a))"},{value:"contract",label:"Contract (Section 25(1)(b))"},{value:"legal_obligation",label:"Legal Obligation (Section 25(1)(c))"},{value:"vital_interests",label:"Vital Interests (Section 25(1)(d))"},{value:"public_interest",label:"Public Interest (Section 25(1)(e))"},{value:"legitimate_interests",label:"Legitimate Interests (Section 25(1)(f))"}],de=[{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"archived",label:"Archived"}],$e=[{value:"data_subject",label:"Directly from Data Subject"},{value:"third_party",label:"Third Party"},{value:"public_source",label:"Public Source"},{value:"other",label:"Other"}],He={active:"ndpr-badge ndpr-badge--success",inactive:"ndpr-badge ndpr-badge--warning",archived:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"},Ve={active:"Active",inactive:"Inactive",archived:"Archived"},Ge={consent:"Consent",contract:"Contract",legal_obligation:"Legal Obligation",vital_interests:"Vital Interests",public_interest:"Public Interest",legitimate_interests:"Legitimate Interests"};function Je(){let o=Date.now();return {id:`proc_${o}_${Math.random().toString(36).substring(2,11)}`,name:"",description:"",controllerDetails:{name:"",contact:"",address:""},lawfulBasis:"consent",lawfulBasisJustification:"",purposes:[],dataCategories:[],dataSubjectCategories:[],recipients:[],retentionPeriod:"",securityMeasures:[],dataSource:"data_subject",dpiaRequired:false,automatedDecisionMaking:false,status:"active",createdAt:o,updatedAt:o}}function oe(o){return o?new Date(o).toLocaleDateString():"N/A"}var Ye=({ropa:o,onAdd:D,onUpdate:y,onArchive:S,title:B,description:I,className:le="",buttonClassName:F="",classNames:e,unstyled:n})=>{var N,ee;let H=c(),pe=(N=B!=null?B:H.ropa.title)!=null?N:"Record of Processing Activities (ROPA)",ce=(ee=I!=null?I:H.ropa.description)!=null?ee:"Maintain a comprehensive record of all data processing activities as required by the NDPA accountability principle.",[f,b$2]=useState("list"),[w,ue]=useState(""),[P,se]=useState("all"),[k,ge]=useState("all"),[l,h]=useState(null),[V,C]=useState([]),[L,G]=useState(""),[E,J]=useState(""),[M,z]=useState(""),[O,W]=useState(""),[T,K]=useState(""),[j,Q]=useState(""),[q,X]=useState(""),g=useMemo(()=>b(o),[o]),_=useMemo(()=>d(o),[o]),Y=useMemo(()=>{let r=[...o.records];if(P!=="all"&&(r=r.filter(a=>a.status===P)),k!=="all"&&(r=r.filter(a=>a.lawfulBasis===k)),w){let a=w.toLowerCase();r=r.filter(p=>p.name.toLowerCase().includes(a)||p.description.toLowerCase().includes(a)||p.dataCategories.some(m=>m.toLowerCase().includes(a))||p.department&&p.department.toLowerCase().includes(a));}return r},[o.records,P,k,w]);useEffect(()=>{l&&(G(l.purposes.join(", ")),J(l.dataCategories.join(", ")),z((l.sensitiveDataCategories||[]).join(", ")),W(l.dataSubjectCategories.join(", ")),K(l.recipients.join(", ")),Q(l.securityMeasures.join(", ")),X((l.systemsUsed||[]).join(", ")));},[l==null?void 0:l.id]);let me=useCallback(()=>{let r=Je();r.controllerDetails.name=o.organizationName,r.controllerDetails.contact=o.organizationContact,r.controllerDetails.address=o.organizationAddress,o.ndpcRegistrationNumber&&(r.controllerDetails.registrationNumber=o.ndpcRegistrationNumber),o.dpoDetails&&(r.controllerDetails.dpoContact=o.dpoDetails.email),h(r),C([]),b$2("form");},[o.organizationName,o.organizationContact,o.organizationAddress,o.ndpcRegistrationNumber,o.dpoDetails]),ve=useCallback(r=>{h(a({},r)),C([]),b$2("form");},[]),v=r=>r.split(",").map(a=>a.trim()).filter(a=>a.length>0),fe=useCallback(()=>{if(!l)return;let r=b$1(a({},l),{purposes:v(L),dataCategories:v(E),sensitiveDataCategories:v(M),dataSubjectCategories:v(O),recipients:v(T),securityMeasures:v(j),systemsUsed:v(q),updatedAt:Date.now()});r.sensitiveDataCategories&&r.sensitiveDataCategories.length===0&&(r.sensitiveDataCategories=void 0),r.systemsUsed&&r.systemsUsed.length===0&&(r.systemsUsed=void 0);let a$2=a$1(r);if(!a$2.valid){C(a$2.errors);return}o.records.find(m=>m.id===r.id)?y==null||y(r.id,r):D==null||D(r),h(null),C([]),b$2("list");},[l,L,E,M,O,T,j,q,o.records,y,D]),be=useCallback(r=>{S==null||S(r);},[S]),he=useCallback(()=>{let r=c$1(o),a=new Blob([r],{type:"text/csv;charset=utf-8;"}),p=URL.createObjectURL(a),m=document.createElement("a");m.href=p,m.download=`ropa_${o.organizationName.replace(/\s+/g,"_").toLowerCase()}_${new Date().toISOString().slice(0,10)}.csv`,m.click(),setTimeout(()=>URL.revokeObjectURL(p),100);},[o]),Z=useCallback(()=>{h(null),C([]),b$2("list");},[]),u=useCallback((r,a$1)=>{h(p=>p&&b$1(a({},p),{[r]:a$1}));},[]),U=useCallback((r,a$1)=>{h(p=>p&&b$1(a({},p),{controllerDetails:b$1(a({},p.controllerDetails),{[r]:a$1})}));},[]),_e=useCallback(r=>!!r.nextReviewDate&&r.nextReviewDate<=Date.now(),[]),xe=useCallback(r=>{ue(r.target.value);},[]),Ce=useCallback(r=>{se(r.target.value);},[]),Re=useCallback(r=>{ge(r.target.value);},[]),De=useCallback(r=>{G(r.target.value);},[]),ye=useCallback(r=>{J(r.target.value);},[]),Se=useCallback(r=>{z(r.target.value);},[]),we=useCallback(r=>{W(r.target.value);},[]),Pe=useCallback(r=>{K(r.target.value);},[]),ke=useCallback(r=>{Q(r.target.value);},[]),Ae=useCallback(r=>{X(r.target.value);},[]),Be=useCallback(()=>b$2("list"),[]),Ie=useCallback(()=>b$2("summary"),[]),Fe=useCallback(r=>jsx("span",{className:a$2(`px-2 py-1 rounded text-xs font-medium ${He[r]}`,e==null?void 0:e.statusBadge,n),children:Ve[r]}),[e==null?void 0:e.statusBadge,n]),Le=useCallback(r=>jsx("span",{className:"ndpr-badge ndpr-badge--info",children:Ge[r]}),[]),Ee=()=>jsxs("div",{className:a$2("mb-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md",e==null?void 0:e.orgInfo,n),children:[jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium ndpr-text-muted",children:"Organization"}),jsx("p",{className:"ndpr-section-heading",children:o.organizationName})]}),o.dpoDetails&&jsxs("div",{children:[jsx("p",{className:"text-sm font-medium ndpr-text-muted",children:"Data Protection Officer"}),jsx("p",{className:"ndpr-section-heading",children:o.dpoDetails.name}),jsx("p",{className:"ndpr-form-field__hint",children:o.dpoDetails.email})]}),o.ndpcRegistrationNumber&&jsxs("div",{children:[jsx("p",{className:"text-sm font-medium ndpr-text-muted",children:"NDPC Registration No."}),jsx("p",{className:"ndpr-section-heading",children:o.ndpcRegistrationNumber})]})]}),jsxs("div",{className:"mt-2 text-xs ndpr-text-muted",children:["Version ",o.version," | Last Updated: ",oe(o.lastUpdated)]})]}),Me=()=>jsxs("div",{className:a$2("mb-6",e==null?void 0:e.summary,n),children:[jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4",children:[jsxs("div",{className:a$2("p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:g.totalRecords}),jsx("p",{className:"text-xs ndpr-text-info",children:"Total Records"})]}),jsxs("div",{className:a$2("p-4 bg-green-50 dark:bg-green-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-success",children:g.activeRecords}),jsx("p",{className:"text-xs ndpr-text-success",children:"Active"})]}),jsxs("div",{className:a$2("p-4 bg-purple-50 dark:bg-purple-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:g.crossBorderRecords}),jsx("p",{className:"text-xs ndpr-text-info",children:"Cross-Border"})]}),jsxs("div",{className:a$2("p-4 bg-orange-50 dark:bg-orange-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-warning",children:_.length}),jsx("p",{className:"text-xs ndpr-text-warning",children:"Records with Gaps"})]})]}),jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 mb-4",children:[jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"By Lawful Basis"}),$.map(r=>jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:r.label.split(" (")[0]}),jsx("span",{className:"font-medium",children:g.byLawfulBasis[r.value]||0})]},r.value))]}),jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"Risk Indicators"}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"Sensitive Data"}),jsx("span",{className:"font-medium",children:g.sensitiveDataRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"DPIA Required"}),jsx("span",{className:"font-medium",children:g.dpiaRequiredRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"Automated Decisions"}),jsx("span",{className:"font-medium",children:g.automatedDecisionRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"Due for Review"}),jsx("span",{className:`font-medium ${g.recordsDueForReview.length>0?"ndpr-text-destructive":""}`,children:g.recordsDueForReview.length})]})]}),g.topDepartments.length>0&&jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"Top Departments"}),g.topDepartments.slice(0,5).map(r=>jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:r.department}),jsx("span",{className:"font-medium",children:r.count})]},r.department))]})]}),_.length>0&&jsxs("div",{className:a$2("p-3 bg-red-50 dark:bg-red-900/20 rounded-md",e==null?void 0:e.complianceGap,n),role:"status","aria-live":"polite",children:[jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-2",children:"Compliance Gaps Detected"}),_.slice(0,5).map(r=>jsxs("div",{className:"mb-2",children:[jsx("p",{className:"text-xs font-medium ndpr-text-destructive",children:r.recordName}),jsx("ul",{className:"list-disc list-inside",children:r.gaps.map((a,p)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:a},p))})]},r.recordId)),_.length>5&&jsxs("p",{className:"text-xs ndpr-text-destructive mt-1",children:["...and ",_.length-5," more record(s) with gaps."]})]})]}),Oe=()=>jsxs("div",{children:[jsxs("div",{className:"mb-4 grid grid-cols-1 md:grid-cols-4 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"ropaSearch",className:"ndpr-form-field__label",children:"Search"}),jsx("input",{type:"text",id:"ropaSearch",value:w,onChange:xe,placeholder:"Search records...",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"ropaStatusFilter",className:"ndpr-form-field__label",children:"Status"}),jsxs("select",{id:"ropaStatusFilter",value:P,onChange:Ce,className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:[jsx("option",{value:"all",children:"All Statuses"}),de.map(r=>jsx("option",{value:r.value,children:r.label},r.value))]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"ropaBasisFilter",className:"ndpr-form-field__label",children:"Lawful Basis"}),jsxs("select",{id:"ropaBasisFilter",value:k,onChange:Re,className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:[jsx("option",{value:"all",children:"All Bases"}),$.map(r=>jsx("option",{value:r.value,children:r.label.split(" (")[0]},r.value))]})]}),jsxs("div",{className:"flex items-end space-x-2",children:[jsx("button",{onClick:me,className:a$2(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm ${F}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),n),children:"Add Record"}),jsx("button",{onClick:he,"aria-label":"Export ROPA records as CSV",className:a$2(`px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700 text-sm ${F}`,(e==null?void 0:e.secondaryButton)||(e==null?void 0:e.exportButton),n),children:"Export CSV"})]})]}),Y.length===0?jsx("p",{className:"ndpr-empty-state",children:"No processing records found."}):jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:a$2("w-full text-sm text-left",e==null?void 0:e.table,n),children:[jsx("thead",{className:a$2("ndpr-table__head",e==null?void 0:e.tableHeader,n),children:jsxs("tr",{children:[jsx("th",{className:"ndpr-table__cell",children:"Name"}),jsx("th",{className:"ndpr-table__cell",children:"Lawful Basis"}),jsx("th",{className:"ndpr-table__cell",children:"Data Categories"}),jsx("th",{className:"ndpr-table__cell",children:"Status"}),jsx("th",{className:"ndpr-table__cell",children:"Last Reviewed"}),jsx("th",{className:"ndpr-table__cell",children:"Actions"})]})}),jsx("tbody",{children:Y.map(r=>{let a=_e(r),p=_.some(m=>m.recordId===r.id);return jsxs("tr",{className:a$2(`border-b dark:border-gray-600 ${a?"bg-red-50 dark:bg-red-900/10":p?"bg-yellow-50 dark:bg-yellow-900/10":"bg-white dark:bg-gray-800"} hover:bg-gray-50 dark:hover:bg-gray-700`,e==null?void 0:e.tableRow,n),children:[jsx("td",{className:"ndpr-table__cell",children:jsxs("div",{children:[jsx("p",{className:"font-medium",children:r.name}),r.department&&jsx("p",{className:"ndpr-form-field__hint",children:r.department}),a&&jsx("span",{className:"text-xs ndpr-text-destructive font-medium",children:"Review Overdue"})]})}),jsx("td",{className:"ndpr-table__cell",children:Le(r.lawfulBasis)}),jsx("td",{className:"ndpr-table__cell",children:jsx("p",{className:"text-xs ndpr-text-muted max-w-xs truncate",children:r.dataCategories.join(", ")})}),jsx("td",{className:"ndpr-table__cell",children:Fe(r.status)}),jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:oe(r.lastReviewedAt)}),jsx("td",{className:"ndpr-table__cell",children:jsxs("div",{className:"ndpr-card__footer",children:[jsx("button",{onClick:()=>ve(r),"aria-label":`Edit record: ${r.name}`,className:"ndpr-text-primary hover:underline text-xs",children:"Edit"}),r.status!=="archived"&&jsx("button",{onClick:()=>be(r.id),"aria-label":`Archive record: ${r.name}`,className:"ndpr-text-muted hover:underline text-xs",children:"Archive"})]})})]},r.id)})})]})})]}),Te=useMemo(()=>l?!o.records.find(r=>r.id===l.id):true,[l,o.records]),je=()=>{if(!l)return null;let r=Te;return jsxs("div",{"data-ndpr-component":"ropa-manager",className:a$2("",e==null?void 0:e.form,n),children:[jsxs("div",{className:a$2("flex justify-between items-center mb-4",e==null?void 0:e.header,n),children:[jsx("h3",{className:"ndpr-section-heading",children:r?"Add Processing Record":"Edit Processing Record"}),jsx("button",{onClick:Z,className:"ndpr-button ndpr-button--ghost ndpr-button--sm",children:"Cancel"})]}),V.length>0&&jsxs("div",{className:"ndpr-alert ndpr-alert--destructive",role:"status","aria-live":"polite",children:[jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-1",children:"Please fix the following errors:"}),jsx("ul",{className:"list-disc list-inside",children:V.map((a,p)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:a},p))})]}),jsxs("div",{className:"ndpr-form-section",children:[jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Basic Information"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"recordName",className:"ndpr-form-field__label",children:"Activity Name *"}),jsx("input",{type:"text",id:"recordName",value:l.name,onChange:a=>u("name",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Customer Account Management"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recordDepartment",className:"ndpr-form-field__label",children:"Department"}),jsx("input",{type:"text",id:"recordDepartment",value:l.department||"",onChange:a=>u("department",a.target.value||void 0),className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Marketing"})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"recordDescription",className:"ndpr-form-field__label",children:"Description *"}),jsx("textarea",{id:"recordDescription",value:l.description,onChange:a=>u("description",a.target.value),rows:3,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Describe what personal data processing is performed..."})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recordStatus",className:"ndpr-form-field__label",children:"Status *"}),jsx("select",{id:"recordStatus",value:l.status,onChange:a=>u("status",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:de.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Controller Details"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"controllerName",className:"ndpr-form-field__label",children:"Controller Name *"}),jsx("input",{type:"text",id:"controllerName",value:l.controllerDetails.name,onChange:a=>U("name",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"controllerContact",className:"ndpr-form-field__label",children:"Controller Contact *"}),jsx("input",{type:"text",id:"controllerContact",value:l.controllerDetails.contact,onChange:a=>U("contact",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"controllerAddress",className:"ndpr-form-field__label",children:"Controller Address *"}),jsx("input",{type:"text",id:"controllerAddress",value:l.controllerDetails.address,onChange:a=>U("address",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Lawful Basis (NDPA Section 25)"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"lawfulBasis",className:"ndpr-form-field__label",children:"Lawful Basis *"}),jsx("select",{id:"lawfulBasis",value:l.lawfulBasis,onChange:a=>u("lawfulBasis",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:$.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxs("div",{children:[jsx("label",{htmlFor:"lawfulBasisJustification",className:"ndpr-form-field__label",children:"Justification *"}),jsx("textarea",{id:"lawfulBasisJustification",value:l.lawfulBasisJustification,onChange:a=>u("lawfulBasisJustification",a.target.value),rows:2,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Explain why this lawful basis applies..."})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Data Details"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"purposes",className:"ndpr-form-field__label",children:"Purposes * (comma-separated)"}),jsx("input",{type:"text",id:"purposes",value:L,onChange:De,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Account management, Service delivery"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataCategories",className:"ndpr-form-field__label",children:"Data Categories * (comma-separated)"}),jsx("input",{type:"text",id:"dataCategories",value:E,onChange:ye,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Name, Email, Phone number"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"sensitiveData",className:"ndpr-form-field__label",children:"Sensitive Data Categories (comma-separated)"}),jsx("input",{type:"text",id:"sensitiveData",value:M,onChange:Se,className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Health data, Biometric data"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"subjectCategories",className:"ndpr-form-field__label",children:"Data Subject Categories * (comma-separated)"}),jsx("input",{type:"text",id:"subjectCategories",value:O,onChange:we,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Customers, Employees"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recipients",className:"ndpr-form-field__label",children:"Recipients * (comma-separated)"}),jsx("input",{type:"text",id:"recipients",value:T,onChange:Pe,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Payment processors, Cloud service providers"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataSource",className:"ndpr-form-field__label",children:"Data Source *"}),jsx("select",{id:"dataSource",value:l.dataSource,onChange:a=>u("dataSource",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:$e.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),l.dataSource==="third_party"&&jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"thirdPartyDetails",className:"ndpr-form-field__label",children:"Third-Party Source Details *"}),jsx("input",{type:"text",id:"thirdPartyDetails",value:l.thirdPartySourceDetails||"",onChange:a=>u("thirdPartySourceDetails",a.target.value||void 0),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Describe the third-party data source..."})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Retention and Security"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"retentionPeriod",className:"ndpr-form-field__label",children:"Retention Period *"}),jsx("input",{type:"text",id:"retentionPeriod",value:l.retentionPeriod,onChange:a=>u("retentionPeriod",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., 5 years after account closure"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"retentionJustification",className:"ndpr-form-field__label",children:"Retention Justification"}),jsx("input",{type:"text",id:"retentionJustification",value:l.retentionJustification||"",onChange:a=>u("retentionJustification",a.target.value||void 0),className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Why this retention period is necessary..."})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"securityMeasures",className:"ndpr-form-field__label",children:"Security Measures * (comma-separated)"}),jsx("input",{type:"text",id:"securityMeasures",value:j,onChange:ke,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Encryption at rest, Access controls, Audit logging"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"systemsUsed",className:"ndpr-form-field__label",children:"Systems Used (comma-separated)"}),jsx("input",{type:"text",id:"systemsUsed",value:q,onChange:Ae,className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., CRM, ERP, Cloud Storage"})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Risk Indicators"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",id:"dpiaRequired",checked:l.dpiaRequired,onChange:a=>u("dpiaRequired",a.target.checked),className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:"dpiaRequired",className:"ndpr-text-sm ndpr-font-medium",children:"DPIA Required"})]}),l.dpiaRequired&&jsxs("div",{children:[jsx("label",{htmlFor:"dpiaReference",className:"ndpr-form-field__label",children:"DPIA Reference *"}),jsx("input",{type:"text",id:"dpiaReference",value:l.dpiaReference||"",onChange:a=>u("dpiaReference",a.target.value||void 0),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Reference to the completed DPIA"})]}),jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",id:"automatedDecisionMaking",checked:l.automatedDecisionMaking,onChange:a=>u("automatedDecisionMaking",a.target.checked),className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:"automatedDecisionMaking",className:"ndpr-text-sm ndpr-font-medium",children:"Automated Decision-Making"})]}),l.automatedDecisionMaking&&jsxs("div",{children:[jsx("label",{htmlFor:"automatedDecisionMakingDetails",className:"ndpr-form-field__label",children:"Automated Decision-Making Details *"}),jsx("textarea",{id:"automatedDecisionMakingDetails",value:l.automatedDecisionMakingDetails||"",onChange:a=>u("automatedDecisionMakingDetails",a.target.value||void 0),rows:2,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Describe the automated decision-making process..."})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Review Schedule"}),jsx("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:jsxs("div",{children:[jsx("label",{htmlFor:"nextReviewDate",className:"ndpr-form-field__label",children:"Next Review Date"}),jsx("input",{type:"date",id:"nextReviewDate",value:l.nextReviewDate?new Date(l.nextReviewDate).toISOString().slice(0,10):"",onChange:a=>u("nextReviewDate",a.target.value?new Date(a.target.value).getTime():void 0),className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]})})]}),jsxs("div",{className:"flex justify-end space-x-3",children:[jsx("button",{onClick:Z,className:"ndpr-button ndpr-button--secondary ndpr-button--sm",children:"Cancel"}),jsx("button",{onClick:fe,className:a$2(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm ${F}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),n),children:r?"Add Record":"Save Changes"})]})]})]})},qe=()=>jsxs("div",{className:"ndpr-section-divider ndpr-text-sm",children:[jsx("button",{onClick:Be,className:`pb-2 text-sm font-medium ${f==="list"?"border-b-2 border-[rgb(var(--ndpr-primary))] ndpr-text-primary":"ndpr-text-muted hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Processing Records"}),jsx("button",{onClick:Ie,className:`pb-2 text-sm font-medium ${f==="summary"?"border-b-2 border-[rgb(var(--ndpr-primary))] ndpr-text-primary":"ndpr-text-muted hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Compliance Summary"})]});return jsxs("div",{className:a$2(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${le}`,e==null?void 0:e.root,n),children:[jsx("h2",{className:a$2("ndpr-section-heading",e==null?void 0:e.title,n),children:pe}),jsx("p",{className:"ndpr-card__subtitle",children:ce}),Ee(),f!=="form"&&qe(),f==="list"&&Oe(),f==="summary"&&Me(),f==="form"&&je()]})};export{Ye as a};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
'use strict';var chunkD2ZKDQVL_js=require('./chunk-D2ZKDQVL.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),
|
|
1
|
+
'use strict';var chunkD2ZKDQVL_js=require('./chunk-D2ZKDQVL.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkI5ZDNSX5_js=require('./chunk-I5ZDNSX5.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var Ee=({sections:E=chunkD2ZKDQVL_js.c,variables:R=chunkD2ZKDQVL_js.d,onGenerate:S,title:F,description:A,className:N="",buttonClassName:P="",generateButtonText:Y,showPreview:q=true,allowEditing:Q=true,classNames:t,unstyled:y=false})=>{var W,de,ae;let B=chunkI5ZDNSX5_js.c(),Z=(W=F!=null?F:B.policy.generatorTitle)!=null?W:"NDPA Privacy Policy Generator",l=(de=A!=null?A:B.policy.generatorDescription)!=null?de:"Generate an NDPA-compliant privacy policy for your organization in accordance with NDPA Section 27.",i=(ae=Y!=null?Y:B.policy.generate)!=null?ae:"Generate Policy",m=react.useId(),[L,ee]=react.useState(E),[b,k]=react.useState(R),[g,$]=react.useState("sections"),[X,H]=react.useState(""),[U,M]=react.useState(""),[ne,T]=react.useState(false),[h,G]=react.useState({});react.useEffect(()=>{ee(E);},[E]),react.useEffect(()=>{k(R);},[R]);let oe=p=>{ee(c=>c.map(e=>e.id===p?chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},e),{included:!e.included}):e));},I=(p,c)=>{k(e=>e.map(d=>d.id===p?chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},d),{value:c}):d)),h[p]&&G(e=>{let d=chunkRFPLZDIO_js.a({},e);return delete d[p],d});},ie=()=>{let p={},c=true;return b.forEach(e=>{e.required&&!e.value&&(p[e.id]=`${e.name} is required`,c=false);}),G(p),c},re=()=>{if(!ie()){$("variables");return}let p=L.filter(d=>d.included),c=Object.fromEntries(b.map(d=>[d.name,d.value])),e="";p.forEach(d=>{e+=`## ${d.title}
|
|
2
2
|
|
|
3
3
|
`,e+=chunkD2ZKDQVL_js.b(d.template,c),e+=`
|
|
4
4
|
|
|
5
5
|
`;}),H(e),M(e),T(true),$("preview");},V=()=>{S({sections:L,variables:b,content:Q?U:X});},u=()=>jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-generator",className:chunkAME4HJR4_js.a("ndpr-form-section",t==null?void 0:t.sectionList,y),role:"group","aria-labelledby":`${m}-sections-heading`,children:[jsxRuntime.jsx("h3",{id:`${m}-sections-heading`,className:"text-lg font-medium mb-4",children:"Select Policy Sections"}),L.map(p=>{let c=`${m}-section-${p.id}`,e=p.description?`${m}-section-desc-${p.id}`:void 0;return jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("border border-gray-200 dark:border-gray-700 rounded-md p-4",t==null?void 0:t.sectionItem,y),children:jsxRuntime.jsxs("div",{className:"flex items-start",children:[jsxRuntime.jsx("div",{className:"flex items-center h-5",children:jsxRuntime.jsx("input",{id:c,type:"checkbox",checked:p.included,onChange:()=>oe(p.id),disabled:p.required,"aria-describedby":e,className:chunkAME4HJR4_js.a("w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600",t==null?void 0:t.input,y)})}),jsxRuntime.jsxs("div",{className:"ml-3 text-sm",children:[jsxRuntime.jsxs("label",{htmlFor:c,className:"font-medium ndpr-text-foreground",children:[p.title," ",p.required&&jsxRuntime.jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"}),p.required&&jsxRuntime.jsx("span",{className:"sr-only",children:" (required)"})]}),p.description&&jsxRuntime.jsx("p",{id:e,className:"ndpr-text-muted mt-1",children:p.description})]})]})},p.id)}),jsxRuntime.jsx("div",{className:"mt-6",children:jsxRuntime.jsx("button",{onClick:()=>$("variables"),className:chunkAME4HJR4_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${P}`,(t==null?void 0:t.primaryButton)||(t==null?void 0:t.generateButton),y),children:"Next: Fill Variables"})})]}),f=()=>{let p={};return b.forEach(c=>{let e=c.id.split(".")[0];p[e]||(p[e]=[]),p[e].push(c);}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("",t==null?void 0:t.form,y),children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Fill Policy Variables"}),jsxRuntime.jsx("div",{className:"ndpr-form-section",children:Object.entries(p).map(([c,e])=>{let d=L.find(r=>r.id===c);return d&&!d.included?null:jsxRuntime.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsxRuntime.jsx("h4",{className:"font-medium text-lg mb-3",children:d?d.title:"General Information"}),jsxRuntime.jsx("div",{className:"ndpr-form-section",children:e.map(r=>{let O=`${m}-var-${r.id}`,j=r.description?`${m}-var-desc-${r.id}`:void 0,le=h[r.id]?`${m}-var-err-${r.id}`:void 0,J=[j,le].filter(Boolean).join(" ")||void 0;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:O,className:"ndpr-form-field__label",children:[r.name," ",r.required&&jsxRuntime.jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})]}),r.description&&jsxRuntime.jsx("p",{id:j,className:"text-xs ndpr-text-muted mb-2",children:r.description}),r.inputType==="textarea"?jsxRuntime.jsx("textarea",{id:O,value:r.value,onChange:_=>I(r.id,_.target.value),rows:4,className:chunkAME4HJR4_js.a(`w-full px-3 py-2 border ${h[r.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,t==null?void 0:t.input,y),required:r.required,"aria-required":r.required||void 0,"aria-describedby":J,"aria-invalid":h[r.id]?true:void 0}):r.inputType==="select"&&r.options?jsxRuntime.jsxs("select",{id:O,value:r.value,onChange:_=>I(r.id,_.target.value),className:chunkAME4HJR4_js.a(`w-full px-3 py-2 border ${h[r.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,t==null?void 0:t.input,y),required:r.required,"aria-required":r.required||void 0,"aria-describedby":J,"aria-invalid":h[r.id]?true:void 0,children:[jsxRuntime.jsx("option",{value:"",children:"Select an option"}),r.options.map(_=>jsxRuntime.jsx("option",{value:_,children:_},_))]}):jsxRuntime.jsx("input",{id:O,type:r.inputType,value:r.value,onChange:_=>I(r.id,_.target.value),className:chunkAME4HJR4_js.a(`w-full px-3 py-2 border ${h[r.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,t==null?void 0:t.input,y),required:r.required,"aria-required":r.required||void 0,"aria-describedby":J,"aria-invalid":h[r.id]?true:void 0}),h[r.id]&&jsxRuntime.jsx("p",{id:le,role:"alert",className:"mt-1 text-sm ndpr-text-destructive dark:text-red-500",children:h[r.id]})]},r.id)})})]},c)})}),jsxRuntime.jsxs("div",{className:"mt-6 flex space-x-4",children:[jsxRuntime.jsx("button",{onClick:()=>$("sections"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${P}`,children:"Back to Sections"}),jsxRuntime.jsx("button",{onClick:re,className:chunkAME4HJR4_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${P}`,(t==null?void 0:t.primaryButton)||(t==null?void 0:t.generateButton),y),children:i})]})]})},x=()=>{let p=`${m}-policy-content`;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Preview Generated Policy"}),Q?jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsx("label",{htmlFor:p,className:"ndpr-form-field__label",children:"Edit Policy Content"}),jsxRuntime.jsx("textarea",{id:p,value:U,onChange:c=>M(c.target.value),rows:20,className:"ndpr-form-field__input ndpr-form-field__input--mono"})]}):jsxRuntime.jsx("div",{className:"ndpr-panel","aria-live":"polite",children:jsxRuntime.jsx("div",{className:"prose dark:prose-invert max-w-none",children:X.split(`
|
|
6
|
-
`).map((c,e)=>c.startsWith("## ")?jsxRuntime.jsx("h3",{className:"text-xl font-bold mt-6 mb-3",children:c.substring(3)},e):c.startsWith("### ")?jsxRuntime.jsx("h4",{className:"text-lg font-bold mt-4 mb-2",children:c.substring(4)},e):c===""?jsxRuntime.jsx("br",{},e):jsxRuntime.jsx("p",{className:"mb-2",children:c},e))})}),jsxRuntime.jsxs("div",{className:"mt-6 flex space-x-4",children:[jsxRuntime.jsx("button",{onClick:()=>$("variables"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${P}`,children:"Back to Variables"}),jsxRuntime.jsx("button",{onClick:V,className:`px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${P}`,children:"Save Policy"})]})]})},C=()=>{switch(g){case "sections":return u();case "variables":return f();case "preview":return x();default:return u()}};return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${N}`,t==null?void 0:t.root,y),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("mb-6",t==null?void 0:t.header,y),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",t==null?void 0:t.title,y),children:Z}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-card__subtitle",t==null?void 0:t.description,y),children:l})]}),jsxRuntime.jsx("nav",{"aria-label":"Policy generation steps",className:"mb-8",children:jsxRuntime.jsxs("ol",{className:"flex items-center w-full",children:[jsxRuntime.jsxs("li",{className:`flex w-full items-center ${g==="sections"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${g==="sections"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":g==="sections"?"step":void 0,children:"1"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Sections"}),jsxRuntime.jsx("span",{className:"sr-only",children:g==="sections"?" (current step)":""})]}),jsxRuntime.jsxs("li",{className:`flex w-full items-center ${g==="variables"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${g==="variables"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":g==="variables"?"step":void 0,children:"2"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Variables"}),jsxRuntime.jsx("span",{className:"sr-only",children:g==="variables"?" (current step)":""})]}),jsxRuntime.jsxs("li",{className:`flex items-center ${g==="preview"?"ndpr-text-primary":"ndpr-card__subtitle"}`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${g==="preview"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":g==="preview"?"step":void 0,children:"3"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Preview"}),jsxRuntime.jsx("span",{className:"sr-only",children:g==="preview"?" (current step)":""})]})]})}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",t==null?void 0:t.complianceNotice,y),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsxRuntime.jsx("p",{className:"ndpr-text-info text-sm",children:"This tool helps you generate a privacy policy that aligns with the Nigeria Data Protection Act (NDPA) 2023. While we strive to ensure compliance, we recommend having the final policy reviewed by a legal professional familiar with NDPA requirements."})]}),C()]})};var Ie=({content:E,sections:R,variables:S,onExport:F,onEdit:A,title:N,description:P,className:Y="",buttonClassName:q="",showExportOptions:Q=true,showEditButton:t=true,showTableOfContents:y=true,showMetadata:B=true,organizationName:Z,lastUpdated:l,classNames:i,unstyled:m=false})=>{var re,V;let L=
|
|
6
|
+
`).map((c,e)=>c.startsWith("## ")?jsxRuntime.jsx("h3",{className:"text-xl font-bold mt-6 mb-3",children:c.substring(3)},e):c.startsWith("### ")?jsxRuntime.jsx("h4",{className:"text-lg font-bold mt-4 mb-2",children:c.substring(4)},e):c===""?jsxRuntime.jsx("br",{},e):jsxRuntime.jsx("p",{className:"mb-2",children:c},e))})}),jsxRuntime.jsxs("div",{className:"mt-6 flex space-x-4",children:[jsxRuntime.jsx("button",{onClick:()=>$("variables"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${P}`,children:"Back to Variables"}),jsxRuntime.jsx("button",{onClick:V,className:`px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${P}`,children:"Save Policy"})]})]})},C=()=>{switch(g){case "sections":return u();case "variables":return f();case "preview":return x();default:return u()}};return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${N}`,t==null?void 0:t.root,y),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("mb-6",t==null?void 0:t.header,y),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",t==null?void 0:t.title,y),children:Z}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-card__subtitle",t==null?void 0:t.description,y),children:l})]}),jsxRuntime.jsx("nav",{"aria-label":"Policy generation steps",className:"mb-8",children:jsxRuntime.jsxs("ol",{className:"flex items-center w-full",children:[jsxRuntime.jsxs("li",{className:`flex w-full items-center ${g==="sections"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${g==="sections"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":g==="sections"?"step":void 0,children:"1"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Sections"}),jsxRuntime.jsx("span",{className:"sr-only",children:g==="sections"?" (current step)":""})]}),jsxRuntime.jsxs("li",{className:`flex w-full items-center ${g==="variables"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${g==="variables"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":g==="variables"?"step":void 0,children:"2"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Variables"}),jsxRuntime.jsx("span",{className:"sr-only",children:g==="variables"?" (current step)":""})]}),jsxRuntime.jsxs("li",{className:`flex items-center ${g==="preview"?"ndpr-text-primary":"ndpr-card__subtitle"}`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${g==="preview"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":g==="preview"?"step":void 0,children:"3"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Preview"}),jsxRuntime.jsx("span",{className:"sr-only",children:g==="preview"?" (current step)":""})]})]})}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",t==null?void 0:t.complianceNotice,y),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsxRuntime.jsx("p",{className:"ndpr-text-info text-sm",children:"This tool helps you generate a privacy policy that aligns with the Nigeria Data Protection Act (NDPA) 2023. While we strive to ensure compliance, we recommend having the final policy reviewed by a legal professional familiar with NDPA requirements."})]}),C()]})};var Ie=({content:E,sections:R,variables:S,onExport:F,onEdit:A,title:N,description:P,className:Y="",buttonClassName:q="",showExportOptions:Q=true,showEditButton:t=true,showTableOfContents:y=true,showMetadata:B=true,organizationName:Z,lastUpdated:l,classNames:i,unstyled:m=false})=>{var re,V;let L=chunkI5ZDNSX5_js.c(),ee=(re=N!=null?N:L.policy.previewTitle)!=null?re:"Privacy Policy Preview",b=(V=P!=null?P:L.policy.previewDescription)!=null?V:"Preview your NDPA-compliant privacy policy before exporting.",k=react.useId(),[g,$]=react.useState("preview"),X=`${k}-tab-preview`,H=`${k}-tab-markdown`,U=`${k}-panel-preview`,M=`${k}-panel-markdown`,T=(()=>{let u=E.split(`
|
|
7
7
|
`),f=[];return u.forEach(x=>{if(x.startsWith("## ")){let C=x.substring(3).trim(),W=`${k}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;f.push({id:W,title:C,level:2});}else if(x.startsWith("### ")){let C=x.substring(4).trim(),W=`${k}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;f.push({id:W,title:C,level:3});}}),f})(),h=u=>{if(F)F(u);else if(u==="markdown"){let f=document.createElement("a"),x=new Blob([E],{type:"text/markdown"});f.href=URL.createObjectURL(x),f.download=`privacy-policy-${new Date().toISOString().split("T")[0]}.md`,document.body.appendChild(f),f.click(),document.body.removeChild(f);}},G=()=>!y||T.length===0?null:jsxRuntime.jsxs("nav",{"aria-label":"Table of contents",className:"ndpr-panel",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Table of Contents"}),jsxRuntime.jsx("ul",{className:"space-y-1",children:T.map((u,f)=>jsxRuntime.jsx("li",{style:{marginLeft:`${(u.level-2)*1.5}rem`},children:jsxRuntime.jsx("a",{href:`#${u.id}`,className:"ndpr-text-primary hover:underline",children:u.title})},f))})]}),oe=()=>B?jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-preview",className:"mb-6",children:[jsxRuntime.jsx("h1",{className:"ndpr-card__title",children:Z?`${Z} Privacy Policy`:"Privacy Policy"}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:["Last Updated: ",l?l.toLocaleDateString():"N/A"]})]}):null,I=()=>jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("prose dark:prose-invert max-w-none",i==null?void 0:i.sectionContent,m),children:E.split(`
|
|
8
|
-
`).map((u,f)=>{if(u.startsWith("## ")){let x=u.substring(3).trim(),C=`${k}-${x.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsxRuntime.jsx("h3",{id:C,className:chunkAME4HJR4_js.a("text-xl font-bold mt-6 mb-3",i==null?void 0:i.sectionTitle,m),children:x},f)}else if(u.startsWith("### ")){let x=u.substring(4).trim(),C=`${k}-${x.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsxRuntime.jsx("h4",{id:C,className:chunkAME4HJR4_js.a("text-lg font-bold mt-4 mb-2",i==null?void 0:i.sectionTitle,m),children:x},f)}else return u===""?jsxRuntime.jsx("br",{},f):jsxRuntime.jsx("p",{className:"mb-2",children:u},f)})}),ie=()=>Q?jsxRuntime.jsxs("div",{className:"mt-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Export Options"}),jsxRuntime.jsxs("div",{className:"ndpr-card__footer",children:[jsxRuntime.jsx("button",{onClick:()=>h("pdf"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${q}`,children:"Export as PDF"}),jsxRuntime.jsx("button",{onClick:()=>h("docx"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${q}`,children:"Export as DOCX"}),jsxRuntime.jsx("button",{onClick:()=>h("html"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${q}`,children:"Export as HTML"}),jsxRuntime.jsx("button",{onClick:()=>h("markdown"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${q}`,children:"Export as Markdown"})]})]}):null;return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Y}`,i==null?void 0:i.root,m),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("flex justify-between items-start mb-6",i==null?void 0:i.header,m),children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",i==null?void 0:i.title,m),children:ee}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-card__subtitle",i==null?void 0:i.description,m),children:b})]}),t&&A&&jsxRuntime.jsx("button",{onClick:A,className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${q}`,children:"Edit Policy"})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",i==null?void 0:i.complianceNotice,m),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsxRuntime.jsx("p",{className:"ndpr-text-info text-sm",children:"This privacy policy has been generated to align with the Nigeria Data Protection Act (NDPA) 2023. We recommend having the final policy reviewed by a legal professional familiar with NDPA requirements before publishing it on your website or sharing it with your users."})]}),jsxRuntime.jsx("div",{className:"mb-6 border-b border-gray-200 dark:border-gray-700",children:jsxRuntime.jsxs("div",{role:"tablist","aria-label":"Policy view options",className:"flex flex-wrap -mb-px",children:[jsxRuntime.jsx("div",{className:"mr-2",children:jsxRuntime.jsx("button",{role:"tab",id:X,"aria-selected":g==="preview","aria-controls":U,onClick:()=>$("preview"),className:`inline-block p-4 ${g==="preview"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Preview"})}),jsxRuntime.jsx("div",{className:"mr-2",children:jsxRuntime.jsx("button",{role:"tab",id:H,"aria-selected":g==="markdown","aria-controls":M,onClick:()=>$("markdown"),className:`inline-block p-4 ${g==="markdown"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Markdown"})})]})}),jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("bg-white dark:bg-gray-800 p-4 rounded-md",i==null?void 0:i.content,m),children:g==="preview"?jsxRuntime.jsxs("div",{role:"tabpanel",id:U,"aria-labelledby":X,"aria-live":"polite",children:[oe(),G(),jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("bg-gray-50 dark:bg-gray-700 p-6 rounded-md",i==null?void 0:i.section,m),children:I()})]}):jsxRuntime.jsx("div",{role:"tabpanel",id:M,"aria-labelledby":H,children:jsxRuntime.jsx("pre",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md overflow-auto whitespace-pre-wrap font-mono text-sm text-gray-800 dark:text-gray-200",children:E})})}),ie()]})};var Me=({content:E,title:R,organizationName:S,lastUpdated:F,onExportComplete:A,componentTitle:N="Export Privacy Policy",description:P,className:Y="",buttonClassName:q="",showExportHistory:Q=true,includeComplianceNotice:t=true,includeLogo:y=false,logoUrl:B,customStyles:Z,classNames:l,unstyled:i=false})=>{var p,c;let m=
|
|
8
|
+
`).map((u,f)=>{if(u.startsWith("## ")){let x=u.substring(3).trim(),C=`${k}-${x.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsxRuntime.jsx("h3",{id:C,className:chunkAME4HJR4_js.a("text-xl font-bold mt-6 mb-3",i==null?void 0:i.sectionTitle,m),children:x},f)}else if(u.startsWith("### ")){let x=u.substring(4).trim(),C=`${k}-${x.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsxRuntime.jsx("h4",{id:C,className:chunkAME4HJR4_js.a("text-lg font-bold mt-4 mb-2",i==null?void 0:i.sectionTitle,m),children:x},f)}else return u===""?jsxRuntime.jsx("br",{},f):jsxRuntime.jsx("p",{className:"mb-2",children:u},f)})}),ie=()=>Q?jsxRuntime.jsxs("div",{className:"mt-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Export Options"}),jsxRuntime.jsxs("div",{className:"ndpr-card__footer",children:[jsxRuntime.jsx("button",{onClick:()=>h("pdf"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${q}`,children:"Export as PDF"}),jsxRuntime.jsx("button",{onClick:()=>h("docx"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${q}`,children:"Export as DOCX"}),jsxRuntime.jsx("button",{onClick:()=>h("html"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${q}`,children:"Export as HTML"}),jsxRuntime.jsx("button",{onClick:()=>h("markdown"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${q}`,children:"Export as Markdown"})]})]}):null;return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Y}`,i==null?void 0:i.root,m),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("flex justify-between items-start mb-6",i==null?void 0:i.header,m),children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",i==null?void 0:i.title,m),children:ee}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-card__subtitle",i==null?void 0:i.description,m),children:b})]}),t&&A&&jsxRuntime.jsx("button",{onClick:A,className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${q}`,children:"Edit Policy"})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",i==null?void 0:i.complianceNotice,m),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsxRuntime.jsx("p",{className:"ndpr-text-info text-sm",children:"This privacy policy has been generated to align with the Nigeria Data Protection Act (NDPA) 2023. We recommend having the final policy reviewed by a legal professional familiar with NDPA requirements before publishing it on your website or sharing it with your users."})]}),jsxRuntime.jsx("div",{className:"mb-6 border-b border-gray-200 dark:border-gray-700",children:jsxRuntime.jsxs("div",{role:"tablist","aria-label":"Policy view options",className:"flex flex-wrap -mb-px",children:[jsxRuntime.jsx("div",{className:"mr-2",children:jsxRuntime.jsx("button",{role:"tab",id:X,"aria-selected":g==="preview","aria-controls":U,onClick:()=>$("preview"),className:`inline-block p-4 ${g==="preview"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Preview"})}),jsxRuntime.jsx("div",{className:"mr-2",children:jsxRuntime.jsx("button",{role:"tab",id:H,"aria-selected":g==="markdown","aria-controls":M,onClick:()=>$("markdown"),className:`inline-block p-4 ${g==="markdown"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Markdown"})})]})}),jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("bg-white dark:bg-gray-800 p-4 rounded-md",i==null?void 0:i.content,m),children:g==="preview"?jsxRuntime.jsxs("div",{role:"tabpanel",id:U,"aria-labelledby":X,"aria-live":"polite",children:[oe(),G(),jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("bg-gray-50 dark:bg-gray-700 p-6 rounded-md",i==null?void 0:i.section,m),children:I()})]}):jsxRuntime.jsx("div",{role:"tabpanel",id:M,"aria-labelledby":H,children:jsxRuntime.jsx("pre",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md overflow-auto whitespace-pre-wrap font-mono text-sm text-gray-800 dark:text-gray-200",children:E})})}),ie()]})};var Me=({content:E,title:R,organizationName:S,lastUpdated:F,onExportComplete:A,componentTitle:N="Export Privacy Policy",description:P,className:Y="",buttonClassName:q="",showExportHistory:Q=true,includeComplianceNotice:t=true,includeLogo:y=false,logoUrl:B,customStyles:Z,classNames:l,unstyled:i=false})=>{var p,c;let m=chunkI5ZDNSX5_js.c(),L=(p=R!=null?R:m.policy.exporterTitle)!=null?p:"Privacy Policy",ee=(c=P!=null?P:m.policy.exporterDescription)!=null?c:"Export your NDPA-compliant privacy policy in various formats.",b=react.useId(),[k,g]=react.useState([]),[$,X]=react.useState("pdf"),[H,U]=react.useState(false),[M,ne]=react.useState(null),[T,h]=react.useState(""),[G,oe]=react.useState(""),[I,ie]=react.useState(""),[re,V]=react.useState(false),u=e=>{let d=new Date().toISOString().split("T")[0];return `${S?S.toLowerCase().replace(/[^a-z0-9]+/g,"-"):"privacy-policy"}-privacy-policy-${d}.${e.toLowerCase()}`},f=e=>T?T.endsWith(`.${e.toLowerCase()}`)?T:`${T}.${e.toLowerCase()}`:u(e),x=()=>{let e=S?`${S} ${L}`:L,d=F?F.toLocaleDateString():"N/A",r=`<!DOCTYPE html>
|
|
9
9
|
<html lang="en">
|
|
10
10
|
<head>
|
|
11
11
|
<meta charset="UTF-8">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var chunkYFBDJ4FH_js=require('./chunk-YFBDJ4FH.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),
|
|
1
|
+
'use strict';var chunkYFBDJ4FH_js=require('./chunk-YFBDJ4FH.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkI5ZDNSX5_js=require('./chunk-I5ZDNSX5.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var z=[{value:"adequacy_decision",label:"Adequacy Decision (Section 42)"},{value:"standard_clauses",label:"Standard Contractual Clauses (Section 41(1)(a))"},{value:"binding_corporate_rules",label:"Binding Corporate Rules (Section 41(1)(a))"},{value:"ndpc_authorization",label:"NDPC Authorization (Section 42(5))"},{value:"explicit_consent",label:"Explicit Consent (Section 43(1)(a))"},{value:"contract_performance",label:"Contract Performance (Section 43(1)(b))"},{value:"public_interest",label:"Public Interest (Section 43(1)(d))"},{value:"legal_claims",label:"Legal Claims (Section 43(1)(e))"},{value:"vital_interests",label:"Vital Interests (Section 43(1)(f))"}],ae=[{value:"adequate",label:"Adequate"},{value:"inadequate",label:"Inadequate"},{value:"pending_review",label:"Pending Review"},{value:"unknown",label:"Unknown"}],ne=[{value:"one_time",label:"One-Time"},{value:"periodic",label:"Periodic"},{value:"continuous",label:"Continuous"}],ie=[{value:"active",label:"Active"},{value:"suspended",label:"Suspended"},{value:"terminated",label:"Terminated"},{value:"pending_approval",label:"Pending Approval"}],ye={low:"ndpr-badge ndpr-badge--success",medium:"ndpr-badge ndpr-badge--warning",high:"ndpr-badge ndpr-badge--destructive"},Se={active:"ndpr-badge ndpr-badge--success",suspended:"ndpr-badge ndpr-badge--warning",terminated:"ndpr-badge ndpr-badge--neutral",pending_approval:"ndpr-badge ndpr-badge--info"},ke={active:"Active",suspended:"Suspended",terminated:"Terminated",pending_approval:"Pending Approval"},de={destinationCountry:"",destinationCountryCode:"",adequacyStatus:"unknown",transferMechanism:"adequacy_decision",dataCategories:"",includesSensitiveData:false,estimatedDataSubjects:"",recipientOrganization:"",recipientContactName:"",recipientContactEmail:"",recipientContactPhone:"",recipientContactAddress:"",purpose:"",safeguards:"",riskAssessment:"",riskLevel:"medium",frequency:"one_time",status:"active",tiaCompleted:false,tiaReference:"",ndpcApprovalApplied:false,ndpcApprovalApproved:false,ndpcApprovalReference:""},Be=({transfers:g,onAdd:y,onUpdate:S,onArchive:k,summary:B,title:M,description:P,className:pe="",buttonClassName:I="",showSummary:oe=true,showTIA:le=true,classNames:r,unstyled:d})=>{var J,X;let $=chunkI5ZDNSX5_js.c(),se=(J=M!=null?M:$.crossBorder.title)!=null?J:"Cross-Border Data Transfer Manager",ce=(X=P!=null?P:$.crossBorder.description)!=null?X:"Manage and document cross-border personal data transfers in compliance with NDPA 2023 Part VIII (Sections 41-43).",[f,T]=react.useState(null),[V,D]=react.useState(false),[h,U]=react.useState(null),[i,N]=react.useState(de),[C,G]=react.useState(null),[R,ue]=react.useState("all"),[q,me]=react.useState("all"),x=react.useMemo(()=>{let t=[...g];return R!=="all"&&(t=t.filter(a=>a.status===R)),q!=="all"&&(t=t.filter(a=>a.transferMechanism===q)),t.sort((a,o)=>o.updatedAt-a.updatedAt),t},[g,R,q]);react.useEffect(()=>{x.length>0&&!f&&T(x[0].id);},[x,f]);let H=react.useMemo(()=>{var t;return f&&(t=g.find(a=>a.id===f))!=null?t:null},[g,f]),A=react.useCallback(t=>new Date(t).toLocaleDateString(),[]),_=react.useCallback(()=>{N(de),U(null),G(null);},[]),ve=react.useCallback(()=>{_(),D(true);},[_]),fe=react.useCallback(t=>{var a,o,u,v;U(t.id),N({destinationCountry:t.destinationCountry,destinationCountryCode:t.destinationCountryCode||"",adequacyStatus:t.adequacyStatus,transferMechanism:t.transferMechanism,dataCategories:t.dataCategories.join(", "),includesSensitiveData:t.includesSensitiveData,estimatedDataSubjects:((a=t.estimatedDataSubjects)==null?void 0:a.toString())||"",recipientOrganization:t.recipientOrganization,recipientContactName:t.recipientContact.name,recipientContactEmail:t.recipientContact.email,recipientContactPhone:t.recipientContact.phone||"",recipientContactAddress:t.recipientContact.address||"",purpose:t.purpose,safeguards:t.safeguards.join(`
|
|
2
2
|
`),riskAssessment:t.riskAssessment,riskLevel:t.riskLevel,frequency:t.frequency,status:t.status,tiaCompleted:t.tiaCompleted,tiaReference:t.tiaReference||"",ndpcApprovalApplied:((o=t.ndpcApproval)==null?void 0:o.applied)||false,ndpcApprovalApproved:((u=t.ndpcApproval)==null?void 0:u.approved)||false,ndpcApprovalReference:((v=t.ndpcApproval)==null?void 0:v.referenceNumber)||""}),D(true);},[]),l=react.useCallback((t,a)=>{N(o=>chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},o),{[t]:a}));},[]),K=react.useCallback(()=>{let t=chunkYFBDJ4FH_js.e(i.transferMechanism),a=Date.now();return {destinationCountry:i.destinationCountry.trim(),destinationCountryCode:i.destinationCountryCode.trim()||void 0,adequacyStatus:i.adequacyStatus,transferMechanism:i.transferMechanism,dataCategories:i.dataCategories.split(",").map(o=>o.trim()).filter(Boolean),includesSensitiveData:i.includesSensitiveData,estimatedDataSubjects:i.estimatedDataSubjects?parseInt(i.estimatedDataSubjects,10):void 0,recipientOrganization:i.recipientOrganization.trim(),recipientContact:{name:i.recipientContactName.trim(),email:i.recipientContactEmail.trim(),phone:i.recipientContactPhone.trim()||void 0,address:i.recipientContactAddress.trim()||void 0},purpose:i.purpose.trim(),safeguards:i.safeguards.split(`
|
|
3
3
|
`).map(o=>o.trim()).filter(Boolean),riskAssessment:i.riskAssessment.trim(),riskLevel:i.riskLevel,frequency:i.frequency,status:t&&!i.ndpcApprovalApproved?"pending_approval":i.status,tiaCompleted:i.tiaCompleted,tiaReference:i.tiaReference.trim()||void 0,ndpcApproval:t?{required:true,applied:i.ndpcApprovalApplied,approved:i.ndpcApprovalApproved||void 0,referenceNumber:i.ndpcApprovalReference.trim()||void 0,appliedAt:i.ndpcApprovalApplied?a:void 0,approvedAt:i.ndpcApprovalApproved?a:void 0}:void 0,startDate:a,reviewDate:a+365*24*60*60*1e3}},[i]),be=react.useCallback(()=>{let t=K(),a=chunkRFPLZDIO_js.a({id:h||"temp",createdAt:Date.now(),updatedAt:Date.now()},t),o=chunkYFBDJ4FH_js.g(a);G(o),o.isValid&&(h?S==null||S(h,t):y==null||y(t),_(),D(false));},[K,h,S,y,_]),Y=react.useCallback(()=>{_(),D(false);},[_]),ge=react.useCallback(t=>{k==null||k(t),f===t&&T(null);},[k,f]),Q=react.useCallback(t=>jsxRuntime.jsxs("span",{className:chunkAME4HJR4_js.a(`px-2 py-1 rounded text-xs font-medium ${ye[t]}`,r==null?void 0:r.riskBadge,d),children:[t.charAt(0).toUpperCase()+t.slice(1)," Risk"]}),[r==null?void 0:r.riskBadge,d]),W=react.useCallback(t=>jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.a(`px-2 py-1 rounded text-xs font-medium ${Se[t]}`,r==null?void 0:r.statusBadge,d),children:ke[t]}),[r==null?void 0:r.statusBadge,d]),he=react.useCallback(t=>{var u;chunkYFBDJ4FH_js.e(t);let o=((u=z.find(v=>v.value===t))==null?void 0:u.label)||t;return jsxRuntime.jsx("span",{className:"px-2 py-1 rounded text-xs font-medium ndpr-badge ndpr-badge--info",children:o})},[]),w=react.useMemo(()=>{var v,c;if(B)return B;let t=0,a=[],o=[],u=[];for(let s of g){let O=s.status==="active";O&&t++,(s.status==="pending_approval"||(v=s.ndpcApproval)!=null&&v.required&&!((c=s.ndpcApproval)!=null&&c.approved))&&a.push(s),s.riskLevel==="high"&&O&&o.push(s),!s.tiaCompleted&&O&&u.push(s);}return {totalActiveTransfers:t,pendingApproval:a,highRiskTransfers:o,missingTIA:u,byMechanism:{},byAdequacy:{},dueForReview:[],lastUpdated:Date.now()}},[B,g]),Ce=()=>jsxRuntime.jsxs("div",{"data-ndpr-component":"cross-border-transfer-manager",role:"status","aria-label":"Transfer compliance summary",className:chunkAME4HJR4_js.a("mb-6 grid grid-cols-2 md:grid-cols-4 gap-4",r==null?void 0:r.summary,d),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",r==null?void 0:r.summaryCard,d),children:[jsxRuntime.jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:w.totalActiveTransfers}),jsxRuntime.jsx("p",{className:"text-sm ndpr-text-info",children:"Active Transfers"})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",r==null?void 0:r.summaryCard,d),children:[jsxRuntime.jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:w.pendingApproval.length}),jsxRuntime.jsx("p",{className:"text-sm ndpr-text-info",children:"Pending Approval"})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--destructive",r==null?void 0:r.summaryCard,d),children:[jsxRuntime.jsx("p",{className:"ndpr-stat__value ndpr-text-destructive",children:w.highRiskTransfers.length}),jsxRuntime.jsx("p",{className:"text-sm ndpr-text-destructive",children:"High Risk"})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--warning",r==null?void 0:r.summaryCard,d),children:[jsxRuntime.jsx("p",{className:"ndpr-stat__value ndpr-text-warning",children:w.missingTIA.length}),jsxRuntime.jsx("p",{className:"text-sm ndpr-text-warning",children:"Missing TIA"})]})]}),_e=()=>{let t=chunkYFBDJ4FH_js.e(i.transferMechanism);return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("bg-gray-50 dark:bg-gray-700 p-6 rounded-lg mb-6",r==null?void 0:r.form,d),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("flex justify-between items-center mb-4",r==null?void 0:r.header,d),children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:h?"Edit Transfer":"Add New Transfer"}),jsxRuntime.jsx("button",{onClick:Y,"aria-label":"Cancel form",className:"text-gray-600 hover:ndpr-text-muted dark:hover:text-gray-200",children:"Cancel"})]}),C&&!C.isValid&&jsxRuntime.jsxs("div",{id:"cb-form-errors",role:"alert",className:"ndpr-alert ndpr-alert--destructive",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-1",children:"Please fix the following errors:"}),jsxRuntime.jsx("ul",{className:"list-disc list-inside text-sm ndpr-text-destructive",children:C.errors.map((a,o)=>jsxRuntime.jsx("li",{children:a},o))})]}),C&&C.warnings.length>0&&jsxRuntime.jsxs("div",{id:"cb-form-warnings",role:"alert",className:"ndpr-alert ndpr-alert--warning",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium ndpr-text-warning mb-1",children:"Warnings:"}),jsxRuntime.jsx("ul",{className:"list-disc list-inside text-sm ndpr-text-warning",children:C.warnings.map((a,o)=>jsxRuntime.jsx("li",{children:a},o))})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"cb-destinationCountry",className:"ndpr-form-field__label",children:["Destination Country ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{id:"cb-destinationCountry",type:"text",value:i.destinationCountry,onChange:a=>l("destinationCountry",a.target.value),placeholder:"e.g. United Kingdom","aria-required":"true","aria-describedby":"cb-form-errors","aria-label":"Destination country",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"cb-destinationCountryCode",className:"ndpr-form-field__label",children:"Country Code (ISO)"}),jsxRuntime.jsx("input",{id:"cb-destinationCountryCode",type:"text",value:i.destinationCountryCode,onChange:a=>l("destinationCountryCode",a.target.value),placeholder:"e.g. GB",maxLength:3,"aria-label":"Country code in ISO format",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"cb-recipientOrganization",className:"ndpr-form-field__label",children:["Recipient Organization ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{id:"cb-recipientOrganization",type:"text",value:i.recipientOrganization,onChange:a=>l("recipientOrganization",a.target.value),placeholder:"Organization name","aria-required":"true","aria-describedby":"cb-form-errors",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"cb-transferMechanism",className:"ndpr-form-field__label",children:["Transfer Mechanism ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("select",{id:"cb-transferMechanism",value:i.transferMechanism,onChange:a=>l("transferMechanism",a.target.value),"aria-required":"true","aria-describedby":"cb-form-errors",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.select,d),children:z.map(a=>jsxRuntime.jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"cb-adequacyStatus",className:"ndpr-form-field__label",children:"Adequacy Status"}),jsxRuntime.jsx("select",{id:"cb-adequacyStatus",value:i.adequacyStatus,onChange:a=>l("adequacyStatus",a.target.value),"aria-label":"Select adequacy status of destination country",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.select,d),children:ae.map(a=>jsxRuntime.jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"cb-transfer-riskLevel",className:"ndpr-form-field__label",children:"Risk Level"}),jsxRuntime.jsxs("select",{id:"cb-transfer-riskLevel",value:i.riskLevel,onChange:a=>l("riskLevel",a.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.select,d),children:[jsxRuntime.jsx("option",{value:"low",children:"Low"}),jsxRuntime.jsx("option",{value:"medium",children:"Medium"}),jsxRuntime.jsx("option",{value:"high",children:"High"})]})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsxs("label",{htmlFor:"cb-dataCategories",className:"ndpr-form-field__label",children:["Data Categories ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{id:"cb-dataCategories",type:"text",value:i.dataCategories,onChange:a=>l("dataCategories",a.target.value),placeholder:"Comma-separated, e.g. Names, Email addresses, Phone numbers","aria-required":"true","aria-describedby":"cb-dataCategories-help",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)}),jsxRuntime.jsx("p",{id:"cb-dataCategories-help",className:"text-xs text-gray-500 mt-1",children:"Separate categories with commas"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"checkbox",id:"includesSensitiveData",checked:i.includesSensitiveData,onChange:a=>l("includesSensitiveData",a.target.checked),className:"ndpr-form-field__checkbox"}),jsxRuntime.jsx("label",{htmlFor:"includesSensitiveData",className:"ndpr-text-sm ndpr-font-medium",children:"Includes sensitive personal data"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"cb-transfer-estimatedDataSubjects",className:"ndpr-form-field__label",children:"Estimated Data Subjects"}),jsxRuntime.jsx("input",{id:"cb-transfer-estimatedDataSubjects",type:"number",value:i.estimatedDataSubjects,onChange:a=>l("estimatedDataSubjects",a.target.value),placeholder:"Number of data subjects",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"cb-recipientContactName",className:"ndpr-form-field__label",children:["Recipient Contact Name ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{id:"cb-recipientContactName",type:"text",value:i.recipientContactName,onChange:a=>l("recipientContactName",a.target.value),placeholder:"Contact person name","aria-required":"true","aria-describedby":"cb-form-errors",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"cb-recipientContactEmail",className:"ndpr-form-field__label",children:["Recipient Contact Email ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{id:"cb-recipientContactEmail",type:"email",value:i.recipientContactEmail,onChange:a=>l("recipientContactEmail",a.target.value),placeholder:"contact@example.com","aria-required":"true","aria-describedby":"cb-form-errors",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"cb-transfer-recipientContactPhone",className:"ndpr-form-field__label",children:"Recipient Contact Phone"}),jsxRuntime.jsx("input",{id:"cb-transfer-recipientContactPhone",type:"text",value:i.recipientContactPhone,onChange:a=>l("recipientContactPhone",a.target.value),placeholder:"Phone number",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"cb-transfer-recipientContactAddress",className:"ndpr-form-field__label",children:"Recipient Contact Address"}),jsxRuntime.jsx("input",{id:"cb-transfer-recipientContactAddress",type:"text",value:i.recipientContactAddress,onChange:a=>l("recipientContactAddress",a.target.value),placeholder:"Address",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsxs("label",{htmlFor:"cb-purpose",className:"ndpr-form-field__label",children:["Purpose of Transfer ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("textarea",{id:"cb-purpose",value:i.purpose,onChange:a=>l("purpose",a.target.value),placeholder:"Describe the purpose of this data transfer",rows:2,"aria-required":"true","aria-describedby":"cb-form-errors",className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsxs("label",{htmlFor:"cb-safeguards",className:"ndpr-form-field__label",children:["Safeguards ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("textarea",{id:"cb-safeguards",value:i.safeguards,onChange:a=>l("safeguards",a.target.value),placeholder:`One safeguard per line, e.g.
|
|
4
4
|
End-to-end encryption
|