@tantainnovative/ndpr-toolkit 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/dist/chunk-3APT25XO.mjs +1 -0
- package/dist/chunk-45D7AMB3.js +1 -0
- package/dist/chunk-65J4P5ID.js +1 -0
- package/dist/{chunk-NB6SKG76.mjs → chunk-6H6IXTHA.mjs} +1 -1
- package/dist/{chunk-GUERZD4O.mjs → chunk-6OPGI27L.mjs} +1 -1
- package/dist/{chunk-3XU6FL2I.js → chunk-6YFPDGNB.js} +1 -1
- package/dist/{chunk-IHNAFXDM.mjs → chunk-7Z7NURIA.mjs} +1 -1
- package/dist/chunk-D3HHDWBR.js +1 -0
- package/dist/chunk-DSIIEUAD.mjs +1 -0
- package/dist/chunk-H2FDWK4F.js +6 -0
- package/dist/chunk-HLFS3NXG.js +1 -0
- package/dist/chunk-JGY65SHX.mjs +1 -0
- package/dist/chunk-NI54X543.mjs +1 -0
- package/dist/{chunk-5F2IAUWJ.js → chunk-O4ATGGVK.js} +1 -1
- package/dist/chunk-P5MPUC5F.js +1 -0
- package/dist/{chunk-BGV2AKT7.mjs → chunk-PSPYIRIF.mjs} +1 -1
- package/dist/{chunk-HOAC5VUF.js → chunk-ROOUYQD4.js} +1 -1
- package/dist/{chunk-WMISQDSV.js → chunk-UJGNW6CH.js} +1 -1
- package/dist/chunk-UTXDZDYF.mjs +6 -0
- package/dist/chunk-W6VVLHRQ.mjs +1 -0
- package/dist/consent.d.mts +2 -0
- package/dist/consent.d.ts +2 -0
- package/dist/consent.js +1 -1
- package/dist/consent.mjs +1 -1
- package/dist/core.d.mts +13 -0
- package/dist/core.d.ts +13 -0
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/cross-border.d.mts +24 -0
- package/dist/cross-border.d.ts +24 -0
- package/dist/cross-border.js +1 -1
- package/dist/cross-border.mjs +1 -1
- package/dist/dsr.d.mts +3 -0
- package/dist/dsr.d.ts +3 -0
- package/dist/dsr.js +1 -1
- package/dist/dsr.mjs +1 -1
- package/dist/headless.d.mts +22 -1
- package/dist/headless.d.ts +22 -1
- package/dist/headless.js +1 -1
- package/dist/headless.mjs +1 -1
- package/dist/hooks.d.mts +22 -1
- package/dist/hooks.d.ts +22 -1
- package/dist/hooks.js +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/index.d.mts +215 -1
- package/dist/index.d.ts +215 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/lawful-basis.d.mts +21 -0
- package/dist/lawful-basis.d.ts +21 -0
- package/dist/lawful-basis.js +1 -1
- package/dist/lawful-basis.mjs +1 -1
- package/dist/presets.d.mts +93 -0
- package/dist/presets.d.ts +93 -0
- package/dist/presets.js +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/ropa-lite.d.mts +13 -1
- package/dist/ropa-lite.d.ts +13 -1
- package/dist/ropa-lite.js +1 -1
- package/dist/ropa-lite.mjs +1 -1
- package/dist/ropa.d.mts +43 -1
- package/dist/ropa.d.ts +43 -1
- package/dist/ropa.js +1 -1
- package/dist/ropa.mjs +1 -1
- package/dist/server.d.mts +135 -0
- package/dist/server.d.ts +135 -0
- package/dist/server.js +1 -1
- package/dist/server.mjs +1 -1
- package/dist/styles.css +18 -16
- package/package.json +1 -1
- package/dist/chunk-42JPSNVV.mjs +0 -6
- package/dist/chunk-7FXNGGMO.js +0 -1
- package/dist/chunk-B46SJB5V.js +0 -1
- package/dist/chunk-BL5W472Q.js +0 -1
- package/dist/chunk-O2WEABB3.js +0 -1
- package/dist/chunk-OZHUINWS.js +0 -1
- package/dist/chunk-PJNKQPQP.mjs +0 -1
- package/dist/chunk-RBKFNCGO.mjs +0 -1
- package/dist/chunk-VPNK7OID.mjs +0 -1
- package/dist/chunk-WKUC65HL.mjs +0 -1
- package/dist/chunk-XYGGUGTO.js +0 -6
- package/dist/chunk-Z2M5VJX2.mjs +0 -1
package/dist/ropa-lite.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';var chunk4CVBQC66_js=require('./chunk-4CVBQC66.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkYDKWD6MQ_js=require('./chunk-YDKWD6MQ.js');require('./chunk-TTMGFC6C.js'),require('./chunk-RFPLZDIO.js');var react=require('react'),jsxRuntime=require('react/jsx-runtime');var
|
|
2
|
+
'use strict';var chunk4CVBQC66_js=require('./chunk-4CVBQC66.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkYDKWD6MQ_js=require('./chunk-YDKWD6MQ.js');require('./chunk-TTMGFC6C.js'),require('./chunk-RFPLZDIO.js');var react=require('react'),jsxRuntime=require('react/jsx-runtime');var D={consent:"Consent",contract:"Contract",legal_obligation:"Legal Obligation",vital_interests:"Vital Interests",public_interest:"Public Interest",legitimate_interests:"Legitimate Interests"},G=["consent","contract","legal_obligation","vital_interests","public_interest","legitimate_interests"],I={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"},E={active:"Active",inactive:"Inactive",archived:"Archived"};function $(n){return n?new Date(n).toLocaleDateString():"N/A"}function T(n){return !!n.nextReviewDate&&n.nextReviewDate<=Date.now()}var F=({records:n,ropa:p,title:_,description:x,className:O="",classNames:t,unstyled:d,showSummary:S=true,showComplianceGaps:k=true,onRecordClick:c})=>{var w,P;let A=chunkYDKWD6MQ_js.c(),B=(w=_!=null?_:A.ropa.title)!=null?w:"Record of Processing Activities (ROPA)",N=(P=x!=null?x:A.ropa.description)!=null?P:"Maintain a comprehensive record of all data processing activities as required by the NDPA accountability principle.",h=react.useRef(false);react.useEffect(()=>{process.env.NODE_ENV==="production"||h.current||n!==void 0&&p===void 0&&(h.current=true,console.warn("[ndpr-toolkit/ropa] ROPAManagerLite `records` is deprecated; pass the full `ropa` object instead. Will be removed in 5.0."));},[n,p]);let b=react.useMemo(()=>p?p.records:n!=null?n:[],[p,n]),f=react.useMemo(()=>p!=null?p:{id:"lite",organizationName:"",organizationContact:"",organizationAddress:"",records:b,lastUpdated:0,version:"0"},[p,b]),s=react.useMemo(()=>chunk4CVBQC66_js.b(f),[f]),u=react.useMemo(()=>chunk4CVBQC66_js.d(f),[f]);return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${O}`,t==null?void 0:t.root,d),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("",t==null?void 0:t.header,d),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",t==null?void 0:t.title,d),children:B}),jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:N})]}),S&&jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("mb-6",t==null?void 0:t.summary,d),children:[jsxRuntime.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4",children:[["p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md text-center","ndpr-text-info","Total Records",s.totalRecords,false],["p-4 bg-green-50 dark:bg-green-900/20 rounded-md text-center","ndpr-text-success","Active",s.activeRecords,false],["p-4 bg-purple-50 dark:bg-purple-900/20 rounded-md text-center","ndpr-text-info","Cross-Border",s.crossBorderRecords,false],["p-4 bg-orange-50 dark:bg-orange-900/20 rounded-md text-center","ndpr-text-warning","Records with Gaps",u.length,true]].map(([r,o,l,g,m])=>jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(r,t==null?void 0:t.summaryCard,d),children:[jsxRuntime.jsx("p",{className:m?chunkAME4HJR4_js.a(`ndpr-stat__value ${o}`,t==null?void 0:t.complianceScore,d):`ndpr-stat__value ${o}`,children:g}),jsxRuntime.jsx("p",{className:`text-xs ${o}`,children:l})]},l))}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 mb-4",children:[jsxRuntime.jsxs("div",{className:"ndpr-panel",children:[jsxRuntime.jsx("p",{className:"ndpr-form-field__label",children:"By Lawful Basis"}),G.map(r=>jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"ndpr-card__subtitle",children:D[r]}),jsxRuntime.jsx("span",{className:"font-medium",children:s.byLawfulBasis[r]||0})]},r))]}),jsxRuntime.jsxs("div",{className:"ndpr-panel",children:[jsxRuntime.jsx("p",{className:"ndpr-form-field__label",children:"Risk Indicators"}),[["Sensitive Data",s.sensitiveDataRecords,false],["DPIA Required",s.dpiaRequiredRecords,false],["Automated Decisions",s.automatedDecisionRecords,false],["Due for Review",s.recordsDueForReview.length,s.recordsDueForReview.length>0]].map(([r,o,l])=>jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"ndpr-card__subtitle",children:r}),jsxRuntime.jsx("span",{className:`font-medium ${l?"ndpr-text-destructive":""}`,children:o})]},r))]}),s.topDepartments.length>0&&jsxRuntime.jsxs("div",{className:"ndpr-panel",children:[jsxRuntime.jsx("p",{className:"ndpr-form-field__label",children:"Top Departments"}),s.topDepartments.slice(0,5).map(r=>jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"ndpr-card__subtitle",children:r.department}),jsxRuntime.jsx("span",{className:"font-medium",children:r.count})]},r.department))]})]})]}),k&&u.length>0&&jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("p-3 bg-red-50 dark:bg-red-900/20 rounded-md mb-6",t==null?void 0:t.gapAlert,d),role:"status","aria-live":"polite",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-2",children:"Compliance Gaps Detected"}),u.slice(0,5).map(r=>jsxRuntime.jsxs("div",{className:"mb-2",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium ndpr-text-destructive",children:r.recordName}),jsxRuntime.jsx("ul",{className:"list-disc list-inside",children:r.gaps.map((o,l)=>jsxRuntime.jsx("li",{className:"text-xs ndpr-text-destructive",children:o},l))})]},r.recordId)),u.length>5&&jsxRuntime.jsxs("p",{className:"text-xs ndpr-text-destructive mt-1",children:["...and ",u.length-5," more record(s) with gaps."]})]}),b.length===0?jsxRuntime.jsx("p",{className:"ndpr-empty-state",children:"No processing records found."}):jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:chunkAME4HJR4_js.a("w-full text-sm text-left",t==null?void 0:t.table,d),children:[jsxRuntime.jsx("thead",{className:chunkAME4HJR4_js.a("ndpr-table__head",t==null?void 0:t.tableHeader,d),children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Name"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Lawful Basis"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Data Categories"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Retention"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Status"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Last Reviewed"})]})}),jsxRuntime.jsx("tbody",{children:b.map(r=>{let o=T(r),l=u.some(m=>m.recordId===r.id),g=!!c;return jsxRuntime.jsxs("tr",{onClick:g?()=>c==null?void 0:c(r):void 0,role:g?"button":void 0,tabIndex:g?0:void 0,onKeyDown:g?m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),c==null||c(r));}:void 0,className:chunkAME4HJR4_js.a(`border-b dark:border-gray-600 ${o?"bg-red-50 dark:bg-red-900/10":l?"bg-yellow-50 dark:bg-yellow-900/10":"bg-white dark:bg-gray-800"} ${g?"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700":""}`,t==null?void 0:t.tableRow,d),children:[jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"font-medium",children:r.name}),r.department&&jsxRuntime.jsx("p",{className:"ndpr-form-field__hint",children:r.department}),o&&jsxRuntime.jsx("span",{className:"text-xs ndpr-text-destructive font-medium",children:"Review Overdue"})]})}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:jsxRuntime.jsx("span",{className:"ndpr-badge ndpr-badge--info",children:D[r.lawfulBasis]})}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:jsxRuntime.jsx("p",{className:"text-xs ndpr-text-muted max-w-xs truncate",children:r.dataCategories.join(", ")})}),jsxRuntime.jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:r.retentionPeriod||"N/A"}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.a(`px-2 py-1 rounded text-xs font-medium ${I[r.status]}`,t==null?void 0:t.statusBadge,d),children:E[r.status]})}),jsxRuntime.jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:$(r.lastReviewedAt)})]},r.id)})})]})})]})};Object.defineProperty(exports,"generateROPASummary",{enumerable:true,get:function(){return chunk4CVBQC66_js.b}});Object.defineProperty(exports,"identifyComplianceGaps",{enumerable:true,get:function(){return chunk4CVBQC66_js.d}});exports.ROPAManagerLite=F;
|
package/dist/ropa-lite.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {b,d}from'./chunk-XP5PL6K7.mjs';export{b as generateROPASummary,d as identifyComplianceGaps}from'./chunk-XP5PL6K7.mjs';import {a}from'./chunk-SFGW37LE.mjs';import {c}from'./chunk-FRQFU44F.mjs';import'./chunk-V5TZJJWU.mjs';import'./chunk-ZJYULEER.mjs';import {useMemo}from'react';import {jsxs,jsx}from'react/jsx-runtime';var
|
|
2
|
+
import {b,d}from'./chunk-XP5PL6K7.mjs';export{b as generateROPASummary,d as identifyComplianceGaps}from'./chunk-XP5PL6K7.mjs';import {a}from'./chunk-SFGW37LE.mjs';import {c}from'./chunk-FRQFU44F.mjs';import'./chunk-V5TZJJWU.mjs';import'./chunk-ZJYULEER.mjs';import {useRef,useEffect,useMemo}from'react';import {jsxs,jsx}from'react/jsx-runtime';var D={consent:"Consent",contract:"Contract",legal_obligation:"Legal Obligation",vital_interests:"Vital Interests",public_interest:"Public Interest",legitimate_interests:"Legitimate Interests"},G=["consent","contract","legal_obligation","vital_interests","public_interest","legitimate_interests"],I={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"},E={active:"Active",inactive:"Inactive",archived:"Archived"};function $(n){return n?new Date(n).toLocaleDateString():"N/A"}function T(n){return !!n.nextReviewDate&&n.nextReviewDate<=Date.now()}var F=({records:n,ropa:p,title:_,description:x,className:O="",classNames:t,unstyled:d$1,showSummary:S=true,showComplianceGaps:k=true,onRecordClick:c$1})=>{var w,P;let A=c(),B=(w=_!=null?_:A.ropa.title)!=null?w:"Record of Processing Activities (ROPA)",N=(P=x!=null?x:A.ropa.description)!=null?P:"Maintain a comprehensive record of all data processing activities as required by the NDPA accountability principle.",h=useRef(false);useEffect(()=>{process.env.NODE_ENV==="production"||h.current||n!==void 0&&p===void 0&&(h.current=true,console.warn("[ndpr-toolkit/ropa] ROPAManagerLite `records` is deprecated; pass the full `ropa` object instead. Will be removed in 5.0."));},[n,p]);let b$1=useMemo(()=>p?p.records:n!=null?n:[],[p,n]),f=useMemo(()=>p!=null?p:{id:"lite",organizationName:"",organizationContact:"",organizationAddress:"",records:b$1,lastUpdated:0,version:"0"},[p,b$1]),s=useMemo(()=>b(f),[f]),u=useMemo(()=>d(f),[f]);return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${O}`,t==null?void 0:t.root,d$1),children:[jsxs("div",{className:a("",t==null?void 0:t.header,d$1),children:[jsx("h2",{className:a("ndpr-section-heading",t==null?void 0:t.title,d$1),children:B}),jsx("p",{className:"ndpr-card__subtitle",children:N})]}),S&&jsxs("div",{className:a("mb-6",t==null?void 0:t.summary,d$1),children:[jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4",children:[["p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md text-center","ndpr-text-info","Total Records",s.totalRecords,false],["p-4 bg-green-50 dark:bg-green-900/20 rounded-md text-center","ndpr-text-success","Active",s.activeRecords,false],["p-4 bg-purple-50 dark:bg-purple-900/20 rounded-md text-center","ndpr-text-info","Cross-Border",s.crossBorderRecords,false],["p-4 bg-orange-50 dark:bg-orange-900/20 rounded-md text-center","ndpr-text-warning","Records with Gaps",u.length,true]].map(([r,o,l,g,m])=>jsxs("div",{className:a(r,t==null?void 0:t.summaryCard,d$1),children:[jsx("p",{className:m?a(`ndpr-stat__value ${o}`,t==null?void 0:t.complianceScore,d$1):`ndpr-stat__value ${o}`,children:g}),jsx("p",{className:`text-xs ${o}`,children:l})]},l))}),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"}),G.map(r=>jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:D[r]}),jsx("span",{className:"font-medium",children:s.byLawfulBasis[r]||0})]},r))]}),jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"Risk Indicators"}),[["Sensitive Data",s.sensitiveDataRecords,false],["DPIA Required",s.dpiaRequiredRecords,false],["Automated Decisions",s.automatedDecisionRecords,false],["Due for Review",s.recordsDueForReview.length,s.recordsDueForReview.length>0]].map(([r,o,l])=>jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:r}),jsx("span",{className:`font-medium ${l?"ndpr-text-destructive":""}`,children:o})]},r))]}),s.topDepartments.length>0&&jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"Top Departments"}),s.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))]})]})]}),k&&u.length>0&&jsxs("div",{className:a("p-3 bg-red-50 dark:bg-red-900/20 rounded-md mb-6",t==null?void 0:t.gapAlert,d$1),role:"status","aria-live":"polite",children:[jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-2",children:"Compliance Gaps Detected"}),u.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((o,l)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:o},l))})]},r.recordId)),u.length>5&&jsxs("p",{className:"text-xs ndpr-text-destructive mt-1",children:["...and ",u.length-5," more record(s) with gaps."]})]}),b$1.length===0?jsx("p",{className:"ndpr-empty-state",children:"No processing records found."}):jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:a("w-full text-sm text-left",t==null?void 0:t.table,d$1),children:[jsx("thead",{className:a("ndpr-table__head",t==null?void 0:t.tableHeader,d$1),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:"Retention"}),jsx("th",{className:"ndpr-table__cell",children:"Status"}),jsx("th",{className:"ndpr-table__cell",children:"Last Reviewed"})]})}),jsx("tbody",{children:b$1.map(r=>{let o=T(r),l=u.some(m=>m.recordId===r.id),g=!!c$1;return jsxs("tr",{onClick:g?()=>c$1==null?void 0:c$1(r):void 0,role:g?"button":void 0,tabIndex:g?0:void 0,onKeyDown:g?m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),c$1==null||c$1(r));}:void 0,className:a(`border-b dark:border-gray-600 ${o?"bg-red-50 dark:bg-red-900/10":l?"bg-yellow-50 dark:bg-yellow-900/10":"bg-white dark:bg-gray-800"} ${g?"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700":""}`,t==null?void 0:t.tableRow,d$1),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}),o&&jsx("span",{className:"text-xs ndpr-text-destructive font-medium",children:"Review Overdue"})]})}),jsx("td",{className:"ndpr-table__cell",children:jsx("span",{className:"ndpr-badge ndpr-badge--info",children:D[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 ndpr-table__cell--muted",children:r.retentionPeriod||"N/A"}),jsx("td",{className:"ndpr-table__cell",children:jsx("span",{className:a(`px-2 py-1 rounded text-xs font-medium ${I[r.status]}`,t==null?void 0:t.statusBadge,d$1),children:E[r.status]})}),jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:$(r.lastReviewedAt)})]},r.id)})})]})})]})};export{F as ROPAManagerLite};
|
package/dist/ropa.d.mts
CHANGED
|
@@ -212,16 +212,37 @@ declare interface ROPAManagerProps {
|
|
|
212
212
|
ropa: RecordOfProcessingActivities;
|
|
213
213
|
/**
|
|
214
214
|
* Callback when a new record is added
|
|
215
|
+
* @deprecated Renamed to `onAdd` in 4.1. The legacy name still fires
|
|
216
|
+
* for backward compatibility and will be removed in 5.0.
|
|
215
217
|
*/
|
|
216
218
|
onAddRecord?: (record: ProcessingRecord) => void;
|
|
217
219
|
/**
|
|
218
220
|
* Callback when a record is updated
|
|
221
|
+
* @deprecated Renamed to `onUpdate` in 4.1. The legacy name still fires
|
|
222
|
+
* for backward compatibility and will be removed in 5.0.
|
|
219
223
|
*/
|
|
220
224
|
onUpdateRecord?: (id: string, updates: Partial<ProcessingRecord>) => void;
|
|
221
225
|
/**
|
|
222
226
|
* Callback when a record is archived
|
|
227
|
+
* @deprecated Renamed to `onArchive` in 4.1. The legacy name still fires
|
|
228
|
+
* for backward compatibility and will be removed in 5.0.
|
|
223
229
|
*/
|
|
224
230
|
onArchiveRecord?: (id: string) => void;
|
|
231
|
+
/**
|
|
232
|
+
* Callback when a new record is added (uniform 4.1+ name).
|
|
233
|
+
* Takes precedence over `onAddRecord` when both are provided.
|
|
234
|
+
*/
|
|
235
|
+
onAdd?: (record: ProcessingRecord) => void;
|
|
236
|
+
/**
|
|
237
|
+
* Callback when a record is updated (uniform 4.1+ name).
|
|
238
|
+
* Takes precedence over `onUpdateRecord` when both are provided.
|
|
239
|
+
*/
|
|
240
|
+
onUpdate?: (id: string, updates: Partial<ProcessingRecord>) => void;
|
|
241
|
+
/**
|
|
242
|
+
* Callback when a record is archived (uniform 4.1+ name).
|
|
243
|
+
* Takes precedence over `onArchiveRecord` when both are provided.
|
|
244
|
+
*/
|
|
245
|
+
onArchive?: (id: string) => void;
|
|
225
246
|
/**
|
|
226
247
|
* Title displayed on the manager
|
|
227
248
|
* @default "Record of Processing Activities (ROPA)"
|
|
@@ -331,7 +352,7 @@ export declare interface StorageAdapter<T = unknown> {
|
|
|
331
352
|
* }
|
|
332
353
|
* ```
|
|
333
354
|
*/
|
|
334
|
-
export declare function useROPA({ initialData, adapter, onRecordAdd, onRecordUpdate, onRecordArchive, }: UseROPAOptions): UseROPAReturn;
|
|
355
|
+
export declare function useROPA({ initialData, adapter, onRecordAdd, onRecordUpdate, onRecordArchive, onAdd, onUpdate, onArchive, }: UseROPAOptions): UseROPAReturn;
|
|
335
356
|
|
|
336
357
|
export declare function useROPACompound(): ROPAContextValue;
|
|
337
358
|
|
|
@@ -348,16 +369,37 @@ export declare interface UseROPAOptions {
|
|
|
348
369
|
adapter?: StorageAdapter<RecordOfProcessingActivities>;
|
|
349
370
|
/**
|
|
350
371
|
* Callback when a record is added
|
|
372
|
+
* @deprecated Renamed to `onAdd` in 4.1. The legacy name still fires
|
|
373
|
+
* for backward compatibility and will be removed in 5.0.
|
|
351
374
|
*/
|
|
352
375
|
onRecordAdd?: (record: ProcessingRecord) => void;
|
|
353
376
|
/**
|
|
354
377
|
* Callback when a record is updated
|
|
378
|
+
* @deprecated Renamed to `onUpdate` in 4.1. The legacy name still fires
|
|
379
|
+
* for backward compatibility and will be removed in 5.0.
|
|
355
380
|
*/
|
|
356
381
|
onRecordUpdate?: (id: string, updates: Partial<ProcessingRecord>) => void;
|
|
357
382
|
/**
|
|
358
383
|
* Callback when a record is archived
|
|
384
|
+
* @deprecated Renamed to `onArchive` in 4.1. The legacy name still fires
|
|
385
|
+
* for backward compatibility and will be removed in 5.0.
|
|
359
386
|
*/
|
|
360
387
|
onRecordArchive?: (id: string) => void;
|
|
388
|
+
/**
|
|
389
|
+
* Callback when a record is added (uniform 4.1+ name).
|
|
390
|
+
* Takes precedence over `onRecordAdd` when both are provided.
|
|
391
|
+
*/
|
|
392
|
+
onAdd?: (record: ProcessingRecord) => void;
|
|
393
|
+
/**
|
|
394
|
+
* Callback when a record is updated (uniform 4.1+ name).
|
|
395
|
+
* Takes precedence over `onRecordUpdate` when both are provided.
|
|
396
|
+
*/
|
|
397
|
+
onUpdate?: (id: string, updates: Partial<ProcessingRecord>) => void;
|
|
398
|
+
/**
|
|
399
|
+
* Callback when a record is archived (uniform 4.1+ name).
|
|
400
|
+
* Takes precedence over `onRecordArchive` when both are provided.
|
|
401
|
+
*/
|
|
402
|
+
onArchive?: (id: string) => void;
|
|
361
403
|
}
|
|
362
404
|
|
|
363
405
|
export declare interface UseROPAReturn {
|
package/dist/ropa.d.ts
CHANGED
|
@@ -212,16 +212,37 @@ declare interface ROPAManagerProps {
|
|
|
212
212
|
ropa: RecordOfProcessingActivities;
|
|
213
213
|
/**
|
|
214
214
|
* Callback when a new record is added
|
|
215
|
+
* @deprecated Renamed to `onAdd` in 4.1. The legacy name still fires
|
|
216
|
+
* for backward compatibility and will be removed in 5.0.
|
|
215
217
|
*/
|
|
216
218
|
onAddRecord?: (record: ProcessingRecord) => void;
|
|
217
219
|
/**
|
|
218
220
|
* Callback when a record is updated
|
|
221
|
+
* @deprecated Renamed to `onUpdate` in 4.1. The legacy name still fires
|
|
222
|
+
* for backward compatibility and will be removed in 5.0.
|
|
219
223
|
*/
|
|
220
224
|
onUpdateRecord?: (id: string, updates: Partial<ProcessingRecord>) => void;
|
|
221
225
|
/**
|
|
222
226
|
* Callback when a record is archived
|
|
227
|
+
* @deprecated Renamed to `onArchive` in 4.1. The legacy name still fires
|
|
228
|
+
* for backward compatibility and will be removed in 5.0.
|
|
223
229
|
*/
|
|
224
230
|
onArchiveRecord?: (id: string) => void;
|
|
231
|
+
/**
|
|
232
|
+
* Callback when a new record is added (uniform 4.1+ name).
|
|
233
|
+
* Takes precedence over `onAddRecord` when both are provided.
|
|
234
|
+
*/
|
|
235
|
+
onAdd?: (record: ProcessingRecord) => void;
|
|
236
|
+
/**
|
|
237
|
+
* Callback when a record is updated (uniform 4.1+ name).
|
|
238
|
+
* Takes precedence over `onUpdateRecord` when both are provided.
|
|
239
|
+
*/
|
|
240
|
+
onUpdate?: (id: string, updates: Partial<ProcessingRecord>) => void;
|
|
241
|
+
/**
|
|
242
|
+
* Callback when a record is archived (uniform 4.1+ name).
|
|
243
|
+
* Takes precedence over `onArchiveRecord` when both are provided.
|
|
244
|
+
*/
|
|
245
|
+
onArchive?: (id: string) => void;
|
|
225
246
|
/**
|
|
226
247
|
* Title displayed on the manager
|
|
227
248
|
* @default "Record of Processing Activities (ROPA)"
|
|
@@ -331,7 +352,7 @@ export declare interface StorageAdapter<T = unknown> {
|
|
|
331
352
|
* }
|
|
332
353
|
* ```
|
|
333
354
|
*/
|
|
334
|
-
export declare function useROPA({ initialData, adapter, onRecordAdd, onRecordUpdate, onRecordArchive, }: UseROPAOptions): UseROPAReturn;
|
|
355
|
+
export declare function useROPA({ initialData, adapter, onRecordAdd, onRecordUpdate, onRecordArchive, onAdd, onUpdate, onArchive, }: UseROPAOptions): UseROPAReturn;
|
|
335
356
|
|
|
336
357
|
export declare function useROPACompound(): ROPAContextValue;
|
|
337
358
|
|
|
@@ -348,16 +369,37 @@ export declare interface UseROPAOptions {
|
|
|
348
369
|
adapter?: StorageAdapter<RecordOfProcessingActivities>;
|
|
349
370
|
/**
|
|
350
371
|
* Callback when a record is added
|
|
372
|
+
* @deprecated Renamed to `onAdd` in 4.1. The legacy name still fires
|
|
373
|
+
* for backward compatibility and will be removed in 5.0.
|
|
351
374
|
*/
|
|
352
375
|
onRecordAdd?: (record: ProcessingRecord) => void;
|
|
353
376
|
/**
|
|
354
377
|
* Callback when a record is updated
|
|
378
|
+
* @deprecated Renamed to `onUpdate` in 4.1. The legacy name still fires
|
|
379
|
+
* for backward compatibility and will be removed in 5.0.
|
|
355
380
|
*/
|
|
356
381
|
onRecordUpdate?: (id: string, updates: Partial<ProcessingRecord>) => void;
|
|
357
382
|
/**
|
|
358
383
|
* Callback when a record is archived
|
|
384
|
+
* @deprecated Renamed to `onArchive` in 4.1. The legacy name still fires
|
|
385
|
+
* for backward compatibility and will be removed in 5.0.
|
|
359
386
|
*/
|
|
360
387
|
onRecordArchive?: (id: string) => void;
|
|
388
|
+
/**
|
|
389
|
+
* Callback when a record is added (uniform 4.1+ name).
|
|
390
|
+
* Takes precedence over `onRecordAdd` when both are provided.
|
|
391
|
+
*/
|
|
392
|
+
onAdd?: (record: ProcessingRecord) => void;
|
|
393
|
+
/**
|
|
394
|
+
* Callback when a record is updated (uniform 4.1+ name).
|
|
395
|
+
* Takes precedence over `onRecordUpdate` when both are provided.
|
|
396
|
+
*/
|
|
397
|
+
onUpdate?: (id: string, updates: Partial<ProcessingRecord>) => void;
|
|
398
|
+
/**
|
|
399
|
+
* Callback when a record is archived (uniform 4.1+ name).
|
|
400
|
+
* Takes precedence over `onRecordArchive` when both are provided.
|
|
401
|
+
*/
|
|
402
|
+
onArchive?: (id: string) => void;
|
|
361
403
|
}
|
|
362
404
|
|
|
363
405
|
export declare interface UseROPAReturn {
|
package/dist/ropa.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';var
|
|
2
|
+
'use strict';var chunkHLFS3NXG_js=require('./chunk-HLFS3NXG.js'),chunkP5MPUC5F_js=require('./chunk-P5MPUC5F.js'),chunk4CVBQC66_js=require('./chunk-4CVBQC66.js');require('./chunk-AME4HJR4.js'),require('./chunk-YDKWD6MQ.js'),require('./chunk-TTMGFC6C.js'),require('./chunk-RFPLZDIO.js');var react=require('react'),jsxRuntime=require('react/jsx-runtime');var t=react.createContext(null);function u(){let r=react.useContext(t);if(!r)throw new Error("ROPA compound components must be wrapped in <ROPA.Provider>. Example: <ROPA.Provider initialData={...}><ROPA.Manager /></ROPA.Provider>");return r}var p=({initialData:r,adapter:i,onRecordAdd:P,onRecordUpdate:n,onRecordArchive:a,children:s})=>{let R=chunkP5MPUC5F_js.a({initialData:r,adapter:i,onRecordAdd:P,onRecordUpdate:n,onRecordArchive:a});return jsxRuntime.jsx(t.Provider,{value:R,children:s})};var v={Provider:p,Manager:chunkHLFS3NXG_js.a};Object.defineProperty(exports,"ROPAManager",{enumerable:true,get:function(){return chunkHLFS3NXG_js.a}});Object.defineProperty(exports,"useROPA",{enumerable:true,get:function(){return chunkP5MPUC5F_js.a}});Object.defineProperty(exports,"exportROPAToCSV",{enumerable:true,get:function(){return chunk4CVBQC66_js.c}});Object.defineProperty(exports,"generateROPASummary",{enumerable:true,get:function(){return chunk4CVBQC66_js.b}});Object.defineProperty(exports,"identifyComplianceGaps",{enumerable:true,get:function(){return chunk4CVBQC66_js.d}});Object.defineProperty(exports,"validateProcessingRecord",{enumerable:true,get:function(){return chunk4CVBQC66_js.a}});exports.ROPA=v;exports.ROPAProvider=p;exports.useROPACompound=u;
|
package/dist/ropa.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {a}from'./chunk-
|
|
2
|
+
import {a}from'./chunk-W6VVLHRQ.mjs';export{a as ROPAManager}from'./chunk-W6VVLHRQ.mjs';import {a as a$1}from'./chunk-JGY65SHX.mjs';export{a as useROPA}from'./chunk-JGY65SHX.mjs';export{c as exportROPAToCSV,b as generateROPASummary,d as identifyComplianceGaps,a as validateProcessingRecord}from'./chunk-XP5PL6K7.mjs';import'./chunk-SFGW37LE.mjs';import'./chunk-FRQFU44F.mjs';import'./chunk-V5TZJJWU.mjs';import'./chunk-ZJYULEER.mjs';import {createContext,useContext}from'react';import {jsx}from'react/jsx-runtime';var t=createContext(null);function u(){let r=useContext(t);if(!r)throw new Error("ROPA compound components must be wrapped in <ROPA.Provider>. Example: <ROPA.Provider initialData={...}><ROPA.Manager /></ROPA.Provider>");return r}var p=({initialData:r,adapter:i,onRecordAdd:P,onRecordUpdate:n,onRecordArchive:a,children:s})=>{let R=a$1({initialData:r,adapter:i,onRecordAdd:P,onRecordUpdate:n,onRecordArchive:a});return jsx(t.Provider,{value:R,children:s})};var v={Provider:p,Manager:a};export{v as ROPA,p as ROPAProvider,u as useROPACompound};
|
package/dist/server.d.mts
CHANGED
|
@@ -152,6 +152,10 @@ declare interface ApiAdapterSuccessContext<T = unknown> {
|
|
|
152
152
|
*/
|
|
153
153
|
export declare function appendAuditEntry(entry: ConsentAuditEntry, storageKey?: string): void;
|
|
154
154
|
|
|
155
|
+
export declare const arabicLocale: Required<{
|
|
156
|
+
[K in keyof NDPRLocale]: Required<NonNullable<NDPRLocale[K]>>;
|
|
157
|
+
}>;
|
|
158
|
+
|
|
155
159
|
/**
|
|
156
160
|
* Assemble an ordered, NDPA-aligned array of privacy-policy sections from
|
|
157
161
|
* a {@link TemplateContext}. This is the canonical "compute the policy"
|
|
@@ -1199,6 +1203,7 @@ export declare function findUnfilledTokens(rendered: string): string[];
|
|
|
1199
1203
|
* Formats a DSR request for display or submission
|
|
1200
1204
|
* @param request The DSR request to format
|
|
1201
1205
|
* @returns Formatted request data
|
|
1206
|
+
* @deprecated Use `formatDSRRequestStructured()` for typed `{ field, code, message }[]` errors. The legacy string-returning shape will be removed in 5.0.
|
|
1202
1207
|
*/
|
|
1203
1208
|
export declare function formatDSRRequest(request: DSRRequest): {
|
|
1204
1209
|
formattedRequest: Record<string, unknown>;
|
|
@@ -1206,6 +1211,35 @@ export declare function formatDSRRequest(request: DSRRequest): {
|
|
|
1206
1211
|
validationErrors: string[];
|
|
1207
1212
|
};
|
|
1208
1213
|
|
|
1214
|
+
/**
|
|
1215
|
+
* Structured-result variant of {@link formatDSRRequest}. Same formatting
|
|
1216
|
+
* output, but `validationErrors` is replaced with a typed `errors` array
|
|
1217
|
+
* of `{ field, code, message }`.
|
|
1218
|
+
*
|
|
1219
|
+
* Codes emitted:
|
|
1220
|
+
* - `request_id_required`
|
|
1221
|
+
* - `request_type_required`
|
|
1222
|
+
* - `request_status_required`
|
|
1223
|
+
* - `created_at_required`
|
|
1224
|
+
* - `subject_name_required`
|
|
1225
|
+
* - `subject_email_required`
|
|
1226
|
+
*/
|
|
1227
|
+
export declare function formatDSRRequestStructured(request: DSRRequest): FormatDSRRequestStructuredResult;
|
|
1228
|
+
|
|
1229
|
+
/** Result of {@link formatDSRRequestStructured}. */
|
|
1230
|
+
export declare interface FormatDSRRequestStructuredResult {
|
|
1231
|
+
valid: boolean;
|
|
1232
|
+
errors: StructuredValidationError[];
|
|
1233
|
+
/** Formatted request payload — always populated regardless of `valid`. */
|
|
1234
|
+
formattedRequest: Record<string, unknown>;
|
|
1235
|
+
/** Narrowed input — populated only on `valid: true`. */
|
|
1236
|
+
data?: DSRRequest;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
export declare const frenchLocale: Required<{
|
|
1240
|
+
[K in keyof NDPRLocale]: Required<NonNullable<NDPRLocale[K]>>;
|
|
1241
|
+
}>;
|
|
1242
|
+
|
|
1209
1243
|
/**
|
|
1210
1244
|
* Generates a summary of all lawful basis documentation across processing activities.
|
|
1211
1245
|
*
|
|
@@ -2302,6 +2336,30 @@ export declare interface StorageAdapter<T = unknown> {
|
|
|
2302
2336
|
remove(): void | Promise<void>;
|
|
2303
2337
|
}
|
|
2304
2338
|
|
|
2339
|
+
/**
|
|
2340
|
+
* Single structured validation error with a stable, locale-independent
|
|
2341
|
+
* `code` consumers can switch on programmatically.
|
|
2342
|
+
*/
|
|
2343
|
+
export declare interface StructuredValidationError {
|
|
2344
|
+
/** Dot-path of the offending field (e.g. `'timestamp'`, `'dataSubject.email'`, `'options[0].purpose'`). */
|
|
2345
|
+
field: string;
|
|
2346
|
+
/** Stable, snake_case error code — safe to switch on across locales. */
|
|
2347
|
+
code: string;
|
|
2348
|
+
/** Human-readable English message — informational only; do not regex-match. */
|
|
2349
|
+
message: string;
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
/**
|
|
2353
|
+
* Result of a structured validator. `errors` is an array (one entry per
|
|
2354
|
+
* failed rule). `data` is the narrowed, typed payload, only populated on
|
|
2355
|
+
* `valid: true`.
|
|
2356
|
+
*/
|
|
2357
|
+
export declare interface StructuredValidationResult<T> {
|
|
2358
|
+
valid: boolean;
|
|
2359
|
+
errors: StructuredValidationError[];
|
|
2360
|
+
data?: T;
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2305
2363
|
/** Full context used to generate an adaptive privacy policy. */
|
|
2306
2364
|
export declare interface TemplateContext {
|
|
2307
2365
|
/** Organisation details, extended with industry and size. */
|
|
@@ -2444,6 +2502,7 @@ export declare const UNFILLED_SUFFIX = "\u00BB";
|
|
|
2444
2502
|
* Validates consent settings to ensure they meet NDPA requirements
|
|
2445
2503
|
* @param settings The consent settings to validate
|
|
2446
2504
|
* @returns An object containing validation result and any error messages
|
|
2505
|
+
* @deprecated Use `validateConsentStructured()` for typed `{ field, code, message }[]` errors. The legacy string-returning shape will be removed in 5.0.
|
|
2447
2506
|
*/
|
|
2448
2507
|
export declare function validateConsent(settings: ConsentSettings): {
|
|
2449
2508
|
valid: boolean;
|
|
@@ -2456,12 +2515,50 @@ export declare function validateConsent(settings: ConsentSettings): {
|
|
|
2456
2515
|
* as consent must be specific and informed per the Nigeria Data Protection Act.
|
|
2457
2516
|
* @param options The consent options to validate
|
|
2458
2517
|
* @returns An object containing validation result and any error messages
|
|
2518
|
+
* @deprecated Use `validateConsentOptionsStructured()` for typed `{ field, code, message }[]` errors. The legacy string-returning shape will be removed in 5.0.
|
|
2459
2519
|
*/
|
|
2460
2520
|
export declare function validateConsentOptions(options: ConsentOption[]): {
|
|
2461
2521
|
valid: boolean;
|
|
2462
2522
|
errors: string[];
|
|
2463
2523
|
};
|
|
2464
2524
|
|
|
2525
|
+
/**
|
|
2526
|
+
* Structured-result variant of {@link validateConsentOptions}. Each option
|
|
2527
|
+
* is checked for a non-empty `purpose` (NDPA Section 26). Failing options
|
|
2528
|
+
* are reported with `field: 'options[i].purpose'` so consumers can map
|
|
2529
|
+
* errors back to the originating option index.
|
|
2530
|
+
*
|
|
2531
|
+
* Codes emitted:
|
|
2532
|
+
* - `options_required` — empty / missing options array
|
|
2533
|
+
* - `purpose_required` — single option missing a purpose
|
|
2534
|
+
*/
|
|
2535
|
+
export declare function validateConsentOptionsStructured(options: ConsentOption[]): StructuredValidationResult<ConsentOption[]>;
|
|
2536
|
+
|
|
2537
|
+
/**
|
|
2538
|
+
* Structured-result variant of {@link validateConsent}. Returns the same
|
|
2539
|
+
* checks as `{ field, code, message }[]` so consumers can switch on `code`
|
|
2540
|
+
* across locales without regex-matching English strings.
|
|
2541
|
+
*
|
|
2542
|
+
* Codes emitted:
|
|
2543
|
+
* - `consents_required`
|
|
2544
|
+
* - `timestamp_required`
|
|
2545
|
+
* - `timestamp_invalid`
|
|
2546
|
+
* - `version_required`
|
|
2547
|
+
* - `method_required`
|
|
2548
|
+
* - `has_interacted_required`
|
|
2549
|
+
* - `consent_stale`
|
|
2550
|
+
*
|
|
2551
|
+
* @example
|
|
2552
|
+
* ```ts
|
|
2553
|
+
* const { valid, errors, data } = validateConsentStructured(settings);
|
|
2554
|
+
* if (!valid) {
|
|
2555
|
+
* const stale = errors.find((e) => e.code === 'consent_stale');
|
|
2556
|
+
* if (stale) showRefreshBanner();
|
|
2557
|
+
* }
|
|
2558
|
+
* ```
|
|
2559
|
+
*/
|
|
2560
|
+
export declare function validateConsentStructured(settings: ConsentSettings): StructuredValidationResult<ConsentSettings>;
|
|
2561
|
+
|
|
2465
2562
|
/**
|
|
2466
2563
|
* Validate a raw DSR submission payload against the same rules
|
|
2467
2564
|
* `<DSRRequestForm />` enforces client-side. Designed to be called from a
|
|
@@ -2497,6 +2594,8 @@ export declare function validateConsentOptions(options: ConsentOption[]): {
|
|
|
2497
2594
|
* ```ts
|
|
2498
2595
|
* validateDsrSubmission(payload, { requireIdentityVerification: false });
|
|
2499
2596
|
* ```
|
|
2597
|
+
*
|
|
2598
|
+
* @deprecated Use `validateDsrSubmissionStructured()` for typed `{ field, code, message }[]` errors. The legacy string-returning shape will be removed in 5.0.
|
|
2500
2599
|
*/
|
|
2501
2600
|
export declare function validateDsrSubmission(payload: unknown, options?: ValidateDsrSubmissionOptions): DsrSubmissionValidationResult;
|
|
2502
2601
|
|
|
@@ -2517,6 +2616,42 @@ export declare interface ValidateDsrSubmissionOptions {
|
|
|
2517
2616
|
allowedRequestTypes?: string[];
|
|
2518
2617
|
}
|
|
2519
2618
|
|
|
2619
|
+
/**
|
|
2620
|
+
* Structured-result variant of {@link validateDsrSubmission}. Same rules,
|
|
2621
|
+
* but returns an array of `{ field, code, message }` so callers can switch
|
|
2622
|
+
* on `code` programmatically across locales.
|
|
2623
|
+
*
|
|
2624
|
+
* Codes emitted:
|
|
2625
|
+
* - `payload_not_object`
|
|
2626
|
+
* - `request_type_required`
|
|
2627
|
+
* - `request_type_not_allowed`
|
|
2628
|
+
* - `data_subject_required`
|
|
2629
|
+
* - `full_name_required`
|
|
2630
|
+
* - `email_required`
|
|
2631
|
+
* - `email_invalid_format`
|
|
2632
|
+
* - `phone_invalid_type`
|
|
2633
|
+
* - `identifier_type_required`
|
|
2634
|
+
* - `identifier_value_required`
|
|
2635
|
+
* - `submitted_at_invalid`
|
|
2636
|
+
* - `additional_info_invalid_type`
|
|
2637
|
+
* - `payload_final_narrowing_failed`
|
|
2638
|
+
*
|
|
2639
|
+
* @example **Next.js Route Handler**
|
|
2640
|
+
* ```ts
|
|
2641
|
+
* import { validateDsrSubmissionStructured } from '@tantainnovative/ndpr-toolkit/server';
|
|
2642
|
+
*
|
|
2643
|
+
* export async function POST(req: Request) {
|
|
2644
|
+
* const { valid, errors, data } = validateDsrSubmissionStructured(await req.json());
|
|
2645
|
+
* if (!valid) {
|
|
2646
|
+
* return Response.json({ errors }, { status: 422 });
|
|
2647
|
+
* }
|
|
2648
|
+
* await dsrStore.create(data);
|
|
2649
|
+
* return Response.json({ ok: true }, { status: 201 });
|
|
2650
|
+
* }
|
|
2651
|
+
* ```
|
|
2652
|
+
*/
|
|
2653
|
+
export declare function validateDsrSubmissionStructured(payload: unknown, options?: ValidateDsrSubmissionOptions): StructuredValidationResult<DsrSubmissionPayload>;
|
|
2654
|
+
|
|
2520
2655
|
/**
|
|
2521
2656
|
* Validates that all required fields are present on a processing activity
|
|
2522
2657
|
* and that the lawful basis is properly documented.
|