D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
aramrprl
/
www
/
wp-content
/
plugins
/
complianz-gdpr
/
settings
/
build
/
Filename :
2980.92a8207f9d739ea56809.js
back
Copy
"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[17,2980,5207,5228,8414],{5207:(e,t,a)=>{a.r(t),a.d(t,{default:()=>i});var n=a(81621),l=a(16535),s=a(9588),c=a(73710);const i=(0,n.vt)((e,t)=>({documentsLoaded:!1,savedDocument:{},conclusions:[],region:"",fileName:"",fetching:!1,updating:!1,loadingFields:!1,documents:[],regions:[],fields:[],editDocumentId:!1,resetEditDocumentId:t=>{e({editDocumentId:!1,region:""})},editDocument:async t=>{e({updating:!0}),await s.doAction("load_databreach_report",{id:t}).then(t=>{e({fields:t.fields,region:t.region,updating:!1,fileName:t.file_name})}).catch(e=>{console.error(e)}),e({editDocumentId:t})},setRegion:t=>{e({region:t})},updateField:(a,n)=>{let s=!1,i=!1;e((0,l.Ay)(e=>{e.fields.forEach(function(e,t){e.id===a&&(i=t,s=!0)}),!1!==i&&(e.fields[i].value=n)}));let o=(0,c.updateFieldsListWithConditions)(t().fields);e({fields:o})},save:async a=>{e({updating:!0});let n=t().editDocumentId,l=0;await s.doAction("save_databreach_report",{fields:t().fields,region:a,post_id:n}).then(t=>(l=t.post_id,e({updating:!1,conclusions:t.conclusions}),t)).catch(e=>{console.error(e)}),await t().fetchData();let c=t().documents.filter(e=>e.id===l);c.length>0&&e({savedDocument:c[0]})},deleteDocuments:async a=>{let n=t().documents.filter(e=>a.includes(e.id));e(e=>({documents:e.documents.filter(e=>!a.includes(e.id))}));let l={};l.documents=n,await s.doAction("delete_databreach_report",l).then(e=>e).catch(e=>{console.error(e)})},fetchData:async()=>{if(t().fetching)return;e({fetching:!0});const{documents:a,regions:n}=await s.doAction("get_databreach_reports",{}).then(e=>e).catch(e=>{console.error(e)});e(e=>({documentsLoaded:!0,documents:a,regions:n,fetching:!1}))},fetchFields:async t=>{let a={region:t};e({loadingFields:!0});const{fields:n}=await s.doAction("get_databreach_report_fields",a).then(e=>e).catch(e=>{console.error(e)});let l=(0,c.updateFieldsListWithConditions)(n);e(e=>({fields:l,loadingFields:!1}))}}))},25228:(e,t,a)=>{a.r(t),a.d(t,{default:()=>o});var n=a(86087),l=a(21366),s=a(45111),c=a(27723),i=a(10790);const o=(0,n.memo)(({value:e=!1,onChange:t,required:a,defaultValue:n,disabled:o,options:d={},canBeEmpty:r=!0,label:u})=>{if(Array.isArray(d)){let e={};d.map(t=>{e[t.value]=t.label}),d=e}return r?(""===e||!1===e||0===e)&&(e="0",d={0:(0,c.__)("Select an option","complianz-gdpr"),...d}):e||(e=Object.keys(d)[0]),(0,i.jsx)("div",{className:"cmplz-input-group cmplz-select-group",children:(0,i.jsxs)(l.bL,{value:e,defaultValue:n,onValueChange:t,required:a,disabled:o&&!Array.isArray(o),children:[(0,i.jsxs)(l.l9,{className:"cmplz-select-group__trigger",children:[(0,i.jsx)(l.WT,{}),(0,i.jsx)(s.default,{name:"chevron-down"})]}),(0,i.jsxs)(l.UC,{className:"cmplz-select-group__content",position:"popper",children:[(0,i.jsx)(l.PP,{className:"cmplz-select-group__scroll-button",children:(0,i.jsx)(s.default,{name:"chevron-up"})}),(0,i.jsx)(l.LM,{className:"cmplz-select-group__viewport",children:(0,i.jsx)(l.YJ,{children:Object.entries(d).map(([e,t])=>(0,i.jsx)(l.q7,{disabled:Array.isArray(o)&&o.includes(e),className:"cmplz-select-group__item",value:e,children:(0,i.jsx)(l.p4,{children:t})},e))})}),(0,i.jsx)(l.wn,{className:"cmplz-select-group__scroll-button",children:(0,i.jsx)(s.default,{name:"chevron-down"})})]})]})},u)})},38414:(e,t,a)=>{a.r(t),a.d(t,{default:()=>i});var n=a(86087),l=a(45111),s=a(99418),c=a(10790);const i=(0,n.memo)(({conclusion:e,delay:t})=>{const[a,i]=(0,n.useState)(!0);(0,n.useEffect)(()=>{setTimeout(()=>{o()},t)});const o=()=>{i(!1)};let d="green";return"warning"===e.report_status&&(d="orange"),"error"===e.report_status&&(d="red"),(0,c.jsxs)(c.Fragment,{children:[a&&(0,c.jsxs)("li",{className:"cmplz-conclusion__check icon-loading",children:[(0,c.jsx)(l.default,{name:"loading",color:"grey"}),(0,c.jsxs)("div",{className:"cmplz-conclusion__check--report-text",children:[" ",e.check_text," "]})]}),!a&&(0,c.jsxs)("li",{className:"cmplz-conclusion__check icon-"+e.report_status,children:[(0,c.jsx)(l.default,{name:e.report_status,color:d}),(0,c.jsx)("div",{className:"cmplz-conclusion__check--report-text",dangerouslySetInnerHTML:{__html:s.A.sanitize(e.report_text)},children:" "})]})]})})},50599:(e,t,a)=>{a.r(t),a.d(t,{default:()=>p});var n=a(5207),l=a(86087),s=a(27723),c=a(32636),i=a(4219),o=a(45111),d=a(90017),r=a(59387),u=a(25228),m=a(10790);const p=(0,l.memo)(({label:e,field:t})=>{const{fields:a,fileName:p,fetching:h,loadingFields:g,updating:_,regions:f,documentsLoaded:b,resetEditDocumentId:x,savedDocument:j,fetchData:z,fetchFields:v,updateField:y,save:w,editDocumentId:N,region:k,setRegion:C}=(0,n.default)(),[F,D]=(0,l.useState)(!0),[A,L]=(0,l.useState)(!1),[E,S]=(0,l.useState)(0),{allRequiredFieldsCompleted:R,fetchAllFieldsCompleted:I,fieldsLoaded:q,showSavedSettingsNotice:T}=(0,i.default)();let U=React.createRef();(0,l.useEffect)(()=>{N&&S(0),N&&U.current&&U.current.scrollIntoView({behavior:"smooth",block:"start"})},[N]),(0,l.useEffect)(()=>{!b&&cmplz_settings.is_premium&&z()},[b]),(0,l.useEffect)(()=>{I()},[q]),(0,l.useEffect)(()=>{D(""===k)},[k,h,N]);const H=async()=>{if(""!==j.downloadUrl){L(!0);const e=j.download_url;try{let t=new XMLHttpRequest;t.responseType="blob",t.open("get",e,!0),t.send(),t.onreadystatechange=function(){if(4===this.readyState&&200===this.status){let e=window.URL.createObjectURL(this.response),t=window.document.createElement("a");t.setAttribute("href",e),t.setAttribute("download",j.title),window.document.body.appendChild(t),t.click(),L(!1),setTimeout(function(){window.URL.revokeObjectURL(e)},6e4)}}}catch(e){console.error(e),L(!1)}}},M=async()=>{await w(k),T()};(0,l.useEffect)(()=>{""===k||h||D(!1)},[k,h]);let O=a.filter(e=>void 0===e.conditionallyDisabled||!1===e.conditionallyDisabled),P=Math.ceil(O.length/5),V=(e=>{const t=5*(E-1),a=t+5;return e.slice(t,a)})(a);return(0,m.jsxs)(m.Fragment,{children:[!R&&(0,m.jsx)("div",{className:"cmplz-locked",children:(0,m.jsxs)("div",{className:"cmplz-locked-overlay",children:[(0,m.jsx)("span",{className:"cmplz-task-status cmplz-warning",children:(0,s.__)("Incomplete","complianz-gdpr")}),(0,m.jsx)("span",{children:(0,s.__)("The wizard has not been completed yet, but this field requires information from the wizard. Please complete the wizard first.","complianz-gdpr")})]})}),0===E&&(0,m.jsxs)(m.Fragment,{children:[N&&(0,m.jsx)("div",{className:"cmplz-selected-document",children:p}),(0,m.jsx)(r.default,{id:"region_for_databreaches",label:(0,s.__)("Region","complianz-gdpr"),required:!0,type:"select"}),(0,m.jsx)(u.default,{innerRef:U,disabled:_,onChange:e=>C(e),options:f,value:k,required:!0}),(0,m.jsxs)("div",{className:"cmplz-table-header",children:[(0,m.jsx)(r.default,{id:"region_for_databreaches",label:(0,s.__)("Create Data Breach report","complianz-gdpr"),type:"button"}),(0,m.jsxs)("div",{className:"cmplz-table-header-controls",children:[N&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("button",{disabled:_,className:"button button-default",onClick:()=>{x(),S(0)},children:(0,s.__)("Cancel","complianz-gdpr")}),(0,m.jsx)("button",{disabled:_,className:"button button-primary",onClick:()=>S(E+1),children:(0,s.__)("Next","complianz-gdpr")}),(0,m.jsx)("button",{disabled:_,className:"button button-primary",onClick:()=>M(),children:(0,s.__)("Save","complianz-gdpr")})]}),!N&&(0,m.jsx)(m.Fragment,{children:(0,m.jsxs)("button",{disabled:F||g,className:"button button-primary",onClick:()=>(async()=>{await v(k),S(1)})(),children:[(0,s.__)("Create","complianz-gdpr"),g&&(0,m.jsx)(o.default,{name:"loading",color:"grey"})]})})]})]})]}),E>0&&(0,m.jsxs)(m.Fragment,{children:[E<=P&&V.map((e,t)=>(0,m.jsx)(c.default,{index:t,field:e,isCustomField:!0,customChangeHandler:(e,t)=>((e,t)=>{y(e,t)})(e,t)},t)),E>P&&(0,m.jsx)(m.Fragment,{children:(0,m.jsx)(d.default,{})}),(0,m.jsx)("div",{className:"cmplz-table-header",children:(0,m.jsxs)("div",{className:"cmplz-table-header-controls",children:[(0,m.jsxs)("button",{disabled:_,className:"button button-default",onClick:()=>{x(),S(0)},children:[E<=P&&(0,s.__)("Cancel","complianz-gdpr"),E>P&&(0,s.__)("Exit","complianz-gdpr")]}),E<=P&&(0,m.jsx)("button",{className:"button button-default",onClick:()=>S(E-1),children:(0,s.__)("Previous","complianz-gdpr")}),E<P&&(0,m.jsx)(m.Fragment,{children:(0,m.jsx)("button",{className:"button button-primary",onClick:()=>S(E+1),children:(0,s.__)("Next","complianz-gdpr")})}),E===P&&(0,m.jsx)(m.Fragment,{children:(0,m.jsxs)("button",{className:"button button-primary",onClick:()=>(async()=>{await w(k),T(),S(E+1)})(),children:[(0,s.__)("Finish","complianz-gdpr"),_&&(0,m.jsx)(o.default,{name:"loading",color:"grey"})]})}),E>P&&j&&j.has_to_be_reported&&(0,m.jsx)(m.Fragment,{children:(0,m.jsx)("button",{disabled:A,className:"button button-primary",onClick:()=>H(),children:(0,s.__)("Download","complianz-gdpr")})}),N&&E<P&&(0,m.jsx)(m.Fragment,{children:(0,m.jsx)("button",{disabled:_,className:"button button-primary",onClick:()=>M(),children:(0,s.__)("Save","complianz-gdpr")})})]})})]})]})})},90017:(e,t,a)=>{a.r(t),a.d(t,{default:()=>d});var n=a(5207),l=a(86087),s=a(27723),c=a(4219),i=a(38414),o=a(10790);const d=(0,l.memo)(()=>{const{savedDocument:e,conclusions:t}=(0,n.default)(),{addHelpNotice:a}=(0,c.default)();return(0,l.useEffect)(()=>{e.has_to_be_reported&&a("create-data-breach-reports","warning",(0,s.__)("This wizard is intended to provide a general guide to a possible data breach.","complianz-gdpr")+" "+(0,s.__)("Specialist legal advice should be sought about your specific circumstances.","complianz-gdpr"),(0,s.__)("Specialist legal advice required","complianz-gdpr"),!1)},[e]),(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)("div",{id:"cmplz-conclusion",children:[(0,o.jsx)("h3",{children:(0,s.__)("Your dataleak report:","complianz-gdpr")}),(0,o.jsx)("ul",{className:"cmplz-conclusion__list",children:t.length>0&&t.map((e,t)=>(0,o.jsx)(i.default,{conclusion:e,delay:1e3*t},t))})]})})})}}]);