@tantainnovative/ndpr-toolkit 3.12.0 → 3.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +64 -0
- package/dist/breach.d.mts +7 -1
- package/dist/breach.d.ts +7 -1
- package/dist/breach.js +1 -1
- package/dist/breach.mjs +1 -1
- package/dist/chunk-37VFK5SR.js +6 -0
- package/dist/chunk-3E4IH7CE.js +1 -0
- package/dist/chunk-3H6FYU3Z.mjs +93 -0
- package/dist/chunk-3I6FYA5C.js +103 -0
- package/dist/chunk-3SIYRGJF.js +93 -0
- package/dist/chunk-3XU6FL2I.js +1 -0
- package/dist/chunk-42JPSNVV.mjs +6 -0
- package/dist/chunk-42UJFTII.js +1 -0
- package/dist/chunk-737EMUUC.mjs +1 -0
- package/dist/chunk-7FXNGGMO.js +1 -0
- package/dist/chunk-B2EXRSYG.mjs +1 -0
- package/dist/chunk-BGV2AKT7.mjs +1 -0
- package/dist/chunk-BL5W472Q.js +1 -0
- package/dist/chunk-BPMVJOHH.mjs +1 -0
- package/dist/chunk-ELK6VFKC.mjs +2 -0
- package/dist/chunk-F5MGMNQF.js +2 -0
- package/dist/chunk-FRQFU44F.mjs +1 -0
- package/dist/{chunk-WYH3OA5L.mjs → chunk-I2ZBMR7F.mjs} +1 -1
- package/dist/chunk-J7BIJ45O.mjs +103 -0
- package/dist/{chunk-US2VGJ7I.js → chunk-KH3EQJQE.js} +1 -1
- package/dist/{chunk-IPWX5I5P.mjs → chunk-L3FR4PQE.mjs} +1 -1
- package/dist/chunk-N72RNTGP.mjs +6 -0
- package/dist/chunk-NB6SKG76.mjs +1 -0
- package/dist/chunk-NUIRMJKQ.mjs +2 -0
- package/dist/chunk-PXDSPF5B.js +2 -0
- package/dist/chunk-QGUOFGVJ.js +2 -0
- package/dist/chunk-RBKFNCGO.mjs +1 -0
- package/dist/chunk-TTMGFC6C.js +1 -0
- package/dist/{chunk-TWJHEIQH.js → chunk-UZNWXJ2W.js} +1 -1
- package/dist/chunk-V5TZJJWU.mjs +1 -0
- package/dist/chunk-WCTFED27.js +1 -0
- package/dist/chunk-WHQ4PEYS.mjs +2 -0
- package/dist/chunk-WMISQDSV.js +1 -0
- package/dist/{chunk-MTSZ7GL6.mjs → chunk-WVHMY2BV.mjs} +1 -1
- package/dist/chunk-XYGGUGTO.js +6 -0
- package/dist/chunk-YDKWD6MQ.js +1 -0
- package/dist/chunk-Z2M5VJX2.mjs +1 -0
- package/dist/{chunk-D3DVVJCT.js → chunk-ZD2W3YU2.js} +1 -1
- package/dist/chunk-ZM5DLFCZ.js +1 -0
- package/dist/chunk-ZQHGIOYP.mjs +1 -0
- package/dist/consent.js +1 -1
- package/dist/consent.mjs +1 -1
- package/dist/core.d.mts +62 -0
- package/dist/core.d.ts +62 -0
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/cross-border-lite.js +1 -1
- package/dist/cross-border-lite.mjs +1 -1
- package/dist/cross-border.js +1 -1
- package/dist/cross-border.mjs +1 -1
- package/dist/dpia.js +1 -1
- package/dist/dpia.mjs +1 -1
- package/dist/dsr.js +1 -1
- package/dist/dsr.mjs +1 -1
- package/dist/headless.js +1 -1
- package/dist/headless.mjs +1 -1
- package/dist/hooks.js +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/index.d.mts +69 -1
- package/dist/index.d.ts +69 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/lawful-basis-lite.js +1 -1
- package/dist/lawful-basis-lite.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-consent.js +1 -1
- package/dist/presets-consent.mjs +1 -1
- package/dist/presets-dsr.js +1 -1
- package/dist/presets-dsr.mjs +1 -1
- package/dist/presets-policy.d.mts +23 -0
- package/dist/presets-policy.d.ts +23 -0
- package/dist/presets-policy.js +1 -1
- package/dist/presets-policy.mjs +1 -1
- package/dist/presets.d.mts +230 -1
- package/dist/presets.d.ts +230 -1
- package/dist/presets.js +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/ropa-lite.js +1 -1
- package/dist/ropa-lite.mjs +1 -1
- package/dist/ropa.js +1 -1
- package/dist/ropa.mjs +1 -1
- package/dist/server.d.mts +62 -0
- package/dist/server.d.ts +62 -0
- package/dist/server.js +1 -1
- package/dist/server.mjs +1 -1
- package/dist/unstyled.js +1 -1
- package/dist/unstyled.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-25TNTLHJ.mjs +0 -1
- package/dist/chunk-4GIMXUMI.js +0 -6
- package/dist/chunk-5AECGMEB.js +0 -1
- package/dist/chunk-5EKQX6GM.mjs +0 -1
- package/dist/chunk-67KA345Q.mjs +0 -1
- package/dist/chunk-6GM2PBTF.js +0 -2
- package/dist/chunk-6OWCUDTN.mjs +0 -1
- package/dist/chunk-73BMSK67.js +0 -1
- package/dist/chunk-CAFCRCTZ.mjs +0 -1
- package/dist/chunk-EKNWO4DK.js +0 -1
- package/dist/chunk-FMJ6ICLJ.js +0 -1
- package/dist/chunk-G7JKRYM5.mjs +0 -1
- package/dist/chunk-GEP52QFH.mjs +0 -1
- package/dist/chunk-IB3KSUPZ.mjs +0 -1
- package/dist/chunk-JWAN5J4Y.js +0 -1
- package/dist/chunk-JYZOKO2W.mjs +0 -103
- package/dist/chunk-NDKDKDDX.js +0 -1
- package/dist/chunk-NX5MOBRI.js +0 -1
- package/dist/chunk-OLEUIYE2.mjs +0 -1
- package/dist/chunk-Q4CSVWSS.mjs +0 -1
- package/dist/chunk-QMAVEHOR.js +0 -1
- package/dist/chunk-RBMLGRDN.mjs +0 -1
- package/dist/chunk-ROC64RLP.js +0 -1
- package/dist/chunk-RR3KXNET.mjs +0 -6
- package/dist/chunk-TDHH7GS2.mjs +0 -2
- package/dist/chunk-TN4TH3CT.mjs +0 -2
- package/dist/chunk-VUFTRKKC.js +0 -2
- package/dist/chunk-WKTKTLMF.js +0 -1
- package/dist/chunk-WXUXCRAJ.js +0 -1
- package/dist/chunk-XN2UYZXH.mjs +0 -93
- package/dist/chunk-YK22SYCT.js +0 -103
- package/dist/chunk-YSD2DFBR.js +0 -6
- package/dist/chunk-YWCBI7SI.js +0 -93
- package/dist/chunk-ZHX62QAL.mjs +0 -6
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a as a$2}from'./chunk-EWVK45Z3.mjs';import {c}from'./chunk-25TNTLHJ.mjs';import {a}from'./chunk-SFGW37LE.mjs';import {b,a as a$1}from'./chunk-ZJYULEER.mjs';import {useState}from'react';import {jsxs,jsx}from'react/jsx-runtime';var Tr=({requestTypes:y,onSubmit:nr,onValidationError:F,title:T,description:C,submitButtonText:$,className:q="",buttonClassName:dr="",showConfirmation:pr=true,confirmationMessage:ar="Your request has been submitted successfully. You will receive a confirmation email shortly.",requireIdentityVerification:O=true,identifierTypes:D=[{id:"email",label:"Email Address"},{id:"account",label:"Account Number"},{id:"customer_id",label:"Customer ID"}],collectAdditionalContact:ur=true,labels:v={},classNames:r,unstyled:e=false,isSubmitting:A=false,defaultValues:p,onReset:I})=>{var W,J,K,Q,X,V,N,s,rr;if(!Array.isArray(y))throw new Error("[ndpr-toolkit] <DSRRequestForm requestTypes={...} /> requires an array of RequestType[]. See https://ndprtoolkit.com.ng/docs/components/dsr#requesttypes \u2014 or use the `<NDPRSubjectRights />` preset which ships sensible defaults.");let x=c(),br=(W=T!=null?T:x.dsr.title)!=null?W:"Submit a Data Subject Request",fr=(J=C!=null?C:x.dsr.description)!=null?J:"Use this form to exercise your rights under the Nigeria Data Protection Act (NDPA), Part VI.",lr=(K=$!=null?$:x.dsr.submitRequest)!=null?K:"Submit Request",[c$1,z]=useState((p==null?void 0:p.requestType)||""),[P,B]=useState(((Q=p==null?void 0:p.dataSubject)==null?void 0:Q.fullName)||""),[S,M]=useState(((X=p==null?void 0:p.dataSubject)==null?void 0:X.email)||""),[k,Z]=useState(((V=p==null?void 0:p.dataSubject)==null?void 0:V.phone)||""),[G,L]=useState(((N=p==null?void 0:p.dataSubject)==null?void 0:N.identifierType)||((s=D[0])==null?void 0:s.id)||""),[w,Y]=useState(((rr=p==null?void 0:p.dataSubject)==null?void 0:rr.identifierValue)||""),[l,j]=useState((p==null?void 0:p.additionalInfo)||{}),[_r,E]=useState(false),[d,H]=useState({}),mr=()=>{var i;z(""),B(""),M(""),Z(""),L(((i=D[0])==null?void 0:i.id)||""),Y(""),j({}),E(false),H({}),I==null||I();},a$3=y.find(i=>i.id===c$1),gr=i=>{z(i.target.value),j({});},h=(i,b$1)=>{j(_=>b(a$1({},_),{[i]:b$1}));},vr=()=>{let i={};return P.trim()||(i.fullName="Full name is required"),S.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(S)||(i.email="Email is invalid"):i.email="Email is required",c$1||(i.requestType="Please select a request type"),O&&!w.trim()&&(i.identifierValue="Identifier value is required"),a$3!=null&&a$3.requiresAdditionalInfo&&a$3.additionalFields&&a$3.additionalFields.forEach(b=>{b.required&&!l[b.id]&&(i[`additional_${b.id}`]=`${b.label} is required`);}),H(i),i},hr=i=>{i.preventDefault();let b=vr();if(Object.keys(b).length>0){F==null||F(b);return}let _=Object.keys(l).length>0?Object.fromEntries(Object.entries(l).map(([u,m])=>[u,typeof m=="string"?a$2(m):m])):void 0,R={requestType:c$1,dataSubject:{fullName:a$2(P),email:a$2(S),phone:k?a$2(k):void 0,identifierType:G,identifierValue:a$2(w)},additionalInfo:_,submittedAt:Date.now()};nr(R),pr&&E(true);},U=`ndpr-dsr-form__button ndpr-dsr-form__button--primary ${dr}`.trim(),qr="ndpr-dsr-form__button ndpr-dsr-form__button--secondary";return _r?jsxs("div",{"data-ndpr-component":"dsr-request-form","data-ndpr-state":"submitted",className:a(`ndpr-dsr-form__success${q?` ${q}`:""}`,r==null?void 0:r.successMessage,e),"aria-live":"polite",children:[jsx("h2",{className:a("ndpr-dsr-form__success-title",r==null?void 0:r.title,e),children:"Request Submitted"}),jsx("p",{className:a("ndpr-dsr-form__success-body",r==null?void 0:r.description,e),children:ar}),jsx("button",{onClick:()=>E(false),className:a(U,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),e),children:"Submit Another Request"})]}):jsxs("div",{"data-ndpr-component":"dsr-request-form",className:a(`ndpr-dsr-form${q?` ${q}`:""}`,r==null?void 0:r.root,e),children:[jsx("h2",{className:a("ndpr-dsr-form__title",r==null?void 0:r.title,e),children:br}),jsx("p",{className:a("ndpr-dsr-form__description",r==null?void 0:r.description,e),children:fr}),jsx("form",{onSubmit:hr,className:a("",r==null?void 0:r.form,e),children:jsxs("div",{className:a("ndpr-dsr-form__sections",r==null?void 0:r.fieldGroup,e),children:[jsxs("div",{children:[jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Personal Information"}),jsxs("div",{className:e?"":"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"fullName",className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.name||"Full Name"," ",jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsx("input",{type:"text",id:"fullName",value:P,onChange:i=>B(i.target.value),className:a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.fullName,"aria-describedby":d.fullName?"fullName-error":void 0}),d.fullName&&jsx("p",{id:"fullName-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.fullName})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"email",className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.email||"Email Address"," ",jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsx("input",{type:"email",id:"email",value:S,onChange:i=>M(i.target.value),className:a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.email,"aria-describedby":d.email?"email-error":void 0}),d.email&&jsx("p",{id:"email-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.email})]}),ur&&jsxs("div",{children:[jsx("label",{htmlFor:"phone",className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:"Phone Number (Optional)"}),jsx("input",{type:"tel",id:"phone",value:k,onChange:i=>Z(i.target.value),className:a("ndpr-form-field__input",r==null?void 0:r.input,e)})]})]})]}),jsxs("div",{children:[jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Request Details"}),jsxs("div",{className:e?"":"ndpr-form-field",children:[jsxs("label",{htmlFor:"requestType",className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.requestType||"Request Type"," ",jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxs("select",{id:"requestType",value:c$1,onChange:gr,className:a("ndpr-form-field__select",r==null?void 0:r.select,e),required:true,"aria-required":"true","aria-invalid":!!d.requestType,"aria-describedby":d.requestType?"requestType-error":void 0,children:[jsx("option",{value:"",children:"Select a request type"}),y.map(i=>jsx("option",{value:i.id,children:i.name},i.id))]}),d.requestType&&jsx("p",{id:"requestType-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.requestType})]}),a$3&&jsxs("div",{className:e?"":"ndpr-dsr-form__type-info",children:[jsx("p",{children:a$3.description}),jsxs("p",{children:["Estimated completion time: ",a$3.estimatedCompletionTime," ",a$3.estimatedCompletionTime===1?"day":"days"]})]}),jsxs("div",{className:e?"":"ndpr-form-field",children:[jsx("label",{htmlFor:"requestDescription",className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:v.description||"Additional Information"}),jsx("textarea",{id:"requestDescription",className:a("ndpr-form-field__textarea",r==null?void 0:r.textarea,e),rows:4,placeholder:"Please provide any additional details that might help us process your request"})]})]}),O&&jsxs("div",{children:[jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Identity Verification"}),jsx("p",{className:e?"":"ndpr-form-section__hint",children:"To protect your privacy, we need to verify your identity before processing your request."}),jsxs("div",{className:e?"":"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"identifierType",className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:["Identifier Type ",jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsx("select",{id:"identifierType",value:G,onChange:i=>L(i.target.value),className:a("ndpr-form-field__select",r==null?void 0:r.select,e),required:true,"aria-required":"true",children:D.map(i=>jsx("option",{value:i.id,children:i.label},i.id))})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"identifierValue",className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:["Identifier Value ",jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsx("input",{type:"text",id:"identifierValue",value:w,onChange:i=>Y(i.target.value),className:a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.identifierValue,"aria-describedby":d.identifierValue?"identifierValue-error":void 0}),d.identifierValue&&jsx("p",{id:"identifierValue-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.identifierValue})]})]})]}),(a$3==null?void 0:a$3.requiresAdditionalInfo)&&a$3.additionalFields&&a$3.additionalFields.length>0&&jsxs("div",{children:[jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Additional Information"}),jsx("div",{className:e?"":"ndpr-form-section",children:a$3.additionalFields.map(i=>{var b,_,R;return jsxs("div",{children:[jsxs("label",{htmlFor:i.id,className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[i.label," ",i.required&&jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),i.type==="text"&&jsx("input",{type:"text",id:i.id,value:String((b=l[i.id])!=null?b:""),onChange:u=>h(i.id,u.target.value),placeholder:i.placeholder,className:a("ndpr-form-field__input",r==null?void 0:r.input,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),i.type==="textarea"&&jsx("textarea",{id:i.id,value:String((_=l[i.id])!=null?_:""),onChange:u=>h(i.id,u.target.value),placeholder:i.placeholder,className:a("ndpr-form-field__textarea",r==null?void 0:r.textarea,e),rows:4,required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),i.type==="select"&&i.options&&jsxs("select",{id:i.id,value:String((R=l[i.id])!=null?R:""),onChange:u=>h(i.id,u.target.value),className:a("ndpr-form-field__select",r==null?void 0:r.select,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0,children:[jsx("option",{value:"",children:i.placeholder||"Select an option"}),i.options.map(u=>jsx("option",{value:u,children:u},u))]}),i.type==="checkbox"&&jsxs("div",{className:e?"":"ndpr-form-field__checkbox-row",children:[jsx("input",{type:"checkbox",id:i.id,checked:!!l[i.id],onChange:u=>h(i.id,u.target.checked),className:e?"":"ndpr-form-field__checkbox",required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),jsx("label",{htmlFor:i.id,className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:i.placeholder||i.label})]}),i.type==="file"&&jsx("input",{type:"file",id:i.id,onChange:u=>{var ir;let m=(ir=u.target.files)==null?void 0:ir[0];m&&h(i.id,m.name);},className:a("ndpr-form-field__input",r==null?void 0:r.input,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),d[`additional_${i.id}`]&&jsx("p",{id:`additional-${i.id}-error`,role:"alert",className:e?"":"ndpr-form-field__error",children:d[`additional_${i.id}`]})]},i.id)})})]}),jsxs("div",{className:e?"":"ndpr-dsr-form__notice",children:[jsx("h3",{className:e?"":"ndpr-dsr-form__notice-title",children:"Privacy Notice"}),jsx("p",{className:e?"":"ndpr-dsr-form__notice-body",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:e?"":"ndpr-dsr-form__actions",children:[A&&(r==null?void 0:r.loadingOverlay)&&jsx("div",{className:r.loadingOverlay}),jsx("button",{type:"submit",disabled:A,className:a(U,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),e),children:A?"Submitting...":v.submit||lr}),jsx("button",{type:"button",onClick:mr,className:a(qr,void 0,e),children:"Reset"})]})]})})]})};
|
|
1
|
+
import {a as a$2}from'./chunk-EWVK45Z3.mjs';import {a}from'./chunk-SFGW37LE.mjs';import {c}from'./chunk-FRQFU44F.mjs';import {b,a as a$1}from'./chunk-ZJYULEER.mjs';import {useState}from'react';import {jsxs,jsx}from'react/jsx-runtime';var Tr=({requestTypes:y,onSubmit:nr,onValidationError:F,title:T,description:C,submitButtonText:$,className:q="",buttonClassName:dr="",showConfirmation:pr=true,confirmationMessage:ar="Your request has been submitted successfully. You will receive a confirmation email shortly.",requireIdentityVerification:O=true,identifierTypes:D=[{id:"email",label:"Email Address"},{id:"account",label:"Account Number"},{id:"customer_id",label:"Customer ID"}],collectAdditionalContact:ur=true,labels:v={},classNames:r,unstyled:e=false,isSubmitting:A=false,defaultValues:p,onReset:I})=>{var W,J,K,Q,X,V,N,s,rr;if(!Array.isArray(y))throw new Error("[ndpr-toolkit] <DSRRequestForm requestTypes={...} /> requires an array of RequestType[]. See https://ndprtoolkit.com.ng/docs/components/dsr#requesttypes \u2014 or use the `<NDPRSubjectRights />` preset which ships sensible defaults.");let x=c(),br=(W=T!=null?T:x.dsr.title)!=null?W:"Submit a Data Subject Request",fr=(J=C!=null?C:x.dsr.description)!=null?J:"Use this form to exercise your rights under the Nigeria Data Protection Act (NDPA), Part VI.",lr=(K=$!=null?$:x.dsr.submitRequest)!=null?K:"Submit Request",[c$1,z]=useState((p==null?void 0:p.requestType)||""),[P,B]=useState(((Q=p==null?void 0:p.dataSubject)==null?void 0:Q.fullName)||""),[S,M]=useState(((X=p==null?void 0:p.dataSubject)==null?void 0:X.email)||""),[k,Z]=useState(((V=p==null?void 0:p.dataSubject)==null?void 0:V.phone)||""),[G,L]=useState(((N=p==null?void 0:p.dataSubject)==null?void 0:N.identifierType)||((s=D[0])==null?void 0:s.id)||""),[w,Y]=useState(((rr=p==null?void 0:p.dataSubject)==null?void 0:rr.identifierValue)||""),[l,j]=useState((p==null?void 0:p.additionalInfo)||{}),[_r,E]=useState(false),[d,H]=useState({}),mr=()=>{var i;z(""),B(""),M(""),Z(""),L(((i=D[0])==null?void 0:i.id)||""),Y(""),j({}),E(false),H({}),I==null||I();},a$3=y.find(i=>i.id===c$1),gr=i=>{z(i.target.value),j({});},h=(i,b$1)=>{j(_=>b(a$1({},_),{[i]:b$1}));},vr=()=>{let i={};return P.trim()||(i.fullName="Full name is required"),S.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(S)||(i.email="Email is invalid"):i.email="Email is required",c$1||(i.requestType="Please select a request type"),O&&!w.trim()&&(i.identifierValue="Identifier value is required"),a$3!=null&&a$3.requiresAdditionalInfo&&a$3.additionalFields&&a$3.additionalFields.forEach(b=>{b.required&&!l[b.id]&&(i[`additional_${b.id}`]=`${b.label} is required`);}),H(i),i},hr=i=>{i.preventDefault();let b=vr();if(Object.keys(b).length>0){F==null||F(b);return}let _=Object.keys(l).length>0?Object.fromEntries(Object.entries(l).map(([u,m])=>[u,typeof m=="string"?a$2(m):m])):void 0,R={requestType:c$1,dataSubject:{fullName:a$2(P),email:a$2(S),phone:k?a$2(k):void 0,identifierType:G,identifierValue:a$2(w)},additionalInfo:_,submittedAt:Date.now()};nr(R),pr&&E(true);},U=`ndpr-dsr-form__button ndpr-dsr-form__button--primary ${dr}`.trim(),qr="ndpr-dsr-form__button ndpr-dsr-form__button--secondary";return _r?jsxs("div",{"data-ndpr-component":"dsr-request-form","data-ndpr-state":"submitted",className:a(`ndpr-dsr-form__success${q?` ${q}`:""}`,r==null?void 0:r.successMessage,e),"aria-live":"polite",children:[jsx("h2",{className:a("ndpr-dsr-form__success-title",r==null?void 0:r.title,e),children:"Request Submitted"}),jsx("p",{className:a("ndpr-dsr-form__success-body",r==null?void 0:r.description,e),children:ar}),jsx("button",{onClick:()=>E(false),className:a(U,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),e),children:"Submit Another Request"})]}):jsxs("div",{"data-ndpr-component":"dsr-request-form",className:a(`ndpr-dsr-form${q?` ${q}`:""}`,r==null?void 0:r.root,e),children:[jsx("h2",{className:a("ndpr-dsr-form__title",r==null?void 0:r.title,e),children:br}),jsx("p",{className:a("ndpr-dsr-form__description",r==null?void 0:r.description,e),children:fr}),jsx("form",{onSubmit:hr,className:a("",r==null?void 0:r.form,e),children:jsxs("div",{className:a("ndpr-dsr-form__sections",r==null?void 0:r.fieldGroup,e),children:[jsxs("div",{children:[jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Personal Information"}),jsxs("div",{className:e?"":"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"fullName",className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.name||"Full Name"," ",jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsx("input",{type:"text",id:"fullName",value:P,onChange:i=>B(i.target.value),className:a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.fullName,"aria-describedby":d.fullName?"fullName-error":void 0}),d.fullName&&jsx("p",{id:"fullName-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.fullName})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"email",className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.email||"Email Address"," ",jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsx("input",{type:"email",id:"email",value:S,onChange:i=>M(i.target.value),className:a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.email,"aria-describedby":d.email?"email-error":void 0}),d.email&&jsx("p",{id:"email-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.email})]}),ur&&jsxs("div",{children:[jsx("label",{htmlFor:"phone",className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:"Phone Number (Optional)"}),jsx("input",{type:"tel",id:"phone",value:k,onChange:i=>Z(i.target.value),className:a("ndpr-form-field__input",r==null?void 0:r.input,e)})]})]})]}),jsxs("div",{children:[jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Request Details"}),jsxs("div",{className:e?"":"ndpr-form-field",children:[jsxs("label",{htmlFor:"requestType",className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.requestType||"Request Type"," ",jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxs("select",{id:"requestType",value:c$1,onChange:gr,className:a("ndpr-form-field__select",r==null?void 0:r.select,e),required:true,"aria-required":"true","aria-invalid":!!d.requestType,"aria-describedby":d.requestType?"requestType-error":void 0,children:[jsx("option",{value:"",children:"Select a request type"}),y.map(i=>jsx("option",{value:i.id,children:i.name},i.id))]}),d.requestType&&jsx("p",{id:"requestType-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.requestType})]}),a$3&&jsxs("div",{className:e?"":"ndpr-dsr-form__type-info",children:[jsx("p",{children:a$3.description}),jsxs("p",{children:["Estimated completion time: ",a$3.estimatedCompletionTime," ",a$3.estimatedCompletionTime===1?"day":"days"]})]}),jsxs("div",{className:e?"":"ndpr-form-field",children:[jsx("label",{htmlFor:"requestDescription",className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:v.description||"Additional Information"}),jsx("textarea",{id:"requestDescription",className:a("ndpr-form-field__textarea",r==null?void 0:r.textarea,e),rows:4,placeholder:"Please provide any additional details that might help us process your request"})]})]}),O&&jsxs("div",{children:[jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Identity Verification"}),jsx("p",{className:e?"":"ndpr-form-section__hint",children:"To protect your privacy, we need to verify your identity before processing your request."}),jsxs("div",{className:e?"":"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"identifierType",className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:["Identifier Type ",jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsx("select",{id:"identifierType",value:G,onChange:i=>L(i.target.value),className:a("ndpr-form-field__select",r==null?void 0:r.select,e),required:true,"aria-required":"true",children:D.map(i=>jsx("option",{value:i.id,children:i.label},i.id))})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"identifierValue",className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:["Identifier Value ",jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsx("input",{type:"text",id:"identifierValue",value:w,onChange:i=>Y(i.target.value),className:a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.identifierValue,"aria-describedby":d.identifierValue?"identifierValue-error":void 0}),d.identifierValue&&jsx("p",{id:"identifierValue-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.identifierValue})]})]})]}),(a$3==null?void 0:a$3.requiresAdditionalInfo)&&a$3.additionalFields&&a$3.additionalFields.length>0&&jsxs("div",{children:[jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Additional Information"}),jsx("div",{className:e?"":"ndpr-form-section",children:a$3.additionalFields.map(i=>{var b,_,R;return jsxs("div",{children:[jsxs("label",{htmlFor:i.id,className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[i.label," ",i.required&&jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),i.type==="text"&&jsx("input",{type:"text",id:i.id,value:String((b=l[i.id])!=null?b:""),onChange:u=>h(i.id,u.target.value),placeholder:i.placeholder,className:a("ndpr-form-field__input",r==null?void 0:r.input,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),i.type==="textarea"&&jsx("textarea",{id:i.id,value:String((_=l[i.id])!=null?_:""),onChange:u=>h(i.id,u.target.value),placeholder:i.placeholder,className:a("ndpr-form-field__textarea",r==null?void 0:r.textarea,e),rows:4,required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),i.type==="select"&&i.options&&jsxs("select",{id:i.id,value:String((R=l[i.id])!=null?R:""),onChange:u=>h(i.id,u.target.value),className:a("ndpr-form-field__select",r==null?void 0:r.select,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0,children:[jsx("option",{value:"",children:i.placeholder||"Select an option"}),i.options.map(u=>jsx("option",{value:u,children:u},u))]}),i.type==="checkbox"&&jsxs("div",{className:e?"":"ndpr-form-field__checkbox-row",children:[jsx("input",{type:"checkbox",id:i.id,checked:!!l[i.id],onChange:u=>h(i.id,u.target.checked),className:e?"":"ndpr-form-field__checkbox",required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),jsx("label",{htmlFor:i.id,className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:i.placeholder||i.label})]}),i.type==="file"&&jsx("input",{type:"file",id:i.id,onChange:u=>{var ir;let m=(ir=u.target.files)==null?void 0:ir[0];m&&h(i.id,m.name);},className:a("ndpr-form-field__input",r==null?void 0:r.input,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),d[`additional_${i.id}`]&&jsx("p",{id:`additional-${i.id}-error`,role:"alert",className:e?"":"ndpr-form-field__error",children:d[`additional_${i.id}`]})]},i.id)})})]}),jsxs("div",{className:e?"":"ndpr-dsr-form__notice",children:[jsx("h3",{className:e?"":"ndpr-dsr-form__notice-title",children:"Privacy Notice"}),jsx("p",{className:e?"":"ndpr-dsr-form__notice-body",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:e?"":"ndpr-dsr-form__actions",children:[A&&(r==null?void 0:r.loadingOverlay)&&jsx("div",{className:r.loadingOverlay}),jsx("button",{type:"submit",disabled:A,className:a(U,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),e),children:A?"Submitting...":v.submit||lr}),jsx("button",{type:"button",onClick:mr,className:a(qr,void 0,e),children:"Reset"})]})]})})]})};
|
|
2
2
|
export{Tr as a};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import {a}from'./chunk-ITCY2Z66.mjs';import {a as a$1}from'./chunk-SFGW37LE.mjs';import {c}from'./chunk-FRQFU44F.mjs';import T,{useMemo}from'react';import {jsxs,jsx}from'react/jsx-runtime';var G=({result:s,sections:c$1,showFullReport:g=true,allowPrint:v=true,allowExport:f=true,onExport:b,className:w="",buttonClassName:x="",classNames:h={},unstyled:k=false})=>{var I;let N=(I=c().dpia.reportTitle)!=null?I:"Data Protection Impact Assessment Report",m=useMemo(()=>new Date().toLocaleDateString(),[]),r=(a,n)=>{let i=n?h[n]:void 0;return !i&&n==="printButton"&&(i=h.primaryButton),a$1(a,i,k)},o=a=>new Date(a).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}),R=a=>{let n=s.answers[a];return n==null?"Not answered":typeof n=="boolean"?n?"Yes":"No":Array.isArray(n)?n.join(", "):String(n)},p=()=>{window.print();},u=a=>{b&&b(a);},A=a=>jsx("span",{className:r(`px-2 py-1 rounded text-xs font-medium ${{low:"ndpr-badge ndpr-badge--success",medium:"ndpr-badge ndpr-badge--warning",high:"ndpr-badge ndpr-badge--warning",critical:"ndpr-badge ndpr-badge--destructive"}[a]}`,"riskBadge"),children:a.charAt(0).toUpperCase()+a.slice(1)});return jsxs("div",{"data-ndpr-component":"dpia-report",className:`${r("bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 print:shadow-none print:p-0","root")} ${w}`,children:[jsxs("div",{className:r("mb-8 border-b border-gray-200 dark:border-gray-700 pb-6 print:pb-4","header"),children:[jsxs("div",{className:"flex justify-between items-start",children:[jsxs("div",{children:[jsx("h1",{className:r("ndpr-card__title","title"),children:N}),jsx("h2",{className:"text-xl ndpr-text-muted mb-4",children:s.title})]}),(v||f)&&jsxs("div",{className:"flex space-x-2 print:hidden",children:[v&&jsx("button",{onClick:p,className:`${r("px-3 py-1 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600","printButton")} ${x}`,children:jsxs("span",{className:"flex items-center",children:[jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"})}),"Print"]})}),f&&jsx("div",{className:"relative inline-block",children:jsx("button",{onClick:()=>u("pdf"),className:`px-3 py-1 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${x}`,children:jsxs("span",{className:"flex items-center",children:[jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Export PDF"]})})})]})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[jsxs("div",{children:[jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Assessor:"})," ",s.assessor.name,", ",s.assessor.role]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Contact:"})," ",s.assessor.email]})]}),jsxs("div",{children:[jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Started:"})," ",o(s.startedAt)]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Completed:"})," ",s.completedAt?o(s.completedAt):"In progress"]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Next review:"})," ",s.reviewDate?o(s.reviewDate):"Not scheduled"]})]})]})]}),jsxs("div",{className:r("mb-8","summary"),children:[jsx("h2",{className:"ndpr-section-heading",children:"Executive Summary"}),jsxs("div",{className:"ndpr-panel",children:[jsxs("div",{className:"flex items-center mb-2",role:"status","aria-live":"polite",children:[jsx("span",{className:"font-medium mr-2",children:"Overall Risk Level:"}),A(s.overallRiskLevel)]}),jsxs("div",{className:r("mb-2","conclusion"),children:[jsx("span",{className:"font-medium",children:"Conclusion:"})," ",s.conclusion]}),jsxs("div",{role:"status","aria-live":"polite",children:[jsx("span",{className:"font-medium",children:"Can Proceed:"})," ",s.canProceed?"Yes":"No"]})]}),jsxs("div",{children:[jsx("h3",{className:"font-medium ndpr-text-foreground mb-2",children:"Processing Activity Description"}),jsx("p",{className:"ndpr-text-muted mb-4",children:s.processingDescription}),s.recommendations&&s.recommendations.length>0&&jsxs("div",{children:[jsx("h3",{className:"font-medium ndpr-text-foreground mb-2",children:"Key Recommendations"}),jsx("ul",{className:"list-disc pl-5 ndpr-text-muted",children:s.recommendations.map((a,n)=>jsx("li",{className:r("","recommendation"),children:a},n))})]})]})]}),jsxs("div",{className:"mb-8",children:[jsx("h2",{className:"ndpr-section-heading",children:"Identified Risks"}),s.risks.length===0?jsx("p",{className:"ndpr-text-muted",children:"No risks identified."}):jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:r("min-w-full divide-y divide-gray-200 dark:divide-gray-700","riskTable"),children:[jsx("thead",{className:"ndpr-panel",children:jsxs("tr",{children:[jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Risk"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Likelihood"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Impact"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Risk Level"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Mitigated"})]})}),jsx("tbody",{className:"ndpr-table",children:s.risks.map(a=>jsxs("tr",{className:r("","riskRow"),children:[jsx("td",{className:"ndpr-table__cell",children:a.description}),jsxs("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:[a.likelihood," / 5"]}),jsxs("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:[a.impact," / 5"]}),jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:A(a.level)}),jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:a.mitigated?jsx("span",{className:"ndpr-text-success",children:"Yes"}):jsx("span",{className:"ndpr-text-destructive",children:"No"})})]},a.id))})]})})]}),g&&jsxs("div",{children:[jsx("h2",{className:"ndpr-section-heading",children:"Full Assessment Details"}),c$1.map(a=>{let n=a.questions.filter(i=>s.answers[i.id]!==void 0);return n.length===0?null:jsxs("div",{className:"mb-6",children:[jsx("h3",{className:"text-lg font-medium ndpr-text-foreground mb-2",children:a.title}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[jsx("thead",{className:"ndpr-panel",children:jsxs("tr",{children:[jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Question"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Answer"})]})}),jsx("tbody",{className:"ndpr-table",children:n.map(i=>jsxs("tr",{children:[jsx("td",{className:"ndpr-table__cell",children:i.text}),jsx("td",{className:"px-6 py-4 whitespace-normal text-sm ndpr-text-muted",children:R(i.id)})]},i.id))})]})})]},a.id)})]}),jsxs("div",{className:"mt-8 pt-4 border-t border-gray-200 dark:border-gray-700 text-sm ndpr-text-muted",children:[jsx("p",{children:"This DPIA was conducted in accordance with NDPA 2023 Section 28."}),jsxs("p",{children:["DPIA Report Version: ",s.version]}),jsxs("p",{children:["Generated on: ",m]}),jsx("p",{className:"mt-2 italic",role:"note",children:a})]})]})};var Y=({steps:s,onStepClick:c,clickable:g=true,orientation:v="horizontal",className:f="",activeStepClassName:b="",completedStepClassName:w="",incompleteStepClassName:x="",classNames:h={},unstyled:k=false})=>{let d=(r,o)=>a$1(r,o?h[o]:void 0,k),N=r=>{g&&c&&c(r);},m=v==="vertical";return jsx("div",{"data-ndpr-component":"dpia-step-indicator",role:"navigation","aria-label":"Step progress",className:`${d(m?"flex flex-col space-y-4":"flex items-center justify-between","root")} ${f}`,children:s.map((r,o)=>{let C=o===s.length-1,D=r.active?d(`font-medium ${b||"ndpr-text-primary"}`,"label"):r.completed?d(w||"ndpr-text-success","label"):d(x||"ndpr-card__subtitle","label"),R=r.active?d("flex items-center justify-center w-8 h-8 rounded-full bg-[rgb(var(--ndpr-primary)/0.1)] dark:bg-[rgb(var(--ndpr-primary)/0.2)] ndpr-text-primary border-2 border-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]","stepActive"):r.completed?d("flex items-center justify-center w-8 h-8 rounded-full bg-green-100 dark:bg-green-900 ndpr-text-success border-2 border-green-600 dark:border-green-400","stepCompleted"):d("flex items-center justify-center w-8 h-8 rounded-full bg-gray-100 dark:bg-gray-700 ndpr-text-muted border-2 border-gray-300 dark:border-gray-600","stepPending"),p=g&&!!c;return jsxs(T.Fragment,{children:[jsxs("div",{className:d(`${m?"flex items-start":"flex flex-col items-center"} ${g?"cursor-pointer":""}`,"step"),role:p?"button":void 0,tabIndex:p?0:void 0,"aria-label":p?`Go to step ${o+1}: ${r.label}`:void 0,onClick:p?()=>N(r.id):void 0,onKeyDown:p?u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),N(r.id));}:void 0,"aria-current":r.active?"step":void 0,children:[jsx("div",{className:`
|
|
2
|
+
flex items-center justify-center
|
|
3
|
+
${m?"mr-4":""}
|
|
4
|
+
`,children:jsx("div",{className:R,children:r.icon?r.icon:r.completed?jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}):jsx("span",{children:o+1})})}),jsxs("div",{className:`
|
|
5
|
+
${m?"flex-1":"mt-2 text-center"}
|
|
6
|
+
`,children:[jsx("div",{className:`text-sm font-medium ${D}`,children:r.label}),r.description&&jsx("div",{className:"ndpr-form-field__hint",children:r.description})]})]}),!C&&jsx("div",{className:d(m?"ml-4 h-8 border-l-2 border-gray-300 dark:border-gray-600":"w-full border-t-2 border-gray-300 dark:border-gray-600 hidden sm:block","connector")})]},r.id)})})};export{G as a,Y as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {b}from'./chunk-VPNK7OID.mjs';import {a}from'./chunk-SFGW37LE.mjs';import {c}from'./chunk-FRQFU44F.mjs';import {useState,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var pe=({requests:w,onSelectRequest:I,onUpdateStatus:j,onAssignRequest:C,title:V,description:M,className:X="",buttonClassName:L="",showRequestDetails:Z=true,showRequestTimeline:ee=true,showDeadlineAlerts:U=true,assignees:i=[],classNames:l,unstyled:R=false})=>{var u,v;let E=c(),te=(u=V!=null?V:E.dsr.dashboardTitle)!=null?u:"Data Subject Request Dashboard",_=(v=M!=null?M:E.dsr.dashboardDescription)!=null?v:"Track and manage data subject requests in compliance with NDPA Part IV requirements.",[f,y]=useState(null),[D,q]=useState(w),[T,K]=useState("all"),[P,$]=useState("all"),[A,H]=useState(""),[F,ae]=useState("createdAt"),[W,de]=useState("desc"),[S,re]=useState("");useEffect(()=>{let e=[...w];if(T!=="all"&&(e=e.filter(r=>r.status===T)),P!=="all"&&(e=e.filter(r=>r.type===P)),A){let r=A.toLowerCase();e=e.filter(p=>p.subject.name.toLowerCase().includes(r)||p.subject.email.toLowerCase().includes(r)||p.description&&p.description.toLowerCase().includes(r));}e.sort((r,p)=>{let h=0;switch(F){case "createdAt":h=r.createdAt-p.createdAt;break;case "dueDate":h=(r.dueDate||0)-(p.dueDate||0);break;case "type":h=r.type.localeCompare(p.type);break;case "status":h=r.status.localeCompare(p.status);break;default:h=r.createdAt-p.createdAt;}return W==="asc"?h:-h}),q(e);},[w,T,P,A,F,W]),useEffect(()=>{D.length>0&&(f&&D.some(r=>r.id===f)||y(D[0].id));},[D,f]);let J=e=>{y(e),I&&I(e);},Y=e=>{f&&j&&j(f,e);},ie=()=>{f&&S&&C&&(C(f,S),re(""));},k=e=>new Date(e).toLocaleDateString(),z=e=>{let r=Date.now(),p=(e-r)/(1440*60*1e3);return Math.ceil(p)},m=f?w.find(e=>e.id===f):null,B=e=>{let r={information:"bg-teal-100 text-teal-800 dark:bg-teal-900 dark:text-teal-200",access:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",rectification:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",erasure:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",restriction:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",portability:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",objection:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",automated_decision_making:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200",withdraw_consent:"bg-pink-100 text-pink-800 dark:bg-pink-900 dark:text-pink-200"},p={information:"Information",access:"Access",rectification:"Rectification",erasure:"Erasure",restriction:"Restriction",portability:"Portability",objection:"Objection",automated_decision_making:"Automated Decision-Making",withdraw_consent:"Withdraw Consent"};return jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${r[e]}`,children:p[e]})},O=e=>jsx("span",{className:a(`px-2 py-1 rounded text-xs font-medium ${{pending:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",inProgress:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",completed:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",rejected:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",awaitingVerification:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200"}[e]}`,l==null?void 0:l.statusBadge,R),children:e==="inProgress"?"In Progress":e==="awaitingVerification"?"Awaiting Verification":e.charAt(0).toUpperCase()+e.slice(1)}),t=e=>{if(!e.dueDate)return null;let r=z(e.dueDate);return r<=0?jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-md",role:"alert","aria-live":"polite",children:[jsx("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium",children:"Deadline Passed"}),jsx("p",{className:"text-xs text-red-700 dark:text-red-300 mt-1",children:"The response deadline has passed. Immediate action is required."})]}):r<=3?jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-md",role:"alert","aria-live":"polite",children:[jsx("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium",children:"Urgent: Deadline Approaching"}),jsxs("p",{className:"text-xs text-red-700 dark:text-red-300 mt-1",children:["Only ",r," day",r!==1?"s":""," remaining until the response deadline."]})]}):r<=7?jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md","aria-live":"polite",children:[jsx("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 font-medium",children:"Deadline Approaching"}),jsxs("p",{className:"text-xs text-yellow-700 dark:text-yellow-300 mt-1",children:[r," days remaining until the response deadline."]})]}):jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-md","aria-live":"polite",children:[jsx("p",{className:"text-sm text-green-800 dark:text-green-200 font-medium",children:"Deadline Tracking"}),jsxs("p",{className:"text-xs text-green-700 dark:text-green-300 mt-1",children:[r," days remaining until the response deadline."]})]})},s=e=>{let r=[{title:"Request Received",date:e.createdAt,completed:true,description:`Request was received on ${k(e.createdAt)}.`}];return e.verifiedAt?r.push({title:"Identity Verified",date:e.verifiedAt,completed:true,description:`Data subject's identity was verified on ${k(e.verifiedAt)}.`}):e.status==="awaitingVerification"&&r.push({title:"Identity Verification",date:Date.now(),completed:false,description:"Awaiting verification of data subject's identity."}),(e.status==="inProgress"||e.status==="completed"||e.status==="rejected")&&r.push({title:"Processing Started",date:e.updatedAt,completed:true,description:`Request processing started on ${k(e.updatedAt)}.`}),e.status==="completed"?r.push({title:"Request Completed",date:e.completedAt||Date.now(),completed:true,description:`Request was completed on ${k(e.completedAt||Date.now())}.`}):e.status==="rejected"&&r.push({title:"Request Rejected",date:e.completedAt||Date.now(),completed:true,description:`Request was rejected on ${k(e.completedAt||Date.now())}.${e.rejectionReason?` Reason: ${e.rejectionReason}`:""}`}),e.dueDate&&r.push({title:"Response Deadline",date:e.dueDate,completed:Date.now()>e.dueDate,description:`Response is due by ${k(e.dueDate)}.`}),jsxs("div",{className:"mt-6",children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Request Timeline"}),jsx("ol",{className:"relative border-l border-gray-200 dark:border-gray-700",children:r.map((p,h)=>jsxs("li",{className:"mb-6 ml-4",children:[jsx("div",{className:`absolute w-3 h-3 rounded-full mt-1.5 -left-1.5 border ${p.completed?"bg-green-500 border-green-500 dark:border-green-500":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700"}`}),jsx("time",{className:"mb-1 text-sm font-normal leading-none text-gray-600 dark:text-gray-500",children:p.date?k(p.date):"Pending"}),jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:p.title}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:p.description})]},h))})]})},g=()=>[{value:"all",label:"All Types"},{value:"information",label:"Information (NDPA Section 27)"},{value:"access",label:"Access (NDPA Section 34(1)(a))"},{value:"rectification",label:"Rectification (NDPA Section 34(1)(c))"},{value:"erasure",label:"Erasure (NDPA Section 34(1)(d))"},{value:"restriction",label:"Restriction (NDPA Section 34(1)(e))"},{value:"portability",label:"Portability (NDPA Section 38)"},{value:"objection",label:"Objection (NDPA Section 36)"},{value:"automated_decision_making",label:"Automated Decision-Making (NDPA Section 37)"},{value:"withdraw_consent",label:"Withdraw Consent (NDPA Section 35)"}].map(r=>jsx("option",{value:r.value,children:r.label},r.value)),x=()=>[{value:"all",label:"All Statuses"},{value:"pending",label:"Pending"},{value:"awaitingVerification",label:"Awaiting Verification"},{value:"inProgress",label:"In Progress"},{value:"completed",label:"Completed"},{value:"rejected",label:"Rejected"}].map(r=>jsx("option",{value:r.value,children:r.label},r.value)),o=()=>[{value:"pending",label:"Pending"},{value:"awaitingVerification",label:"Awaiting Verification"},{value:"inProgress",label:"In Progress"},{value:"completed",label:"Completed"},{value:"rejected",label:"Rejected"}].map(r=>jsx("option",{value:r.value,children:r.label},r.value));return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${X}`,l==null?void 0:l.root,R),children:[jsxs("div",{className:a("",l==null?void 0:l.header,R),children:[jsx("h2",{className:a("text-xl font-bold mb-2",l==null?void 0:l.title,R),children:te}),jsx("p",{className:"mb-6 text-gray-600 dark:text-gray-300",children:_})]}),jsxs("div",{className:a("mb-6 grid grid-cols-1 md:grid-cols-4 gap-4",l==null?void 0:l.filters,R),children:[jsxs("div",{children:[jsx("label",{htmlFor:"statusFilter",className:"block text-sm font-medium mb-1",children:"Status Filter"}),jsx("select",{id:"statusFilter",value:T,onChange:e=>K(e.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:x()})]}),jsxs("div",{children:[jsx("label",{htmlFor:"typeFilter",className:"block text-sm font-medium mb-1",children:"Request Type Filter"}),jsx("select",{id:"typeFilter",value:P,onChange:e=>$(e.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:g()})]}),jsxs("div",{children:[jsx("label",{htmlFor:"sortBy",className:"block text-sm font-medium mb-1",children:"Sort By"}),jsxs("select",{id:"sortBy",value:F,onChange:e=>ae(e.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:[jsx("option",{value:"createdAt",children:"Date Received"}),jsx("option",{value:"dueDate",children:"Due Date"}),jsx("option",{value:"type",children:"Request Type"}),jsx("option",{value:"status",children:"Status"})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"searchTerm",className:"block text-sm font-medium mb-1",children:"Search"}),jsx("input",{type:"text",id:"searchTerm",value:A,onChange:e=>H(e.target.value),placeholder:"Search requests...",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[jsxs("div",{className:"md:col-span-1",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"DSR Requests"}),D.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data subject requests found."}):jsx("div",{className:a("space-y-2 max-h-96 overflow-y-auto pr-2",l==null?void 0:l.requestList,R),children:D.map(e=>{let r=e.dueDate?z(e.dueDate):null,p=null;return r!==null&&(r<=0?p=jsx("span",{className:"text-xs text-red-600 dark:text-red-400 font-bold",children:"Overdue"}):r<=3?p=jsx("span",{className:"text-xs text-red-600 dark:text-red-400",children:"Urgent"}):r<=7&&(p=jsx("span",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:"Soon"}))),jsxs("div",{role:"button",tabIndex:0,"aria-label":`View request from ${e.subject.name}`,"aria-selected":f===e.id,className:a(`p-3 rounded-md cursor-pointer ${f===e.id?"bg-[rgb(var(--ndpr-primary)/0.05)] dark:bg-[rgb(var(--ndpr-primary)/0.1)] border border-[rgb(var(--ndpr-primary)/0.2)] dark:border-[rgb(var(--ndpr-primary)/0.3)]":"bg-gray-50 dark:bg-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600"}`,l==null?void 0:l.requestItem,R),onClick:()=>J(e.id),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),J(e.id));},children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx("h4",{className:"font-medium text-sm",children:e.subject.name}),B(e.type)]}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:e.subject.email}),jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:["Received: ",k(e.createdAt)]}),jsxs("div",{className:"flex justify-between items-center mt-2",children:[jsx("div",{children:O(e.status)}),jsx("div",{children:p})]})]},e.id)})})]}),jsx("div",{className:a("md:col-span-2",l==null?void 0:l.detailPanel,R),children:m?jsxs("div",{children:[jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsx("h3",{className:"text-lg font-medium",children:m.subject.name}),jsxs("div",{className:"flex space-x-2",children:[B(m.type),O(m.status)]})]}),U&&m.dueDate&&jsx("div",{className:"mb-4",children:t(m)}),Z&&jsxs("div",{className:"mb-6",children:[jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[jsxs("div",{children:[jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Email:"})," ",m.subject.email]}),m.subject.phone&&jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Phone:"})," ",m.subject.phone]}),jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Received:"})," ",k(m.createdAt)]})]}),jsxs("div",{children:[jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Request Type:"})," ",{information:"Information",access:"Access",rectification:"Rectification",erasure:"Erasure",restriction:"Restriction",portability:"Portability",objection:"Objection",automated_decision_making:"Automated Decision-Making"}[m.type]||m.type]}),jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Status:"})," ",m.status==="inProgress"?"In Progress":m.status==="awaitingVerification"?"Awaiting Verification":m.status.charAt(0).toUpperCase()+m.status.slice(1)]}),m.dueDate&&jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Due Date:"})," ",k(m.dueDate)]})]})]}),m.description&&jsxs("div",{className:"mb-4",children:[jsx("p",{className:"text-sm font-medium",children:"Request Details:"}),jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-700 p-2 rounded-md mt-1",children:m.description})]}),m.additionalInfo&&jsxs("div",{children:[jsx("p",{className:"text-sm font-medium",children:"Additional Information:"}),jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-700 p-2 rounded-md mt-1",children:typeof m.additionalInfo=="object"?JSON.stringify(m.additionalInfo,null,2):String(m.additionalInfo||"No additional information provided")})]})]}),jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("h3",{id:"update-status-heading",className:"text-md font-medium mb-2",children:"Update Status"}),jsxs("div",{className:"flex space-x-2",children:[jsx("select",{"aria-label":"Update request status",value:m.status,onChange:e=>Y(e.target.value),className:"flex-grow px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:o()}),jsx("button",{onClick:()=>Y(m.status),"aria-label":"Apply status update",className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${L}`,children:"Update"})]})]}),i.length>0&&jsxs("div",{children:[jsx("h3",{id:"assign-request-heading",className:"text-md font-medium mb-2",children:"Assign Request"}),jsxs("div",{className:"flex space-x-2",children:[jsxs("select",{"aria-label":"Select assignee",value:S,onChange:e=>re(e.target.value),className:"flex-grow px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:[jsx("option",{value:"",children:"Select Assignee"}),i.map(e=>jsx("option",{value:e,children:e},e))]}),jsx("button",{onClick:ie,disabled:!S,"aria-label":"Assign request to selected person",className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] disabled:bg-gray-300 disabled:text-gray-500 ${L}`,children:"Assign"})]})]})]}),jsxs("div",{className:"mb-6",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Request Summary"}),jsx("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-md",children:jsx("pre",{className:"whitespace-pre-wrap text-sm font-mono text-gray-800 dark:text-gray-200",children:jsx("pre",{children:JSON.stringify(b(m),null,2)})})})]}),ee&&s(m)]}):jsx("div",{className:"flex items-center justify-center h-64 bg-gray-50 dark:bg-gray-700 rounded-md",children:jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Select a request to view details"})})})]})]})};var ke=({requests:w,onSelectRequest:I,title:j,description:C,className:V="",buttonClassName:M="",showSummaryStats:X=true,showTypeBreakdown:L=true,showStatusBreakdown:Z=true,showTimelineChart:ee=true,showOverdueRequests:U=true,classNames:i,unstyled:l=false})=>{var B,O;let R=c(),E=(B=j!=null?j:R.dsr.trackerTitle)!=null?B:"DSR Request Tracker",te=(O=C!=null?C:R.dsr.trackerDescription)!=null?O:"Track the status and progress of data subject requests as required by NDPA Part IV.",[_,f]=useState("30days"),[y,D]=useState(w),[q,T]=useState([]),[K,P]=useState([]);useEffect(()=>{let t=Date.now(),s;switch(_){case "7days":s=w.filter(o=>t-o.createdAt<=10080*60*1e3);break;case "30days":s=w.filter(o=>t-o.createdAt<=720*60*60*1e3);break;case "90days":s=w.filter(o=>t-o.createdAt<=2160*60*60*1e3);break;default:s=[...w];}D(s);let g=s.filter(o=>o.dueDate&&t>o.dueDate&&o.status!=="completed"&&o.status!=="rejected");T(g);let x=s.filter(o=>o.dueDate&&t<o.dueDate&&o.dueDate-t<=10080*60*1e3&&o.status!=="completed"&&o.status!=="rejected");P(x);},[w,_]);let $=t=>{I&&I(t);},A=t=>new Date(t).toLocaleDateString(),H=t=>{let s=Date.now(),g=(t-s)/(1440*60*1e3);return Math.ceil(g)},F=()=>{let t=y.filter(g=>g.status==="completed"&&g.completedAt&&g.createdAt);if(t.length===0)return null;let s=t.reduce((g,x)=>{let o=((x.completedAt||0)-x.createdAt)/864e5;return g+o},0);return Number((s/t.length).toFixed(1))},ae=()=>{let t=y.filter(g=>(g.status==="completed"||g.status==="rejected")&&g.completedAt&&g.dueDate);if(t.length===0)return null;let s=t.filter(g=>(g.completedAt||0)<=(g.dueDate||0));return Math.round(s.length/t.length*100)},W=()=>{let t={};return y.forEach(s=>{t[s.type]=(t[s.type]||0)+1;}),{information:t.information||0,access:t.access||0,rectification:t.rectification||0,erasure:t.erasure||0,restriction:t.restriction||0,portability:t.portability||0,objection:t.objection||0,automated_decision_making:t.automated_decision_making||0,withdraw_consent:t.withdraw_consent||0}},de=()=>{let t={};return y.forEach(s=>{t[s.status]=(t[s.status]||0)+1;}),{pending:t.pending||0,awaitingVerification:t.awaitingVerification||0,inProgress:t.inProgress||0,completed:t.completed||0,rejected:t.rejected||0}},S=t=>{let s={information:"bg-teal-100 text-teal-800 dark:bg-teal-900 dark:text-teal-200",access:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",rectification:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",erasure:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",restriction:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",portability:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",objection:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",automated_decision_making:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200",withdraw_consent:"bg-pink-100 text-pink-800 dark:bg-pink-900 dark:text-pink-200"},g={information:"Information",access:"Access",rectification:"Rectification",erasure:"Erasure",restriction:"Restriction",portability:"Portability",objection:"Objection",automated_decision_making:"Automated Decision-Making",withdraw_consent:"Withdraw Consent"};return jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${s[t]}`,children:g[t]})},J=()=>{let t=y.length,s=y.filter(u=>u.status!=="completed"&&u.status!=="rejected").length;y.filter(u=>u.status==="completed"||u.status==="rejected").length;let x=F(),o=ae();return jsxs("div",{className:a("grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",i==null?void 0:i.stats,l),children:[jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",i==null?void 0:i.statCard,l),children:[jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Total Requests"}),jsx("p",{className:"text-2xl font-bold",children:t})]}),jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",i==null?void 0:i.statCard,l),children:[jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Pending Requests"}),jsx("p",{className:"text-2xl font-bold",children:s})]}),jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",i==null?void 0:i.statCard,l),children:[jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Avg. Response Time"}),jsx("p",{className:"text-2xl font-bold",children:x!==null?`${x} days`:"N/A"})]}),jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",i==null?void 0:i.statCard,l),children:[jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Compliance Rate"}),jsx("p",{className:"text-2xl font-bold",children:o!==null?`${o}%`:"N/A"})]})]})},Y=()=>{let t=W(),s=y.length,g=Object.entries(t).sort(([,x],[,o])=>o-x).map(([x])=>x);return jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",i==null?void 0:i.table,l),children:[jsx("h3",{className:a("text-lg font-medium mb-4",i==null?void 0:i.tableHeader,l),children:"Request Types"}),s===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data available for the selected timeframe."}):jsx("div",{className:"space-y-4",children:g.map(x=>{let o=t[x],u=Math.round(o/s*100);return jsxs("div",{children:[jsxs("div",{className:"flex justify-between items-center mb-1",children:[jsxs("div",{className:"flex items-center",children:[S(x),jsxs("span",{className:"ml-2 text-sm",children:[o," requests"]})]}),jsxs("span",{className:"text-sm font-medium",children:[u,"%"]})]}),jsx("div",{className:"w-full bg-gray-200 dark:bg-gray-600 rounded-full h-2.5",children:jsx("div",{className:"bg-[rgb(var(--ndpr-primary))] h-2.5 rounded-full",style:{width:`${u}%`}})})]},x)})})]})},ie=()=>{let t=de(),s=y.length,g=["pending","awaitingVerification","inProgress","completed","rejected"],x={pending:"bg-yellow-500",awaitingVerification:"bg-purple-500",inProgress:"bg-blue-500",completed:"bg-green-500",rejected:"bg-red-500"};return jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",i==null?void 0:i.table,l),children:[jsx("h3",{className:a("text-lg font-medium mb-4",i==null?void 0:i.tableHeader,l),children:"Request Status"}),s===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data available for the selected timeframe."}):jsxs("div",{children:[jsx("div",{className:"flex h-4 mb-2",children:g.map(o=>{let u=t[o],v=u/s*100;return v>0?jsx("div",{className:`${x[o]} first:rounded-l-full last:rounded-r-full`,style:{width:`${v}%`},title:`${o}: ${u} (${Math.round(v)}%)`},o):null})}),jsx("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-2 mt-4",children:g.map(o=>{let u=t[o],v=Math.round(u/s*100);return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:`w-3 h-3 rounded-full ${x[o]} mr-2`}),jsxs("div",{children:[jsx("p",{className:"text-xs font-medium",children:o==="inProgress"?"In Progress":o==="awaitingVerification"?"Awaiting Verification":o.charAt(0).toUpperCase()+o.slice(1)}),jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:[u," (",v,"%)"]})]})]},o)})})]})]})},k=()=>{let t={};y.forEach(u=>{let v=new Date(u.createdAt),e=`${v.getFullYear()}-${String(v.getMonth()+1).padStart(2,"0")}`;t[e]=(t[e]||0)+1;});let g=Object.keys(t).sort().slice(-6),x=Math.max(...Object.values(t).filter(u=>u>0),1),o=u=>{let[v,e]=u.split("-");return `${e}/${v.slice(2)}`};return jsxs("div",{className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Request Timeline"}),g.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data available for the selected timeframe."}):jsxs("div",{className:"h-40",children:[jsx("div",{className:"flex h-32 items-end justify-between space-x-2",children:g.map(u=>{let v=t[u],e=`${v/x*100}%`;return jsx("div",{className:"flex flex-col items-center flex-1",children:jsx("div",{className:"w-full bg-[rgb(var(--ndpr-primary))] rounded-t",style:{height:e},title:`${o(u)}: ${v} requests`})},u)})}),jsx("div",{className:"flex justify-between mt-2",children:g.map(u=>jsx("div",{className:"text-xs text-center",children:o(u)},u))})]})]})},z=()=>jsxs("div",{className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6","aria-live":"polite",children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Overdue Requests"}),q.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No overdue requests."}):jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:q.map(t=>jsxs("div",{role:"button",tabIndex:0,"aria-label":`View overdue request from ${t.subject.name}`,className:a("p-3 bg-red-50 dark:bg-red-900/20 rounded-md cursor-pointer hover:bg-red-100 dark:hover:bg-red-900/30",i==null?void 0:i.tableRow,l),onClick:()=>$(t.id),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),$(t.id));},children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx("h4",{className:"font-medium text-sm",children:t.subject.name}),S(t.type)]}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:t.subject.email}),jsxs("div",{className:"flex justify-between items-center",children:[jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:["Due: ",A(t.dueDate||0)]}),jsxs("p",{className:"text-xs font-bold text-red-600 dark:text-red-400",children:["Overdue by ",Math.abs(H(t.dueDate||0))," days"]})]})]},t.id))})]}),m=()=>jsxs("div",{className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6","aria-live":"polite",children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Upcoming Deadlines"}),K.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No upcoming deadlines in the next 7 days."}):jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:K.map(t=>{let s=H(t.dueDate||0);return jsxs("div",{role:"button",tabIndex:0,"aria-label":`View upcoming deadline for ${t.subject.name}`,className:a("p-3 bg-yellow-50 dark:bg-yellow-900/20 rounded-md cursor-pointer hover:bg-yellow-100 dark:hover:bg-yellow-900/30",i==null?void 0:i.tableRow,l),onClick:()=>$(t.id),onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),$(t.id));},children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx("h4",{className:"font-medium text-sm",children:t.subject.name}),S(t.type)]}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:t.subject.email}),jsxs("div",{className:"flex justify-between items-center",children:[jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:["Due: ",A(t.dueDate||0)]}),jsxs("p",{className:`text-xs font-bold ${s<=3?"text-red-600 dark:text-red-400":"text-yellow-600 dark:text-yellow-400"}`,children:["Due in ",s," days"]})]})]},t.id)})})]});return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${V}`,i==null?void 0:i.root,l),children:[jsxs("div",{className:a("flex flex-col md:flex-row md:justify-between md:items-center mb-6",i==null?void 0:i.header,l),children:[jsxs("div",{children:[jsx("h2",{className:a("text-xl font-bold mb-2",i==null?void 0:i.title,l),children:E}),jsx("p",{className:"text-gray-600 dark:text-gray-300",children:te})]}),jsxs("div",{className:"mt-4 md:mt-0",children:[jsx("label",{htmlFor:"timeframe",className:"block text-sm font-medium mb-1",children:"Timeframe"}),jsxs("select",{id:"timeframe",value:_,onChange:t=>f(t.target.value),className:"px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:[jsx("option",{value:"7days",children:"Last 7 Days"}),jsx("option",{value:"30days",children:"Last 30 Days"}),jsx("option",{value:"90days",children:"Last 90 Days"}),jsx("option",{value:"all",children:"All Time"})]})]})]}),X&&J(),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[jsxs("div",{children:[L&&Y(),Z&&ie()]}),jsxs("div",{children:[ee&&k(),U&&z(),U&&m()]})]})]})};export{pe as a,ke as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a as a$2}from'./chunk-EWVK45Z3.mjs';import {a}from'./chunk-SFGW37LE.mjs';import {c}from'./chunk-FRQFU44F.mjs';import {a as a$1,b}from'./chunk-ZJYULEER.mjs';import {useRef,useEffect,useState}from'react';import {jsxs,jsx}from'react/jsx-runtime';var ur=({categories:Ke,onSubmit:Je,onValidationError:x,title:C,description:f,formDescription:S,submitButtonText:D,className:X="",buttonClassName:V="",classNames:d={},unstyled:c$1=false,isSubmitting:h=false,showConfirmation:Qe=true,confirmationMessage:Xe="Your breach report has been submitted successfully. The data protection team has been notified.",allowAttachments:Ve=true,maxAttachments:A=5,maxFileSize:R=5*1024*1024,allowedFileTypes:w=[".pdf",".jpg",".jpeg",".png",".doc",".docx",".xls",".xlsx",".txt"],defaultValues:t,onReset:F})=>{var qe,Pe,ke,je,Te,Ie,Ee,Be,Me,$e,Oe,Le,ze,Ye,Ue;let ee=useRef(false);useEffect(()=>{process.env.NODE_ENV!=="production"&&S!==void 0&&f===void 0&&!ee.current&&(ee.current=true,console.warn("[ndpr-toolkit/breach] BreachReportFormProps.formDescription is deprecated; rename to 'description'. Will be removed in 4.0."));},[S,f]);let q=c(),er=(qe=C!=null?C:q.breach.title)!=null?qe:"Report a Data Breach",rr=(ke=(Pe=f!=null?f:S)!=null?Pe:q.breach.description)!=null?ke:"Use this form to report a suspected or confirmed data breach in accordance with NDPA Section 40. All fields marked with * are required.",tr=(je=D!=null?D:q.breach.submitReport)!=null?je:"Submit Report",re=r=>{if(!r)return "";let o=new Date(r),l=s=>String(s).padStart(2,"0");return `${o.getFullYear()}-${l(o.getMonth()+1)}-${l(o.getDate())}T${l(o.getHours())}:${l(o.getMinutes())}`},[P,te]=useState((t==null?void 0:t.title)||""),[k,ie]=useState((t==null?void 0:t.description)||""),[j,ae]=useState((t==null?void 0:t.category)||""),[T,ne]=useState(re(t==null?void 0:t.discoveredAt)),[I,oe]=useState(re(t==null?void 0:t.occurredAt)),[E,se]=useState(((Te=t==null?void 0:t.reporter)==null?void 0:Te.name)||""),[_,de]=useState(((Ie=t==null?void 0:t.reporter)==null?void 0:Ie.email)||""),[B,me]=useState(((Ee=t==null?void 0:t.reporter)==null?void 0:Ee.department)||""),[M,ce]=useState(((Be=t==null?void 0:t.reporter)==null?void 0:Be.phone)||""),[pe,le]=useState((t==null?void 0:t.affectedSystems)||[]),[ir,ge]=useState(((Me=t==null?void 0:t.affectedSystems)==null?void 0:Me.join(", "))||""),[$,be]=useState((t==null?void 0:t.dataTypes)||[]),[v,fe]=useState((t==null?void 0:t.estimatedAffectedSubjects)!=null?String(t.estimatedAffectedSubjects):""),[O,he]=useState((t==null?void 0:t.approximateRecordCount)!=null?String(t.approximateRecordCount):""),[L,ve]=useState((($e=t==null?void 0:t.dataSubjectCategories)==null?void 0:$e.join(", "))||""),[Ne,_e]=useState((Oe=t==null?void 0:t.involvesSensitiveData)!=null?Oe:false),[z,ue]=useState((t==null?void 0:t.likelyConsequences)||""),[Y,ye]=useState((t==null?void 0:t.mitigationMeasures)||""),[U,xe]=useState(((Le=t==null?void 0:t.dpoContact)==null?void 0:Le.name)||""),[H,Ce]=useState(((ze=t==null?void 0:t.dpoContact)==null?void 0:ze.email)||""),[Z,Se]=useState(((Ye=t==null?void 0:t.dpoContact)==null?void 0:Ye.phone)||""),[G,De]=useState((Ue=t==null?void 0:t.isPhasedReport)!=null?Ue:false),[W,Ae]=useState((t==null?void 0:t.supplementsReportId)||""),[Re,we]=useState((t==null?void 0:t.status)||"ongoing"),[K,Fe]=useState((t==null?void 0:t.initialActions)||""),[u,J]=useState([]),[ar,Q]=useState(false),[a$3,N]=useState({}),nr=()=>{te(""),ie(""),ae(""),ne(""),oe(""),se(""),de(""),me(""),ce(""),le([]),ge(""),be([]),fe(""),he(""),ve(""),_e(false),ue(""),ye(""),xe(""),Ce(""),Se(""),De(false),Ae(""),we("ongoing"),Fe(""),J([]),Q(false),N({}),F==null||F();},or=r=>{let o=r.target.value;ge(o);let l=o.split(",").map(s=>s.trim()).filter(Boolean);le(l);},sr=r=>{be(o=>o.includes(r)?o.filter(l=>l!==r):[...o,r]);},dr=r=>{var He;let o=r.target.files;if(!o)return;let l=[],s={};if(u.length+o.length>A){s.attachments=`Maximum of ${A} files allowed`,N(g=>a$1(a$1({},g),s));return}for(let g=0;g<o.length;g++){let y=o[g];if(y.size>R){s.attachments=`File ${y.name} exceeds the maximum size of ${R/(1024*1024)}MB`;continue}let Ze="."+((He=y.name.split(".").pop())==null?void 0:He.toLowerCase());if(!w.includes(Ze)){s.attachments=`File type ${Ze} is not allowed`;continue}l.push(y);}l.length>0&&J(g=>[...g,...l]),Object.keys(s).length>0?N(g=>a$1(a$1({},g),s)):N(g=>b(a$1({},g),{attachments:""}));},mr=r=>{J(o=>o.filter((l,s)=>s!==r));},cr=()=>{let r={};return P.trim()||(r.breachTitle="Breach title is required"),k.trim()||(r.description="Description is required"),j||(r.category="Category is required"),T||(r.discoveredAt="Discovery date is required"),E.trim()||(r.reporterName="Reporter name is required"),_.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(_)||(r.reporterEmail="Reporter email is invalid"):r.reporterEmail="Reporter email is required",B.trim()||(r.reporterDepartment="Reporter department is required"),pe.length===0&&(r.affectedSystems="At least one affected system is required"),$.length===0&&(r.dataTypes="At least one data type is required"),v&&isNaN(Number(v))&&(r.estimatedAffectedSubjects="Estimated affected subjects must be a number"),N(r),r},pr=r=>{r.preventDefault();let o=cr();if(Object.keys(o).length>0){x==null||x(o);return}let l={title:a$2(P),description:a$2(k),category:j,discoveredAt:new Date(T).getTime(),occurredAt:I?new Date(I).getTime():void 0,reportedAt:Date.now(),reporter:{name:a$2(E),email:a$2(_),department:a$2(B),phone:M?a$2(M):void 0},affectedSystems:pe.map(s=>a$2(s)),dataTypes:$,estimatedAffectedSubjects:v?Number(v):void 0,approximateRecordCount:O?Number(O):void 0,dataSubjectCategories:L?L.split(",").map(s=>a$2(s.trim())).filter(Boolean):void 0,involvesSensitiveData:Ne,likelyConsequences:z?a$2(z):void 0,mitigationMeasures:Y?a$2(Y):void 0,dpoContact:U||H?{name:a$2(U),email:a$2(H),phone:Z?a$2(Z):void 0}:void 0,isPhasedReport:G||void 0,supplementsReportId:W?a$2(W):void 0,status:Re,initialActions:K?a$2(K):void 0,attachments:u.map(s=>({name:s.name,type:s.type,size:s.size,file:s}))};Je(l),Qe&&Q(true);};if(ar)return jsxs("div",{"data-ndpr-component":"breach-report-form",className:`p-4 bg-green-50 dark:bg-green-900/20 rounded-md ${X}`,children:[jsx("h2",{className:"text-lg font-bold ndpr-text-success mb-2",children:"Report Submitted"}),jsx("p",{className:"ndpr-text-success",children:Xe}),jsxs("div",{className:"mt-4 p-4 bg-yellow-50 dark:bg-yellow-900/20 rounded-md",children:[jsx("h3",{className:"text-sm font-bold ndpr-text-warning mb-2",children:"Important: Next Steps"}),jsx("p",{className:"ndpr-text-warning text-sm",children:"Under the NDPA (Section 40), data breaches that pose a risk to the rights and freedoms of data subjects must be reported to the NDPC within 72 hours of discovery. The data protection team will assess this breach and determine if notification is required."})]}),jsx("button",{onClick:()=>Q(false),className:`mt-4 px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${V}`,children:"Report Another Breach"})]});let lr=[{id:"personal",label:"Personal Information (names, addresses)"},{id:"contact",label:"Contact Information (email, phone)"},{id:"financial",label:"Financial Information (bank details, payment info)"},{id:"health",label:"Health Information"},{id:"identification",label:"Identification Documents (ID cards, passports)"},{id:"login",label:"Login Credentials"},{id:"biometric",label:"Biometric Data"},{id:"children",label:"Children's Data"},{id:"location",label:"Location Data"},{id:"communications",label:"Communications Content"}];return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${X}`,d.root,c$1),children:[jsx("h2",{className:a("ndpr-section-heading",d.title,c$1),children:er}),jsx("p",{className:"ndpr-card__subtitle",children:rr}),jsx("form",{onSubmit:pr,className:a("",d.form,c$1),children:jsxs("div",{className:"ndpr-form-section",children:[jsxs("div",{className:a("",d.fieldGroup,c$1),children:[jsx("h3",{className:"ndpr-section-heading",children:"Breach Information"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"breachTitle",className:a("ndpr-form-field__label",d.label,c$1),children:["Breach Title/Summary ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("input",{type:"text",id:"breachTitle",value:P,onChange:r=>te(r.target.value),className:a("ndpr-form-field__input",d.input,c$1),required:true,"aria-invalid":!!a$3.breachTitle,"aria-describedby":a$3.breachTitle?"breachTitle-error":void 0}),a$3.breachTitle&&jsx("p",{id:"breachTitle-error",role:"alert",className:"ndpr-form-field__error",children:a$3.breachTitle})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"category",className:a("ndpr-form-field__label",d.label,c$1),children:["Breach Category ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxs("select",{id:"category",value:j,onChange:r=>ae(r.target.value),className:a("ndpr-form-field__input",d.select,c$1),required:true,"aria-invalid":!!a$3.category,"aria-describedby":a$3.category?"category-error":void 0,children:[jsx("option",{value:"",children:"Select a category"}),Ke.map(r=>jsx("option",{value:r.id,children:r.name},r.id))]}),a$3.category&&jsx("p",{id:"category-error",role:"alert",className:"ndpr-form-field__error",children:a$3.category})]}),jsxs("div",{className:"md:col-span-2",children:[jsxs("label",{htmlFor:"description",className:a("ndpr-form-field__label",d.label,c$1),children:["Detailed Description ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("textarea",{id:"description",value:k,onChange:r=>ie(r.target.value),rows:4,className:a("ndpr-form-field__input",d.textarea,c$1),required:true,"aria-invalid":!!a$3.description,"aria-describedby":a$3.description?"description-error":void 0}),a$3.description&&jsx("p",{id:"description-error",role:"alert",className:"ndpr-form-field__error",children:a$3.description})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"discoveredAt",className:"ndpr-form-field__label",children:["Date Discovered ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("input",{type:"datetime-local",id:"discoveredAt",value:T,onChange:r=>ne(r.target.value),className:"ndpr-form-field__input",required:true,"aria-invalid":!!a$3.discoveredAt,"aria-describedby":a$3.discoveredAt?"discoveredAt-error":void 0}),a$3.discoveredAt&&jsx("p",{id:"discoveredAt-error",role:"alert",className:"ndpr-form-field__error",children:a$3.discoveredAt})]}),jsxs("div",{children:[jsx("label",{htmlFor:"occurredAt",className:"ndpr-form-field__label",children:"Date Occurred (if known)"}),jsx("input",{type:"datetime-local",id:"occurredAt",value:I,onChange:r=>oe(r.target.value),className:"ndpr-form-field__input"})]})]})]}),jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"Reporter Information"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"reporterName",className:"ndpr-form-field__label",children:["Your Name ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("input",{type:"text",id:"reporterName",value:E,onChange:r=>se(r.target.value),className:"ndpr-form-field__input",required:true,"aria-invalid":!!a$3.reporterName,"aria-describedby":a$3.reporterName?"reporterName-error":void 0}),a$3.reporterName&&jsx("p",{id:"reporterName-error",role:"alert",className:"ndpr-form-field__error",children:a$3.reporterName})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"reporterEmail",className:"ndpr-form-field__label",children:["Your Email ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("input",{type:"email",id:"reporterEmail",value:_,onChange:r=>de(r.target.value),className:"ndpr-form-field__input",required:true,"aria-invalid":!!a$3.reporterEmail,"aria-describedby":a$3.reporterEmail?"reporterEmail-error":void 0}),a$3.reporterEmail&&jsx("p",{id:"reporterEmail-error",role:"alert",className:"ndpr-form-field__error",children:a$3.reporterEmail})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"reporterDepartment",className:"ndpr-form-field__label",children:["Your Department ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("input",{type:"text",id:"reporterDepartment",value:B,onChange:r=>me(r.target.value),className:"ndpr-form-field__input",required:true,"aria-invalid":!!a$3.reporterDepartment,"aria-describedby":a$3.reporterDepartment?"reporterDepartment-error":void 0}),a$3.reporterDepartment&&jsx("p",{id:"reporterDepartment-error",role:"alert",className:"ndpr-form-field__error",children:a$3.reporterDepartment})]}),jsxs("div",{children:[jsx("label",{htmlFor:"reporterPhone",className:"ndpr-form-field__label",children:"Your Phone Number (Optional)"}),jsx("input",{type:"tel",id:"reporterPhone",value:M,onChange:r=>ce(r.target.value),className:"ndpr-form-field__input"})]})]})]}),jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"Impact Information"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"affectedSystems",className:"ndpr-form-field__label",children:["Affected Systems/Applications ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("input",{type:"text",id:"affectedSystems",value:ir,onChange:or,placeholder:"e.g. CRM, Email Server, Website (comma separated)",className:"ndpr-form-field__input",required:true,"aria-invalid":!!a$3.affectedSystems,"aria-describedby":a$3.affectedSystems?"affectedSystems-error":void 0}),a$3.affectedSystems&&jsx("p",{id:"affectedSystems-error",role:"alert",className:"ndpr-form-field__error",children:a$3.affectedSystems})]}),jsxs("div",{children:[jsx("label",{htmlFor:"estimatedAffectedSubjects",className:"ndpr-form-field__label",children:"Estimated Number of Affected Data Subjects"}),jsx("input",{type:"text",id:"estimatedAffectedSubjects",value:v,onChange:r=>fe(r.target.value),placeholder:"e.g. 100",className:"ndpr-form-field__input","aria-invalid":!!a$3.estimatedAffectedSubjects,"aria-describedby":a$3.estimatedAffectedSubjects?"estimatedAffectedSubjects-error":void 0}),a$3.estimatedAffectedSubjects&&jsx("p",{id:"estimatedAffectedSubjects-error",role:"alert",className:"ndpr-form-field__error",children:a$3.estimatedAffectedSubjects})]}),jsxs("fieldset",{className:"md:col-span-2","aria-invalid":!!a$3.dataTypes,"aria-describedby":a$3.dataTypes?"dataTypes-error":void 0,children:[jsxs("legend",{className:"ndpr-form-field__label",children:["Types of Data Involved ",jsx("span",{className:"ndpr-form-field__required","aria-hidden":"true",children:"*"}),jsx("span",{className:"sr-only",children:"(required)"})]}),jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:lr.map(r=>jsxs("div",{className:"flex items-center",children:[jsx("input",{type:"checkbox",id:`dataType_${r.id}`,checked:$.includes(r.id),onChange:()=>sr(r.id),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("label",{htmlFor:`dataType_${r.id}`,className:"ml-2 text-sm ndpr-text-muted",children:r.label})]},r.id))}),a$3.dataTypes&&jsx("p",{id:"dataTypes-error",role:"alert",className:"ndpr-form-field__error",children:a$3.dataTypes})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"status",className:"ndpr-form-field__label",children:["Current Status ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxs("select",{id:"status",value:Re,onChange:r=>we(r.target.value),className:a("ndpr-form-field__input",d.select,c$1),required:true,children:[jsx("option",{value:"ongoing",children:"Ongoing (breach is still active)"}),jsx("option",{value:"contained",children:"Contained (breach is stopped but not resolved)"}),jsx("option",{value:"resolved",children:"Resolved (breach is fully addressed)"})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"approximateRecordCount",className:"ndpr-form-field__label",children:"Approximate Number of Records Concerned"}),jsx("input",{type:"text",id:"approximateRecordCount",value:O,onChange:r=>he(r.target.value),placeholder:"e.g. 5000",className:"ndpr-form-field__input"}),jsx("p",{className:"text-xs ndpr-text-muted mt-1",children:"Required for the NDPC report (NDPA Section 40(2))."})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataSubjectCategories",className:"ndpr-form-field__label",children:"Categories of Data Subjects Affected"}),jsx("input",{type:"text",id:"dataSubjectCategories",value:L,onChange:r=>ve(r.target.value),placeholder:"e.g. customers, employees, minors",className:"ndpr-form-field__input"}),jsx("p",{className:"text-xs ndpr-text-muted mt-1",children:"Comma-separated. Required for the NDPC report (NDPA Section 40(2))."})]}),jsxs("div",{className:"md:col-span-2 flex items-center",children:[jsx("input",{id:"involvesSensitiveData",type:"checkbox",checked:Ne,onChange:r=>_e(r.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("label",{htmlFor:"involvesSensitiveData",className:"ml-2 text-sm ndpr-text-muted",children:"Sensitive personal data (NDPA Section 30) is involved"})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"likelyConsequences",className:"ndpr-form-field__label",children:"Likely Consequences for Data Subjects"}),jsx("textarea",{id:"likelyConsequences",value:z,onChange:r=>ue(r.target.value),placeholder:"e.g. identity theft, financial loss, reputational damage, discrimination",rows:3,className:a("ndpr-form-field__input",d.textarea,c$1)}),jsx("p",{className:"text-xs ndpr-text-muted mt-1",children:"Required content for NDPC report and Section 40(3) communications to data subjects."})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"mitigationMeasures",className:"ndpr-form-field__label",children:"Mitigation Measures"}),jsx("textarea",{id:"mitigationMeasures",value:Y,onChange:r=>ye(r.target.value),placeholder:"Measures taken or proposed to mitigate possible adverse effects (NDPA Section 40(3))",rows:3,className:a("ndpr-form-field__input",d.textarea,c$1)})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("h4",{className:"ndpr-section-heading text-sm mt-4",children:"Data Protection Officer (NDPC contact)"}),jsx("p",{className:"text-xs ndpr-text-muted mb-2",children:"Defaults to organisation-level DPO if left blank."})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dpoName",className:"ndpr-form-field__label",children:"DPO Name"}),jsx("input",{type:"text",id:"dpoName",value:U,onChange:r=>xe(r.target.value),className:"ndpr-form-field__input"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dpoEmail",className:"ndpr-form-field__label",children:"DPO Email"}),jsx("input",{type:"email",id:"dpoEmail",value:H,onChange:r=>Ce(r.target.value),className:"ndpr-form-field__input"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dpoPhone",className:"ndpr-form-field__label",children:"DPO Phone"}),jsx("input",{type:"tel",id:"dpoPhone",value:Z,onChange:r=>Se(r.target.value),className:"ndpr-form-field__input"})]}),jsxs("div",{className:"md:col-span-2 flex items-center mt-2",children:[jsx("input",{id:"isPhasedReport",type:"checkbox",checked:G,onChange:r=>De(r.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("label",{htmlFor:"isPhasedReport",className:"ml-2 text-sm ndpr-text-muted",children:"This is a phased / interim report (Section 40(2) \u2014 complete info not yet available)"})]}),G&&jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"supplementsReportId",className:"ndpr-form-field__label",children:"Supplements Report ID (if applicable)"}),jsx("input",{type:"text",id:"supplementsReportId",value:W,onChange:r=>Ae(r.target.value),placeholder:"Prior report ID this report supplements",className:"ndpr-form-field__input"})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"initialActions",className:"ndpr-form-field__label",children:"Initial Actions Taken"}),jsx("textarea",{id:"initialActions",value:K,onChange:r=>Fe(r.target.value),placeholder:"Describe any immediate actions that have been taken to address the breach",rows:3,className:a("ndpr-form-field__input",d.textarea,c$1)})]})]})]}),Ve&&jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"Attachments"}),jsxs("div",{className:"ndpr-form-field",children:[jsx("label",{htmlFor:"breach-attachments",className:"ndpr-form-field__label",children:"Upload Supporting Files (Optional)"}),jsxs("p",{className:"text-xs ndpr-text-muted mb-2",children:["Max ",A," files, ",R/(1024*1024),"MB each. Allowed types: ",w.join(", ")]}),jsx("input",{id:"breach-attachments",type:"file",onChange:dr,multiple:true,className:"ndpr-form-field__input",accept:w.join(",")}),a$3.attachments&&jsx("p",{id:"attachments-error",role:"alert",className:"ndpr-form-field__error",children:a$3.attachments})]}),u.length>0&&jsxs("div",{className:"ndpr-form-field",children:[jsx("h4",{className:"ndpr-form-field__label",children:"Attached Files:"}),jsx("ul",{className:"ndpr-form-section",children:u.map((r,o)=>jsxs("li",{className:"flex items-center justify-between p-2 bg-gray-50 dark:bg-gray-700 rounded",children:[jsxs("div",{className:"flex items-center",children:[jsx("svg",{"aria-hidden":"true",focusable:"false",className:"w-4 h-4 ndpr-text-muted mr-2",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{fillRule:"evenodd",d:"M8 4a3 3 0 00-3 3v4a5 5 0 0010 0V7a1 1 0 112 0v4a7 7 0 11-14 0V7a5 5 0 0110 0v4a3 3 0 11-6 0V7a1 1 0 012 0v4a1 1 0 102 0V7a3 3 0 00-3-3z",clipRule:"evenodd"})}),jsx("span",{className:"text-sm ndpr-text-muted",children:r.name}),jsxs("span",{className:"ml-2 text-xs ndpr-text-muted",children:["(",(r.size/1024).toFixed(1)," KB)"]})]}),jsxs("button",{type:"button",onClick:()=>mr(o),"aria-label":`Remove attachment ${r.name}`,className:"text-red-500 hover:ndpr-text-destructive p-2 min-w-[44px] min-h-[44px] flex items-center justify-center",children:[jsx("svg",{"aria-hidden":"true",focusable:"false",className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})}),jsx("span",{className:"sr-only",children:"Remove"})]})]},o))})]})]}),jsxs("div",{className:a("ndpr-alert ndpr-alert--info",d.notice,c$1),children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Breach Notification Requirements"}),jsx("p",{className:"ndpr-text-info text-sm",children:"Under the Nigeria Data Protection Act (NDPA), Section 40, data breaches that pose a risk to the rights and freedoms of data subjects must be reported to the NDPC within 72 hours of discovery. The data protection team will assess this breach and determine if notification is required."})]}),jsxs("div",{className:"mt-6 relative flex gap-3",children:[h&&d.loadingOverlay&&jsx("div",{className:d.loadingOverlay}),jsx("button",{type:"submit",disabled:h,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 ${V} ${h?"opacity-50 cursor-not-allowed":""}`,d.primaryButton||d.submitButton,c$1),children:h?"Submitting...":tr}),jsx("button",{type:"button",onClick:nr,disabled:h,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,c$1),children:"Reset"})]})]})})]})};
|
|
2
|
+
export{ur as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkOZHUINWS_js=require('./chunk-OZHUINWS.js'),chunkVWED6UTN_js=require('./chunk-VWED6UTN.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react');function K(D,i){return i?chunkVWED6UTN_js.a(D):{load:()=>null,save:()=>{},remove:()=>{}}}function G({initialRequests:D=[],requestTypes:i,adapter:c,storageKey:P="ndpr_dsr_requests",useLocalStorage:y=true,onSubmit:g,onUpdate:m}){var h;let w=react.useRef(false);!w.current&&!c&&y&&typeof process!="undefined"&&((h=process.env)==null?void 0:h.NODE_ENV)!=="production"&&(w.current=true,console.warn("[ndpr-toolkit/dsr] useDSR() is using the default localStorageAdapter, which stores DSR requests (including data subjects' PII) in the admin's browser. For production deployments, pass an explicit adapter (apiAdapter for server-side persistence, memoryAdapter for in-process, or set useLocalStorage: false to disable). In 4.0, the default will switch to in-memory; localStorage will require explicit opt-in. See https://ndprtoolkit.com.ng/docs/guides/upgrading-3-7-to-3-10#dsr-storage"));let A=c!=null?c:K(P,y),a=react.useRef(A);a.current=A;let[n,R]=react.useState(D),[T,q]=react.useState(true);react.useEffect(()=>{let e=false;try{let t=a.current.load();t instanceof Promise?t.then(s=>{e||(s&&R(s),q(!1));},()=>{e||q(!1);}):(t&&R(t),q(!1));}catch(t){e||q(false);}return ()=>{e=true;}},[]);let p=react.useCallback(e=>{Promise.resolve(a.current.save(e)).catch(t=>{console.warn("[ndpr-toolkit] Failed to save DSR requests:",t);});},[]),O=()=>"dsr_"+Date.now()+"_"+Math.random().toString(36).substr(2,9),_=react.useCallback(e=>{let t=i.find(o=>o.id===e.type),s=(t==null?void 0:t.estimatedCompletionTime)||30,u=Date.now(),d=u+s*24*60*60*1e3,l=chunkRFPLZDIO_js.a({id:O(),status:"pending",createdAt:u,updatedAt:u,dueDate:d},e);return R(o=>{let S=[...o,l];return p(S),S}),g&&g(l),l},[i,p,g]),B=react.useCallback((e,t)=>{let s=null;return R(u=>{let d=u.findIndex(S=>S.id===e);if(d===-1)return u;let l=u[d];s=chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a(chunkRFPLZDIO_js.a({},l),t),{updatedAt:Date.now()});let o=[...u];return o[d]=s,p(o),o}),s&&m&&m(s),s},[p,m]),C=react.useCallback(e=>n.find(t=>t.id===e)||null,[n]),L=react.useCallback(e=>n.filter(t=>t.status===e),[n]),E=react.useCallback(e=>n.filter(t=>t.type===e),[n]),F=react.useCallback(e=>i.find(t=>t.id===e),[i]),U=react.useCallback(e=>{let{formattedRequest:t}=chunkOZHUINWS_js.b(e);return t},[]),N=react.useCallback(()=>{R([]),Promise.resolve(a.current.remove()).catch(e=>{console.warn("[ndpr-toolkit] Failed to remove DSR requests:",e);});},[a]);return {requests:n,submitRequest:_,updateRequest:B,getRequest:C,getRequestsByStatus:L,getRequestsByType:E,getRequestType:F,formatRequest:U,clearRequests:N,isLoading:T}}
|
|
2
|
+
exports.a=G;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkUXUMYP4L_js=require('./chunk-UXUMYP4L.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkYDKWD6MQ_js=require('./chunk-YDKWD6MQ.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var ur=({categories:Ke,onSubmit:Je,onValidationError:x,title:C,description:f,formDescription:S,submitButtonText:D,className:X="",buttonClassName:V="",classNames:d={},unstyled:c=false,isSubmitting:h=false,showConfirmation:Qe=true,confirmationMessage:Xe="Your breach report has been submitted successfully. The data protection team has been notified.",allowAttachments:Ve=true,maxAttachments:A=5,maxFileSize:R=5*1024*1024,allowedFileTypes:w=[".pdf",".jpg",".jpeg",".png",".doc",".docx",".xls",".xlsx",".txt"],defaultValues:t,onReset:F})=>{var qe,Pe,ke,je,Te,Ie,Ee,Be,Me,$e,Oe,Le,ze,Ye,Ue;let ee=react.useRef(false);react.useEffect(()=>{process.env.NODE_ENV!=="production"&&S!==void 0&&f===void 0&&!ee.current&&(ee.current=true,console.warn("[ndpr-toolkit/breach] BreachReportFormProps.formDescription is deprecated; rename to 'description'. Will be removed in 4.0."));},[S,f]);let q=chunkYDKWD6MQ_js.c(),er=(qe=C!=null?C:q.breach.title)!=null?qe:"Report a Data Breach",rr=(ke=(Pe=f!=null?f:S)!=null?Pe:q.breach.description)!=null?ke:"Use this form to report a suspected or confirmed data breach in accordance with NDPA Section 40. All fields marked with * are required.",tr=(je=D!=null?D:q.breach.submitReport)!=null?je:"Submit Report",re=r=>{if(!r)return "";let o=new Date(r),l=s=>String(s).padStart(2,"0");return `${o.getFullYear()}-${l(o.getMonth()+1)}-${l(o.getDate())}T${l(o.getHours())}:${l(o.getMinutes())}`},[P,te]=react.useState((t==null?void 0:t.title)||""),[k,ie]=react.useState((t==null?void 0:t.description)||""),[j,ae]=react.useState((t==null?void 0:t.category)||""),[T,ne]=react.useState(re(t==null?void 0:t.discoveredAt)),[I,oe]=react.useState(re(t==null?void 0:t.occurredAt)),[E,se]=react.useState(((Te=t==null?void 0:t.reporter)==null?void 0:Te.name)||""),[_,de]=react.useState(((Ie=t==null?void 0:t.reporter)==null?void 0:Ie.email)||""),[B,me]=react.useState(((Ee=t==null?void 0:t.reporter)==null?void 0:Ee.department)||""),[M,ce]=react.useState(((Be=t==null?void 0:t.reporter)==null?void 0:Be.phone)||""),[pe,le]=react.useState((t==null?void 0:t.affectedSystems)||[]),[ir,ge]=react.useState(((Me=t==null?void 0:t.affectedSystems)==null?void 0:Me.join(", "))||""),[$,be]=react.useState((t==null?void 0:t.dataTypes)||[]),[v,fe]=react.useState((t==null?void 0:t.estimatedAffectedSubjects)!=null?String(t.estimatedAffectedSubjects):""),[O,he]=react.useState((t==null?void 0:t.approximateRecordCount)!=null?String(t.approximateRecordCount):""),[L,ve]=react.useState((($e=t==null?void 0:t.dataSubjectCategories)==null?void 0:$e.join(", "))||""),[Ne,_e]=react.useState((Oe=t==null?void 0:t.involvesSensitiveData)!=null?Oe:false),[z,ue]=react.useState((t==null?void 0:t.likelyConsequences)||""),[Y,ye]=react.useState((t==null?void 0:t.mitigationMeasures)||""),[U,xe]=react.useState(((Le=t==null?void 0:t.dpoContact)==null?void 0:Le.name)||""),[H,Ce]=react.useState(((ze=t==null?void 0:t.dpoContact)==null?void 0:ze.email)||""),[Z,Se]=react.useState(((Ye=t==null?void 0:t.dpoContact)==null?void 0:Ye.phone)||""),[G,De]=react.useState((Ue=t==null?void 0:t.isPhasedReport)!=null?Ue:false),[W,Ae]=react.useState((t==null?void 0:t.supplementsReportId)||""),[Re,we]=react.useState((t==null?void 0:t.status)||"ongoing"),[K,Fe]=react.useState((t==null?void 0:t.initialActions)||""),[u,J]=react.useState([]),[ar,Q]=react.useState(false),[a,N]=react.useState({}),nr=()=>{te(""),ie(""),ae(""),ne(""),oe(""),se(""),de(""),me(""),ce(""),le([]),ge(""),be([]),fe(""),he(""),ve(""),_e(false),ue(""),ye(""),xe(""),Ce(""),Se(""),De(false),Ae(""),we("ongoing"),Fe(""),J([]),Q(false),N({}),F==null||F();},or=r=>{let o=r.target.value;ge(o);let l=o.split(",").map(s=>s.trim()).filter(Boolean);le(l);},sr=r=>{be(o=>o.includes(r)?o.filter(l=>l!==r):[...o,r]);},dr=r=>{var He;let o=r.target.files;if(!o)return;let l=[],s={};if(u.length+o.length>A){s.attachments=`Maximum of ${A} files allowed`,N(g=>chunkRFPLZDIO_js.a(chunkRFPLZDIO_js.a({},g),s));return}for(let g=0;g<o.length;g++){let y=o[g];if(y.size>R){s.attachments=`File ${y.name} exceeds the maximum size of ${R/(1024*1024)}MB`;continue}let Ze="."+((He=y.name.split(".").pop())==null?void 0:He.toLowerCase());if(!w.includes(Ze)){s.attachments=`File type ${Ze} is not allowed`;continue}l.push(y);}l.length>0&&J(g=>[...g,...l]),Object.keys(s).length>0?N(g=>chunkRFPLZDIO_js.a(chunkRFPLZDIO_js.a({},g),s)):N(g=>chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},g),{attachments:""}));},mr=r=>{J(o=>o.filter((l,s)=>s!==r));},cr=()=>{let r={};return P.trim()||(r.breachTitle="Breach title is required"),k.trim()||(r.description="Description is required"),j||(r.category="Category is required"),T||(r.discoveredAt="Discovery date is required"),E.trim()||(r.reporterName="Reporter name is required"),_.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(_)||(r.reporterEmail="Reporter email is invalid"):r.reporterEmail="Reporter email is required",B.trim()||(r.reporterDepartment="Reporter department is required"),pe.length===0&&(r.affectedSystems="At least one affected system is required"),$.length===0&&(r.dataTypes="At least one data type is required"),v&&isNaN(Number(v))&&(r.estimatedAffectedSubjects="Estimated affected subjects must be a number"),N(r),r},pr=r=>{r.preventDefault();let o=cr();if(Object.keys(o).length>0){x==null||x(o);return}let l={title:chunkUXUMYP4L_js.a(P),description:chunkUXUMYP4L_js.a(k),category:j,discoveredAt:new Date(T).getTime(),occurredAt:I?new Date(I).getTime():void 0,reportedAt:Date.now(),reporter:{name:chunkUXUMYP4L_js.a(E),email:chunkUXUMYP4L_js.a(_),department:chunkUXUMYP4L_js.a(B),phone:M?chunkUXUMYP4L_js.a(M):void 0},affectedSystems:pe.map(s=>chunkUXUMYP4L_js.a(s)),dataTypes:$,estimatedAffectedSubjects:v?Number(v):void 0,approximateRecordCount:O?Number(O):void 0,dataSubjectCategories:L?L.split(",").map(s=>chunkUXUMYP4L_js.a(s.trim())).filter(Boolean):void 0,involvesSensitiveData:Ne,likelyConsequences:z?chunkUXUMYP4L_js.a(z):void 0,mitigationMeasures:Y?chunkUXUMYP4L_js.a(Y):void 0,dpoContact:U||H?{name:chunkUXUMYP4L_js.a(U),email:chunkUXUMYP4L_js.a(H),phone:Z?chunkUXUMYP4L_js.a(Z):void 0}:void 0,isPhasedReport:G||void 0,supplementsReportId:W?chunkUXUMYP4L_js.a(W):void 0,status:Re,initialActions:K?chunkUXUMYP4L_js.a(K):void 0,attachments:u.map(s=>({name:s.name,type:s.type,size:s.size,file:s}))};Je(l),Qe&&Q(true);};if(ar)return jsxRuntime.jsxs("div",{"data-ndpr-component":"breach-report-form",className:`p-4 bg-green-50 dark:bg-green-900/20 rounded-md ${X}`,children:[jsxRuntime.jsx("h2",{className:"text-lg font-bold ndpr-text-success mb-2",children:"Report Submitted"}),jsxRuntime.jsx("p",{className:"ndpr-text-success",children:Xe}),jsxRuntime.jsxs("div",{className:"mt-4 p-4 bg-yellow-50 dark:bg-yellow-900/20 rounded-md",children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-warning mb-2",children:"Important: Next Steps"}),jsxRuntime.jsx("p",{className:"ndpr-text-warning text-sm",children:"Under the NDPA (Section 40), data breaches that pose a risk to the rights and freedoms of data subjects must be reported to the NDPC within 72 hours of discovery. The data protection team will assess this breach and determine if notification is required."})]}),jsxRuntime.jsx("button",{onClick:()=>Q(false),className:`mt-4 px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${V}`,children:"Report Another Breach"})]});let lr=[{id:"personal",label:"Personal Information (names, addresses)"},{id:"contact",label:"Contact Information (email, phone)"},{id:"financial",label:"Financial Information (bank details, payment info)"},{id:"health",label:"Health Information"},{id:"identification",label:"Identification Documents (ID cards, passports)"},{id:"login",label:"Login Credentials"},{id:"biometric",label:"Biometric Data"},{id:"children",label:"Children's Data"},{id:"location",label:"Location Data"},{id:"communications",label:"Communications Content"}];return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${X}`,d.root,c),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",d.title,c),children:er}),jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:rr}),jsxRuntime.jsx("form",{onSubmit:pr,className:chunkAME4HJR4_js.a("",d.form,c),children:jsxRuntime.jsxs("div",{className:"ndpr-form-section",children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("",d.fieldGroup,c),children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Breach Information"}),jsxRuntime.jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"breachTitle",className:chunkAME4HJR4_js.a("ndpr-form-field__label",d.label,c),children:["Breach Title/Summary ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"breachTitle",value:P,onChange:r=>te(r.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",d.input,c),required:true,"aria-invalid":!!a.breachTitle,"aria-describedby":a.breachTitle?"breachTitle-error":void 0}),a.breachTitle&&jsxRuntime.jsx("p",{id:"breachTitle-error",role:"alert",className:"ndpr-form-field__error",children:a.breachTitle})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"category",className:chunkAME4HJR4_js.a("ndpr-form-field__label",d.label,c),children:["Breach Category ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsxs("select",{id:"category",value:j,onChange:r=>ae(r.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",d.select,c),required:true,"aria-invalid":!!a.category,"aria-describedby":a.category?"category-error":void 0,children:[jsxRuntime.jsx("option",{value:"",children:"Select a category"}),Ke.map(r=>jsxRuntime.jsx("option",{value:r.id,children:r.name},r.id))]}),a.category&&jsxRuntime.jsx("p",{id:"category-error",role:"alert",className:"ndpr-form-field__error",children:a.category})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsxs("label",{htmlFor:"description",className:chunkAME4HJR4_js.a("ndpr-form-field__label",d.label,c),children:["Detailed Description ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("textarea",{id:"description",value:k,onChange:r=>ie(r.target.value),rows:4,className:chunkAME4HJR4_js.a("ndpr-form-field__input",d.textarea,c),required:true,"aria-invalid":!!a.description,"aria-describedby":a.description?"description-error":void 0}),a.description&&jsxRuntime.jsx("p",{id:"description-error",role:"alert",className:"ndpr-form-field__error",children:a.description})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"discoveredAt",className:"ndpr-form-field__label",children:["Date Discovered ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{type:"datetime-local",id:"discoveredAt",value:T,onChange:r=>ne(r.target.value),className:"ndpr-form-field__input",required:true,"aria-invalid":!!a.discoveredAt,"aria-describedby":a.discoveredAt?"discoveredAt-error":void 0}),a.discoveredAt&&jsxRuntime.jsx("p",{id:"discoveredAt-error",role:"alert",className:"ndpr-form-field__error",children:a.discoveredAt})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"occurredAt",className:"ndpr-form-field__label",children:"Date Occurred (if known)"}),jsxRuntime.jsx("input",{type:"datetime-local",id:"occurredAt",value:I,onChange:r=>oe(r.target.value),className:"ndpr-form-field__input"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Reporter Information"}),jsxRuntime.jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"reporterName",className:"ndpr-form-field__label",children:["Your Name ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"reporterName",value:E,onChange:r=>se(r.target.value),className:"ndpr-form-field__input",required:true,"aria-invalid":!!a.reporterName,"aria-describedby":a.reporterName?"reporterName-error":void 0}),a.reporterName&&jsxRuntime.jsx("p",{id:"reporterName-error",role:"alert",className:"ndpr-form-field__error",children:a.reporterName})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"reporterEmail",className:"ndpr-form-field__label",children:["Your Email ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{type:"email",id:"reporterEmail",value:_,onChange:r=>de(r.target.value),className:"ndpr-form-field__input",required:true,"aria-invalid":!!a.reporterEmail,"aria-describedby":a.reporterEmail?"reporterEmail-error":void 0}),a.reporterEmail&&jsxRuntime.jsx("p",{id:"reporterEmail-error",role:"alert",className:"ndpr-form-field__error",children:a.reporterEmail})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"reporterDepartment",className:"ndpr-form-field__label",children:["Your Department ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"reporterDepartment",value:B,onChange:r=>me(r.target.value),className:"ndpr-form-field__input",required:true,"aria-invalid":!!a.reporterDepartment,"aria-describedby":a.reporterDepartment?"reporterDepartment-error":void 0}),a.reporterDepartment&&jsxRuntime.jsx("p",{id:"reporterDepartment-error",role:"alert",className:"ndpr-form-field__error",children:a.reporterDepartment})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"reporterPhone",className:"ndpr-form-field__label",children:"Your Phone Number (Optional)"}),jsxRuntime.jsx("input",{type:"tel",id:"reporterPhone",value:M,onChange:r=>ce(r.target.value),className:"ndpr-form-field__input"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Impact Information"}),jsxRuntime.jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"affectedSystems",className:"ndpr-form-field__label",children:["Affected Systems/Applications ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"affectedSystems",value:ir,onChange:or,placeholder:"e.g. CRM, Email Server, Website (comma separated)",className:"ndpr-form-field__input",required:true,"aria-invalid":!!a.affectedSystems,"aria-describedby":a.affectedSystems?"affectedSystems-error":void 0}),a.affectedSystems&&jsxRuntime.jsx("p",{id:"affectedSystems-error",role:"alert",className:"ndpr-form-field__error",children:a.affectedSystems})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"estimatedAffectedSubjects",className:"ndpr-form-field__label",children:"Estimated Number of Affected Data Subjects"}),jsxRuntime.jsx("input",{type:"text",id:"estimatedAffectedSubjects",value:v,onChange:r=>fe(r.target.value),placeholder:"e.g. 100",className:"ndpr-form-field__input","aria-invalid":!!a.estimatedAffectedSubjects,"aria-describedby":a.estimatedAffectedSubjects?"estimatedAffectedSubjects-error":void 0}),a.estimatedAffectedSubjects&&jsxRuntime.jsx("p",{id:"estimatedAffectedSubjects-error",role:"alert",className:"ndpr-form-field__error",children:a.estimatedAffectedSubjects})]}),jsxRuntime.jsxs("fieldset",{className:"md:col-span-2","aria-invalid":!!a.dataTypes,"aria-describedby":a.dataTypes?"dataTypes-error":void 0,children:[jsxRuntime.jsxs("legend",{className:"ndpr-form-field__label",children:["Types of Data Involved ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required","aria-hidden":"true",children:"*"}),jsxRuntime.jsx("span",{className:"sr-only",children:"(required)"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:lr.map(r=>jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("input",{type:"checkbox",id:`dataType_${r.id}`,checked:$.includes(r.id),onChange:()=>sr(r.id),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsxRuntime.jsx("label",{htmlFor:`dataType_${r.id}`,className:"ml-2 text-sm ndpr-text-muted",children:r.label})]},r.id))}),a.dataTypes&&jsxRuntime.jsx("p",{id:"dataTypes-error",role:"alert",className:"ndpr-form-field__error",children:a.dataTypes})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"status",className:"ndpr-form-field__label",children:["Current Status ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsxs("select",{id:"status",value:Re,onChange:r=>we(r.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",d.select,c),required:true,children:[jsxRuntime.jsx("option",{value:"ongoing",children:"Ongoing (breach is still active)"}),jsxRuntime.jsx("option",{value:"contained",children:"Contained (breach is stopped but not resolved)"}),jsxRuntime.jsx("option",{value:"resolved",children:"Resolved (breach is fully addressed)"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"approximateRecordCount",className:"ndpr-form-field__label",children:"Approximate Number of Records Concerned"}),jsxRuntime.jsx("input",{type:"text",id:"approximateRecordCount",value:O,onChange:r=>he(r.target.value),placeholder:"e.g. 5000",className:"ndpr-form-field__input"}),jsxRuntime.jsx("p",{className:"text-xs ndpr-text-muted mt-1",children:"Required for the NDPC report (NDPA Section 40(2))."})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"dataSubjectCategories",className:"ndpr-form-field__label",children:"Categories of Data Subjects Affected"}),jsxRuntime.jsx("input",{type:"text",id:"dataSubjectCategories",value:L,onChange:r=>ve(r.target.value),placeholder:"e.g. customers, employees, minors",className:"ndpr-form-field__input"}),jsxRuntime.jsx("p",{className:"text-xs ndpr-text-muted mt-1",children:"Comma-separated. Required for the NDPC report (NDPA Section 40(2))."})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2 flex items-center",children:[jsxRuntime.jsx("input",{id:"involvesSensitiveData",type:"checkbox",checked:Ne,onChange:r=>_e(r.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsxRuntime.jsx("label",{htmlFor:"involvesSensitiveData",className:"ml-2 text-sm ndpr-text-muted",children:"Sensitive personal data (NDPA Section 30) is involved"})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsx("label",{htmlFor:"likelyConsequences",className:"ndpr-form-field__label",children:"Likely Consequences for Data Subjects"}),jsxRuntime.jsx("textarea",{id:"likelyConsequences",value:z,onChange:r=>ue(r.target.value),placeholder:"e.g. identity theft, financial loss, reputational damage, discrimination",rows:3,className:chunkAME4HJR4_js.a("ndpr-form-field__input",d.textarea,c)}),jsxRuntime.jsx("p",{className:"text-xs ndpr-text-muted mt-1",children:"Required content for NDPC report and Section 40(3) communications to data subjects."})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsx("label",{htmlFor:"mitigationMeasures",className:"ndpr-form-field__label",children:"Mitigation Measures"}),jsxRuntime.jsx("textarea",{id:"mitigationMeasures",value:Y,onChange:r=>ye(r.target.value),placeholder:"Measures taken or proposed to mitigate possible adverse effects (NDPA Section 40(3))",rows:3,className:chunkAME4HJR4_js.a("ndpr-form-field__input",d.textarea,c)})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsx("h4",{className:"ndpr-section-heading text-sm mt-4",children:"Data Protection Officer (NDPC contact)"}),jsxRuntime.jsx("p",{className:"text-xs ndpr-text-muted mb-2",children:"Defaults to organisation-level DPO if left blank."})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"dpoName",className:"ndpr-form-field__label",children:"DPO Name"}),jsxRuntime.jsx("input",{type:"text",id:"dpoName",value:U,onChange:r=>xe(r.target.value),className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"dpoEmail",className:"ndpr-form-field__label",children:"DPO Email"}),jsxRuntime.jsx("input",{type:"email",id:"dpoEmail",value:H,onChange:r=>Ce(r.target.value),className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"dpoPhone",className:"ndpr-form-field__label",children:"DPO Phone"}),jsxRuntime.jsx("input",{type:"tel",id:"dpoPhone",value:Z,onChange:r=>Se(r.target.value),className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2 flex items-center mt-2",children:[jsxRuntime.jsx("input",{id:"isPhasedReport",type:"checkbox",checked:G,onChange:r=>De(r.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsxRuntime.jsx("label",{htmlFor:"isPhasedReport",className:"ml-2 text-sm ndpr-text-muted",children:"This is a phased / interim report (Section 40(2) \u2014 complete info not yet available)"})]}),G&&jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsx("label",{htmlFor:"supplementsReportId",className:"ndpr-form-field__label",children:"Supplements Report ID (if applicable)"}),jsxRuntime.jsx("input",{type:"text",id:"supplementsReportId",value:W,onChange:r=>Ae(r.target.value),placeholder:"Prior report ID this report supplements",className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsx("label",{htmlFor:"initialActions",className:"ndpr-form-field__label",children:"Initial Actions Taken"}),jsxRuntime.jsx("textarea",{id:"initialActions",value:K,onChange:r=>Fe(r.target.value),placeholder:"Describe any immediate actions that have been taken to address the breach",rows:3,className:chunkAME4HJR4_js.a("ndpr-form-field__input",d.textarea,c)})]})]})]}),Ve&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Attachments"}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsx("label",{htmlFor:"breach-attachments",className:"ndpr-form-field__label",children:"Upload Supporting Files (Optional)"}),jsxRuntime.jsxs("p",{className:"text-xs ndpr-text-muted mb-2",children:["Max ",A," files, ",R/(1024*1024),"MB each. Allowed types: ",w.join(", ")]}),jsxRuntime.jsx("input",{id:"breach-attachments",type:"file",onChange:dr,multiple:true,className:"ndpr-form-field__input",accept:w.join(",")}),a.attachments&&jsxRuntime.jsx("p",{id:"attachments-error",role:"alert",className:"ndpr-form-field__error",children:a.attachments})]}),u.length>0&&jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsx("h4",{className:"ndpr-form-field__label",children:"Attached Files:"}),jsxRuntime.jsx("ul",{className:"ndpr-form-section",children:u.map((r,o)=>jsxRuntime.jsxs("li",{className:"flex items-center justify-between p-2 bg-gray-50 dark:bg-gray-700 rounded",children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("svg",{"aria-hidden":"true",focusable:"false",className:"w-4 h-4 ndpr-text-muted mr-2",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M8 4a3 3 0 00-3 3v4a5 5 0 0010 0V7a1 1 0 112 0v4a7 7 0 11-14 0V7a5 5 0 0110 0v4a3 3 0 11-6 0V7a1 1 0 012 0v4a1 1 0 102 0V7a3 3 0 00-3-3z",clipRule:"evenodd"})}),jsxRuntime.jsx("span",{className:"text-sm ndpr-text-muted",children:r.name}),jsxRuntime.jsxs("span",{className:"ml-2 text-xs ndpr-text-muted",children:["(",(r.size/1024).toFixed(1)," KB)"]})]}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>mr(o),"aria-label":`Remove attachment ${r.name}`,className:"text-red-500 hover:ndpr-text-destructive p-2 min-w-[44px] min-h-[44px] flex items-center justify-center",children:[jsxRuntime.jsx("svg",{"aria-hidden":"true",focusable:"false",className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})}),jsxRuntime.jsx("span",{className:"sr-only",children:"Remove"})]})]},o))})]})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",d.notice,c),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Breach Notification Requirements"}),jsxRuntime.jsx("p",{className:"ndpr-text-info text-sm",children:"Under the Nigeria Data Protection Act (NDPA), Section 40, data breaches that pose a risk to the rights and freedoms of data subjects must be reported to the NDPC within 72 hours of discovery. The data protection team will assess this breach and determine if notification is required."})]}),jsxRuntime.jsxs("div",{className:"mt-6 relative flex gap-3",children:[h&&d.loadingOverlay&&jsxRuntime.jsx("div",{className:d.loadingOverlay}),jsxRuntime.jsx("button",{type:"submit",disabled:h,className:chunkAME4HJR4_js.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 ${V} ${h?"opacity-50 cursor-not-allowed":""}`,d.primaryButton||d.submitButton,c),children:h?"Submitting...":tr}),jsxRuntime.jsx("button",{type:"button",onClick:nr,disabled:h,className:chunkAME4HJR4_js.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,c),children:"Reset"})]})]})})]})};
|
|
2
|
+
exports.a=ur;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {d,c as c$1,a as a$1,b as b$1}from'./chunk-LWIKDDSU.mjs';import {a as a$2}from'./chunk-SFGW37LE.mjs';import {c}from'./chunk-FRQFU44F.mjs';import {b,a}from'./chunk-ZJYULEER.mjs';import {useState,useMemo,useCallback}from'react';import {jsx,jsxs}from'react/jsx-runtime';var V={name:"",description:"",lawfulBasis:"consent",lawfulBasisJustification:"",dataCategories:"",involvesSensitiveData:false,sensitiveDataCondition:"",dataSubjectCategories:"",purposes:"",retentionPeriod:"",retentionJustification:"",recipients:"",crossBorderTransfer:false,reviewDate:"",liaPurposeTest:"",liaNecessityTest:"",liaBalancingTest:"",liaSafeguards:"",liaConclusion:""},re=[{value:"consent",label:"Consent"},{value:"contract",label:"Contract"},{value:"legal_obligation",label:"Legal Obligation"},{value:"vital_interests",label:"Vital Interests"},{value:"public_interest",label:"Public Interest"},{value:"legitimate_interests",label:"Legitimate Interests"}],ae=[{value:"explicit_consent",label:"Explicit Consent"},{value:"employment_law",label:"Employment Law"},{value:"vital_interests_incapable",label:"Vital Interests (Incapable)"},{value:"nonprofit_legitimate",label:"Nonprofit Legitimate Activities"},{value:"publicly_available",label:"Publicly Available Data"},{value:"legal_claims",label:"Legal Claims"},{value:"substantial_public_interest",label:"Substantial Public Interest"},{value:"health_purposes",label:"Health Purposes"},{value:"public_health",label:"Public Health"},{value:"archiving_research",label:"Archiving / Research"}],Ae={active:"ndpr-badge ndpr-badge--success",inactive:"ndpr-badge ndpr-badge--neutral",under_review:"ndpr-badge ndpr-badge--warning",archived:"ndpr-badge ndpr-badge--destructive"},Be={active:"Active",inactive:"Inactive",under_review:"Under Review",archived:"Archived"},De={consent:"ndpr-badge ndpr-badge--info",contract:"ndpr-badge ndpr-badge--info",legal_obligation:"ndpr-badge ndpr-badge--info",vital_interests:"ndpr-badge ndpr-badge--destructive",public_interest:"ndpr-badge ndpr-badge--warning",legitimate_interests:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200"},Se={consent:"Consent",contract:"Contract",legal_obligation:"Legal Obligation",vital_interests:"Vital Interests",public_interest:"Public Interest",legitimate_interests:"Legitimate Interests"},je=({activities:g,onAddActivity:T,onUpdateActivity:F,onArchiveActivity:I,title:j,description:E,className:ne="",buttonClassName:m="",showSummary:oe=true,showComplianceGaps:de=true,classNames:i,unstyled:o})=>{var X,Z;let M=c(),le=(X=j!=null?j:M.lawfulBasis.title)!=null?X:"Lawful Basis Tracker",se=(Z=E!=null?E:M.lawfulBasis.description)!=null?Z:"Document and track the lawful basis for each processing activity as required by NDPA 2023 Section 25.",[x,f]=useState("list"),[a$3,w]=useState(V),[b$2,J]=useState(null),[R,pe]=useState(null),[B,ue]=useState("all"),[D,ce]=useState("all"),[S,ge]=useState(""),[c$2,C]=useState([]),U=useMemo(()=>{let e=[...g];if(B!=="all"&&(e=e.filter(l=>l.status===B)),D!=="all"&&(e=e.filter(l=>l.lawfulBasis===D)),S){let l=S.toLowerCase();e=e.filter(p=>p.name.toLowerCase().includes(l)||p.description.toLowerCase().includes(l)||p.purposes.some($=>$.toLowerCase().includes(l)));}return e.sort((l,p)=>p.updatedAt-l.updatedAt),e},[g,B,D,S]),y=useCallback(e=>new Date(e).toLocaleDateString(),[]),P=useMemo(()=>d(g),[g]),h=useMemo(()=>c$1(g),[g]),A=useCallback(e=>e.split(",").map(l=>l.trim()).filter(l=>l.length>0),[]),ve=useCallback(()=>{w(V),J(null),C([]),f("form");},[]),H=useCallback(e=>{w({name:e.name,description:e.description,lawfulBasis:e.lawfulBasis,lawfulBasisJustification:e.lawfulBasisJustification,dataCategories:e.dataCategories.join(", "),involvesSensitiveData:e.involvesSensitiveData,sensitiveDataCondition:e.sensitiveDataCondition||"",dataSubjectCategories:e.dataSubjectCategories.join(", "),purposes:e.purposes.join(", "),retentionPeriod:e.retentionPeriod,retentionJustification:e.retentionJustification||"",recipients:(e.recipients||[]).join(", "),crossBorderTransfer:e.crossBorderTransfer,reviewDate:e.reviewDate?new Date(e.reviewDate).toISOString().split("T")[0]:"",liaPurposeTest:"",liaNecessityTest:"",liaBalancingTest:"",liaSafeguards:"",liaConclusion:""}),J(e.id),C([]),f("form");},[]),me=useCallback(()=>{let e={name:a$3.name,description:a$3.description,lawfulBasis:a$3.lawfulBasis,lawfulBasisJustification:a$3.lawfulBasisJustification,dataCategories:A(a$3.dataCategories),involvesSensitiveData:a$3.involvesSensitiveData,sensitiveDataCondition:a$3.sensitiveDataCondition||void 0,dataSubjectCategories:A(a$3.dataSubjectCategories),purposes:A(a$3.purposes),retentionPeriod:a$3.retentionPeriod,retentionJustification:a$3.retentionJustification||void 0,recipients:a$3.recipients?A(a$3.recipients):void 0,crossBorderTransfer:a$3.crossBorderTransfer,reviewDate:a$3.reviewDate?new Date(a$3.reviewDate).getTime():void 0,status:"active"},l=b(a({},e),{id:b$2||"temp",createdAt:Date.now(),updatedAt:Date.now()}),p=a$1(l);if(!p.isValid){C(p.errors);return}b$2&&F?F(b$2,e):T&&T(e),w(V),J(null),C([]),f("list");},[a$3,b$2,F,T,A]),Y=useCallback(e=>{I&&I(e);},[I]),fe=useCallback(e=>{pe(e),f("detail");},[]),n=useMemo(()=>R?g.find(e=>e.id===R):null,[g,R]),W=useCallback(e=>jsx("span",{className:a$2(`px-2 py-1 rounded text-xs font-medium ${Ae[e]}`,i==null?void 0:i.statusBadge,o),children:Be[e]}),[i==null?void 0:i.statusBadge,o]),z=useCallback(e=>jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${De[e]}`,children:Se[e]}),[]),K=useCallback(e=>e.dpoApproval?e.dpoApproval.approved?jsx("span",{className:"ndpr-badge ndpr-badge--success",children:"Approved"}):jsx("span",{className:"ndpr-badge ndpr-badge--warning",children:"Pending Approval"}):jsx("span",{className:"px-2 py-1 rounded text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-400",children:"No DPO Review"}),[]),be=()=>jsxs("div",{"data-ndpr-component":"lawful-basis-tracker",className:a$2("grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",i==null?void 0:i.summary,o),role:"status","aria-label":"Compliance summary",children:[jsxs("div",{className:a$2("ndpr-alert ndpr-alert--info",i==null?void 0:i.summaryCard,o),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:P.totalActivities}),jsx("p",{className:"text-sm ndpr-text-info",children:"Total Activities"})]}),jsxs("div",{className:a$2("bg-orange-50 dark:bg-orange-900/20 p-4 rounded-lg",i==null?void 0:i.summaryCard,o),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-warning",children:P.sensitiveDataActivities}),jsx("p",{className:"text-sm ndpr-text-warning",children:"Sensitive Data"})]}),jsxs("div",{className:a$2("ndpr-alert ndpr-alert--info",i==null?void 0:i.summaryCard,o),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:P.crossBorderActivities}),jsx("p",{className:"text-sm ndpr-text-info",children:"Cross-Border Transfers"})]}),jsxs("div",{className:a$2("ndpr-alert ndpr-alert--destructive",i==null?void 0:i.summaryCard,o),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-destructive",children:P.activitiesWithoutApproval.length}),jsx("p",{className:"text-sm ndpr-text-destructive",children:"Pending Approval"})]})]}),N=useMemo(()=>h.filter(e=>e.severity==="high"),[h]),O=useMemo(()=>h.filter(e=>e.severity==="medium"),[h]),he=()=>h.length===0?jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-4 rounded-lg mb-6",role:"status","aria-label":"No compliance gaps",children:[jsx("p",{className:"text-sm ndpr-text-success font-medium",children:"No compliance gaps detected."}),jsx("p",{className:"text-xs ndpr-text-success mt-1",children:"All processing activities appear to be properly documented."})]}):jsxs("div",{className:"mb-6",role:"status","aria-label":`${h.length} compliance gaps detected`,children:[N.length>0&&jsxs("div",{className:a$2("bg-red-50 dark:bg-red-900/20 p-4 rounded-lg mb-3",i==null?void 0:i.gapAlert,o),children:[jsxs("p",{className:"text-sm ndpr-text-destructive font-medium mb-2",children:["High Priority (",N.length,")"]}),jsx("ul",{className:"space-y-1",children:N.map((e,l)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:e.description},l))})]}),O.length>0&&jsxs("div",{className:a$2("ndpr-alert ndpr-alert--warning",i==null?void 0:i.gapAlert,o),children:[jsxs("p",{className:"text-sm ndpr-text-warning font-medium mb-2",children:["Medium Priority (",O.length,")"]}),jsx("ul",{className:"space-y-1",children:O.map((e,l)=>jsx("li",{className:"text-xs ndpr-text-warning",children:e.description},l))})]})]}),Q=useCallback(()=>{f("list"),C([]);},[]),_e=useCallback(()=>{f("list");},[]),s=useCallback((e,l)=>{w(p=>b(a({},p),{[e]:l}));},[]),xe=useCallback(e=>{w(l=>b(a({},l),{involvesSensitiveData:e,sensitiveDataCondition:e?l.sensitiveDataCondition:""}));},[]),we=()=>jsxs("div",{className:a$2("",i==null?void 0:i.form,o),children:[jsxs("div",{className:a$2("flex justify-between items-center mb-4",i==null?void 0:i.header,o),children:[jsx("h3",{className:"ndpr-section-heading",children:b$2?"Edit Processing Activity":"New Processing Activity"}),jsx("button",{onClick:Q,className:`px-4 py-2 ndpr-text-muted bg-gray-100 dark:bg-gray-700 rounded hover:bg-gray-200 dark:hover:bg-gray-600 ${m}`,children:"Cancel"})]}),c$2.length>0&&jsxs("div",{id:"form-errors",className:"bg-red-50 dark:bg-red-900/20 p-4 rounded-lg mb-4",role:"alert",children:[jsx("p",{className:"text-sm ndpr-text-destructive font-medium mb-2",children:"Please correct the following errors:"}),jsx("ul",{className:"list-disc list-inside space-y-1",children:c$2.map((e,l)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:e},l))})]}),jsxs("div",{className:"ndpr-form-section",children:[jsxs("div",{children:[jsx("label",{htmlFor:"activityName",className:"ndpr-form-field__label",children:"Activity Name *"}),jsx("input",{type:"text",id:"activityName",value:a$3.name,onChange:e=>s("name",e.target.value),placeholder:"e.g., Customer Account Management","aria-required":"true","aria-describedby":c$2.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"activityDescription",className:"ndpr-form-field__label",children:"Description *"}),jsx("textarea",{id:"activityDescription",value:a$3.description,onChange:e=>s("description",e.target.value),placeholder:"Describe what processing is performed...",rows:3,"aria-required":"true","aria-describedby":c$2.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"lawfulBasis",className:"ndpr-form-field__label",children:"Lawful Basis (NDPA Section 25) *"}),jsx("select",{id:"lawfulBasis",value:a$3.lawfulBasis,onChange:e=>s("lawfulBasis",e.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",i==null?void 0:i.select,o),children:re.map(e=>jsx("option",{value:e.value,children:e.label},e.value))}),jsx("p",{className:"mt-1 text-xs ndpr-text-muted",children:b$1(a$3.lawfulBasis)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"justification",className:"ndpr-form-field__label",children:"Lawful Basis Justification *"}),jsx("textarea",{id:"justification",value:a$3.lawfulBasisJustification,onChange:e=>s("lawfulBasisJustification",e.target.value),placeholder:"Document why this lawful basis applies to this processing activity...",rows:3,"aria-required":"true","aria-describedby":c$2.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),a$3.lawfulBasis==="legitimate_interests"&&jsxs("div",{className:"border border-indigo-200 dark:border-indigo-800 rounded-lg p-4 bg-indigo-50 dark:bg-indigo-900/20",children:[jsx("h4",{className:"text-sm font-semibold text-indigo-800 dark:text-indigo-200 mb-3",children:"Legitimate Interest Assessment (LIA)"}),jsx("p",{className:"text-xs text-indigo-600 dark:text-indigo-300 mb-4",children:"NDPA Section 25(1)(f) requires a balancing test when relying on legitimate interests."}),jsxs("div",{className:"ndpr-form-section",children:[jsxs("div",{children:[jsx("label",{htmlFor:"liaPurpose",className:"ndpr-form-field__label",children:"Purpose Test"}),jsx("textarea",{id:"liaPurpose",value:a$3.liaPurposeTest,onChange:e=>s("liaPurposeTest",e.target.value),placeholder:"Describe the legitimate interest being pursued...",rows:2,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"liaNecessity",className:"ndpr-form-field__label",children:"Necessity Test"}),jsx("textarea",{id:"liaNecessity",value:a$3.liaNecessityTest,onChange:e=>s("liaNecessityTest",e.target.value),placeholder:"Explain why this processing is necessary for the stated purpose...",rows:2,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"liaBalancing",className:"ndpr-form-field__label",children:"Balancing Test"}),jsx("textarea",{id:"liaBalancing",value:a$3.liaBalancingTest,onChange:e=>s("liaBalancingTest",e.target.value),placeholder:"Assess the impact on data subjects' rights and interests...",rows:2,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"liaSafeguards",className:"ndpr-form-field__label",children:"Safeguards"}),jsx("input",{type:"text",id:"liaSafeguards",value:a$3.liaSafeguards,onChange:e=>s("liaSafeguards",e.target.value),placeholder:"List safeguards (comma-separated)...",className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"liaConclusion",className:"ndpr-form-field__label",children:"Conclusion"}),jsx("textarea",{id:"liaConclusion",value:a$3.liaConclusion,onChange:e=>s("liaConclusion",e.target.value),placeholder:"State your overall conclusion...",rows:2,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataCategories",className:"ndpr-form-field__label",children:"Data Categories *"}),jsx("input",{type:"text",id:"dataCategories",value:a$3.dataCategories,onChange:e=>s("dataCategories",e.target.value),placeholder:"e.g., Name, Email, Phone Number (comma-separated)","aria-required":"true","aria-describedby":c$2.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsx("div",{children:jsxs("label",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",checked:a$3.involvesSensitiveData,onChange:e=>xe(e.target.checked),className:"rounded border-gray-300 dark:border-gray-600 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("span",{className:"ndpr-text-sm ndpr-font-medium",children:"Involves Sensitive Personal Data (NDPA Section 27)"})]})}),a$3.involvesSensitiveData&&jsxs("div",{children:[jsx("label",{htmlFor:"sensitiveCondition",className:"ndpr-form-field__label",children:"Sensitive Data Condition (NDPA Section 27) *"}),jsxs("select",{id:"sensitiveCondition",value:a$3.sensitiveDataCondition,onChange:e=>s("sensitiveDataCondition",e.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",i==null?void 0:i.select,o),children:[jsx("option",{value:"",children:"Select a condition..."}),ae.map(e=>jsx("option",{value:e.value,children:e.label},e.value))]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataSubjectCategories",className:"ndpr-form-field__label",children:"Data Subject Categories *"}),jsx("input",{type:"text",id:"dataSubjectCategories",value:a$3.dataSubjectCategories,onChange:e=>s("dataSubjectCategories",e.target.value),placeholder:"e.g., Customers, Employees, Vendors (comma-separated)","aria-required":"true","aria-describedby":c$2.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"purposes",className:"ndpr-form-field__label",children:"Processing Purposes *"}),jsx("input",{type:"text",id:"purposes",value:a$3.purposes,onChange:e=>s("purposes",e.target.value),placeholder:"e.g., Account management, Service delivery (comma-separated)","aria-required":"true","aria-describedby":c$2.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"retentionPeriod",className:"ndpr-form-field__label",children:"Retention Period *"}),jsx("input",{type:"text",id:"retentionPeriod",value:a$3.retentionPeriod,onChange:e=>s("retentionPeriod",e.target.value),placeholder:"e.g., 3 years after account closure","aria-required":"true","aria-describedby":c$2.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"retentionJustification",className:"ndpr-form-field__label",children:"Retention Justification"}),jsx("input",{type:"text",id:"retentionJustification",value:a$3.retentionJustification,onChange:e=>s("retentionJustification",e.target.value),placeholder:"Reason for the retention period",className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recipients",className:"ndpr-form-field__label",children:"Recipients"}),jsx("input",{type:"text",id:"recipients",value:a$3.recipients,onChange:e=>s("recipients",e.target.value),placeholder:"e.g., Payment processor, Cloud provider (comma-separated)",className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsx("div",{children:jsxs("label",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",checked:a$3.crossBorderTransfer,onChange:e=>s("crossBorderTransfer",e.target.checked),className:"rounded border-gray-300 dark:border-gray-600 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("span",{className:"ndpr-text-sm ndpr-font-medium",children:"Involves Cross-Border Transfer Outside Nigeria"})]})}),jsxs("div",{children:[jsx("label",{htmlFor:"reviewDate",className:"ndpr-form-field__label",children:"Next Review Date"}),jsx("input",{type:"date",id:"reviewDate",value:a$3.reviewDate,onChange:e=>s("reviewDate",e.target.value),className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[jsx("button",{onClick:Q,className:`px-4 py-2 ndpr-text-muted bg-gray-100 dark:bg-gray-700 rounded hover:bg-gray-200 dark:hover:bg-gray-600 ${m}`,children:"Cancel"}),jsx("button",{onClick:me,className:a$2(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${m}`,(i==null?void 0:i.primaryButton)||(i==null?void 0:i.submitButton),o),children:b$2?"Update Activity":"Create Activity"})]})]})]}),Ce=()=>{var l;if(!n)return jsx("div",{className:"ndpr-empty-state",children:jsx("p",{className:"ndpr-card__subtitle",children:"Activity not found."})});let e=a$1(n);return jsxs("div",{children:[jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsxs("div",{children:[jsx("button",{onClick:_e,className:"text-sm ndpr-text-primary hover:underline mb-2","aria-label":"Back to activities list",children:"Back to list"}),jsx("h3",{className:"ndpr-section-heading",children:n.name})]}),jsxs("div",{className:"ndpr-card__footer",children:[z(n.lawfulBasis),W(n.status),K(n)]})]}),e.warnings.length>0&&jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md mb-4",children:[jsx("p",{className:"text-sm ndpr-text-warning font-medium mb-1",children:"Warnings"}),jsx("ul",{className:"list-disc list-inside space-y-1",children:e.warnings.map((p,$)=>jsx("li",{className:"text-xs ndpr-text-warning",children:p},$))})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Description:"})," ",n.description]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Lawful Basis:"})," ",b$1(n.lawfulBasis)]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Justification:"})," ",n.lawfulBasisJustification]})]}),jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Data Categories:"})," ",n.dataCategories.join(", ")]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Data Subject Categories:"})," ",n.dataSubjectCategories.join(", ")]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Purposes:"})," ",n.purposes.join(", ")]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Retention Period:"})," ",n.retentionPeriod,n.retentionJustification&&jsxs("span",{className:"ndpr-card__subtitle",children:[" ","(",n.retentionJustification,")"]})]})]})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Sensitive Data:"})," ",n.involvesSensitiveData?"Yes":"No",n.sensitiveDataCondition&&jsxs("span",{children:[" ","(Condition:"," ",((l=ae.find(p=>p.value===n.sensitiveDataCondition))==null?void 0:l.label)||n.sensitiveDataCondition,")"]})]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Cross-Border Transfer:"})," ",n.crossBorderTransfer?"Yes":"No"]}),n.recipients&&n.recipients.length>0&&jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Recipients:"})," ",n.recipients.join(", ")]})]}),jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Created:"})," ",y(n.createdAt)]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Last Updated:"})," ",y(n.updatedAt)]}),n.reviewDate&&jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Next Review:"})," ",y(n.reviewDate),n.reviewDate<Date.now()&&jsx("span",{className:"ndpr-text-destructive font-medium",children:" (Overdue)"})]})]})]}),n.dpoApproval&&jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md mb-6",children:[jsx("h4",{className:"ndpr-section-heading",children:"DPO Approval"}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Status:"})," ",n.dpoApproval.approved?"Approved":"Not Approved"]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Approved By:"})," ",n.dpoApproval.approvedBy]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Date:"})," ",y(n.dpoApproval.approvedAt)]}),n.dpoApproval.notes&&jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Notes:"})," ",n.dpoApproval.notes]})]}),jsxs("div",{className:"flex space-x-3",children:[jsx("button",{onClick:()=>H(n),"aria-label":`Edit ${n.name}`,className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${m}`,children:"Edit"}),n.status!=="archived"&&jsx("button",{onClick:()=>Y(n.id),"aria-label":`Archive ${n.name}`,className:`px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700 ${m}`,children:"Archive"})]})]})},ye=()=>jsxs("div",{children:[jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-4 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"basisFilter",className:"ndpr-form-field__label",children:"Lawful Basis"}),jsxs("select",{id:"basisFilter",value:D,onChange:e=>ce(e.target.value),"aria-label":"Filter by lawful basis",className:a$2("ndpr-form-field__input",i==null?void 0:i.select,o),children:[jsx("option",{value:"all",children:"All Bases"}),re.map(e=>jsx("option",{value:e.value,children:e.label},e.value))]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"statusFilterSelect",className:"ndpr-form-field__label",children:"Status"}),jsxs("select",{id:"statusFilterSelect",value:B,onChange:e=>ue(e.target.value),"aria-label":"Filter by status",className:a$2("ndpr-form-field__input",i==null?void 0:i.select,o),children:[jsx("option",{value:"all",children:"All Statuses"}),jsx("option",{value:"active",children:"Active"}),jsx("option",{value:"inactive",children:"Inactive"}),jsx("option",{value:"under_review",children:"Under Review"}),jsx("option",{value:"archived",children:"Archived"})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"searchInput",className:"ndpr-form-field__label",children:"Search"}),jsx("input",{type:"text",id:"searchInput",value:S,onChange:e=>ge(e.target.value),placeholder:"Search activities...",className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsx("div",{className:"flex items-end",children:jsx("button",{onClick:ve,className:a$2(`w-full px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${m}`,(i==null?void 0:i.primaryButton)||(i==null?void 0:i.submitButton),o),children:"Add Activity"})})]}),U.length===0?jsx("div",{className:"flex items-center justify-center h-32 bg-gray-50 dark:bg-gray-700 rounded-md",children:jsx("p",{className:"ndpr-card__subtitle",children:"No processing activities found."})}):jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:a$2("w-full text-sm text-left",i==null?void 0:i.table,o),children:[jsx("thead",{className:a$2("ndpr-table__head",i==null?void 0:i.tableHeader,o),children:jsxs("tr",{children:[jsx("th",{className:"ndpr-table__cell",children:"Activity"}),jsx("th",{className:"ndpr-table__cell",children:"Lawful Basis"}),jsx("th",{className:"ndpr-table__cell",children:"Status"}),jsx("th",{className:"ndpr-table__cell",children:"DPO Approval"}),jsx("th",{className:"ndpr-table__cell",children:"Sensitive Data"}),jsx("th",{className:"ndpr-table__cell",children:"Last Updated"}),jsx("th",{className:"ndpr-table__cell",children:"Actions"})]})}),jsx("tbody",{children:U.map(e=>jsxs("tr",{className:a$2("border-b border-gray-200 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700",i==null?void 0:i.tableRow,o),children:[jsxs("td",{className:"ndpr-table__cell",children:[jsx("button",{onClick:()=>fe(e.id),className:"font-medium ndpr-text-primary hover:underline text-left",children:e.name}),jsx("p",{className:"text-xs ndpr-text-muted mt-1 truncate max-w-xs",children:e.description})]}),jsx("td",{className:"ndpr-table__cell",children:z(e.lawfulBasis)}),jsx("td",{className:"ndpr-table__cell",children:W(e.status)}),jsx("td",{className:"ndpr-table__cell",children:K(e)}),jsx("td",{className:"ndpr-table__cell",children:jsx("span",{className:`text-xs ${e.involvesSensitiveData?"ndpr-text-warning font-medium":"ndpr-card__subtitle"}`,children:e.involvesSensitiveData?"Yes":"No"})}),jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:y(e.updatedAt)}),jsx("td",{className:"ndpr-table__cell",children:jsxs("div",{className:"ndpr-card__footer",children:[jsx("button",{onClick:()=>H(e),"aria-label":`Edit ${e.name}`,className:"text-xs ndpr-text-primary hover:underline",children:"Edit"}),e.status!=="archived"&&jsx("button",{onClick:()=>Y(e.id),"aria-label":`Archive ${e.name}`,className:"text-xs ndpr-text-muted hover:underline",children:"Archive"})]})})]},e.id))})]})})]});return jsxs("div",{className:a$2(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${ne}`,i==null?void 0:i.root,o),children:[jsx("h2",{className:a$2("ndpr-section-heading",i==null?void 0:i.title,o),children:le}),jsx("p",{className:"ndpr-card__subtitle",children:se}),oe&&x==="list"&&be(),de&&x==="list"&&he(),x==="list"&&ye(),x==="form"&&we(),x==="detail"&&Ce()]})};export{je as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js');var r={consent:{title:"We Value Your Privacy",description:"We use cookies and similar technologies to provide our services and enhance your experience. Your consent is collected in accordance with NDPA Sections 25-26.",acceptAll:"Accept All",rejectAll:"Reject All",customize:"Customize",savePreferences:"Save Preferences",selectAll:"Select All",deselectAll:"Deselect All",required:"Required",cookieNotice:'By clicking "Accept All", you agree to the use of ALL cookies. Visit our Cookie Policy to learn more.',managerTitle:"Manage Your Privacy Settings",managerDescription:"Update your consent preferences at any time. Required cookies cannot be disabled as they are necessary for the website to function. Consent management is provided in accordance with NDPA Sections 25-26.",resetToDefaults:"Reset to Defaults"},dsr:{title:"Submit a Data Subject Request",description:"Use this form to exercise your rights under the Nigeria Data Protection Act (NDPA), Part VI, Sections 34-38.",submitRequest:"Submit Request",reset:"Reset",fullName:"Full Name",email:"Email Address",phone:"Phone Number (Optional)",requestType:"Request Type",additionalInfo:"Additional Information",identityVerification:"Identity Verification",identifierType:"Identifier Type",identifierValue:"Identifier Value",privacyNotice:"The information you provide in this form will be used solely for the purpose of processing your data subject request.",successMessage:"Your request has been submitted successfully.",dashboardTitle:"Data Subject Request Dashboard",dashboardDescription:"Track and manage data subject requests in compliance with NDPA Part IV requirements.",trackerTitle:"DSR Request Tracker",trackerDescription:"Track the status and progress of data subject requests as required by NDPA Part IV."},breach:{title:"Report a Data Breach",description:"Use this form to report a suspected or confirmed data breach in accordance with NDPA Section 40.",submitReport:"Submit Report",breachTitle:"Breach Title/Summary",category:"Category",discoveredAt:"Date Discovered",detailedDescription:"Detailed Description",riskAssessmentTitle:"Breach Risk Assessment",riskAssessmentDescription:"Assess the risk level of this data breach to determine notification requirements under NDPA Section 40.",notificationManagerTitle:"Breach Notification Manager",notificationManagerDescription:"Manage data breach notifications and track compliance with NDPA Section 40 requirements.",regulatoryReportTitle:"Generate NDPC Notification Report",regulatoryReportDescription:"Generate a report for submission to the NDPC in compliance with NDPA Section 40 breach notification requirements."},dpia:{title:"Data Protection Impact Assessment",next:"Next",previous:"Previous",complete:"Complete Assessment",progress:"Progress",submit:"Submit",reportTitle:"Data Protection Impact Assessment Report"},policy:{title:"Privacy Policy Generator",generate:"Generate Policy",preview:"Preview",export:"Export",sections:"Sections",variables:"Variables",generatorTitle:"NDPA Privacy Policy Generator",generatorDescription:"Generate an NDPA-compliant privacy policy for your organization in accordance with NDPA Section 24.",previewTitle:"Privacy Policy Preview",previewDescription:"Preview your NDPA-compliant privacy policy before exporting.",exporterTitle:"Privacy Policy",exporterDescription:"Export your NDPA-compliant privacy policy in various formats.",wizardTitle:"Privacy Policy Builder"},lawfulBasis:{title:"Lawful Basis Tracker",description:"Document and track the lawful basis for each processing activity as required by NDPA 2023 Section 25."},crossBorder:{title:"Cross-Border Data Transfer Manager",description:"Manage and document cross-border personal data transfers in compliance with NDPA 2023 Part VIII (Sections 41-43)."},ropa:{title:"Record of Processing Activities (ROPA)",description:"Maintain a comprehensive record of all data processing activities as required by the NDPA accountability principle."},compliance:{score:"Compliance Score",excellent:"Excellent",good:"Good",needsWork:"Needs Work",critical:"Critical",recommendations:"Recommendations",passed:"Passed",gaps:"Gaps"},common:{loading:"Loading...",error:"An error occurred",save:"Save",cancel:"Cancel",delete:"Delete",edit:"Edit",add:"Add",back:"Back",next:"Next",search:"Search",noResults:"No results found"}};function c(e){if(!e)return r;let o=chunkRFPLZDIO_js.a({},r);for(let t of Object.keys(e))e[t]&&(o[t]=chunkRFPLZDIO_js.a(chunkRFPLZDIO_js.a({},r[t]),e[t]));return o}exports.a=r;exports.b=c;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var chunkUXUMYP4L_js=require('./chunk-UXUMYP4L.js'),chunkNDKDKDDX_js=require('./chunk-NDKDKDDX.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var Tr=({requestTypes:y,onSubmit:nr,onValidationError:F,title:T,description:C,submitButtonText:$,className:q="",buttonClassName:dr="",showConfirmation:pr=true,confirmationMessage:ar="Your request has been submitted successfully. You will receive a confirmation email shortly.",requireIdentityVerification:O=true,identifierTypes:D=[{id:"email",label:"Email Address"},{id:"account",label:"Account Number"},{id:"customer_id",label:"Customer ID"}],collectAdditionalContact:ur=true,labels:v={},classNames:r,unstyled:e=false,isSubmitting:A=false,defaultValues:p,onReset:I})=>{var W,J,K,Q,X,V,N,s,rr;if(!Array.isArray(y))throw new Error("[ndpr-toolkit] <DSRRequestForm requestTypes={...} /> requires an array of RequestType[]. See https://ndprtoolkit.com.ng/docs/components/dsr#requesttypes \u2014 or use the `<NDPRSubjectRights />` preset which ships sensible defaults.");let x=chunkNDKDKDDX_js.c(),br=(W=T!=null?T:x.dsr.title)!=null?W:"Submit a Data Subject Request",fr=(J=C!=null?C:x.dsr.description)!=null?J:"Use this form to exercise your rights under the Nigeria Data Protection Act (NDPA), Part VI.",lr=(K=$!=null?$:x.dsr.submitRequest)!=null?K:"Submit Request",[c,z]=react.useState((p==null?void 0:p.requestType)||""),[P,B]=react.useState(((Q=p==null?void 0:p.dataSubject)==null?void 0:Q.fullName)||""),[S,M]=react.useState(((X=p==null?void 0:p.dataSubject)==null?void 0:X.email)||""),[k,Z]=react.useState(((V=p==null?void 0:p.dataSubject)==null?void 0:V.phone)||""),[G,L]=react.useState(((N=p==null?void 0:p.dataSubject)==null?void 0:N.identifierType)||((s=D[0])==null?void 0:s.id)||""),[w,Y]=react.useState(((rr=p==null?void 0:p.dataSubject)==null?void 0:rr.identifierValue)||""),[l,j]=react.useState((p==null?void 0:p.additionalInfo)||{}),[_r,E]=react.useState(false),[d,H]=react.useState({}),mr=()=>{var i;z(""),B(""),M(""),Z(""),L(((i=D[0])==null?void 0:i.id)||""),Y(""),j({}),E(false),H({}),I==null||I();},a=y.find(i=>i.id===c),gr=i=>{z(i.target.value),j({});},h=(i,b)=>{j(_=>chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},_),{[i]:b}));},vr=()=>{let i={};return P.trim()||(i.fullName="Full name is required"),S.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(S)||(i.email="Email is invalid"):i.email="Email is required",c||(i.requestType="Please select a request type"),O&&!w.trim()&&(i.identifierValue="Identifier value is required"),a!=null&&a.requiresAdditionalInfo&&a.additionalFields&&a.additionalFields.forEach(b=>{b.required&&!l[b.id]&&(i[`additional_${b.id}`]=`${b.label} is required`);}),H(i),i},hr=i=>{i.preventDefault();let b=vr();if(Object.keys(b).length>0){F==null||F(b);return}let _=Object.keys(l).length>0?Object.fromEntries(Object.entries(l).map(([u,m])=>[u,typeof m=="string"?chunkUXUMYP4L_js.a(m):m])):void 0,R={requestType:c,dataSubject:{fullName:chunkUXUMYP4L_js.a(P),email:chunkUXUMYP4L_js.a(S),phone:k?chunkUXUMYP4L_js.a(k):void 0,identifierType:G,identifierValue:chunkUXUMYP4L_js.a(w)},additionalInfo:_,submittedAt:Date.now()};nr(R),pr&&E(true);},U=`ndpr-dsr-form__button ndpr-dsr-form__button--primary ${dr}`.trim(),qr="ndpr-dsr-form__button ndpr-dsr-form__button--secondary";return _r?jsxRuntime.jsxs("div",{"data-ndpr-component":"dsr-request-form","data-ndpr-state":"submitted",className:chunkAME4HJR4_js.a(`ndpr-dsr-form__success${q?` ${q}`:""}`,r==null?void 0:r.successMessage,e),"aria-live":"polite",children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__success-title",r==null?void 0:r.title,e),children:"Request Submitted"}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__success-body",r==null?void 0:r.description,e),children:ar}),jsxRuntime.jsx("button",{onClick:()=>E(false),className:chunkAME4HJR4_js.a(U,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),e),children:"Submit Another Request"})]}):jsxRuntime.jsxs("div",{"data-ndpr-component":"dsr-request-form",className:chunkAME4HJR4_js.a(`ndpr-dsr-form${q?` ${q}`:""}`,r==null?void 0:r.root,e),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__title",r==null?void 0:r.title,e),children:br}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__description",r==null?void 0:r.description,e),children:fr}),jsxRuntime.jsx("form",{onSubmit:hr,className:chunkAME4HJR4_js.a("",r==null?void 0:r.form,e),children:jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__sections",r==null?void 0:r.fieldGroup,e),children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Personal Information"}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"fullName",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.name||"Full Name"," ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"fullName",value:P,onChange:i=>B(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.fullName,"aria-describedby":d.fullName?"fullName-error":void 0}),d.fullName&&jsxRuntime.jsx("p",{id:"fullName-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.fullName})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"email",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.email||"Email Address"," ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{type:"email",id:"email",value:S,onChange:i=>M(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.email,"aria-describedby":d.email?"email-error":void 0}),d.email&&jsxRuntime.jsx("p",{id:"email-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.email})]}),ur&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"phone",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:"Phone Number (Optional)"}),jsxRuntime.jsx("input",{type:"tel",id:"phone",value:k,onChange:i=>Z(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e)})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Request Details"}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-field",children:[jsxRuntime.jsxs("label",{htmlFor:"requestType",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.requestType||"Request Type"," ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsxs("select",{id:"requestType",value:c,onChange:gr,className:chunkAME4HJR4_js.a("ndpr-form-field__select",r==null?void 0:r.select,e),required:true,"aria-required":"true","aria-invalid":!!d.requestType,"aria-describedby":d.requestType?"requestType-error":void 0,children:[jsxRuntime.jsx("option",{value:"",children:"Select a request type"}),y.map(i=>jsxRuntime.jsx("option",{value:i.id,children:i.name},i.id))]}),d.requestType&&jsxRuntime.jsx("p",{id:"requestType-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.requestType})]}),a&&jsxRuntime.jsxs("div",{className:e?"":"ndpr-dsr-form__type-info",children:[jsxRuntime.jsx("p",{children:a.description}),jsxRuntime.jsxs("p",{children:["Estimated completion time: ",a.estimatedCompletionTime," ",a.estimatedCompletionTime===1?"day":"days"]})]}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-field",children:[jsxRuntime.jsx("label",{htmlFor:"requestDescription",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:v.description||"Additional Information"}),jsxRuntime.jsx("textarea",{id:"requestDescription",className:chunkAME4HJR4_js.a("ndpr-form-field__textarea",r==null?void 0:r.textarea,e),rows:4,placeholder:"Please provide any additional details that might help us process your request"})]})]}),O&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Identity Verification"}),jsxRuntime.jsx("p",{className:e?"":"ndpr-form-section__hint",children:"To protect your privacy, we need to verify your identity before processing your request."}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"identifierType",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:["Identifier Type ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("select",{id:"identifierType",value:G,onChange:i=>L(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__select",r==null?void 0:r.select,e),required:true,"aria-required":"true",children:D.map(i=>jsxRuntime.jsx("option",{value:i.id,children:i.label},i.id))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"identifierValue",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:["Identifier Value ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"identifierValue",value:w,onChange:i=>Y(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.identifierValue,"aria-describedby":d.identifierValue?"identifierValue-error":void 0}),d.identifierValue&&jsxRuntime.jsx("p",{id:"identifierValue-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.identifierValue})]})]})]}),(a==null?void 0:a.requiresAdditionalInfo)&&a.additionalFields&&a.additionalFields.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Additional Information"}),jsxRuntime.jsx("div",{className:e?"":"ndpr-form-section",children:a.additionalFields.map(i=>{var b,_,R;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:i.id,className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[i.label," ",i.required&&jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),i.type==="text"&&jsxRuntime.jsx("input",{type:"text",id:i.id,value:String((b=l[i.id])!=null?b:""),onChange:u=>h(i.id,u.target.value),placeholder:i.placeholder,className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),i.type==="textarea"&&jsxRuntime.jsx("textarea",{id:i.id,value:String((_=l[i.id])!=null?_:""),onChange:u=>h(i.id,u.target.value),placeholder:i.placeholder,className:chunkAME4HJR4_js.a("ndpr-form-field__textarea",r==null?void 0:r.textarea,e),rows:4,required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),i.type==="select"&&i.options&&jsxRuntime.jsxs("select",{id:i.id,value:String((R=l[i.id])!=null?R:""),onChange:u=>h(i.id,u.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__select",r==null?void 0:r.select,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0,children:[jsxRuntime.jsx("option",{value:"",children:i.placeholder||"Select an option"}),i.options.map(u=>jsxRuntime.jsx("option",{value:u,children:u},u))]}),i.type==="checkbox"&&jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-field__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",id:i.id,checked:!!l[i.id],onChange:u=>h(i.id,u.target.checked),className:e?"":"ndpr-form-field__checkbox",required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),jsxRuntime.jsx("label",{htmlFor:i.id,className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:i.placeholder||i.label})]}),i.type==="file"&&jsxRuntime.jsx("input",{type:"file",id:i.id,onChange:u=>{var ir;let m=(ir=u.target.files)==null?void 0:ir[0];m&&h(i.id,m.name);},className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),d[`additional_${i.id}`]&&jsxRuntime.jsx("p",{id:`additional-${i.id}-error`,role:"alert",className:e?"":"ndpr-form-field__error",children:d[`additional_${i.id}`]})]},i.id)})})]}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-dsr-form__notice",children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-dsr-form__notice-title",children:"Privacy Notice"}),jsxRuntime.jsx("p",{className:e?"":"ndpr-dsr-form__notice-body",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."})]}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-dsr-form__actions",children:[A&&(r==null?void 0:r.loadingOverlay)&&jsxRuntime.jsx("div",{className:r.loadingOverlay}),jsxRuntime.jsx("button",{type:"submit",disabled:A,className:chunkAME4HJR4_js.a(U,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),e),children:A?"Submitting...":v.submit||lr}),jsxRuntime.jsx("button",{type:"button",onClick:mr,className:chunkAME4HJR4_js.a(qr,void 0,e),children:"Reset"})]})]})})]})};
|
|
1
|
+
'use strict';var chunkUXUMYP4L_js=require('./chunk-UXUMYP4L.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkYDKWD6MQ_js=require('./chunk-YDKWD6MQ.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var Tr=({requestTypes:y,onSubmit:nr,onValidationError:F,title:T,description:C,submitButtonText:$,className:q="",buttonClassName:dr="",showConfirmation:pr=true,confirmationMessage:ar="Your request has been submitted successfully. You will receive a confirmation email shortly.",requireIdentityVerification:O=true,identifierTypes:D=[{id:"email",label:"Email Address"},{id:"account",label:"Account Number"},{id:"customer_id",label:"Customer ID"}],collectAdditionalContact:ur=true,labels:v={},classNames:r,unstyled:e=false,isSubmitting:A=false,defaultValues:p,onReset:I})=>{var W,J,K,Q,X,V,N,s,rr;if(!Array.isArray(y))throw new Error("[ndpr-toolkit] <DSRRequestForm requestTypes={...} /> requires an array of RequestType[]. See https://ndprtoolkit.com.ng/docs/components/dsr#requesttypes \u2014 or use the `<NDPRSubjectRights />` preset which ships sensible defaults.");let x=chunkYDKWD6MQ_js.c(),br=(W=T!=null?T:x.dsr.title)!=null?W:"Submit a Data Subject Request",fr=(J=C!=null?C:x.dsr.description)!=null?J:"Use this form to exercise your rights under the Nigeria Data Protection Act (NDPA), Part VI.",lr=(K=$!=null?$:x.dsr.submitRequest)!=null?K:"Submit Request",[c,z]=react.useState((p==null?void 0:p.requestType)||""),[P,B]=react.useState(((Q=p==null?void 0:p.dataSubject)==null?void 0:Q.fullName)||""),[S,M]=react.useState(((X=p==null?void 0:p.dataSubject)==null?void 0:X.email)||""),[k,Z]=react.useState(((V=p==null?void 0:p.dataSubject)==null?void 0:V.phone)||""),[G,L]=react.useState(((N=p==null?void 0:p.dataSubject)==null?void 0:N.identifierType)||((s=D[0])==null?void 0:s.id)||""),[w,Y]=react.useState(((rr=p==null?void 0:p.dataSubject)==null?void 0:rr.identifierValue)||""),[l,j]=react.useState((p==null?void 0:p.additionalInfo)||{}),[_r,E]=react.useState(false),[d,H]=react.useState({}),mr=()=>{var i;z(""),B(""),M(""),Z(""),L(((i=D[0])==null?void 0:i.id)||""),Y(""),j({}),E(false),H({}),I==null||I();},a=y.find(i=>i.id===c),gr=i=>{z(i.target.value),j({});},h=(i,b)=>{j(_=>chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},_),{[i]:b}));},vr=()=>{let i={};return P.trim()||(i.fullName="Full name is required"),S.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(S)||(i.email="Email is invalid"):i.email="Email is required",c||(i.requestType="Please select a request type"),O&&!w.trim()&&(i.identifierValue="Identifier value is required"),a!=null&&a.requiresAdditionalInfo&&a.additionalFields&&a.additionalFields.forEach(b=>{b.required&&!l[b.id]&&(i[`additional_${b.id}`]=`${b.label} is required`);}),H(i),i},hr=i=>{i.preventDefault();let b=vr();if(Object.keys(b).length>0){F==null||F(b);return}let _=Object.keys(l).length>0?Object.fromEntries(Object.entries(l).map(([u,m])=>[u,typeof m=="string"?chunkUXUMYP4L_js.a(m):m])):void 0,R={requestType:c,dataSubject:{fullName:chunkUXUMYP4L_js.a(P),email:chunkUXUMYP4L_js.a(S),phone:k?chunkUXUMYP4L_js.a(k):void 0,identifierType:G,identifierValue:chunkUXUMYP4L_js.a(w)},additionalInfo:_,submittedAt:Date.now()};nr(R),pr&&E(true);},U=`ndpr-dsr-form__button ndpr-dsr-form__button--primary ${dr}`.trim(),qr="ndpr-dsr-form__button ndpr-dsr-form__button--secondary";return _r?jsxRuntime.jsxs("div",{"data-ndpr-component":"dsr-request-form","data-ndpr-state":"submitted",className:chunkAME4HJR4_js.a(`ndpr-dsr-form__success${q?` ${q}`:""}`,r==null?void 0:r.successMessage,e),"aria-live":"polite",children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__success-title",r==null?void 0:r.title,e),children:"Request Submitted"}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__success-body",r==null?void 0:r.description,e),children:ar}),jsxRuntime.jsx("button",{onClick:()=>E(false),className:chunkAME4HJR4_js.a(U,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),e),children:"Submit Another Request"})]}):jsxRuntime.jsxs("div",{"data-ndpr-component":"dsr-request-form",className:chunkAME4HJR4_js.a(`ndpr-dsr-form${q?` ${q}`:""}`,r==null?void 0:r.root,e),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__title",r==null?void 0:r.title,e),children:br}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__description",r==null?void 0:r.description,e),children:fr}),jsxRuntime.jsx("form",{onSubmit:hr,className:chunkAME4HJR4_js.a("",r==null?void 0:r.form,e),children:jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__sections",r==null?void 0:r.fieldGroup,e),children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Personal Information"}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"fullName",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.name||"Full Name"," ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"fullName",value:P,onChange:i=>B(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.fullName,"aria-describedby":d.fullName?"fullName-error":void 0}),d.fullName&&jsxRuntime.jsx("p",{id:"fullName-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.fullName})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"email",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.email||"Email Address"," ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{type:"email",id:"email",value:S,onChange:i=>M(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.email,"aria-describedby":d.email?"email-error":void 0}),d.email&&jsxRuntime.jsx("p",{id:"email-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.email})]}),ur&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"phone",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:"Phone Number (Optional)"}),jsxRuntime.jsx("input",{type:"tel",id:"phone",value:k,onChange:i=>Z(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e)})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Request Details"}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-field",children:[jsxRuntime.jsxs("label",{htmlFor:"requestType",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.requestType||"Request Type"," ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsxs("select",{id:"requestType",value:c,onChange:gr,className:chunkAME4HJR4_js.a("ndpr-form-field__select",r==null?void 0:r.select,e),required:true,"aria-required":"true","aria-invalid":!!d.requestType,"aria-describedby":d.requestType?"requestType-error":void 0,children:[jsxRuntime.jsx("option",{value:"",children:"Select a request type"}),y.map(i=>jsxRuntime.jsx("option",{value:i.id,children:i.name},i.id))]}),d.requestType&&jsxRuntime.jsx("p",{id:"requestType-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.requestType})]}),a&&jsxRuntime.jsxs("div",{className:e?"":"ndpr-dsr-form__type-info",children:[jsxRuntime.jsx("p",{children:a.description}),jsxRuntime.jsxs("p",{children:["Estimated completion time: ",a.estimatedCompletionTime," ",a.estimatedCompletionTime===1?"day":"days"]})]}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-field",children:[jsxRuntime.jsx("label",{htmlFor:"requestDescription",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:v.description||"Additional Information"}),jsxRuntime.jsx("textarea",{id:"requestDescription",className:chunkAME4HJR4_js.a("ndpr-form-field__textarea",r==null?void 0:r.textarea,e),rows:4,placeholder:"Please provide any additional details that might help us process your request"})]})]}),O&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Identity Verification"}),jsxRuntime.jsx("p",{className:e?"":"ndpr-form-section__hint",children:"To protect your privacy, we need to verify your identity before processing your request."}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"identifierType",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:["Identifier Type ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("select",{id:"identifierType",value:G,onChange:i=>L(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__select",r==null?void 0:r.select,e),required:true,"aria-required":"true",children:D.map(i=>jsxRuntime.jsx("option",{value:i.id,children:i.label},i.id))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"identifierValue",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:["Identifier Value ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"identifierValue",value:w,onChange:i=>Y(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.identifierValue,"aria-describedby":d.identifierValue?"identifierValue-error":void 0}),d.identifierValue&&jsxRuntime.jsx("p",{id:"identifierValue-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.identifierValue})]})]})]}),(a==null?void 0:a.requiresAdditionalInfo)&&a.additionalFields&&a.additionalFields.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Additional Information"}),jsxRuntime.jsx("div",{className:e?"":"ndpr-form-section",children:a.additionalFields.map(i=>{var b,_,R;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:i.id,className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[i.label," ",i.required&&jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),i.type==="text"&&jsxRuntime.jsx("input",{type:"text",id:i.id,value:String((b=l[i.id])!=null?b:""),onChange:u=>h(i.id,u.target.value),placeholder:i.placeholder,className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),i.type==="textarea"&&jsxRuntime.jsx("textarea",{id:i.id,value:String((_=l[i.id])!=null?_:""),onChange:u=>h(i.id,u.target.value),placeholder:i.placeholder,className:chunkAME4HJR4_js.a("ndpr-form-field__textarea",r==null?void 0:r.textarea,e),rows:4,required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),i.type==="select"&&i.options&&jsxRuntime.jsxs("select",{id:i.id,value:String((R=l[i.id])!=null?R:""),onChange:u=>h(i.id,u.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__select",r==null?void 0:r.select,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0,children:[jsxRuntime.jsx("option",{value:"",children:i.placeholder||"Select an option"}),i.options.map(u=>jsxRuntime.jsx("option",{value:u,children:u},u))]}),i.type==="checkbox"&&jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-field__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",id:i.id,checked:!!l[i.id],onChange:u=>h(i.id,u.target.checked),className:e?"":"ndpr-form-field__checkbox",required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),jsxRuntime.jsx("label",{htmlFor:i.id,className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:i.placeholder||i.label})]}),i.type==="file"&&jsxRuntime.jsx("input",{type:"file",id:i.id,onChange:u=>{var ir;let m=(ir=u.target.files)==null?void 0:ir[0];m&&h(i.id,m.name);},className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),d[`additional_${i.id}`]&&jsxRuntime.jsx("p",{id:`additional-${i.id}-error`,role:"alert",className:e?"":"ndpr-form-field__error",children:d[`additional_${i.id}`]})]},i.id)})})]}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-dsr-form__notice",children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-dsr-form__notice-title",children:"Privacy Notice"}),jsxRuntime.jsx("p",{className:e?"":"ndpr-dsr-form__notice-body",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."})]}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-dsr-form__actions",children:[A&&(r==null?void 0:r.loadingOverlay)&&jsxRuntime.jsx("div",{className:r.loadingOverlay}),jsxRuntime.jsx("button",{type:"submit",disabled:A,className:chunkAME4HJR4_js.a(U,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),e),children:A?"Submitting...":v.submit||lr}),jsxRuntime.jsx("button",{type:"button",onClick:mr,className:chunkAME4HJR4_js.a(qr,void 0,e),children:"Reset"})]})]})})]})};
|
|
2
2
|
exports.a=Tr;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-ZJYULEER.mjs';var r={consent:{title:"We Value Your Privacy",description:"We use cookies and similar technologies to provide our services and enhance your experience. Your consent is collected in accordance with NDPA Sections 25-26.",acceptAll:"Accept All",rejectAll:"Reject All",customize:"Customize",savePreferences:"Save Preferences",selectAll:"Select All",deselectAll:"Deselect All",required:"Required",cookieNotice:'By clicking "Accept All", you agree to the use of ALL cookies. Visit our Cookie Policy to learn more.',managerTitle:"Manage Your Privacy Settings",managerDescription:"Update your consent preferences at any time. Required cookies cannot be disabled as they are necessary for the website to function. Consent management is provided in accordance with NDPA Sections 25-26.",resetToDefaults:"Reset to Defaults"},dsr:{title:"Submit a Data Subject Request",description:"Use this form to exercise your rights under the Nigeria Data Protection Act (NDPA), Part VI, Sections 34-38.",submitRequest:"Submit Request",reset:"Reset",fullName:"Full Name",email:"Email Address",phone:"Phone Number (Optional)",requestType:"Request Type",additionalInfo:"Additional Information",identityVerification:"Identity Verification",identifierType:"Identifier Type",identifierValue:"Identifier Value",privacyNotice:"The information you provide in this form will be used solely for the purpose of processing your data subject request.",successMessage:"Your request has been submitted successfully.",dashboardTitle:"Data Subject Request Dashboard",dashboardDescription:"Track and manage data subject requests in compliance with NDPA Part IV requirements.",trackerTitle:"DSR Request Tracker",trackerDescription:"Track the status and progress of data subject requests as required by NDPA Part IV."},breach:{title:"Report a Data Breach",description:"Use this form to report a suspected or confirmed data breach in accordance with NDPA Section 40.",submitReport:"Submit Report",breachTitle:"Breach Title/Summary",category:"Category",discoveredAt:"Date Discovered",detailedDescription:"Detailed Description",riskAssessmentTitle:"Breach Risk Assessment",riskAssessmentDescription:"Assess the risk level of this data breach to determine notification requirements under NDPA Section 40.",notificationManagerTitle:"Breach Notification Manager",notificationManagerDescription:"Manage data breach notifications and track compliance with NDPA Section 40 requirements.",regulatoryReportTitle:"Generate NDPC Notification Report",regulatoryReportDescription:"Generate a report for submission to the NDPC in compliance with NDPA Section 40 breach notification requirements."},dpia:{title:"Data Protection Impact Assessment",next:"Next",previous:"Previous",complete:"Complete Assessment",progress:"Progress",submit:"Submit",reportTitle:"Data Protection Impact Assessment Report"},policy:{title:"Privacy Policy Generator",generate:"Generate Policy",preview:"Preview",export:"Export",sections:"Sections",variables:"Variables",generatorTitle:"NDPA Privacy Policy Generator",generatorDescription:"Generate an NDPA-compliant privacy policy for your organization in accordance with NDPA Section 24.",previewTitle:"Privacy Policy Preview",previewDescription:"Preview your NDPA-compliant privacy policy before exporting.",exporterTitle:"Privacy Policy",exporterDescription:"Export your NDPA-compliant privacy policy in various formats.",wizardTitle:"Privacy Policy Builder"},lawfulBasis:{title:"Lawful Basis Tracker",description:"Document and track the lawful basis for each processing activity as required by NDPA 2023 Section 25."},crossBorder:{title:"Cross-Border Data Transfer Manager",description:"Manage and document cross-border personal data transfers in compliance with NDPA 2023 Part VIII (Sections 41-43)."},ropa:{title:"Record of Processing Activities (ROPA)",description:"Maintain a comprehensive record of all data processing activities as required by the NDPA accountability principle."},compliance:{score:"Compliance Score",excellent:"Excellent",good:"Good",needsWork:"Needs Work",critical:"Critical",recommendations:"Recommendations",passed:"Passed",gaps:"Gaps"},common:{loading:"Loading...",error:"An error occurred",save:"Save",cancel:"Cancel",delete:"Delete",edit:"Edit",add:"Add",back:"Back",next:"Next",search:"Search",noResults:"No results found"}};function c(e){if(!e)return r;let o=a({},r);for(let t of Object.keys(e))e[t]&&(o[t]=a(a({},r[t]),e[t]));return o}export{r as a,c as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkYDKWD6MQ_js=require('./chunk-YDKWD6MQ.js'),jsxRuntime=require('react/jsx-runtime');var K=({sections:v,answers:k,onAnswerChange:c,currentSectionIndex:o,onNextSection:S,onPrevSection:L,validationErrors:R={},readOnly:t=false,className:V="",buttonClassName:$="",nextButtonText:m,prevButtonText:b,submitButtonText:g,showProgress:j=true,progress:u,classNames:y={},unstyled:B=false})=>{var P,x,A;let _=chunkYDKWD6MQ_js.c(),F=(P=m!=null?m:_.dpia.next)!=null?P:"Next",z=(x=b!=null?b:_.dpia.previous)!=null?x:"Previous",E=(A=g!=null?g:_.dpia.submit)!=null?A:"Submit",f=v[o],G=o===v.length-1,l=(e,r)=>{let d=r?y[r]:void 0;return !d&&r==="nextButton"&&(d=y.primaryButton),!d&&r==="prevButton"&&(d=y.secondaryButton),chunkAME4HJR4_js.a(e,d,B)},W=e=>e.showWhen?e.showWhen.every(r=>{let d=k[r.questionId];switch(r.operator){case "equals":return d===r.value;case "contains":return Array.isArray(d)?d.includes(String(r.value)):false;case "greaterThan":return typeof d=="number"&&typeof r.value=="number"?d>r.value:false;case "lessThan":return typeof d=="number"&&typeof r.value=="number"?d<r.value:false;default:return true}}):true,h=e=>l("ndpr-form-field__input","input"),M=e=>{if(!W(e))return null;let r=R[e.id],d=k[e.id],s=typeof d=="boolean"?String(d):d,C=e.guidance?`${e.id}-guidance`:void 0,w=r?`${e.id}-error`:void 0,p=[C,w].filter(Boolean).join(" ")||void 0;return jsxRuntime.jsxs("div",{className:l("ndpr-form-field","question"),children:[jsxRuntime.jsxs("label",{htmlFor:e.id,className:l("ndpr-form-field__label","questionText"),children:[e.text,e.required&&jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),e.guidance&&jsxRuntime.jsx("p",{id:C,className:l("ndpr-form-field__hint","guidance"),children:e.guidance}),e.type==="text"&&jsxRuntime.jsx("input",{type:"text",id:e.id,value:s||"",onChange:a=>c(e.id,a.target.value),disabled:t,className:h(),"aria-required":e.required||void 0,"aria-describedby":p,"aria-invalid":r?true:void 0}),e.type==="textarea"&&jsxRuntime.jsx("textarea",{id:e.id,value:s||"",onChange:a=>c(e.id,a.target.value),disabled:t,rows:4,className:h(),"aria-required":e.required||void 0,"aria-describedby":p,"aria-invalid":r?true:void 0}),e.type==="select"&&e.options&&jsxRuntime.jsxs("select",{id:e.id,value:s||"",onChange:a=>c(e.id,a.target.value),disabled:t,className:h(),"aria-required":e.required||void 0,"aria-describedby":p,"aria-invalid":r?true:void 0,children:[jsxRuntime.jsx("option",{value:"",children:"Select an option"}),e.options.map(a=>jsxRuntime.jsx("option",{value:a.value,children:a.label},a.value))]}),e.type==="radio"&&e.options&&jsxRuntime.jsx("div",{className:l("ndpr-form-field__option-group","radioGroup"),role:"radiogroup","aria-required":e.required||void 0,"aria-describedby":p,"aria-invalid":r?true:void 0,children:e.options.map(a=>jsxRuntime.jsxs("div",{className:l("ndpr-form-field__checkbox-row","radioOption"),children:[jsxRuntime.jsx("input",{type:"radio",id:`${e.id}_${a.value}`,name:e.id,value:a.value,checked:s===a.value,onChange:()=>c(e.id,a.value),disabled:t,className:"ndpr-form-field__radio"}),jsxRuntime.jsxs("label",{htmlFor:`${e.id}_${a.value}`,className:"ndpr-form-field__label",children:[a.label,a.riskLevel&&jsxRuntime.jsxs("span",{className:a.riskLevel==="low"?"ndpr-badge ndpr-badge--success":a.riskLevel==="medium"?"ndpr-badge ndpr-badge--warning":"ndpr-badge ndpr-badge--destructive",children:[a.riskLevel.charAt(0).toUpperCase()+a.riskLevel.slice(1)," Risk"]})]})]},a.value))}),e.type==="checkbox"&&e.options&&jsxRuntime.jsx("div",{className:"ndpr-form-field__option-group",role:"group","aria-label":e.text,"aria-describedby":p,"aria-invalid":r?true:void 0,children:e.options.map(a=>jsxRuntime.jsxs("div",{className:"ndpr-form-field__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",id:`${e.id}_${a.value}`,value:a.value,checked:Array.isArray(s)?s.includes(a.value):false,onChange:N=>{let D=Array.isArray(s)?[...s]:[];N.target.checked?c(e.id,[...D,a.value]):c(e.id,D.filter(U=>U!==a.value));},disabled:t,className:"ndpr-form-field__checkbox"}),jsxRuntime.jsx("label",{htmlFor:`${e.id}_${a.value}`,className:"ndpr-form-field__label",children:a.label})]},a.value))}),e.type==="scale"&&jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsx("div",{className:"ndpr-form-field__hint",style:{display:"flex",justifyContent:"space-between"},children:e.scaleLabels&&Object.entries(e.scaleLabels).map(([a,N])=>jsxRuntime.jsx("span",{style:{width:`${100/Object.keys(e.scaleLabels||{}).length}%`,textAlign:"center"},children:N},a))}),jsxRuntime.jsx("input",{type:"range",id:e.id,min:e.minValue||1,max:e.maxValue||5,value:typeof s=="number"?s:e.minValue||1,onChange:a=>c(e.id,parseInt(a.target.value,10)),disabled:t,className:"ndpr-form-field__range","aria-required":e.required||void 0,"aria-describedby":p,"aria-invalid":r?true:void 0}),jsxRuntime.jsxs("div",{className:"ndpr-form-field__hint",style:{textAlign:"center"},children:["Selected value: ",s||e.minValue||1]})]}),r&&jsxRuntime.jsx("p",{id:w,className:"ndpr-form-field__error",role:"alert",children:r})]},e.id)};return f?jsxRuntime.jsxs("div",{"data-ndpr-component":"dpia-questionnaire",className:`${l("ndpr-card","root")} ${V}`,children:[j&&jsxRuntime.jsxs("div",{className:l("ndpr-card__header","header"),style:{flexDirection:"column",alignItems:"stretch",gap:"var(--ndpr-space-2)"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"var(--ndpr-font-size-sm)",color:"rgb(var(--ndpr-muted-foreground))"},children:[jsxRuntime.jsxs("span",{children:["Section ",o+1," of ",v.length]}),jsxRuntime.jsx("span",{children:u!==void 0?`${u}% Complete`:""})]}),jsxRuntime.jsx("div",{className:l("ndpr-progress","progressBar"),role:"progressbar","aria-valuenow":u!==void 0?u:Math.round((o+1)/v.length*100),"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Questionnaire progress",children:jsxRuntime.jsx("div",{className:"ndpr-progress__bar",style:{width:`${u!==void 0?u:(o+1)/v.length*100}%`}})})]}),jsxRuntime.jsx("h2",{className:l("ndpr-card__title","title"),"aria-live":"polite",children:f.title}),f.description&&jsxRuntime.jsx("p",{className:l("ndpr-card__subtitle","sectionTitle"),children:f.description}),jsxRuntime.jsx("div",{className:l("ndpr-card__body","section"),children:f.questions.map(e=>M(e))}),jsxRuntime.jsxs("div",{className:l("ndpr-card__footer","navigation"),style:{justifyContent:"space-between"},children:[jsxRuntime.jsx("button",{type:"button",onClick:L,disabled:o===0||t,className:`${l("ndpr-button ndpr-button--secondary","prevButton")} ${$}`,children:z}),jsxRuntime.jsx("button",{type:"button",onClick:S,disabled:t,className:`${l("ndpr-button ndpr-button--primary","nextButton")} ${$}`,children:G?E:F})]})]}):jsxRuntime.jsx("div",{children:"No section found."})};exports.a=K;
|