@tantainnovative/ndpr-toolkit
Version:
Nigeria Data Protection Toolkit — enterprise-grade compliance components for the Nigeria Data Protection Act (NDPA) 2023
2 lines • 5.94 kB
JavaScript
"use client";
import {a}from'./chunk-SFGW37LE.mjs';import {c}from'./chunk-PHA3YMFO.mjs';import'./chunk-5LJ652AH.mjs';import'./chunk-ZJYULEER.mjs';import {useMemo}from'react';import {jsxs,jsx}from'react/jsx-runtime';var q={adequacy_decision:"Adequacy Decision (Section 42)",standard_clauses:"Standard Contractual Clauses (Section 41(1)(a))",binding_corporate_rules:"Binding Corporate Rules (Section 41(1)(a))",ndpc_authorization:"NDPC Authorization (Section 42(5))",explicit_consent:"Explicit Consent (Section 43(1)(a))",contract_performance:"Contract Performance (Section 43(1)(b))",public_interest:"Public Interest (Section 43(1)(d))",legal_claims:"Legal Claims (Section 43(1)(e))",vital_interests:"Vital Interests (Section 43(1)(f))"},P={adequate:"Adequate",inadequate:"Inadequate",pending_review:"Pending Review",unknown:"Unknown"},D={active:"Active",suspended:"Suspended",terminated:"Terminated",pending_approval:"Pending Approval"},I={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"},E={low:"ndpr-badge ndpr-badge--success",medium:"ndpr-badge ndpr-badge--warning",high:"ndpr-badge ndpr-badge--destructive"},$=new Set(["standard_clauses","binding_corporate_rules","ndpc_authorization"]),H=({transfers:g,title:u,description:l,className:x="",classNames:r,unstyled:a$1,showSummary:B=true,showRiskAlerts:M=true,onTransferClick:m})=>{var h,C;let v=c(),w=(h=u!=null?u:v.crossBorder.title)!=null?h:"Cross-Border Data Transfer Manager",L=(C=l!=null?l:v.crossBorder.description)!=null?C:"Manage and document cross-border personal data transfers in compliance with NDPA 2023 Part VIII (Sections 41-43).",b=useMemo(()=>[...g].sort((e,o)=>o.updatedAt-e.updatedAt),[g]),n=useMemo(()=>{var y,S,k;let e=0,o=0,s=0,A=0,T=0;for(let p of g){let f=p.status==="active";f&&(e+=1),(p.status==="pending_approval"||(y=p.ndpcApproval)!=null&&y.required&&!((S=p.ndpcApproval)!=null&&S.approved))&&(o+=1),p.riskLevel==="high"&&f&&(s+=1),!p.tiaCompleted&&f&&(A+=1),((k=p.ndpcApproval)!=null&&k.required||$.has(p.transferMechanism))&&(T+=1);}return {totalActiveTransfers:e,pendingApproval:o,highRiskTransfers:s,missingTIA:A,ndpcApprovalRequired:T}},[g]),c$1=typeof m=="function";return jsxs("div",{"data-ndpr-component":"cross-border-transfer-manager-lite",className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${x}`,r==null?void 0:r.root,a$1),children:[jsxs("div",{className:a("",r==null?void 0:r.header,a$1),children:[jsx("h2",{className:a("ndpr-section-heading",r==null?void 0:r.title,a$1),children:w}),jsx("p",{className:"ndpr-card__subtitle",children:L})]}),B&&jsx("div",{role:"status","aria-label":"Transfer compliance summary",className:a("mb-6 grid grid-cols-2 md:grid-cols-4 gap-4",r==null?void 0:r.summary,a$1),children:[["info",n.totalActiveTransfers,"Active Transfers"],["info",n.pendingApproval,"Pending Approval"],["destructive",n.highRiskTransfers,"High Risk"],["warning",n.missingTIA,"Missing TIA"]].map(([e,o,s])=>jsxs("div",{className:a(`ndpr-alert ndpr-alert--${e}`,r==null?void 0:r.summaryCard,a$1),children:[jsx("p",{className:`ndpr-stat__value ndpr-text-${e}`,children:o}),jsx("p",{className:`text-sm ndpr-text-${e}`,children:s})]},s))}),M&&(n.highRiskTransfers>0||n.ndpcApprovalRequired>0)&&jsxs("div",{role:"alert","aria-label":"Cross-border transfer risk alerts",className:a("mb-6 ndpr-alert ndpr-alert--warning",r==null?void 0:r.riskAlert,a$1),children:[jsx("p",{className:"text-sm font-medium ndpr-text-warning mb-1",children:"Risk alerts"}),jsxs("ul",{className:"list-disc list-inside text-sm ndpr-text-warning",children:[n.highRiskTransfers>0&&jsxs("li",{children:[n.highRiskTransfers," high-risk active transfer",n.highRiskTransfers===1?"":"s"," require enhanced safeguards."]}),n.ndpcApprovalRequired>0&&jsxs("li",{children:[n.ndpcApprovalRequired," transfer",n.ndpcApprovalRequired===1?"":"s"," use a mechanism that typically requires NDPC approval."]})]})]}),jsx("h3",{className:"text-lg font-medium mb-3",children:"Transfers"}),b.length===0?jsx("p",{className:"ndpr-card__subtitle",children:"No cross-border transfers found."}):jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:a("w-full text-left text-sm",r==null?void 0:r.table,a$1),"aria-label":"Cross-border transfers",children:[jsx("thead",{className:a("ndpr-text-muted",r==null?void 0:r.tableHeader,a$1),children:jsx("tr",{children:["Destination","Recipient","Mechanism","Adequacy","Risk","Status"].map(e=>jsx("th",{className:"py-2 pr-4 font-medium",children:e},e))})}),jsx("tbody",{children:b.map(e=>{let o=c$1?()=>m(e):void 0;return jsxs("tr",{className:a(`border-t border-gray-100 dark:border-gray-700 ${c$1?"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700":""}`,r==null?void 0:r.tableRow,a$1),role:c$1?"button":void 0,tabIndex:c$1?0:void 0,"aria-label":c$1?`View transfer to ${e.destinationCountry}`:void 0,onClick:o,onKeyDown:c$1?s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),o());}:void 0,children:[jsxs("td",{className:"py-2 pr-4",children:[jsx("div",{className:"font-medium",children:e.destinationCountry}),e.destinationCountryCode&&jsx("div",{className:"text-xs ndpr-text-muted",children:e.destinationCountryCode})]}),jsx("td",{className:"py-2 pr-4",children:e.recipientOrganization}),jsx("td",{className:"py-2 pr-4",children:q[e.transferMechanism]}),jsx("td",{className:"py-2 pr-4",children:P[e.adequacyStatus]}),jsx("td",{className:"py-2 pr-4",children:jsxs("span",{className:a(`px-2 py-1 rounded text-xs font-medium ${E[e.riskLevel]}`,r==null?void 0:r.riskBadge,a$1),children:[e.riskLevel.charAt(0).toUpperCase()+e.riskLevel.slice(1)," Risk"]})}),jsx("td",{className:"py-2 pr-4",children:jsx("span",{className:a(`px-2 py-1 rounded text-xs font-medium ${I[e.status]}`,r==null?void 0:r.statusBadge,a$1),children:D[e.status]})})]},e.id)})})]})})]})};export{H as CrossBorderTransferManagerLite};