@tantainnovative/ndpr-toolkit 3.2.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters.js +1 -1
- package/dist/adapters.mjs +1 -1
- package/dist/breach.js +1 -1
- package/dist/breach.mjs +1 -1
- package/dist/chunk-256APOQM.js +2 -0
- package/dist/chunk-2FWCVWKN.js +2 -0
- package/dist/chunk-3DJGO6WG.js +2 -0
- package/dist/chunk-4XCL62MJ.mjs +2 -0
- package/dist/chunk-555WWZ3W.js +2 -0
- package/dist/chunk-6BXUVS6E.js +81 -0
- package/dist/{chunk-KHRBU5K7.js → chunk-6RQGQZT2.js} +2 -2
- package/dist/chunk-6TA2MVTU.mjs +2 -0
- package/dist/chunk-6WIP33TW.mjs +2 -0
- package/dist/{chunk-2ORDHJRD.js → chunk-7AVN424U.js} +2 -2
- package/dist/{chunk-5VMHKNJY.js → chunk-7SMLHZ4B.js} +2 -2
- package/dist/chunk-A4PK7JB2.js +2 -0
- package/dist/chunk-ABDB7LEV.mjs +2 -0
- package/dist/chunk-BKRETVJ6.js +2 -0
- package/dist/chunk-CWUPGY3M.mjs +3 -0
- package/dist/chunk-DJGS7SSN.mjs +2 -0
- package/dist/{chunk-SVCRYM4I.mjs → chunk-E4NCJ7RD.mjs} +2 -2
- package/dist/chunk-E63VPR7U.js +2 -0
- package/dist/{chunk-TKBZRULW.mjs → chunk-EH2I4L7M.mjs} +27 -27
- package/dist/chunk-ELKB2AFZ.js +2 -0
- package/dist/chunk-FDDI426Y.mjs +2 -0
- package/dist/chunk-FOXZRRMW.mjs +2 -0
- package/dist/chunk-GKKAK6ES.mjs +3 -0
- package/dist/chunk-GOD4LA2J.mjs +2 -0
- package/dist/{chunk-SWF3YVE5.js → chunk-GOU6FU6Y.js} +3 -3
- package/dist/chunk-HO5M7M4M.js +2 -0
- package/dist/{chunk-SKJCQKFL.mjs → chunk-I23WPZNQ.mjs} +3 -3
- package/dist/chunk-I4M2AA3N.js +2 -0
- package/dist/chunk-I54CDQGN.js +3 -0
- package/dist/{chunk-6D3ZUGBB.mjs → chunk-IR7VCBWV.mjs} +2 -2
- package/dist/{chunk-4VVARDN2.mjs → chunk-K45S6YQV.mjs} +2 -2
- package/dist/chunk-KBAFOVE3.js +2 -0
- package/dist/{chunk-P7BSBCB3.js → chunk-KBP26GLC.js} +2 -2
- package/dist/{chunk-DQLDX5X6.js → chunk-KVOGOLIR.js} +27 -27
- package/dist/chunk-MDWG2KDA.mjs +2 -0
- package/dist/{chunk-ZQSX5ZHB.mjs → chunk-NN233SGA.mjs} +3 -3
- package/dist/chunk-NRQELKAE.js +2 -0
- package/dist/chunk-NUDVUAD4.mjs +81 -0
- package/dist/chunk-NXQMU36Z.mjs +2 -0
- package/dist/chunk-P42Z5CFE.js +2 -0
- package/dist/chunk-PATONNTZ.mjs +2 -0
- package/dist/{chunk-WLSW4Z4W.mjs → chunk-PM7O5IGE.mjs} +2 -2
- package/dist/chunk-Q7VHB64E.mjs +2 -0
- package/dist/{chunk-PEH5GIMN.js → chunk-QH6YUVJS.js} +2 -2
- package/dist/{chunk-BGHQTZAC.js → chunk-QY7PD5XB.js} +4 -4
- package/dist/chunk-R3OYAJI6.mjs +2 -0
- package/dist/chunk-S4GRSNB4.js +2 -0
- package/dist/chunk-SAA7UVI2.js +3 -0
- package/dist/{chunk-PYEX7DFR.mjs → chunk-SHMJNRHO.mjs} +3 -3
- package/dist/chunk-U62QYKVG.mjs +2 -0
- package/dist/{chunk-JZKH5RMC.js → chunk-UDNRAQLE.js} +3 -3
- package/dist/{chunk-5RSOLEEP.js → chunk-UXMGBIX6.js} +4 -4
- package/dist/{chunk-UZ5EZOA7.js → chunk-VK27WVV3.js} +2 -2
- package/dist/{chunk-G26I6MP5.mjs → chunk-VWPGIES4.mjs} +2 -2
- package/dist/{chunk-NPLXE43Q.mjs → chunk-XQ4M5FHC.mjs} +2 -2
- package/dist/{chunk-CAB7O3GR.mjs → chunk-ZEOQYWOE.mjs} +4 -4
- package/dist/consent.js +1 -1
- package/dist/consent.mjs +1 -1
- package/dist/core.js +1 -1
- package/dist/core.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/hooks.js +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/lawful-basis.js +1 -1
- package/dist/lawful-basis.mjs +1 -1
- package/dist/policy.js +1 -1
- package/dist/policy.mjs +1 -1
- package/dist/presets.js +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/ropa.js +1 -1
- package/dist/ropa.mjs +1 -1
- package/package.json +3 -2
- package/dist/chunk-27NYSWUG.mjs +0 -2
- package/dist/chunk-2SYNHRP6.mjs +0 -2
- package/dist/chunk-2W7ARAW2.js +0 -2
- package/dist/chunk-3F34NACG.js +0 -2
- package/dist/chunk-3V23O4ZJ.js +0 -2
- package/dist/chunk-3XAUN5IM.mjs +0 -3
- package/dist/chunk-6E54NSAO.mjs +0 -2
- package/dist/chunk-7F5F5YWI.mjs +0 -2
- package/dist/chunk-CMZTI7SG.js +0 -2
- package/dist/chunk-EPF7J2FK.js +0 -3
- package/dist/chunk-FR7ZYZXB.js +0 -2
- package/dist/chunk-FXTZDKDC.mjs +0 -3
- package/dist/chunk-GIV2OHE6.mjs +0 -2
- package/dist/chunk-GPJVTGHR.mjs +0 -2
- package/dist/chunk-GVANK6PL.js +0 -3
- package/dist/chunk-HNZK7LY3.mjs +0 -2
- package/dist/chunk-IKEPXHCZ.js +0 -2
- package/dist/chunk-IQQW52EF.js +0 -2
- package/dist/chunk-ISSGO2YT.mjs +0 -72
- package/dist/chunk-LFNA6WYQ.mjs +0 -2
- package/dist/chunk-PGSA2O5P.mjs +0 -2
- package/dist/chunk-RGYK4VAY.mjs +0 -2
- package/dist/chunk-RSUDIFZV.mjs +0 -2
- package/dist/chunk-RYZEIDNR.js +0 -2
- package/dist/chunk-SBNAMPAP.mjs +0 -2
- package/dist/chunk-SSGJREE3.js +0 -2
- package/dist/chunk-U6VWHC46.js +0 -72
- package/dist/chunk-UK656RCG.js +0 -2
- package/dist/chunk-UOSEH6DC.js +0 -2
- package/dist/chunk-VDZKGCAF.js +0 -2
- package/dist/chunk-XSK4BSZJ.mjs +0 -2
- package/dist/chunk-Y34DQYS7.js +0 -2
- package/dist/chunk-YJCGEOLO.mjs +0 -2
- package/dist/chunk-ZCZ5RRZO.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function R(e,s){if(s){let{riskLevel:t,risksToRightsAndFreedoms:o,highRisksToRightsAndFreedoms:d}=s;return {severityLevel:t,notificationRequired:o,urgentNotificationRequired:d,timeframeHours:72,justification:s.justification||"Based on risk assessment results"}}let r={ongoing:e.status==="ongoing",sensitiveData:["health","financial","biometric","children","location","religious","political","ethnic"].some(t=>e.dataTypes.includes(t)),largeScale:(e.estimatedAffectedSubjects||0)>1e3,delayedDiscovery:e.occurredAt&&e.discoveredAt-e.occurredAt>10080*60*1e3},c=Object.values(r).filter(Boolean).length,i;c===0?i="low":c===1?i="medium":c===2?i="high":i="critical";let a=i!=="low",l=i==="high"||i==="critical",u=72,n=Object.entries(r).filter(([t,o])=>o).map(([t,o])=>t).join(", "),f=n?`${i.charAt(0).toUpperCase()+i.slice(1)} risk (factors: ${n})`:`${i.charAt(0).toUpperCase()+i.slice(1)} risk`;return {severityLevel:i,notificationRequired:a,urgentNotificationRequired:l,timeframeHours:u,justification:f}}export{R as a};//# sourceMappingURL=chunk-DJGS7SSN.mjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-DJGS7SSN.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {d,a as a$1}from'./chunk-TXBZPCGF.mjs';import {a as a$2}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {d,a as a$1}from'./chunk-TXBZPCGF.mjs';import {a as a$2}from'./chunk-6WIP33TW.mjs';import {b,a}from'./chunk-WWT2ZSNU.mjs';import {useRef,useState,useEffect,useCallback}from'react';function F(v,c){return c?a$2(v):{load:()=>null,save:()=>{},remove:()=>{}}}function z({initialActivities:v=[],adapter:c,storageKey:b$1="ndpr_lawful_basis_activities",useLocalStorage:R=true,onAdd:g,onUpdate:A,onRemove:y}={}){let p=c!=null?c:F(b$1,R),f=useRef(p);f.current=p;let[o,u]=useState(v),[x,l]=useState(true);useEffect(()=>{let t=false;try{let i=f.current.load();i instanceof Promise?i.then(e=>{t||(e&&u(e),l(!1));},()=>{t||l(!1);}):(i&&u(i),l(!1));}catch(i){t||l(false);}return ()=>{t=true;}},[]);let a$2=useCallback(t=>{Promise.resolve(f.current.save(t)).catch(i=>{console.warn("[ndpr-toolkit] Failed to save lawful basis activities:",i);});},[]),_=()=>"lb_"+Date.now()+"_"+Math.random().toString(36).substring(2,11),h=useCallback(t=>{let i=Date.now(),e=b(a({},t),{id:_(),createdAt:i,updatedAt:i});return u(s=>{let r=[...s,e];return a$2(r),r}),g&&g(e),e},[g,a$2]),O=useCallback((t,i)=>{let e=null;return u(s=>{let r=s.findIndex(k=>k.id===t);if(r===-1)return s;e=b(a(a({},s[r]),i),{id:s[r].id,updatedAt:Date.now()});let P=[...s];return P[r]=e,a$2(P),P}),e&&A&&A(e),e},[A,a$2]),D=useCallback(t=>{u(i=>{let e=i.filter(s=>s.id!==t);return a$2(e),e}),y&&y(t);},[y,a$2]),I=useCallback(t=>o.find(i=>i.id===t)||null,[o]),U=useCallback(()=>d(o),[o]),V=useCallback(t=>a$1(t),[]);return {activities:o,addActivity:h,updateActivity:O,removeActivity:D,getActivity:I,getSummary:U,validateActivity:V,isLoading:x}}export{z as a};//# sourceMappingURL=chunk-E4NCJ7RD.mjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-E4NCJ7RD.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkUXMGBIX6_js=require('./chunk-UXMGBIX6.js'),chunkELKB2AFZ_js=require('./chunk-ELKB2AFZ.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react');function j(d,a){return a?chunkELKB2AFZ_js.a(d):{load:()=>null,save:()=>{},remove:()=>{}}}function E({templates:d,initialPolicy:a,adapter:g,storageKey:I="ndpr_privacy_policy",useLocalStorage:h=true,onGenerate:v}){let f=g!=null?g:j(I,h),p=react.useRef(f);p.current=f;let[o,m]=react.useState(a||null),[l,P]=react.useState(null),[y,O]=react.useState({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),[D,b]=react.useState(true),S=react.useRef(d);S.current=d,react.useEffect(()=>{if(a){b(false);return}let e=false;try{let n=p.current.load(),t=i=>{if(i){if(m(i),i.templateId){let c=S.current.find(u=>u.id===i.templateId);c&&P(c);}i.organizationInfo&&O(i.organizationInfo);}b(!1);};n instanceof Promise?n.then(i=>{e||t(i);},()=>{e||b(!1);}):t(n);}catch(n){e||b(false);}return ()=>{e=true;}},[a]);let q=e=>{Promise.resolve(p.current.save(e)).catch(n=>{console.warn("[ndpr-toolkit] Failed to save policy:",n);});},N=e=>{let n=d.find(u=>u.id===e);if(!n)return false;P(n);let t=n.sections.map(u=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},u),{customContent:void 0})),i={};Object.keys(n.variables).forEach(u=>{i[u]=n.variables[u].defaultValue||"";});let c=Date.now();return m({id:"policy_"+c+"_"+Math.random().toString(36).substr(2,9),title:"",templateId:n.id,organizationInfo:y,sections:t,variableValues:i,effectiveDate:c,lastUpdated:c,version:"1.0"}),true},R=e=>{O(n=>chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},n),e));},U=(e,n)=>{l&&(o?m(t=>t&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},t),{sections:t.sections.map(i=>i.id===e?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{included:n}):i)})):P(t=>t&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},t),{sections:t.sections.map(i=>i.id===e?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{included:n}):i)})));},C=(e,n)=>{l&&(o?m(t=>t&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},t),{sections:t.sections.map(i=>i.id===e?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{customContent:n}):i)})):P(t=>t&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},t),{sections:t.sections.map(i=>i.id===e?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{customContent:n}):i)})));},A=(e,n)=>{o&&m(t=>t&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},t),{variableValues:chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},t.variableValues),{[e]:n})}));},L=()=>"policy_"+Date.now()+"_"+Math.random().toString(36).substr(2,9);return {policy:o,selectedTemplate:l,organizationInfo:y,selectTemplate:N,updateOrganizationInfo:R,toggleSection:U,updateSectionContent:C,updateVariableValue:A,generatePolicy:()=>{if(!l)throw new Error("No template selected");let e=Date.now(),n={id:(o==null?void 0:o.id)||L(),title:`Privacy Policy for ${y.name}`,templateId:l.id,organizationInfo:y,sections:l.sections.map(t=>{var i;return chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},t),{customContent:(i=o==null?void 0:o.sections.find(c=>c.id===t.id))==null?void 0:i.customContent})}),variableValues:(o==null?void 0:o.variableValues)||{},effectiveDate:e,lastUpdated:e,version:"1.0"};return m(n),q(n),v&&v(n),n},getPolicyText:()=>{if(!o)return {fullText:"",sectionTexts:{},missingVariables:[]};let e=chunkUXMGBIX6_js.a(o.sections,o.organizationInfo);return typeof e=="string"?{fullText:e,sectionTexts:{full:e},missingVariables:[]}:e},resetPolicy:()=>{m(null),P(null),O({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),Promise.resolve(p.current.remove()).catch(e=>{console.warn("[ndpr-toolkit] Failed to remove policy:",e);});},isValid:()=>{let e=[];if(l||e.push("No template selected"),y.name||e.push("Organization name is required"),y.website||e.push("Organization website is required"),y.privacyEmail||e.push("Privacy contact email is required"),l){let n=l.sections.filter(i=>i.required),t=(o==null?void 0:o.sections.filter(i=>i.included))||[];n.forEach(i=>{t.some(c=>c.id===i.id)||e.push(`Required section "${i.title}" must be included`);});}return l&&o&&Object.entries(l.variables).forEach(([n,t])=>{t.required&&!o.variableValues[n]&&e.push(`Required variable "${t.name}" must have a value`);}),{valid:e.length===0,errors:e}},isLoading:D}}function X(d={}){let{orgInfo:a,storageKey:g,useLocalStorage:I}=d,{sections:h,variables:v}=chunkUXMGBIX6_js.d(),f={};a&&(a.name&&(f.orgName=a.name),a.email&&(f.privacyEmail=a.email),a.dpoName&&(f.dpoName=a.dpoName));let p={id:"default-business",name:"Default Business Policy",description:"NDPA-compliant privacy policy template for businesses.",organizationType:"business",sections:h,variables:Object.fromEntries(v.map(o=>[o.name,{name:o.name,description:o.description,required:o.required,defaultValue:f[o.name]||o.value||void 0}])),version:"1.0",lastUpdated:Date.now(),ndpaCompliant:true};return E({templates:[p],storageKey:g,useLocalStorage:I})}exports.a=E;exports.b=X;//# sourceMappingURL=chunk-E63VPR7U.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-E63VPR7U.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {b,d as d$1,c}from'./chunk-GCQRHMTQ.mjs';import {a}from'./chunk-
|
|
2
|
-
`),v=[],e=false;for(let a of
|
|
3
|
-
`)}var
|
|
1
|
+
import {b,d as d$1,c}from'./chunk-GCQRHMTQ.mjs';import {a}from'./chunk-6WIP33TW.mjs';import {d,b as b$1,a as a$1}from'./chunk-WWT2ZSNU.mjs';import {useRef,useState,useEffect,useMemo,useCallback}from'react';function M(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function ce(r){return r.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function Le(r){let u=r.split(`
|
|
2
|
+
`),v=[],e=false;for(let a of u){let s=a.trimEnd();s.startsWith("- ")||s.startsWith("\u2022 ")?(e||(v.push("<ul>"),e=true),v.push(` <li>${M(s.replace(/^[-•]\s*/,""))}</li>`)):(e&&(v.push("</ul>"),e=false),s.trim()===""||v.push(`<p>${M(s)}</p>`));}return e&&v.push("</ul>"),v.join(`
|
|
3
|
+
`)}var Ne=`
|
|
4
4
|
/* \u2500\u2500 Reset & Base \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
5
5
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
6
6
|
|
|
@@ -243,27 +243,27 @@ import {b,d as d$1,c}from'./chunk-GCQRHMTQ.mjs';import {a}from'./chunk-SBNAMPAP.
|
|
|
243
243
|
|
|
244
244
|
a { color: inherit; text-decoration: none; }
|
|
245
245
|
}
|
|
246
|
-
`.trim();function
|
|
246
|
+
`.trim();function ee(r,u){var R;let v=(u==null?void 0:u.includeStyles)!==false,e=(R=u==null?void 0:u.customCSS)!=null?R:"",a=r.sections.filter(d=>d.included),s=M(r.organizationInfo.name||"Organisation"),t=M(r.title||"Privacy Policy"),l=M(r.version||"1.0"),c=r.effectiveDate?new Date(r.effectiveDate).toLocaleDateString("en-NG",{day:"numeric",month:"long",year:"numeric"}):new Date().toLocaleDateString("en-NG",{day:"numeric",month:"long",year:"numeric"}),y=r.lastUpdated?new Date(r.lastUpdated).toLocaleDateString("en-NG",{day:"numeric",month:"long",year:"numeric"}):c,C=r.organizationInfo.website?`<a href="${M(r.organizationInfo.website)}" target="_blank" rel="noopener">${M(r.organizationInfo.website)}</a>`:"",x=r.organizationInfo.privacyEmail?`<a href="mailto:${M(r.organizationInfo.privacyEmail)}">${M(r.organizationInfo.privacyEmail)}</a>`:"",F=`
|
|
247
247
|
<nav class="policy-toc" aria-label="Table of Contents">
|
|
248
248
|
<h2>Table of Contents</h2>
|
|
249
249
|
<ol>
|
|
250
|
-
${a.map((
|
|
250
|
+
${a.map((d,w)=>` <li><a href="#${ce(d.title)}">${M(d.title)}</a></li>`).join(`
|
|
251
251
|
`)}
|
|
252
252
|
</ol>
|
|
253
|
-
</nav>`,
|
|
254
|
-
<h2 id="section-heading-${
|
|
255
|
-
<span class="section-number" aria-hidden="true">${
|
|
256
|
-
${
|
|
253
|
+
</nav>`,k=a.map((d,w)=>{let p=ce(d.title),T=d.template||d.defaultContent||"",b=Le(T);return ` <section class="policy-section" id="${p}" aria-labelledby="section-heading-${p}">
|
|
254
|
+
<h2 id="section-heading-${p}">
|
|
255
|
+
<span class="section-number" aria-hidden="true">${w+1}</span>
|
|
256
|
+
${M(d.title)}
|
|
257
257
|
</h2>
|
|
258
|
-
${
|
|
258
|
+
${b}
|
|
259
259
|
</section>`}).join(`
|
|
260
260
|
|
|
261
|
-
`),
|
|
262
|
-
${
|
|
263
|
-
${
|
|
261
|
+
`),z=e?e.replace(/<\/style>/gi,""):"",L=v?`<style>
|
|
262
|
+
${Ne}
|
|
263
|
+
${z?`
|
|
264
264
|
/* \u2500\u2500 Custom styles \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
265
|
-
${
|
|
266
|
-
</style>`:
|
|
265
|
+
${z}`:""}
|
|
266
|
+
</style>`:z?`<style>${z}</style>`:"";return `<!DOCTYPE html>
|
|
267
267
|
<html lang="en">
|
|
268
268
|
<head>
|
|
269
269
|
<meta charset="UTF-8" />
|
|
@@ -271,7 +271,7 @@ ${e}`:""}
|
|
|
271
271
|
<meta name="description" content="Privacy Policy for ${s}" />
|
|
272
272
|
<meta name="generator" content="NDPA Toolkit" />
|
|
273
273
|
<title>${t} \u2014 ${s}</title>
|
|
274
|
-
${
|
|
274
|
+
${L}
|
|
275
275
|
</head>
|
|
276
276
|
<body>
|
|
277
277
|
<div class="policy-wrapper">
|
|
@@ -289,16 +289,16 @@ ${N}
|
|
|
289
289
|
</div>
|
|
290
290
|
</header>
|
|
291
291
|
|
|
292
|
-
${
|
|
292
|
+
${F}
|
|
293
293
|
|
|
294
294
|
<article class="policy-body" aria-label="Policy content">
|
|
295
295
|
|
|
296
|
-
${
|
|
296
|
+
${k}
|
|
297
297
|
|
|
298
298
|
</article>
|
|
299
299
|
|
|
300
300
|
<footer class="policy-footer" role="contentinfo">
|
|
301
|
-
<div>${s}${
|
|
301
|
+
<div>${s}${C?` — ${C}`:""}</div>
|
|
302
302
|
${x?`<div>Privacy contact: ${x}</div>`:""}
|
|
303
303
|
<div>Effective ${c} • Version ${l}</div>
|
|
304
304
|
<div>Generated by <strong>NDPA Toolkit</strong> — Nigeria Data Protection Act 2023</div>
|
|
@@ -306,11 +306,11 @@ ${A}
|
|
|
306
306
|
|
|
307
307
|
</div>
|
|
308
308
|
</body>
|
|
309
|
-
</html>`}function
|
|
310
|
-
`);for(let x of
|
|
311
|
-
`)}function
|
|
312
|
-
`);e.setFontSize(9.5),e.setFont("helvetica","normal"),e.setTextColor(50,50,50),
|
|
313
|
-
`).forEach(
|
|
314
|
-
|
|
315
|
-
${n.suggestedContent}`.trim()})});break}}},[
|
|
316
|
-
//# sourceMappingURL=chunk-
|
|
309
|
+
</html>`}function Ie(r){return r.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function te(r){let u=r.sections.filter(l=>l.included),v=r.title||"Privacy Policy",e=r.organizationInfo.name||"Organisation",a=r.version||"1.0",s=r.effectiveDate?new Date(r.effectiveDate).toLocaleDateString("en-NG",{day:"numeric",month:"long",year:"numeric"}):new Date().toLocaleDateString("en-NG",{day:"numeric",month:"long",year:"numeric"}),t=[];return t.push(`# ${v}`),t.push(""),t.push(`_Effective: ${s} | Version: ${a} | ${e}_`),t.push(""),r.organizationInfo.website&&t.push(`**Website:** ${r.organizationInfo.website} `),r.organizationInfo.privacyEmail&&t.push(`**Privacy contact:** ${r.organizationInfo.privacyEmail} `),(r.organizationInfo.website||r.organizationInfo.privacyEmail)&&t.push(""),t.push("> This privacy policy is compliant with the **Nigeria Data Protection Act (NDPA) 2023**."),t.push(""),t.push("---"),t.push(""),u.length>0&&(t.push("## Table of Contents"),t.push(""),u.forEach((l,c)=>{let y=Ie(`${c+1} ${l.title}`);t.push(`${c+1}. [${l.title}](#${y})`);}),t.push(""),t.push("---"),t.push("")),u.forEach((l,c)=>{t.push(`## ${c+1}. ${l.title}`),t.push("");let y=(l.template||l.defaultContent||"").trim();if(y){let C=y.split(`
|
|
310
|
+
`);for(let x of C){let D=x.trimEnd();D.startsWith("-")||D.startsWith("\u2022")||D===""?t.push(D.replace(/^•/,"-")):t.push(D);}}t.push(""),t.push("---"),t.push("");}),t.push(`_Generated by **NDPA Toolkit** \u2014 ${e} \u2022 Version ${a}_`),t.push(""),t.join(`
|
|
311
|
+
`)}function oe(r,u){return d(this,null,function*(){var R;let v;try{let d=yield import('jspdf');v=(R=d.jsPDF)!=null?R:d.default;}catch(d){throw new Error('The "jspdf" package is required for PDF export. Install it with: pnpm add jspdf')}let e=new v({unit:"mm",format:"a4"}),a=e.internal.pageSize.getWidth(),s=e.internal.pageSize.getHeight(),t=20,l=a-t*2,c=t,y=r.organizationInfo.name||"",C=r.title||"Privacy Policy",x=r.version||"1.0",D=r.effectiveDate?new Date(r.effectiveDate).toLocaleDateString():new Date().toLocaleDateString(),F=()=>{e.setFontSize(8),e.setFont("helvetica","italic"),e.setTextColor(150,150,150),e.text(y?`${y} \u2014 ${C}`:C,t,12),e.setDrawColor(220,220,220),e.setLineWidth(.3),e.line(t,14,a-t,14),e.setTextColor(0,0,0);},k=d=>{c+d>s-t-10&&(e.addPage(),c=t+8,F());};if((u==null?void 0:u.includeCoverPage)!==false){e.setFillColor(22,163,74),e.rect(0,0,a,12,"F"),e.setFontSize(28),e.setFont("helvetica","bold"),e.setTextColor(22,163,74);let d=e.splitTextToSize(C,l-10),w=72;d.forEach(T=>{e.text(T,a/2,w,{align:"center"}),w+=11;}),e.setDrawColor(22,163,74),e.setLineWidth(.6);let p=w+6;if(e.line(a/2-30,p,a/2+30,p),e.setFontSize(14),e.setFont("helvetica","normal"),e.setTextColor(40,40,40),e.text(y,a/2,p+14,{align:"center"}),e.setFontSize(10),e.setTextColor(100,100,100),e.text(`Effective Date: ${D}`,a/2,p+26,{align:"center"}),e.text(`Version ${x}`,a/2,p+34,{align:"center"}),(u==null?void 0:u.includeComplianceBadge)!==false){let T=p+52,b="Compliant with the Nigeria Data Protection Act (NDPA) 2023";e.setFontSize(8.5),e.setFont("helvetica","bold"),e.setTextColor(255,255,255);let f=e.getTextWidth(b),m=7,_=3.5,H=(a-f-m*2)/2;e.setFillColor(22,163,74),e.roundedRect(H,T-_-1,f+m*2,7+_,2,2,"F"),e.text(b,a/2,T+1.5,{align:"center"}),e.setTextColor(0,0,0);}e.setFillColor(22,163,74),e.rect(0,s-12,a,12,"F"),e.addPage(),c=t+8,F();}let z=r.sections.filter(d=>d.included);(u==null?void 0:u.includeTOC)!==false&&(e.setFontSize(18),e.setFont("helvetica","bold"),e.setTextColor(22,163,74),e.text("Table of Contents",t,c+4),e.setDrawColor(22,163,74),e.setLineWidth(.5),e.line(t,c+8,t+80,c+8),c+=18,e.setFontSize(10.5),e.setFont("helvetica","normal"),e.setTextColor(40,40,40),z.forEach((d,w)=>{k(7);let p=`${w+1}. ${d.title}`;e.text(p,t+4,c),c+=6.5;}),e.addPage(),c=t+8,F()),z.forEach((d,w)=>{k(18),e.setFillColor(22,163,74),e.circle(t+3.5,c-1.5,3.8,"F"),e.setFontSize(8),e.setFont("helvetica","bold"),e.setTextColor(255,255,255),e.text(String(w+1),t+3.5,c-.5,{align:"center"}),e.setFontSize(13),e.setFont("helvetica","bold"),e.setTextColor(22,163,74),e.text(d.title,t+11,c),c+=3,e.setDrawColor(200,200,200),e.setLineWidth(.25),e.line(t+11,c,a-t,c),c+=6;let p=(d.template||d.defaultContent||"").trim();if(p){let T=p.split(`
|
|
312
|
+
`);e.setFontSize(9.5),e.setFont("helvetica","normal"),e.setTextColor(50,50,50),T.forEach(b=>{let f=b.trimEnd();if(f===""){c+=3;return}let m=f.startsWith("-")||f.startsWith("\u2022"),_=m?t+8:t+4,H=m?f.replace(/^[-•]\s*/,""):f,A=l-(m?12:8);e.splitTextToSize(H,A).forEach((X,Z)=>{k(5),m&&Z===0&&(e.setFillColor(22,163,74),e.circle(t+4,c-1,.9,"F")),e.text(X,_,c),c+=5;});});}c+=10;});let L=e.getNumberOfPages();for(let d=1;d<=L;d++)e.setPage(d),e.setFontSize(7.5),e.setFont("helvetica","normal"),e.setTextColor(160,160,160),e.setDrawColor(220,220,220),e.setLineWidth(.3),e.line(t,s-12,a-t,s-12),e.text(y?`${y} \u2014 Privacy Policy`:"Privacy Policy",t,s-8),e.text(`Page ${d} of ${L}`,a-t,s-8,{align:"right"}),e.setTextColor(0,0,0);return e.setProperties({title:C,author:y,subject:"Privacy Policy \u2014 NDPA 2023 Compliant",keywords:"privacy policy, NDPA, Nigeria, data protection"}),e.output("blob")})}function re(r,u){return d(this,null,function*(){let v;try{v=yield import('docx');}catch(b){throw new Error('The "docx" package is required for Word export. Install it with: pnpm add docx')}let{Document:e,Paragraph:a,TextRun:s,HeadingLevel:t,Packer:l,Header:c,Footer:y,PageNumber:C,AlignmentType:x,BorderStyle:D,ShadingType:F,TableOfContents:k}=v,z=r.organizationInfo.name||"",L=r.title||"Privacy Policy",R=r.version||"1.0",d=r.effectiveDate?new Date(r.effectiveDate).toLocaleDateString("en-NG",{day:"numeric",month:"long",year:"numeric"}):new Date().toLocaleDateString("en-NG",{day:"numeric",month:"long",year:"numeric"}),w=r.sections.filter(b=>b.included),p=[];if(p.push(new a({children:[new s({text:L,bold:true,size:52,color:"064e3b"})],heading:t.TITLE,spacing:{after:160},alignment:x.CENTER})),p.push(new a({children:[new s({text:`${z}${z?" \u2022 ":""}Version ${R} \u2022 Effective ${d}`,size:20,color:"6b7280",italics:true})],spacing:{after:120},alignment:x.CENTER})),p.push(new a({children:[new s({text:"Compliant with the Nigeria Data Protection Act (NDPA) 2023",size:18,color:"16a34a",bold:true})],spacing:{after:400},alignment:x.CENTER})),p.push(new a({children:[],spacing:{after:200},border:{bottom:{color:"16a34a",style:D.SINGLE,size:6,space:1}}})),(u==null?void 0:u.includeTOC)!==false){if(p.push(new a({children:[new s({text:"Table of Contents",bold:true,size:28,color:"064e3b"})],heading:t.HEADING_1,spacing:{before:400,after:200}})),typeof k=="function")try{p.push(new k("Table of Contents",{hyperlink:!0,headingStyleRange:"1-1"}));}catch(b){w.forEach((f,m)=>{p.push(new a({children:[new s({text:`${m+1}. ${f.title}`,size:22,color:"15803d"})],spacing:{after:80}}));});}else w.forEach((b,f)=>{p.push(new a({children:[new s({text:`${f+1}. ${b.title}`,size:22,color:"15803d"})],spacing:{after:80}}));});p.push(new a({children:[],pageBreakBefore:true}));}w.forEach((b,f)=>{p.push(new a({children:[new s({text:`${f+1}. ${b.title}`,bold:true,size:28,color:"064e3b"})],heading:t.HEADING_1,spacing:{before:400,after:200},border:{bottom:{color:"dcfce7",style:D.SINGLE,size:4,space:1}}}));let m=(b.template||b.defaultContent||"").trim();m&&m.split(`
|
|
313
|
+
`).forEach(H=>{let A=H.trimEnd();if(A===""){p.push(new a({children:[],spacing:{after:60}}));return}let N=A.startsWith("- ")||A.startsWith("\u2022 "),X=N?A.replace(/^[-•]\s*/,""):A;N?p.push(new a({children:[new s({text:X,size:22})],spacing:{after:80},bullet:{level:0}})):p.push(new a({children:[new s({text:X,size:22})],spacing:{after:100}}));});}),p.push(new a({children:[new s({text:`Generated by NDPA Toolkit \u2014 ${z}${z?" \u2014 ":""}Privacy Policy v${R}`,size:16,color:"9ca3af",italics:true})],spacing:{before:600},alignment:x.CENTER}));let T=new e({title:L,description:"Privacy Policy \u2014 NDPA 2023 Compliant",styles:{paragraphStyles:[{id:"Normal",name:"Normal",run:{font:"Calibri",size:22}}]},sections:[{headers:{default:new c({children:[new a({children:[new s({text:z||"Privacy Policy",size:16,color:"9ca3af"})],alignment:x.RIGHT})]})},footers:{default:new y({children:[new a({children:[new s({text:"Page ",size:16,color:"9ca3af"}),new s({children:[C.CURRENT],size:16,color:"9ca3af"}),new s({text:" of ",size:16,color:"9ca3af"}),new s({children:[C.TOTAL_PAGES],size:16,color:"9ca3af"})],alignment:x.CENTER})]})},children:p}]});return l.toBlob(T)})}var le=10,Me="ndpr_policy_draft",Re=2e3;function de(){return `section_${Date.now()}_${Math.random().toString(36).slice(2,9)}`}function pe(){return `draft_${Date.now()}_${Math.random().toString(36).slice(2,9)}`}function U(r,u,v){let e=Date.now();return {id:v,title:`Privacy Policy${r.org.name?` \u2014 ${r.org.name}`:""}`,templateId:"adaptive-policy-wizard",organizationInfo:{name:r.org.name,website:r.org.website,privacyEmail:r.org.privacyEmail,address:r.org.address,dpoName:r.org.dpoName,dpoEmail:r.org.dpoEmail,industry:r.org.industry},sections:u,variableValues:{},effectiveDate:e,lastUpdated:e,version:"1.0",applicableFrameworks:["ndpa","ndpr"]}}function ot(r={}){var ne;let{onComplete:u,onComplianceChange:v}=r,e=useRef((ne=r.adapter)!=null?ne:a(Me));r.adapter&&(e.current=r.adapter);let a$2=useRef(pe()),[s,t]=useState(1),[l,c$1]=useState(b),[y,C]=useState([]),[x,D]=useState({}),[F,k]=useState([]),[z,L]=useState(false),[R,d$2]=useState(null),[w,p]=useState(true),T=useRef(false),b$2=useRef(null);useEffect(()=>{let o=false,n=i=>{i&&(a$2.current=i.id,c$1(i.templateContext),C(i.customSections),D(i.sectionOverrides),k(i.sectionOrder),t(i.currentStep),d$2(i.lastSavedAt),L(true));};try{let i=e.current.load();i instanceof Promise?i.then(h=>{o||(n(h),p(!1));},()=>{o||p(!1);}):(n(i),p(!1));}catch(i){o||p(false);}return ()=>{o=true;}},[]);let f=useMemo(()=>{let n=d$1(l).map(g=>x[g.id]?b$1(a$1({},g),{template:x[g.id]}):g),i=y.map(g=>{var E;return {id:g.id,title:g.title,template:(E=x[g.id])!=null?E:g.content,order:g.order,required:false,included:true}}),h=[...n,...i];if(F.length>0){let g=new Map(F.map((E,$)=>[E,$]));return [...h].sort((E,$)=>{let O=g.has(E.id)?g.get(E.id):h.length,W=g.has($.id)?g.get($.id):h.length;return O-W})}return [...h].sort((g,E)=>{var $,O;return (($=g.order)!=null?$:0)-((O=E.order)!=null?O:0)})},[l,y,x,F]),m=useMemo(()=>!l.org.name&&!l.org.privacyEmail?null:U(l,f,a$2.current),[l,f]),_=useMemo(()=>U(b(),[],a$2.current),[]),H=useMemo(()=>c(m!=null?m:_,l),[m,l,_]),A=H.percentage,N=H.gaps,X=useRef({score:-1,gaps:[]});useEffect(()=>{let o=X.current;v&&(A!==o.score||N!==o.gaps)&&v(A,N),X.current={score:A,gaps:N};},[A,N,v]);let Z=useMemo(()=>{switch(s){case 1:return l.org.name.trim().length>0&&l.org.privacyEmail.trim().length>0;case 2:return l.dataCategories.some(o=>o.selected);case 3:return l.purposes.length>0;case 4:return true;default:return false}},[s,l]),me=useCallback(o=>{let n=Math.min(Math.max(1,o),4);n<4&&(T.current=false),t(n);},[]),ue=useCallback(()=>{t(o=>Math.min(o+1,4));},[]),fe=useCallback(()=>{T.current=false,t(o=>Math.max(o-1,1));},[]),ge=useCallback(o=>{c$1(n=>a$1(a$1({},n),o));},[]),he=useCallback(o=>{c$1(n=>b$1(a$1({},n),{org:a$1(a$1({},n.org),o)}));},[]),ye=useCallback(o=>{c$1(n=>b$1(a$1({},n),{dataCategories:n.dataCategories.map(i=>i.id===o?b$1(a$1({},i),{selected:!i.selected}):i)}));},[]),ve=useCallback(o=>{c$1(n=>{let i=n.purposes.includes(o);return b$1(a$1({},n),{purposes:i?n.purposes.filter(h=>h!==o):[...n.purposes,o]})});},[]),xe=useCallback(o=>{c$1(n=>b$1(a$1({},n),{thirdPartyProcessors:[...n.thirdPartyProcessors,o]}));},[]),be=useCallback(o=>{c$1(n=>b$1(a$1({},n),{thirdPartyProcessors:n.thirdPartyProcessors.filter((i,h)=>h!==o)}));},[]),Pe=useCallback(o=>{C(n=>n.length>=le?n:[...n,b$1(a$1({},o),{id:de(),required:false})]);},[]),Ce=useCallback((o,n)=>{C(i=>i.map(h=>h.id===o?a$1(a$1({},h),n):h));},[]),we=useCallback(o=>{C(n=>n.filter(i=>i.id!==o)),k(n=>n.filter(i=>i!==o)),D(n=>{let i=a$1({},n);return delete i[o],i});},[]),Se=useCallback((o,n)=>{k(i=>{let h=i.length>0?i:f.map(O=>O.id),g=h.indexOf(o);if(g===-1){let O=f.map(Ae=>Ae.id),W=O.indexOf(o);if(W===-1)return i;let K=n==="up"?W-1:W+1;if(K<0||K>=O.length)return O;let j=[...O];return [j[W],j[K]]=[j[K],j[W]],j}let E=n==="up"?g-1:g+1;if(E<0||E>=h.length)return h;let $=[...h];return [$[g],$[E]]=[$[E],$[g]],$});},[f]),De=useCallback((o,n)=>{D(i=>b$1(a$1({},i),{[o]:n}));},[]),Te=useCallback(o=>{let n=N.find(i=>i.requirementId===o);if(n)switch(n.fixType){case "fill_field":{T.current=false;let h=["data-categories-disclosed"],g=["purpose-of-processing"];h.includes(o)?t(2):g.includes(o)?t(3):(t(1));break}case "add_section":{if(!n.suggestedContent)break;C(i=>i.length>=le?i:[...i,{id:de(),title:n.requirement,content:n.suggestedContent,order:999,required:false}]);break}case "add_content":{if(!n.suggestedContent)break;let i="data-subject-rights";D(h=>{var E,$,O;let g=(O=($=h[i])!=null?$:(E=f.find(W=>W.id===i))==null?void 0:E.template)!=null?O:"";return b$1(a$1({},h),{[i]:`${g}
|
|
314
|
+
|
|
315
|
+
${n.suggestedContent}`.trim()})});break}}},[N,f]),Y=useCallback(o=>({id:a$2.current,templateContext:l,customSections:y,sectionOverrides:x,sectionOrder:F,currentStep:o,lastSavedAt:Date.now(),status:"draft"}),[l,y,x,F]),Ee=useCallback(()=>d(null,null,function*(){let o=Y(s);try{yield Promise.resolve(e.current.save(o)),d$2(o.lastSavedAt),L(!0);}catch(n){console.warn("[ndpr-toolkit] Failed to save draft:",n);}}),[Y,s]),$e=useCallback(()=>{Promise.resolve(e.current.remove()).catch(o=>{console.warn("[ndpr-toolkit] Failed to remove draft:",o);}),a$2.current=pe(),T.current=false,c$1(b()),C([]),D({}),k([]),t(1),L(false),d$2(null);},[]);useEffect(()=>{if(!w)return b$2.current&&clearTimeout(b$2.current),b$2.current=setTimeout(()=>{let o=Y(s);Promise.resolve(e.current.save(o)).then(()=>{d$2(o.lastSavedAt),L(true);}).catch(n=>{console.warn("[ndpr-toolkit] Auto-save failed:",n);});},Re),()=>{b$2.current&&clearTimeout(b$2.current);}},[l,y,x,F,s,w,Y]),useEffect(()=>{s===4&&m&&u&&!T.current&&(T.current=true,u(m));},[s,m,u]);let ze=useCallback(o=>d(null,null,function*(){let n=m!=null?m:U(l,f,a$2.current);return oe(n,o)}),[m,l,f]),Oe=useCallback(o=>d(null,null,function*(){let n=m!=null?m:U(l,f,a$2.current);return re(n,o)}),[m,l,f]),Fe=useCallback(o=>{let n=m!=null?m:U(l,f,a$2.current);return ee(n,o)},[m,l,f]),ke=useCallback(()=>{let o=m!=null?m:U(l,f,a$2.current);return te(o)},[m,l,f]);return {currentStep:s,goToStep:me,nextStep:ue,prevStep:fe,canProceed:Z,context:l,updateContext:ge,updateOrg:he,toggleDataCategory:ye,togglePurpose:ve,addProcessor:xe,removeProcessor:be,policy:m,sections:f,customSections:y,addCustomSection:Pe,updateCustomSection:Ce,removeCustomSection:we,reorderSections:Se,editSectionContent:De,sectionOverrides:x,complianceScore:A,complianceResult:H,complianceGaps:N,applyFix:Te,handleExportPDF:ze,handleExportDOCX:Oe,handleExportHTML:Fe,handleExportMarkdown:ke,isDraftSaved:z,lastSavedAt:R,saveDraft:Ee,discardDraft:$e,isLoading:w}}export{ee as a,te as b,oe as c,re as d,ot as e};//# sourceMappingURL=chunk-EH2I4L7M.mjs.map
|
|
316
|
+
//# sourceMappingURL=chunk-EH2I4L7M.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';function n(e){return {load(){if(typeof window=="undefined")return null;try{let t=localStorage.getItem(e);return t?JSON.parse(t):null}catch(t){return null}},save(t){if(typeof window!="undefined")try{localStorage.setItem(e,JSON.stringify(t));}catch(r){}},remove(){if(typeof window!="undefined")try{localStorage.removeItem(e);}catch(t){}}}}exports.a=n;//# sourceMappingURL=chunk-ELKB2AFZ.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-ELKB2AFZ.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a,d}from'./chunk-ZEOQYWOE.mjs';import {a as a$2}from'./chunk-6WIP33TW.mjs';import {b,a as a$1}from'./chunk-WWT2ZSNU.mjs';import {useRef,useState,useEffect}from'react';function j(d,a){return a?a$2(d):{load:()=>null,save:()=>{},remove:()=>{}}}function E({templates:d,initialPolicy:a$2,adapter:g,storageKey:I="ndpr_privacy_policy",useLocalStorage:h=true,onGenerate:v}){let f=g!=null?g:j(I,h),p=useRef(f);p.current=f;let[o,m]=useState(a$2||null),[l,P]=useState(null),[y,O]=useState({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),[D,b$1]=useState(true),S=useRef(d);S.current=d,useEffect(()=>{if(a$2){b$1(false);return}let e=false;try{let n=p.current.load(),t=i=>{if(i){if(m(i),i.templateId){let c=S.current.find(u=>u.id===i.templateId);c&&P(c);}i.organizationInfo&&O(i.organizationInfo);}b$1(!1);};n instanceof Promise?n.then(i=>{e||t(i);},()=>{e||b$1(!1);}):t(n);}catch(n){e||b$1(false);}return ()=>{e=true;}},[a$2]);let q=e=>{Promise.resolve(p.current.save(e)).catch(n=>{console.warn("[ndpr-toolkit] Failed to save policy:",n);});},N=e=>{let n=d.find(u=>u.id===e);if(!n)return false;P(n);let t=n.sections.map(u=>b(a$1({},u),{customContent:void 0})),i={};Object.keys(n.variables).forEach(u=>{i[u]=n.variables[u].defaultValue||"";});let c=Date.now();return m({id:"policy_"+c+"_"+Math.random().toString(36).substr(2,9),title:"",templateId:n.id,organizationInfo:y,sections:t,variableValues:i,effectiveDate:c,lastUpdated:c,version:"1.0"}),true},R=e=>{O(n=>a$1(a$1({},n),e));},U=(e,n)=>{l&&(o?m(t=>t&&b(a$1({},t),{sections:t.sections.map(i=>i.id===e?b(a$1({},i),{included:n}):i)})):P(t=>t&&b(a$1({},t),{sections:t.sections.map(i=>i.id===e?b(a$1({},i),{included:n}):i)})));},C=(e,n)=>{l&&(o?m(t=>t&&b(a$1({},t),{sections:t.sections.map(i=>i.id===e?b(a$1({},i),{customContent:n}):i)})):P(t=>t&&b(a$1({},t),{sections:t.sections.map(i=>i.id===e?b(a$1({},i),{customContent:n}):i)})));},A=(e,n)=>{o&&m(t=>t&&b(a$1({},t),{variableValues:b(a$1({},t.variableValues),{[e]:n})}));},L=()=>"policy_"+Date.now()+"_"+Math.random().toString(36).substr(2,9);return {policy:o,selectedTemplate:l,organizationInfo:y,selectTemplate:N,updateOrganizationInfo:R,toggleSection:U,updateSectionContent:C,updateVariableValue:A,generatePolicy:()=>{if(!l)throw new Error("No template selected");let e=Date.now(),n={id:(o==null?void 0:o.id)||L(),title:`Privacy Policy for ${y.name}`,templateId:l.id,organizationInfo:y,sections:l.sections.map(t=>{var i;return b(a$1({},t),{customContent:(i=o==null?void 0:o.sections.find(c=>c.id===t.id))==null?void 0:i.customContent})}),variableValues:(o==null?void 0:o.variableValues)||{},effectiveDate:e,lastUpdated:e,version:"1.0"};return m(n),q(n),v&&v(n),n},getPolicyText:()=>{if(!o)return {fullText:"",sectionTexts:{},missingVariables:[]};let e=a(o.sections,o.organizationInfo);return typeof e=="string"?{fullText:e,sectionTexts:{full:e},missingVariables:[]}:e},resetPolicy:()=>{m(null),P(null),O({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),Promise.resolve(p.current.remove()).catch(e=>{console.warn("[ndpr-toolkit] Failed to remove policy:",e);});},isValid:()=>{let e=[];if(l||e.push("No template selected"),y.name||e.push("Organization name is required"),y.website||e.push("Organization website is required"),y.privacyEmail||e.push("Privacy contact email is required"),l){let n=l.sections.filter(i=>i.required),t=(o==null?void 0:o.sections.filter(i=>i.included))||[];n.forEach(i=>{t.some(c=>c.id===i.id)||e.push(`Required section "${i.title}" must be included`);});}return l&&o&&Object.entries(l.variables).forEach(([n,t])=>{t.required&&!o.variableValues[n]&&e.push(`Required variable "${t.name}" must have a value`);}),{valid:e.length===0,errors:e}},isLoading:D}}function X(d$1={}){let{orgInfo:a,storageKey:g,useLocalStorage:I}=d$1,{sections:h,variables:v}=d(),f={};a&&(a.name&&(f.orgName=a.name),a.email&&(f.privacyEmail=a.email),a.dpoName&&(f.dpoName=a.dpoName));let p={id:"default-business",name:"Default Business Policy",description:"NDPA-compliant privacy policy template for businesses.",organizationType:"business",sections:h,variables:Object.fromEntries(v.map(o=>[o.name,{name:o.name,description:o.description,required:o.required,defaultValue:f[o.name]||o.value||void 0}])),version:"1.0",lastUpdated:Date.now(),ndpaCompliant:true};return E({templates:[p],storageKey:g,useLocalStorage:I})}export{E as a,X as b};//# sourceMappingURL=chunk-FDDI426Y.mjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-FDDI426Y.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-NXQMU36Z.mjs';import {a as a$2}from'./chunk-6WIP33TW.mjs';import {c,a,b}from'./chunk-WWT2ZSNU.mjs';import {useRef,useState,useEffect,useCallback}from'react';function M(D,o){return o?a$2(D):{load:()=>null,save:()=>{},remove:()=>{}}}function Q({initialRequests:D=[],requestTypes:o,adapter:f,storageKey:x="ndpr_dsr_requests",useLocalStorage:B=true,onSubmit:p,onUpdate:m}){let y=f!=null?f:M(x,B),q=useRef(y);q.current=y;let[r,R]=useState(D),[I,l]=useState(true);useEffect(()=>{let e=false;try{let t=q.current.load();t instanceof Promise?t.then(s=>{e||(s&&R(s),l(!1));},()=>{e||l(!1);}):(t&&R(t),l(!1));}catch(t){e||l(false);}return ()=>{e=true;}},[]);let c$1=useCallback(e=>{Promise.resolve(q.current.save(e)).catch(t=>{console.warn("[ndpr-toolkit] Failed to save DSR requests:",t);});},[]),L=()=>"dsr_"+Date.now()+"_"+Math.random().toString(36).substr(2,9),O=useCallback(e=>{let t=o.find(g=>g.id===e.type),s=(t==null?void 0:t.estimatedCompletionTime)||30,u=Date.now(),a$1=u+s*24*60*60*1e3,v=e,{createdAt:A}=v,i=c(v,["createdAt"]),d=a({id:L(),status:"pending",createdAt:u,updatedAt:u,dueDate:a$1},i);return R(g=>{let b=[...g,d];return c$1(b),b}),p&&p(d),d},[o,c$1,p]),_=useCallback((e,t)=>{let s=null;return R(u=>{let a$1=u.findIndex(d=>d.id===e);if(a$1===-1)return u;let A=u[a$1];s=b(a(a({},A),t),{updatedAt:Date.now()});let i=[...u];return i[a$1]=s,c$1(i),i}),s&&m&&m(s),s},[c$1,m]),k=useCallback(e=>r.find(t=>t.id===e)||null,[r]),U=useCallback(e=>r.filter(t=>t.status===e),[r]),F=useCallback(e=>r.filter(t=>t.type===e),[r]);return {requests:r,submitRequest:O,updateRequest:_,getRequest:k,getRequestsByStatus:U,getRequestsByType:F,getRequestType:e=>o.find(t=>t.id===e),formatRequest:e=>{let{formattedRequest:t}=a$1(e);return t},clearRequests:()=>{R([]),Promise.resolve(q.current.remove()).catch(e=>{console.warn("[ndpr-toolkit] Failed to remove DSR requests:",e);});},isLoading:I}}export{Q as a};//# sourceMappingURL=chunk-FOXZRRMW.mjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-FOXZRRMW.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-6TA2MVTU.mjs';import {a as a$2}from'./chunk-6WIP33TW.mjs';import {b,a}from'./chunk-WWT2ZSNU.mjs';import {useRef,useState,useEffect}from'react';function H(i,A){return A?a$2(i):{load:()=>null,save:()=>{},remove:()=>{}}}function Y({sections:i,initialAnswers:A={},adapter:v,storageKey:E="ndpr_dpia_data",useLocalStorage:C=true,onComplete:P}){let b$1=v!=null?v:H(E,C),d=useRef(b$1);d.current=b$1;let[f,g]=useState(0),[a$2,p]=useState(A),[T,m]=useState(true);useEffect(()=>{let r=false;try{let t=d.current.load();t instanceof Promise?t.then(e=>{r||(e&&p(e),m(!1));},()=>{r||m(!1);}):(t&&p(t),m(!1));}catch(t){r||m(false);}return ()=>{r=true;}},[]);let c=i[f]||null,_=r=>{Promise.resolve(d.current.save(r)).catch(t=>{console.warn("[ndpr-toolkit] Failed to save DPIA answers:",t);});},$=(r,t)=>{p(e=>{let s=b(a({},e),{[r]:t});return _(s),s});},h=r=>r.showWhen?r.showWhen.every(t=>{let e=a$2[t.questionId];switch(t.operator){case "equals":return e===t.value;case "contains":return Array.isArray(e)?e.includes(t.value):false;case "greaterThan":return typeof e=="number"?e>t.value:false;case "lessThan":return typeof e=="number"?e<t.value:false;default:return true}}):true,y=()=>c?c.questions.filter(h):[],w=()=>c?y().every(t=>{if(!t.required)return true;let e=a$2[t.id];return !(e==null||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0)}):false,O=()=>{let r={};return c&&y().forEach(e=>{if(!e.required)return;let s=a$2[e.id];s==null||typeof s=="string"&&s.trim()===""?r[e.id]="This question is required":Array.isArray(s)&&s.length===0&&(r[e.id]="At least one option must be selected");}),r},U=()=>w()&&f<i.length-1?(g(r=>r+1),true):false,V=()=>f>0?(g(r=>r-1),true):false,B=r=>r>=0&&r<i.length?(g(r),true):false,F=()=>i.every(r=>r.questions.filter(h).every(e=>{if(!e.required)return true;let s=a$2[e.id];return !(s==null||typeof s=="string"&&s.trim()===""||Array.isArray(s)&&s.length===0)})),W=()=>{let r=[];return i.forEach(t=>{t.questions.forEach(e=>{let s=a$2[e.id];if(s!=null&&e.riskLevel)if(["select","radio","checkbox"].includes(e.type)&&e.options)(Array.isArray(s)?s:[s]).forEach(o=>{var D;let l=(D=e.options)==null?void 0:D.find(u=>u.value===o);if(l!=null&&l.riskLevel){let u=l.riskLevel,R=u==="low"?1:u==="medium"?3:5,S=u==="low"?1:u==="medium"?3:5;r.push({id:`risk_${r.length+1}`,description:`${e.text} - ${l.label}`,likelihood:R,impact:S,score:R*S,level:u,mitigated:false,relatedQuestionIds:[e.id]});}});else {let n=e.riskLevel,o=n==="low"?1:n==="medium"?3:5,l=n==="low"?1:n==="medium"?3:5;r.push({id:`risk_${r.length+1}`,description:e.text,likelihood:o,impact:l,score:o*l,level:n,mitigated:false,relatedQuestionIds:[e.id]});}});}),r},K=(r,t,e)=>{let s=W(),n={id:`dpia_${Date.now()}`,title:t,processingDescription:e,startedAt:Date.now(),completedAt:Date.now(),assessor:r,answers:a$2,risks:s,overallRiskLevel:"low",canProceed:true,conclusion:"",version:"1.0"},o=a$1(n);return n.overallRiskLevel=o.overallRiskLevel,n.canProceed=o.canProceed,n.conclusion=o.canProceed?"Based on the assessment, the processing can proceed with appropriate safeguards.":"Based on the assessment, the processing should not proceed without further mitigation measures.",n.recommendations=o.recommendations,P&&P(n),n},M=()=>{p({}),g(0),Promise.resolve(d.current.remove()).catch(r=>{console.warn("[ndpr-toolkit] Failed to remove DPIA data:",r);});},j=(()=>{let r=0,t=0;return i.forEach(e=>{e.questions.forEach(s=>{if(s.required&&h(s)){t++;let n=a$2[s.id];n!=null&&!(typeof n=="string"&&n.trim()==="")&&!(Array.isArray(n)&&n.length===0)&&r++;}});}),t>0?Math.round(r/t*100):0})();return {currentSectionIndex:f,currentSection:c,answers:a$2,updateAnswer:$,nextSection:U,prevSection:V,goToSection:B,isCurrentSectionValid:w,getCurrentSectionErrors:O,isComplete:F,completeDPIA:K,getVisibleQuestions:y,resetDPIA:M,progress:j,isLoading:T}}export{Y as a};//# sourceMappingURL=chunk-GOD4LA2J.mjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-GOD4LA2J.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var l=["consent","contract","legal_obligation","vital_interests","public_interest","legitimate_interests"];function h(e){let s=[];return (!e.id||e.id.trim()==="")&&s.push("Record ID is required."),(!e.name||e.name.trim()==="")&&s.push("Processing activity name is required."),(!e.description||e.description.trim()==="")&&s.push("Processing description is required."),e.controllerDetails?((!e.controllerDetails.name||e.controllerDetails.name.trim()==="")&&s.push("Controller name is required."),(!e.controllerDetails.contact||e.controllerDetails.contact.trim()==="")&&s.push("Controller contact is required."),(!e.controllerDetails.address||e.controllerDetails.address.trim()==="")&&s.push("Controller address is required.")):s.push("Controller details are required."),(!e.lawfulBasis||!l.includes(e.lawfulBasis))&&s.push("A valid lawful basis must be specified (NDPA Section 25)."),(!e.lawfulBasisJustification||e.lawfulBasisJustification.trim()==="")&&s.push("Lawful basis justification is required to demonstrate compliance."),(!e.purposes||e.purposes.length===0)&&s.push("At least one processing purpose must be specified."),(!e.dataCategories||e.dataCategories.length===0)&&s.push("At least one data category must be specified."),(!e.dataSubjectCategories||e.dataSubjectCategories.length===0)&&s.push("At least one data subject category must be specified."),(!e.recipients||e.recipients.length===0)&&s.push("At least one recipient or category of recipients must be specified."),(!e.retentionPeriod||e.retentionPeriod.trim()==="")&&s.push("Retention period must be specified."),(!e.securityMeasures||e.securityMeasures.length===0)&&s.push("At least one security measure must be documented."),e.dataSource||s.push("Data source must be specified."),e.dataSource==="third_party"&&(!e.thirdPartySourceDetails||e.thirdPartySourceDetails.trim()==="")&&s.push('Third-party source details are required when data source is "third_party".'),e.automatedDecisionMaking&&(!e.automatedDecisionMakingDetails||e.automatedDecisionMakingDetails.trim()==="")&&s.push("Automated decision-making details are required when automated decision-making is involved."),e.dpiaRequired&&(!e.dpiaReference||e.dpiaReference.trim()==="")&&s.push("DPIA reference is required when DPIA is marked as required."),{valid:s.length===0,errors:s}}function D(e){let s=l.reduce((a,u)=>(a[u]=0,a),{}),o=0,t=0,i=0,n=0,r=0,p=[],d={},m=Date.now();for(let a of e.records)a.lawfulBasis&&l.includes(a.lawfulBasis)&&s[a.lawfulBasis]++,a.status==="active"&&o++,a.sensitiveDataCategories&&a.sensitiveDataCategories.length>0&&t++,a.crossBorderTransfers&&a.crossBorderTransfers.length>0&&i++,a.dpiaRequired&&n++,a.automatedDecisionMaking&&r++,a.nextReviewDate&&a.nextReviewDate<=m&&p.push(a),a.department&&(d[a.department]=(d[a.department]||0)+1);let g=Object.entries(d).map(([a,u])=>({department:a,count:u})).sort((a,u)=>u.count-a.count).slice(0,10);return {totalRecords:e.records.length,activeRecords:o,byLawfulBasis:s,sensitiveDataRecords:t,crossBorderRecords:i,dpiaRequiredRecords:n,automatedDecisionRecords:r,recordsDueForReview:p,topDepartments:g,lastUpdated:e.lastUpdated}}function f(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
1
|
+
'use strict';var l=["consent","contract","legal_obligation","vital_interests","public_interest","legitimate_interests"];function h(e){let s=[];return (!e.id||e.id.trim()==="")&&s.push("Record ID is required."),(!e.name||e.name.trim()==="")&&s.push("Processing activity name is required."),(!e.description||e.description.trim()==="")&&s.push("Processing description is required."),e.controllerDetails?((!e.controllerDetails.name||e.controllerDetails.name.trim()==="")&&s.push("Controller name is required."),(!e.controllerDetails.contact||e.controllerDetails.contact.trim()==="")&&s.push("Controller contact is required."),(!e.controllerDetails.address||e.controllerDetails.address.trim()==="")&&s.push("Controller address is required.")):s.push("Controller details are required."),(!e.lawfulBasis||!l.includes(e.lawfulBasis))&&s.push("A valid lawful basis must be specified (NDPA Section 25)."),(!e.lawfulBasisJustification||e.lawfulBasisJustification.trim()==="")&&s.push("Lawful basis justification is required to demonstrate compliance."),(!e.purposes||e.purposes.length===0)&&s.push("At least one processing purpose must be specified."),(!e.dataCategories||e.dataCategories.length===0)&&s.push("At least one data category must be specified."),(!e.dataSubjectCategories||e.dataSubjectCategories.length===0)&&s.push("At least one data subject category must be specified."),(!e.recipients||e.recipients.length===0)&&s.push("At least one recipient or category of recipients must be specified."),(!e.retentionPeriod||e.retentionPeriod.trim()==="")&&s.push("Retention period must be specified."),(!e.securityMeasures||e.securityMeasures.length===0)&&s.push("At least one security measure must be documented."),e.dataSource||s.push("Data source must be specified."),e.dataSource==="third_party"&&(!e.thirdPartySourceDetails||e.thirdPartySourceDetails.trim()==="")&&s.push('Third-party source details are required when data source is "third_party".'),e.automatedDecisionMaking&&(!e.automatedDecisionMakingDetails||e.automatedDecisionMakingDetails.trim()==="")&&s.push("Automated decision-making details are required when automated decision-making is involved."),e.dpiaRequired&&(!e.dpiaReference||e.dpiaReference.trim()==="")&&s.push("DPIA reference is required when DPIA is marked as required."),{valid:s.length===0,errors:s}}function D(e){let s=l.reduce((a,u)=>(a[u]=0,a),{}),o=0,t=0,i=0,n=0,r=0,p=[],d={},m=Date.now();for(let a of e.records)a.lawfulBasis&&l.includes(a.lawfulBasis)&&s[a.lawfulBasis]++,a.status==="active"&&o++,a.sensitiveDataCategories&&a.sensitiveDataCategories.length>0&&t++,a.crossBorderTransfers&&a.crossBorderTransfers.length>0&&i++,a.dpiaRequired&&n++,a.automatedDecisionMaking&&r++,a.nextReviewDate&&a.nextReviewDate<=m&&p.push(a),a.department&&(d[a.department]=(d[a.department]||0)+1);let g=Object.entries(d).map(([a,u])=>({department:a,count:u})).sort((a,u)=>u.count-a.count).slice(0,10);return {totalRecords:e.records.length,activeRecords:o,byLawfulBasis:s,sensitiveDataRecords:t,crossBorderRecords:i,dpiaRequiredRecords:n,automatedDecisionRecords:r,recordsDueForReview:p,topDepartments:g,lastUpdated:e.lastUpdated}}function f(e){return /^[=+\-@\t\r]/.test(e)&&(e="'"+e),e.includes(",")||e.includes('"')||e.includes(`
|
|
2
2
|
`)||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e}function c(e){return e?new Date(e).toISOString():""}function R(e){let s=["ID","Name","Description","Controller Name","Controller Contact","Lawful Basis","Lawful Basis Justification","Purposes","Data Categories","Sensitive Data Categories","Data Subject Categories","Recipients","Cross-Border Transfers","Retention Period","Security Measures","Data Source","DPIA Required","DPIA Reference","Automated Decision-Making","Status","Department","Systems Used","Created At","Updated At","Last Reviewed At","Next Review Date"],o=e.records.map(i=>{let n=i.crossBorderTransfers?i.crossBorderTransfers.map(r=>`${r.destinationCountry} (${r.transferMechanism}: ${r.safeguards})`).join("; "):"";return [i.id,i.name,i.description,i.controllerDetails.name,i.controllerDetails.contact,i.lawfulBasis,i.lawfulBasisJustification,i.purposes.join("; "),i.dataCategories.join("; "),(i.sensitiveDataCategories||[]).join("; "),i.dataSubjectCategories.join("; "),i.recipients.join("; "),n,i.retentionPeriod,i.securityMeasures.join("; "),i.dataSource,i.dpiaRequired?"Yes":"No",i.dpiaReference||"",i.automatedDecisionMaking?"Yes":"No",i.status,i.department||"",(i.systemsUsed||[]).join("; "),c(i.createdAt),c(i.updatedAt),c(i.lastReviewedAt),c(i.nextReviewDate)].map(r=>f(String(r)))});return [s.map(i=>f(i)).join(","),...o.map(i=>i.join(","))].join(`
|
|
3
|
-
`)}function w(e){let s=[],o=Date.now();for(let t of e.records){let i=[];if((!t.lawfulBasisJustification||t.lawfulBasisJustification.trim()==="")&&i.push("Missing lawful basis justification (NDPA Section 25 requires documented justification)."),(!t.retentionPeriod||t.retentionPeriod.trim()==="")&&i.push("Missing retention period (data must not be kept longer than necessary)."),(!t.securityMeasures||t.securityMeasures.length===0)&&i.push("No security measures documented (NDPA requires appropriate technical and organizational measures)."),t.nextReviewDate&&t.nextReviewDate<=o){let n=Math.ceil((o-t.nextReviewDate)/864e5);i.push(`Review is overdue by ${n} day${n!==1?"s":""}.`);}if(t.dpiaRequired&&(!t.dpiaReference||t.dpiaReference.trim()==="")&&i.push("DPIA is required but no reference to a completed DPIA was provided."),t.automatedDecisionMaking&&(!t.automatedDecisionMakingDetails||t.automatedDecisionMakingDetails.trim()==="")&&i.push("Automated decision-making is flagged but no details are documented."),t.crossBorderTransfers)for(let n of t.crossBorderTransfers)(!n.safeguards||n.safeguards.trim()==="")&&i.push(`Cross-border transfer to ${n.destinationCountry} is missing safeguard documentation.`),(!n.transferMechanism||n.transferMechanism.trim()==="")&&i.push(`Cross-border transfer to ${n.destinationCountry} is missing transfer mechanism.`);t.dataSource==="third_party"&&(!t.thirdPartySourceDetails||t.thirdPartySourceDetails.trim()==="")&&i.push('Data source is "third_party" but no source details are provided.'),(!t.purposes||t.purposes.length===0)&&i.push("No processing purposes specified."),(!t.recipients||t.recipients.length===0)&&i.push("No recipients or categories of recipients specified."),i.length>0&&s.push({recordId:t.id,recordName:t.name,gaps:i});}return s}exports.a=h;exports.b=D;exports.c=R;exports.d=w;//# sourceMappingURL=chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
`)}function w(e){let s=[],o=Date.now();for(let t of e.records){let i=[];if((!t.lawfulBasisJustification||t.lawfulBasisJustification.trim()==="")&&i.push("Missing lawful basis justification (NDPA Section 25 requires documented justification)."),(!t.retentionPeriod||t.retentionPeriod.trim()==="")&&i.push("Missing retention period (data must not be kept longer than necessary)."),(!t.securityMeasures||t.securityMeasures.length===0)&&i.push("No security measures documented (NDPA requires appropriate technical and organizational measures)."),t.nextReviewDate&&t.nextReviewDate<=o){let n=Math.ceil((o-t.nextReviewDate)/864e5);i.push(`Review is overdue by ${n} day${n!==1?"s":""}.`);}if(t.dpiaRequired&&(!t.dpiaReference||t.dpiaReference.trim()==="")&&i.push("DPIA is required but no reference to a completed DPIA was provided."),t.automatedDecisionMaking&&(!t.automatedDecisionMakingDetails||t.automatedDecisionMakingDetails.trim()==="")&&i.push("Automated decision-making is flagged but no details are documented."),t.crossBorderTransfers)for(let n of t.crossBorderTransfers)(!n.safeguards||n.safeguards.trim()==="")&&i.push(`Cross-border transfer to ${n.destinationCountry} is missing safeguard documentation.`),(!n.transferMechanism||n.transferMechanism.trim()==="")&&i.push(`Cross-border transfer to ${n.destinationCountry} is missing transfer mechanism.`);t.dataSource==="third_party"&&(!t.thirdPartySourceDetails||t.thirdPartySourceDetails.trim()==="")&&i.push('Data source is "third_party" but no source details are provided.'),(!t.purposes||t.purposes.length===0)&&i.push("No processing purposes specified."),(!t.recipients||t.recipients.length===0)&&i.push("No recipients or categories of recipients specified."),i.length>0&&s.push({recordId:t.id,recordName:t.name,gaps:i});}return s}exports.a=h;exports.b=D;exports.c=R;exports.d=w;//# sourceMappingURL=chunk-GOU6FU6Y.js.map
|
|
4
|
+
//# sourceMappingURL=chunk-GOU6FU6Y.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';function o(e){let t=[];if((!e.consents||Object.keys(e.consents).length===0)&&t.push("Consent settings must include at least one consent option"),e.timestamp?(typeof e.timestamp!="number"||isNaN(e.timestamp))&&t.push("Consent timestamp must be a valid number"):t.push("Consent timestamp is required"),e.version||t.push("Consent version is required"),e.method||t.push("Consent collection method is required"),e.hasInteracted===void 0&&t.push("User interaction status is required"),e.timestamp){let n=new Date;n.setMonth(n.getMonth()-13);let s=n.getTime();e.timestamp<s&&t.push("Consent is older than 13 months and should be refreshed");}return {valid:t.length===0,errors:t}}function i(e){let t=[];return (!e||e.length===0)&&t.push("At least one consent option is required"),e==null||e.forEach(n=>{(!n.purpose||n.purpose.trim()==="")&&t.push(`Consent option "${n.id}" is missing a purpose. NDPA Section 26 requires consent to be specific to a stated purpose.`);}),{valid:t.length===0,errors:t}}exports.a=o;exports.b=i;//# sourceMappingURL=chunk-HO5M7M4M.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-HO5M7M4M.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {b,c,a as a$2}from'./chunk-
|
|
1
|
+
import {b,c,a as a$2}from'./chunk-ZEOQYWOE.mjs';import {a}from'./chunk-AYKLAEOU.mjs';import {d,b as b$1,a as a$1}from'./chunk-WWT2ZSNU.mjs';import {useState,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var ur=({sections:P=b,variables:R=c,onGenerate:S,title:q="NDPA Privacy Policy Generator",description:B="Generate an NDPA-compliant privacy policy for your organization in accordance with NDPA Section 24.",className:j="",buttonClassName:L="",generateButtonText:z="Generate Policy",showPreview:A=true,allowEditing:V=true,classNames:e,unstyled:x=false})=>{let[T,U]=useState(P),[a$3,t]=useState(R),[m,C]=useState("sections"),[E,X]=useState(""),[F,D]=useState(""),[_,G]=useState(false),[h,W]=useState({});useEffect(()=>{U(P);},[P]),useEffect(()=>{t(R);},[R]);let s=n=>{U(b=>b.map(p=>p.id===n?b$1(a$1({},p),{included:!p.included}):p));},g=(n,b)=>{t(p=>p.map(u=>u.id===n?b$1(a$1({},u),{value:b}):u)),h[n]&&W(p=>{let u=a$1({},p);return delete u[n],u});},v=()=>{let n={},b=true;return a$3.forEach(p=>{p.required&&!p.value&&(n[p.id]=`${p.name} is required`,b=false);}),W(n),b},k=()=>{if(!v()){C("variables");return}let n=T.filter(u=>u.included),b=Object.fromEntries(a$3.map(u=>[u.name,u.value])),p="";n.forEach(u=>{p+=`## ${u.title}
|
|
2
2
|
|
|
3
3
|
`,p+=a$2(u.template,b),p+=`
|
|
4
4
|
|
|
@@ -90,5 +90,5 @@ import {b,c,a as a$2}from'./chunk-CAB7O3GR.mjs';import {a}from'./chunk-AYKLAEOU.
|
|
|
90
90
|
<p>© ${new Date().getFullYear()} ${S||"Company"}. All rights reserved.</p>
|
|
91
91
|
</div>
|
|
92
92
|
</body>
|
|
93
|
-
</html>`,w},n=()=>d(null,null,function*(){D(true),G(null);try{let r=E.toLowerCase(),c="",w;switch(r){case "pdf":let rr=K();w=new Blob([rr],{type:"text/html"}),c=URL.createObjectURL(w);break;case "docx":w=new Blob([P],{type:"text/plain"}),c=URL.createObjectURL(w);break;case "html":let lr=K();w=new Blob([lr],{type:"text/html"}),c=URL.createObjectURL(w);break;default:w=new Blob([P],{type:"text/markdown"}),c=URL.createObjectURL(w);break}let Q=N(r),Y=document.createElement("a");Y.href=c,Y.download=Q,document.body.appendChild(Y),Y.click(),document.body.removeChild(Y);let dr={id:`export_${Date.now()}`,format:r,timestamp:Date.now(),url:c,filename:Q};C(rr=>[dr,...rr]),B&&B(r,c);}catch(r){console.error("Export error:",r),G("An error occurred during export. Please try again.");}finally{D(false);}}),b=()=>{let r=[{value:"pdf",label:"PDF Document (.pdf)"},{value:"docx",label:"Word Document (.docx)"},{value:"html",label:"Web Page (.html)"},{value:"markdown",label:"Markdown (.md)"}];return jsxs("div",{className:a("mb-6",a$1==null?void 0:a$1.formatSelector,t),children:[jsx("label",{htmlFor:"export-format",className:"block text-sm font-medium mb-1",children:"Export Format"}),jsx("select",{id:"export-format",value:E,onChange:c=>X(c.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",a$1==null?void 0:a$1.formatOption,t),children:r.map(c=>jsx("option",{value:c.value,children:c.label},c.value))})]})},p=()=>H?jsxs("div",{className:"mb-6 space-y-4 border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("h3",{className:"text-md font-medium",children:"Advanced Export Options"}),jsx("button",{type:"button",onClick:()=>I(false),className:"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] text-sm",children:"Hide Advanced Options"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"custom-filename",className:"block text-sm font-medium mb-1",children:"Custom Filename"}),jsx("input",{type:"text",id:"custom-filename",value:h,onChange:r=>W(r.target.value),placeholder:J(E),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mt-1",children:"Leave blank to use the default filename format."})]}),jsxs("div",{children:[jsx("label",{htmlFor:"custom-header",className:"block text-sm font-medium mb-1",children:"Custom Header HTML (for HTML/PDF exports)"}),jsx("textarea",{id:"custom-header",value:s,onChange:r=>g(r.target.value),rows:3,placeholder:"<div>Custom header content</div>",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"custom-footer",className:"block text-sm font-medium mb-1",children:"Custom Footer HTML (for HTML/PDF exports)"}),jsx("textarea",{id:"custom-footer",value:v,onChange:r=>k(r.target.value),rows:3,placeholder:"<div>Custom footer content</div>",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]}),jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{id:"include-compliance-notice",type:"checkbox",checked:e,onChange:r=>I(r.target.checked),className:"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"})}),jsxs("div",{className:"ml-3 text-sm",children:[jsx("label",{htmlFor:"include-compliance-notice",className:"font-medium text-gray-900 dark:text-white",children:"Include NDPA Compliance Notice"}),jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Adds a notice explaining that this policy complies with NDPA requirements."})]})]})]}):jsx("button",{type:"button",onClick:()=>I(true),className:"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] text-sm mb-6",children:"Show Advanced Options"}),u=()=>!V||m.length===0?null:jsxs("div",{className:a("mt-6",a$1==null?void 0:a$1.preview,t),children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Export History"}),jsx("div",{className:"bg-gray-50 dark:bg-gray-700 rounded-md overflow-hidden",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-600",children:[jsx("thead",{className:"bg-gray-100 dark:bg-gray-800",children:jsxs("tr",{children:[jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Date"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Format"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Filename"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Actions"})]})}),jsx("tbody",{className:"bg-white dark:bg-gray-700 divide-y divide-gray-200 dark:divide-gray-600",children:m.map(r=>jsxs("tr",{children:[jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-300",children:new Date(r.timestamp).toLocaleString()}),jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-300",children:r.format.toUpperCase()}),jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-300",children:r.filename}),jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:jsx("a",{href:r.url,download:r.filename,className:"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] hover:text-[rgb(var(--ndpr-primary-hover))] dark:hover:text-[rgb(var(--ndpr-primary-hover))] mr-4",children:"Download"})})]},r.id))})]})})]});return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${z}`,a$1==null?void 0:a$1.root,t),children:[jsxs("div",{className:a("mb-6",a$1==null?void 0:a$1.header,t),children:[jsx("h2",{className:a("text-xl font-bold mb-2",a$1==null?void 0:a$1.title,t),children:j}),jsx("p",{className:a("text-gray-600 dark:text-gray-300",a$1==null?void 0:a$1.description,t),children:L})]}),b(),p(),jsxs("div",{className:"mb-6",children:[jsx("button",{onClick:n,disabled:F,className:a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${A} ${F?"opacity-70 cursor-not-allowed":""}`,(a$1==null?void 0:a$1.primaryButton)||(a$1==null?void 0:a$1.exportButton),t),children:F?"Exporting...":`Export as ${E.toUpperCase()}`}),_&&jsx("p",{className:"mt-2 text-sm text-red-600 dark:text-red-500",children:_})]}),jsxs("div",{className:a("mb-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md",a$1==null?void 0:a$1.complianceNotice,t),children:[jsx("h3",{className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2",children:"Export Tips"}),jsxs("ul",{className:"text-blue-700 dark:text-blue-300 text-sm list-disc list-inside space-y-1",children:[jsx("li",{children:"PDF format is recommended for printing or sharing with stakeholders."}),jsx("li",{children:"HTML format is ideal for publishing on your website."}),jsx("li",{children:"DOCX format allows for further editing in Microsoft Word or similar applications."}),jsx("li",{children:"Markdown format is useful for version control systems or technical documentation."})]})]}),u()]})};export{ur as a,wr as b,Sr as c};//# sourceMappingURL=chunk-
|
|
94
|
-
//# sourceMappingURL=chunk-
|
|
93
|
+
</html>`,w},n=()=>d(null,null,function*(){D(true),G(null);try{let r=E.toLowerCase(),c="",w;switch(r){case "pdf":let rr=K();w=new Blob([rr],{type:"text/html"}),c=URL.createObjectURL(w);break;case "docx":w=new Blob([P],{type:"text/plain"}),c=URL.createObjectURL(w);break;case "html":let lr=K();w=new Blob([lr],{type:"text/html"}),c=URL.createObjectURL(w);break;default:w=new Blob([P],{type:"text/markdown"}),c=URL.createObjectURL(w);break}let Q=N(r),Y=document.createElement("a");Y.href=c,Y.download=Q,document.body.appendChild(Y),Y.click(),document.body.removeChild(Y);let dr={id:`export_${Date.now()}`,format:r,timestamp:Date.now(),url:c,filename:Q};C(rr=>[dr,...rr]),B&&B(r,c);}catch(r){console.error("Export error:",r),G("An error occurred during export. Please try again.");}finally{D(false);}}),b=()=>{let r=[{value:"pdf",label:"PDF Document (.pdf)"},{value:"docx",label:"Word Document (.docx)"},{value:"html",label:"Web Page (.html)"},{value:"markdown",label:"Markdown (.md)"}];return jsxs("div",{className:a("mb-6",a$1==null?void 0:a$1.formatSelector,t),children:[jsx("label",{htmlFor:"export-format",className:"block text-sm font-medium mb-1",children:"Export Format"}),jsx("select",{id:"export-format",value:E,onChange:c=>X(c.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",a$1==null?void 0:a$1.formatOption,t),children:r.map(c=>jsx("option",{value:c.value,children:c.label},c.value))})]})},p=()=>H?jsxs("div",{className:"mb-6 space-y-4 border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("h3",{className:"text-md font-medium",children:"Advanced Export Options"}),jsx("button",{type:"button",onClick:()=>I(false),className:"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] text-sm",children:"Hide Advanced Options"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"custom-filename",className:"block text-sm font-medium mb-1",children:"Custom Filename"}),jsx("input",{type:"text",id:"custom-filename",value:h,onChange:r=>W(r.target.value),placeholder:J(E),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mt-1",children:"Leave blank to use the default filename format."})]}),jsxs("div",{children:[jsx("label",{htmlFor:"custom-header",className:"block text-sm font-medium mb-1",children:"Custom Header HTML (for HTML/PDF exports)"}),jsx("textarea",{id:"custom-header",value:s,onChange:r=>g(r.target.value),rows:3,placeholder:"<div>Custom header content</div>",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"custom-footer",className:"block text-sm font-medium mb-1",children:"Custom Footer HTML (for HTML/PDF exports)"}),jsx("textarea",{id:"custom-footer",value:v,onChange:r=>k(r.target.value),rows:3,placeholder:"<div>Custom footer content</div>",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]}),jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{id:"include-compliance-notice",type:"checkbox",checked:e,onChange:r=>I(r.target.checked),className:"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"})}),jsxs("div",{className:"ml-3 text-sm",children:[jsx("label",{htmlFor:"include-compliance-notice",className:"font-medium text-gray-900 dark:text-white",children:"Include NDPA Compliance Notice"}),jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Adds a notice explaining that this policy complies with NDPA requirements."})]})]})]}):jsx("button",{type:"button",onClick:()=>I(true),className:"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] text-sm mb-6",children:"Show Advanced Options"}),u=()=>!V||m.length===0?null:jsxs("div",{className:a("mt-6",a$1==null?void 0:a$1.preview,t),children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Export History"}),jsx("div",{className:"bg-gray-50 dark:bg-gray-700 rounded-md overflow-hidden",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-600",children:[jsx("thead",{className:"bg-gray-100 dark:bg-gray-800",children:jsxs("tr",{children:[jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Date"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Format"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Filename"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Actions"})]})}),jsx("tbody",{className:"bg-white dark:bg-gray-700 divide-y divide-gray-200 dark:divide-gray-600",children:m.map(r=>jsxs("tr",{children:[jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-300",children:new Date(r.timestamp).toLocaleString()}),jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-300",children:r.format.toUpperCase()}),jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-300",children:r.filename}),jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:jsx("a",{href:r.url,download:r.filename,className:"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] hover:text-[rgb(var(--ndpr-primary-hover))] dark:hover:text-[rgb(var(--ndpr-primary-hover))] mr-4",children:"Download"})})]},r.id))})]})})]});return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${z}`,a$1==null?void 0:a$1.root,t),children:[jsxs("div",{className:a("mb-6",a$1==null?void 0:a$1.header,t),children:[jsx("h2",{className:a("text-xl font-bold mb-2",a$1==null?void 0:a$1.title,t),children:j}),jsx("p",{className:a("text-gray-600 dark:text-gray-300",a$1==null?void 0:a$1.description,t),children:L})]}),b(),p(),jsxs("div",{className:"mb-6",children:[jsx("button",{onClick:n,disabled:F,className:a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${A} ${F?"opacity-70 cursor-not-allowed":""}`,(a$1==null?void 0:a$1.primaryButton)||(a$1==null?void 0:a$1.exportButton),t),children:F?"Exporting...":`Export as ${E.toUpperCase()}`}),_&&jsx("p",{className:"mt-2 text-sm text-red-600 dark:text-red-500",children:_})]}),jsxs("div",{className:a("mb-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md",a$1==null?void 0:a$1.complianceNotice,t),children:[jsx("h3",{className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2",children:"Export Tips"}),jsxs("ul",{className:"text-blue-700 dark:text-blue-300 text-sm list-disc list-inside space-y-1",children:[jsx("li",{children:"PDF format is recommended for printing or sharing with stakeholders."}),jsx("li",{children:"HTML format is ideal for publishing on your website."}),jsx("li",{children:"DOCX format allows for further editing in Microsoft Word or similar applications."}),jsx("li",{children:"Markdown format is useful for version control systems or technical documentation."})]})]}),u()]})};export{ur as a,wr as b,Sr as c};//# sourceMappingURL=chunk-I23WPZNQ.mjs.map
|
|
94
|
+
//# sourceMappingURL=chunk-I23WPZNQ.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkBKRETVJ6_js=require('./chunk-BKRETVJ6.js'),chunkELKB2AFZ_js=require('./chunk-ELKB2AFZ.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react');function G(c,d){switch(d.type){case "LOAD":return d.payload;case "ADD_REPORT":return chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},c),{reports:[...c.reports,d.payload]});case "UPDATE_REPORT":{let f=[...c.reports];return f[d.payload.index]=d.payload.report,chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},c),{reports:f})}case "SET_ASSESSMENT":{let{existing:f,id:S,assessment:g}=d.payload,A=f?c.assessments.map(R=>R.id===S?g:R):[...c.assessments,g];return chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},c),{assessments:A})}case "SET_NOTIFICATION":{let{existing:f,id:S,notification:g}=d.payload,A=f?c.notifications.map(R=>R.id===S?g:R):[...c.notifications,g];return chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},c),{notifications:A})}case "CLEAR":return {reports:[],assessments:[],notifications:[]}}}function J(c,d){return d?chunkELKB2AFZ_js.a(c):{load:()=>null,save:()=>{},remove:()=>{}}}function X({categories:c,initialReports:d=[],adapter:f,storageKey:S="ndpr_breach_data",useLocalStorage:g=true,onReport:A,onAssessment:R,onNotification:I}){let k=f!=null?f:J(S,g),E=react.useRef(k);E.current=k;let[b,y]=react.useReducer(G,{reports:d,assessments:[],notifications:[]}),[x,T]=react.useState(true),l=react.useRef(b);l.current=b;let h=react.useCallback(t=>{Promise.resolve(E.current.save(t)).catch(s=>{console.warn("[ndpr-toolkit] Failed to save breach data:",s);});},[]);react.useEffect(()=>{let t=false;try{let s=E.current.load(),i=e=>{var r,n,a;e&&y({type:"LOAD",payload:{reports:(r=e.reports)!=null?r:[],assessments:(n=e.assessments)!=null?n:[],notifications:(a=e.notifications)!=null?a:[]}}),T(!1);};s instanceof Promise?s.then(e=>{t||i(e);},()=>{t||T(!1);}):i(s);}catch(s){t||T(false);}return ()=>{t=true;}},[]);let B=react.useCallback(t=>`${t}_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,[]),_=react.useCallback(t=>{let s=chunkMQFZHA2D_js.a({id:B("breach"),reportedAt:Date.now()},t);y({type:"ADD_REPORT",payload:s});let i=l.current,e=chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{reports:[...i.reports,s]});return h(e),A&&A(s),s},[B,A,h]),P=react.useCallback((t,s)=>{let i=l.current,e=i.reports.findIndex(a=>a.id===t);if(e===-1)return null;let r=chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},i.reports[e]),s);y({type:"UPDATE_REPORT",payload:{index:e,report:r}});let n=[...i.reports];return n[e]=r,h(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{reports:n})),r},[h]),w=react.useCallback(t=>l.current.reports.find(s=>s.id===t)||null,[]),L=react.useCallback((t,s)=>{let i=l.current,e=i.assessments.find(u=>u.breachId===t),r,n;e?(r=chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},e),s),{assessedAt:Date.now()}),n=true):(r=chunkMQFZHA2D_js.a({id:B("assessment"),breachId:t,assessedAt:Date.now()},s),n=false),y({type:"SET_ASSESSMENT",payload:{existing:n,id:e==null?void 0:e.id,assessment:r}});let a=n?i.assessments.map(u=>u.id===e.id?r:u):[...i.assessments,r];return h(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{assessments:a})),R&&R(r),r},[B,R,h]),U=react.useCallback(t=>l.current.assessments.find(s=>s.breachId===t)||null,[]),D=react.useCallback(t=>{let s=l.current.reports.find(N=>N.id===t)||null,i=l.current.assessments.find(N=>N.breachId===t)||null;if(!s)return null;let{severityLevel:e,notificationRequired:r,timeframeHours:n,justification:a}=chunkBKRETVJ6_js.a(s,i||void 0),u=s.discoveredAt+n*60*60*1e3;return {ndpcNotificationRequired:r,ndpcNotificationDeadline:u,dataSubjectNotificationRequired:e==="high"||e==="critical",justification:a}},[]),F=react.useCallback((t,s)=>{let i=l.current,e=i.notifications.find(u=>u.breachId===t),r,n;e?(r=chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},e),s),{sentAt:Date.now()}),n=true):(r=chunkMQFZHA2D_js.a({id:B("notification"),breachId:t,sentAt:Date.now()},s),n=false),y({type:"SET_NOTIFICATION",payload:{existing:n,id:e==null?void 0:e.id,notification:r}});let a=n?i.notifications.map(u=>u.id===e.id?r:u):[...i.notifications,r];return h(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{notifications:a})),I&&I(r),r},[B,I,h]),M=react.useCallback(t=>l.current.notifications.find(s=>s.breachId===t)||null,[]),$=react.useCallback((t=24)=>{let s=Date.now(),i=l.current,e=[];return i.reports.forEach(r=>{if(i.notifications.some(O=>O.breachId===r.id))return;let n=i.assessments.find(O=>O.breachId===r.id)||null;if(!n)return;let a=D(r.id);if(!a||!a.ndpcNotificationRequired)return;let N=(a.ndpcNotificationDeadline-s)/(3600*1e3);N<=t&&e.push({report:r,assessment:n,requirements:a,hoursRemaining:N});}),e.sort((r,n)=>r.hoursRemaining-n.hoursRemaining)},[D]),j=react.useCallback(()=>{y({type:"CLEAR"}),Promise.resolve(E.current.remove()).catch(t=>{console.warn("[ndpr-toolkit] Failed to remove breach data:",t);});},[]);return {reports:b.reports,assessments:b.assessments,notifications:b.notifications,reportBreach:_,updateReport:P,getReport:w,assessRisk:L,getAssessment:U,calculateNotificationRequirements:D,sendNotification:F,getNotification:M,getBreachesRequiringNotification:$,clearBreachData:j,isLoading:x}}exports.a=X;//# sourceMappingURL=chunk-I4M2AA3N.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-I4M2AA3N.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a as a$2}from'./chunk-FXTZDKDC.mjs';import {a}from'./chunk-AYKLAEOU.mjs';import {b,a as a$1}from'./chunk-WWT2ZSNU.mjs';import {useState}from'react';import {jsxs,jsx}from'react/jsx-runtime';var lr=({requestTypes:I,onSubmit:Q,onValidationError:q,title:X="Submit a Data Subject Request",description:V="Use this form to exercise your rights under the Nigeria Data Protection Act (NDPA), Part IV, Sections 29-36.",submitButtonText:s="Submit Request",className:A="",buttonClassName:D="",showConfirmation:N=true,confirmationMessage:rr="Your request has been submitted successfully. You will receive a confirmation email shortly.",requireIdentityVerification:_=true,identifierTypes:k=[{id:"email",label:"Email Address"},{id:"account",label:"Account Number"},{id:"customer_id",label:"Customer ID"}],collectAdditionalContact:er=true,labels:y={},classNames:r,unstyled:o=false,isSubmitting:f=false,defaultValues:g,onReset:S})=>{var G,Y,H,L,U,W;let[c,P]=useState((g==null?void 0:g.requestType)||""),[R,j]=useState(((G=g==null?void 0:g.dataSubject)==null?void 0:G.fullName)||""),[x,E]=useState(((Y=g==null?void 0:g.dataSubject)==null?void 0:Y.email)||""),[F,O]=useState(((H=g==null?void 0:g.dataSubject)==null?void 0:H.phone)||""),[B,z]=useState(((L=g==null?void 0:g.dataSubject)==null?void 0:L.identifierType)||((U=k[0])==null?void 0:U.id)||""),[T,M]=useState(((W=g==null?void 0:g.dataSubject)==null?void 0:W.identifierValue)||""),[b$1,w]=useState((g==null?void 0:g.additionalInfo)||{}),[ir,$]=useState(false),[d,Z]=useState({}),tr=()=>{var e;P(""),j(""),E(""),O(""),z(((e=k[0])==null?void 0:e.id)||""),M(""),w({}),$(false),Z({}),S==null||S();},u=I.find(e=>e.id===c),or=e=>{P(e.target.value),w({});},v=(e,a)=>{w(l=>b(a$1({},l),{[e]:a}));},nr=()=>{let e={};return R.trim()||(e.fullName="Full name is required"),x.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(x)||(e.email="Email is invalid"):e.email="Email is required",c||(e.requestType="Please select a request type"),_&&!T.trim()&&(e.identifierValue="Identifier value is required"),u!=null&&u.requiresAdditionalInfo&&u.additionalFields&&u.additionalFields.forEach(a=>{a.required&&!b$1[a.id]&&(e[`additional_${a.id}`]=`${a.label} is required`);}),Z(e),e},dr=e=>{e.preventDefault();let a=nr();if(Object.keys(a).length>0){q==null||q(a);return}let l=Object.keys(b$1).length>0?Object.fromEntries(Object.entries(b$1).map(([ar,C])=>[ar,typeof C=="string"?a$2(C):C])):void 0,h={requestType:c,dataSubject:{fullName:a$2(R),email:a$2(x),phone:F?a$2(F):void 0,identifierType:B,identifierValue:a$2(T)},additionalInfo:l,submittedAt:Date.now()};Q(h),N&&$(true);};return ir?jsxs("div",{className:a(`p-4 bg-green-50 dark:bg-green-900/20 rounded-md ${A}`,r==null?void 0:r.successMessage,o),children:[jsx("h2",{className:a("text-lg font-bold text-green-800 dark:text-green-200 mb-2",r==null?void 0:r.title,o),children:"Request Submitted"}),jsx("p",{className:a("text-green-700 dark:text-green-300",r==null?void 0:r.description,o),children:rr}),jsx("button",{onClick:()=>$(false),className:a(`mt-4 px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${D}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),o),children:"Submit Another Request"})]}):jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${A}`,r==null?void 0:r.root,o),children:[jsx("h2",{className:a("text-xl font-bold mb-2",r==null?void 0:r.title,o),children:X}),jsx("p",{className:a("mb-6 text-gray-600 dark:text-gray-300",r==null?void 0:r.description,o),children:V}),jsx("form",{onSubmit:dr,className:a("",r==null?void 0:r.form,o),children:jsxs("div",{className:a("space-y-4",r==null?void 0:r.fieldGroup,o),children:[jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Personal Information"}),jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"fullName",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:[y.name||"Full Name"," ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"text",id:"fullName",value:R,onChange:e=>j(e.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o),required:true,"aria-invalid":!!d.fullName,"aria-describedby":d.fullName?"fullName-error":void 0}),d.fullName&&jsx("p",{id:"fullName-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.fullName})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"email",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:[y.email||"Email Address"," ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"email",id:"email",value:x,onChange:e=>E(e.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o),required:true,"aria-invalid":!!d.email,"aria-describedby":d.email?"email-error":void 0}),d.email&&jsx("p",{id:"email-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.email})]}),er&&jsxs("div",{children:[jsx("label",{htmlFor:"phone",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:"Phone Number (Optional)"}),jsx("input",{type:"tel",id:"phone",value:F,onChange:e=>O(e.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Request Details"}),jsxs("div",{className:"mb-4",children:[jsxs("label",{htmlFor:"requestType",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:[y.requestType||"Request Type"," ",jsx("span",{className:"text-red-500",children:"*"})]}),jsxs("select",{id:"requestType",value:c,onChange:or,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,o),required:true,"aria-invalid":!!d.requestType,"aria-describedby":d.requestType?"requestType-error":void 0,children:[jsx("option",{value:"",children:"Select a request type"}),I.map(e=>jsx("option",{value:e.id,children:e.name},e.id))]}),d.requestType&&jsx("p",{id:"requestType-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.requestType})]}),u&&jsxs("div",{className:"mb-4 p-3 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-2",children:u.description}),jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Estimated completion time: ",u.estimatedCompletionTime," ",u.estimatedCompletionTime===1?"day":"days"]})]}),jsxs("div",{className:"mb-4",children:[jsx("label",{htmlFor:"requestDescription",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:y.description||"Additional Information"}),jsx("textarea",{id:"requestDescription",className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.textarea,o),rows:4,placeholder:"Please provide any additional details that might help us process your request"})]})]}),_&&jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Identity Verification"}),jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-3",children:"To protect your privacy, we need to verify your identity before processing your request."}),jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"identifierType",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:["Identifier Type ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("select",{id:"identifierType",value:B,onChange:e=>z(e.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,o),required:true,children:k.map(e=>jsx("option",{value:e.id,children:e.label},e.id))})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"identifierValue",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:["Identifier Value ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"text",id:"identifierValue",value:T,onChange:e=>M(e.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o),required:true,"aria-invalid":!!d.identifierValue,"aria-describedby":d.identifierValue?"identifierValue-error":void 0}),d.identifierValue&&jsx("p",{id:"identifierValue-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.identifierValue})]})]})]}),(u==null?void 0:u.requiresAdditionalInfo)&&u.additionalFields&&u.additionalFields.length>0&&jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Additional Information"}),jsx("div",{className:"space-y-4",children:u.additionalFields.map(e=>jsxs("div",{children:[jsxs("label",{htmlFor:e.id,className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:[e.label," ",e.required&&jsx("span",{className:"text-red-500",children:"*"})]}),e.type==="text"&&jsx("input",{type:"text",id:e.id,value:b$1[e.id]||"",onChange:a=>v(e.id,a.target.value),placeholder:e.placeholder,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o),required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0}),e.type==="textarea"&&jsx("textarea",{id:e.id,value:b$1[e.id]||"",onChange:a=>v(e.id,a.target.value),placeholder:e.placeholder,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.textarea,o),rows:4,required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0}),e.type==="select"&&e.options&&jsxs("select",{id:e.id,value:b$1[e.id]||"",onChange:a=>v(e.id,a.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,o),required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0,children:[jsx("option",{value:"",children:e.placeholder||"Select an option"}),e.options.map(a=>jsx("option",{value:a,children:a},a))]}),e.type==="checkbox"&&jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{type:"checkbox",id:e.id,checked:!!b$1[e.id],onChange:a=>v(e.id,a.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]",required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0})}),jsx("div",{className:"ml-3 text-sm",children:jsx("label",{htmlFor:e.id,className:"text-gray-700 dark:text-gray-300",children:e.placeholder||e.label})})]}),e.type==="file"&&jsx("input",{type:"file",id:e.id,onChange:a=>{var h;let l=(h=a.target.files)==null?void 0:h[0];l&&v(e.id,l);},className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o),required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0}),d[`additional_${e.id}`]&&jsx("p",{id:`additional-${e.id}-error`,role:"alert",className:"mt-1 text-sm text-red-500",children:d[`additional_${e.id}`]})]},e.id))})]}),jsxs("div",{className:"mt-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsx("h3",{className:"text-sm font-semibold mb-2",children:"Privacy Notice"}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-300",children:"The information you provide in this form will be used solely for the purpose of processing your data subject request. We will retain this information for as long as necessary to fulfill your request and to comply with our legal obligations. For more information, please refer to our Privacy Policy."})]}),jsxs("div",{className:"mt-6 flex gap-3 relative",children:[f&&(r==null?void 0:r.loadingOverlay)&&jsx("div",{className:r.loadingOverlay}),jsx("button",{type:"submit",disabled:f,className:a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${D} ${f?"opacity-50 cursor-not-allowed":""}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),o),children:f?"Submitting...":y.submit||s}),jsx("button",{type:"button",onClick:tr,className:a("px-6 py-3 bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-200 rounded-md hover:bg-gray-300 dark:hover:bg-gray-500 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",void 0,o),children:"Reset"})]})]})})]})};export{lr as a};//# sourceMappingURL=chunk-6D3ZUGBB.mjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {a as a$2}from'./chunk-GKKAK6ES.mjs';import {a}from'./chunk-AYKLAEOU.mjs';import {b,a as a$1}from'./chunk-WWT2ZSNU.mjs';import {useState}from'react';import {jsxs,jsx}from'react/jsx-runtime';var lr=({requestTypes:I,onSubmit:Q,onValidationError:q,title:X="Submit a Data Subject Request",description:V="Use this form to exercise your rights under the Nigeria Data Protection Act (NDPA), Part IV, Sections 29-36.",submitButtonText:s="Submit Request",className:A="",buttonClassName:D="",showConfirmation:N=true,confirmationMessage:rr="Your request has been submitted successfully. You will receive a confirmation email shortly.",requireIdentityVerification:_=true,identifierTypes:k=[{id:"email",label:"Email Address"},{id:"account",label:"Account Number"},{id:"customer_id",label:"Customer ID"}],collectAdditionalContact:er=true,labels:y={},classNames:r,unstyled:o=false,isSubmitting:f=false,defaultValues:g,onReset:S})=>{var G,Y,H,L,U,W;let[c,P]=useState((g==null?void 0:g.requestType)||""),[R,j]=useState(((G=g==null?void 0:g.dataSubject)==null?void 0:G.fullName)||""),[x,E]=useState(((Y=g==null?void 0:g.dataSubject)==null?void 0:Y.email)||""),[F,O]=useState(((H=g==null?void 0:g.dataSubject)==null?void 0:H.phone)||""),[B,z]=useState(((L=g==null?void 0:g.dataSubject)==null?void 0:L.identifierType)||((U=k[0])==null?void 0:U.id)||""),[T,M]=useState(((W=g==null?void 0:g.dataSubject)==null?void 0:W.identifierValue)||""),[b$1,w]=useState((g==null?void 0:g.additionalInfo)||{}),[ir,$]=useState(false),[d,Z]=useState({}),tr=()=>{var e;P(""),j(""),E(""),O(""),z(((e=k[0])==null?void 0:e.id)||""),M(""),w({}),$(false),Z({}),S==null||S();},u=I.find(e=>e.id===c),or=e=>{P(e.target.value),w({});},v=(e,a)=>{w(l=>b(a$1({},l),{[e]:a}));},nr=()=>{let e={};return R.trim()||(e.fullName="Full name is required"),x.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(x)||(e.email="Email is invalid"):e.email="Email is required",c||(e.requestType="Please select a request type"),_&&!T.trim()&&(e.identifierValue="Identifier value is required"),u!=null&&u.requiresAdditionalInfo&&u.additionalFields&&u.additionalFields.forEach(a=>{a.required&&!b$1[a.id]&&(e[`additional_${a.id}`]=`${a.label} is required`);}),Z(e),e},dr=e=>{e.preventDefault();let a=nr();if(Object.keys(a).length>0){q==null||q(a);return}let l=Object.keys(b$1).length>0?Object.fromEntries(Object.entries(b$1).map(([ar,C])=>[ar,typeof C=="string"?a$2(C):C])):void 0,h={requestType:c,dataSubject:{fullName:a$2(R),email:a$2(x),phone:F?a$2(F):void 0,identifierType:B,identifierValue:a$2(T)},additionalInfo:l,submittedAt:Date.now()};Q(h),N&&$(true);};return ir?jsxs("div",{className:a(`p-4 bg-green-50 dark:bg-green-900/20 rounded-md ${A}`,r==null?void 0:r.successMessage,o),children:[jsx("h2",{className:a("text-lg font-bold text-green-800 dark:text-green-200 mb-2",r==null?void 0:r.title,o),children:"Request Submitted"}),jsx("p",{className:a("text-green-700 dark:text-green-300",r==null?void 0:r.description,o),children:rr}),jsx("button",{onClick:()=>$(false),className:a(`mt-4 px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${D}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),o),children:"Submit Another Request"})]}):jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${A}`,r==null?void 0:r.root,o),children:[jsx("h2",{className:a("text-xl font-bold mb-2",r==null?void 0:r.title,o),children:X}),jsx("p",{className:a("mb-6 text-gray-600 dark:text-gray-300",r==null?void 0:r.description,o),children:V}),jsx("form",{onSubmit:dr,className:a("",r==null?void 0:r.form,o),children:jsxs("div",{className:a("space-y-4",r==null?void 0:r.fieldGroup,o),children:[jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Personal Information"}),jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"fullName",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:[y.name||"Full Name"," ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"text",id:"fullName",value:R,onChange:e=>j(e.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o),required:true,"aria-invalid":!!d.fullName,"aria-describedby":d.fullName?"fullName-error":void 0}),d.fullName&&jsx("p",{id:"fullName-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.fullName})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"email",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:[y.email||"Email Address"," ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"email",id:"email",value:x,onChange:e=>E(e.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o),required:true,"aria-invalid":!!d.email,"aria-describedby":d.email?"email-error":void 0}),d.email&&jsx("p",{id:"email-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.email})]}),er&&jsxs("div",{children:[jsx("label",{htmlFor:"phone",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:"Phone Number (Optional)"}),jsx("input",{type:"tel",id:"phone",value:F,onChange:e=>O(e.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Request Details"}),jsxs("div",{className:"mb-4",children:[jsxs("label",{htmlFor:"requestType",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:[y.requestType||"Request Type"," ",jsx("span",{className:"text-red-500",children:"*"})]}),jsxs("select",{id:"requestType",value:c,onChange:or,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,o),required:true,"aria-invalid":!!d.requestType,"aria-describedby":d.requestType?"requestType-error":void 0,children:[jsx("option",{value:"",children:"Select a request type"}),I.map(e=>jsx("option",{value:e.id,children:e.name},e.id))]}),d.requestType&&jsx("p",{id:"requestType-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.requestType})]}),u&&jsxs("div",{className:"mb-4 p-3 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-2",children:u.description}),jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Estimated completion time: ",u.estimatedCompletionTime," ",u.estimatedCompletionTime===1?"day":"days"]})]}),jsxs("div",{className:"mb-4",children:[jsx("label",{htmlFor:"requestDescription",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:y.description||"Additional Information"}),jsx("textarea",{id:"requestDescription",className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.textarea,o),rows:4,placeholder:"Please provide any additional details that might help us process your request"})]})]}),_&&jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Identity Verification"}),jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-3",children:"To protect your privacy, we need to verify your identity before processing your request."}),jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"identifierType",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:["Identifier Type ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("select",{id:"identifierType",value:B,onChange:e=>z(e.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,o),required:true,children:k.map(e=>jsx("option",{value:e.id,children:e.label},e.id))})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"identifierValue",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:["Identifier Value ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"text",id:"identifierValue",value:T,onChange:e=>M(e.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o),required:true,"aria-invalid":!!d.identifierValue,"aria-describedby":d.identifierValue?"identifierValue-error":void 0}),d.identifierValue&&jsx("p",{id:"identifierValue-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.identifierValue})]})]})]}),(u==null?void 0:u.requiresAdditionalInfo)&&u.additionalFields&&u.additionalFields.length>0&&jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Additional Information"}),jsx("div",{className:"space-y-4",children:u.additionalFields.map(e=>jsxs("div",{children:[jsxs("label",{htmlFor:e.id,className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:[e.label," ",e.required&&jsx("span",{className:"text-red-500",children:"*"})]}),e.type==="text"&&jsx("input",{type:"text",id:e.id,value:b$1[e.id]||"",onChange:a=>v(e.id,a.target.value),placeholder:e.placeholder,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o),required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0}),e.type==="textarea"&&jsx("textarea",{id:e.id,value:b$1[e.id]||"",onChange:a=>v(e.id,a.target.value),placeholder:e.placeholder,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.textarea,o),rows:4,required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0}),e.type==="select"&&e.options&&jsxs("select",{id:e.id,value:b$1[e.id]||"",onChange:a=>v(e.id,a.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,o),required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0,children:[jsx("option",{value:"",children:e.placeholder||"Select an option"}),e.options.map(a=>jsx("option",{value:a,children:a},a))]}),e.type==="checkbox"&&jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{type:"checkbox",id:e.id,checked:!!b$1[e.id],onChange:a=>v(e.id,a.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]",required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0})}),jsx("div",{className:"ml-3 text-sm",children:jsx("label",{htmlFor:e.id,className:"text-gray-700 dark:text-gray-300",children:e.placeholder||e.label})})]}),e.type==="file"&&jsx("input",{type:"file",id:e.id,onChange:a=>{var h;let l=(h=a.target.files)==null?void 0:h[0];l&&v(e.id,l);},className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o),required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0}),d[`additional_${e.id}`]&&jsx("p",{id:`additional-${e.id}-error`,role:"alert",className:"mt-1 text-sm text-red-500",children:d[`additional_${e.id}`]})]},e.id))})]}),jsxs("div",{className:"mt-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsx("h3",{className:"text-sm font-semibold mb-2",children:"Privacy Notice"}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-300",children:"The information you provide in this form will be used solely for the purpose of processing your data subject request. We will retain this information for as long as necessary to fulfill your request and to comply with our legal obligations. For more information, please refer to our Privacy Policy."})]}),jsxs("div",{className:"mt-6 flex gap-3 relative",children:[f&&(r==null?void 0:r.loadingOverlay)&&jsx("div",{className:r.loadingOverlay}),jsx("button",{type:"submit",disabled:f,className:a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${D} ${f?"opacity-50 cursor-not-allowed":""}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),o),children:f?"Submitting...":y.submit||s}),jsx("button",{type:"button",onClick:tr,className:a("px-6 py-3 bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-200 rounded-md hover:bg-gray-300 dark:hover:bg-gray-500 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",void 0,o),children:"Reset"})]})]})})]})};export{lr as a};//# sourceMappingURL=chunk-IR7VCBWV.mjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-IR7VCBWV.mjs.map
|