1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
|
|
"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[8550,9091,5207,9758,1366],{99091:(e,t,n)=>{n.r(t),n.d(t,{UseCookieScanData:()=>r});var a=n(81621),o=n(9588);const r=(0,a.vt)(((e,t)=>({initialLoadCompleted:!1,setInitialLoadCompleted:t=>e({initialLoadCompleted:t}),iframeLoaded:!1,loading:!1,nextPage:!1,progress:0,cookies:[],lastLoadedIframe:"",setIframeLoaded:t=>e({iframeLoaded:t}),setLastLoadedIframe:t=>e((e=>({lastLoadedIframe:t}))),setProgress:t=>e({progress:t}),fetchProgress:()=>(e({loading:!0}),o.doAction("get_scan_progress",{}).then((t=>(e({initialLoadCompleted:!0,loading:!1,nextPage:t.next_page,progress:t.progress,cookies:t.cookies}),t))))})))},28550:(e,t,n)=>{n.r(t),n.d(t,{default:()=>i});var a=n(51609),o=n(5207),r=n(86087),l=n(27723),c=n(45111),s=n(81366);const i=(0,r.memo)((()=>{const{documents:e,documentsLoaded:t,fetchData:i,deleteDocuments:d,editDocument:u}=(0,o.default)(),[m,p]=(0,r.useState)(""),[g]=(0,r.useState)(""),[f,h]=(0,r.useState)(""),[b,_]=(0,r.useState)([]),[v,E]=(0,r.useState)(!1),[y,k]=(0,r.useState)({}),[C,w]=(0,r.useState)(!1),[N,L]=(0,r.useState)(!1),[z,D]=(0,r.useState)(null);(0,r.useEffect)((()=>{n.e(3757).then(n.bind(n,83757)).then((({default:e})=>{D((()=>e))}))}),[]),(0,r.useEffect)((()=>{t||i()}),[t]);const S=async()=>{let t=e.filter((e=>b.includes(e.id)));E(!0),h(!0);const n=async()=>{if(t.length>0){const e=t.shift(),a=e.download_url;try{let o=new XMLHttpRequest;o.responseType="blob",o.open("get",a,!0),o.send(),o.onreadystatechange=function(){if(4===this.readyState&&200===this.status){let n=window.URL.createObjectURL(this.response),a=window.document.createElement("a");a.setAttribute("href",n),a.setAttribute("download",e.title),window.document.body.appendChild(a),a.click(),_(t),E(!1),h(!1),setTimeout((function(){window.URL.revokeObjectURL(n)}),6e4)}},await n()}catch(e){console.error(e),h(!1)}}};await n()},A=e=>{let t=[...e];return""!==g&&(t=t.filter((e=>e.region===g))),t.sort(((e,t)=>e.title<t.title?-1:e.title>t.title?1:0)),t.filter((e=>e.title.toLowerCase().includes(m.toLowerCase()))),t},I=[{name:(0,a.createElement)(s.default,{options:{true:""},indeterminate:C,value:N,onChange:t=>(t=>{if(t){L(!0);let t=y.currentPage?y.currentPage:1,n=A(e).slice(5*(t-1),5*t);_(n.map((e=>e.id)))}else L(!1),_([]);w(!1)})(t)}),selector:e=>e.selectControl,grow:1,minWidth:"50px"},{name:(0,l.__)("Document","complianz-gdpr"),selector:e=>e.title,sortable:!0,grow:6},{name:(0,l.__)("Region","complianz-gdpr"),selector:e=>(0,a.createElement)("img",{alt:"region",width:"20px",height:"20px",src:cmplz_settings.plugin_url+"assets/images/"+e.region+".svg"}),sortable:!0,grow:2,right:!0},{name:(0,l.__)("Date","complianz-gdpr"),selector:e=>e.date,sortable:!0,grow:4,right:!0,minWidth:"200px"}];let x=A(e),O=[];x.forEach((t=>{let n={...t};n.selectControl=(0,a.createElement)(s.default,{value:b.includes(n.id),options:{true:""},onChange:t=>((t,n)=>{let a=t,o=[...b];a?o.includes(n)||(o.push(n),_(o)):(o=[...b.filter((e=>e!==n))],_(o));let r=y.currentPage?y.currentPage:1,l=A(e).slice(5*(r-1),5*r),c=!0,s=!1;l.forEach((e=>{o.includes(e.id)?s=!0:c=!1})),c?(L(!0),w(!1)):s?(L(!1),w(!0)):w(!1)})(t,n.id)}),O.push(n)}));let P=b.length>1;return P||1!==b.length||(P=""!==e.filter((e=>b.includes(e.id)))[0].download_url),(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",{className:"cmplz-table-header"},(0,a.createElement)("div",{className:"cmplz-table-header-controls"},(0,a.createElement)("input",{className:"cmplz-datatable-search",type:"text",placeholder:(0,l.__)("Search","complianz-gdpr"),value:m,onChange:e=>p(e.target.value)}))),b.length>0&&(0,a.createElement)("div",{className:"cmplz-selected-document"},b.length>1&&(0,l.__)("%s items selected","complianz-gdpr").replace("%s",b.length),1===b.length&&(0,l.__)("1 item selected","complianz-gdpr"),(0,a.createElement)("div",{className:"cmplz-selected-document-controls"},(0,a.createElement)("button",{disabled:f||b.length>1,className:"button button-default",onClick:()=>u(b[0])},(0,l.__)("Edit","complianz-gdpr")),P&&(0,a.createElement)("but
|