"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[7888,5208,628],{65208:(e,t,a)=>{a.r(t),a.d(t,{default:()=>d});var r=a(30809),s=a(25506),o=a(63612),n=a(31228),c=a(51928);const d=(0,r.Su)((e=>({startDate:(0,s.default)((0,o.default)((0,n.c)(new Date,7)),"yyyy-MM-dd"),setStartDate:t=>e((e=>({startDate:t}))),endDate:(0,s.default)((0,c.default)((0,n.c)(new Date,1)),"yyyy-MM-dd"),setEndDate:t=>e((e=>({endDate:t}))),range:"last-7-days",setRange:t=>e((e=>({range:t})))})))},17888:(e,t,a)=>{a.r(t),a.d(t,{default:()=>l});var r=a(51280),s=a(93396),o=a(88496),n=a(10628),c=a(15832),d=a(65208);const l=(0,o.memo)((()=>{const{noData:e,startExport:t,exportLink:l,fetchExportDatarequestsProgress:i,generating:u,progress:p}=(0,n.default)(),[g,m]=(0,o.useState)(null),{startDate:h,endDate:f}=(0,d.default)();return(0,o.useEffect)((()=>{Promise.all([a.e(416),a.e(364),a.e(6749),a.e(5944)]).then(a.bind(a,45944)).then((({default:e})=>{m((()=>e))}))}),[]),(0,o.useEffect)((()=>{i(!0)}),[]),(0,o.useEffect)((()=>{p<100&&u&&i(!1,h,f)}),[p]),(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"cmplz-table-header-controls"},g&&(0,r.createElement)(g,null),(0,r.createElement)("button",{disabled:u,className:"button button-default cmplz-field-button",onClick:()=>t()},(0,s.__)("Export to CSV","complianz-gdpr"),u&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(c.default,{name:"loading",color:"grey"})," ",p,"%"))),p>=100&&(""!==l||e)&&(0,r.createElement)("div",{className:"cmplz-selected-document"},!e&&(0,s.__)("Your Data Requests Export has been completed.","complianz-gdpr"),e&&(0,s.__)("Your selection does not contain any data.","complianz-gdpr"),(0,r.createElement)("div",{className:"cmplz-selected-document-controls"},!e&&(0,r.createElement)("a",{className:"button button-default",href:l},(0,s.__)("Download","complianz-gdpr")))))}))},10628:(e,t,a)=>{a.r(t),a.d(t,{default:()=>n});var r=a(30809),s=a(61744),o=a(524);a(88496);const n=(0,r.Su)(((e,t)=>({recordsLoaded:!1,searchValue:"",setSearchValue:t=>e({searchValue:t}),status:"open",setStatus:t=>e({status:t}),selectedRecords:[],setSelectedRecords:t=>e({selectedRecords:t}),fetching:!1,generating:!1,progress:!1,records:[],totalRecords:0,totalOpen:0,exportLink:"",noData:!1,indeterminate:!1,setIndeterminate:t=>e({indeterminate:t}),paginationPerPage:10,pagination:{currentPage:1},setPagination:t=>e({pagination:t}),orderBy:"ID",setOrderBy:t=>e({orderBy:t}),order:"DESC",setOrder:t=>e({order:t}),deleteRecords:async a=>{let r={};r.per_page=t().paginationPerPage,r.page=t().pagination.currentPage,r.order=t().order.toUpperCase(),r.orderBy=t().orderBy,r.search=t().searchValue,r.status=t().status;let o=t().records.filter((e=>a.includes(e.ID)));e((e=>({records:e.records.filter((e=>!a.includes(e.ID)))}))),r.records=o,await s.doAction("delete_datarequests",r).then((e=>e)).catch((e=>{console.error(e)})),await t().fetchData(),t().setSelectedRecords([]),t().setIndeterminate(!1)},resolveRecords:async a=>{let r={};r.per_page=t().paginationPerPage,r.page=t().pagination.currentPage,r.order=t().order.toUpperCase(),r.orderBy=t().orderBy,r.search=t().searchValue,r.status=t().status,e((0,o.cp)((e=>{e.records.forEach((function(t,r){a.includes(t.ID)&&(e.records[r].resolved=!0)}))}))),r.records=t().records.filter((e=>a.includes(e.ID))),await s.doAction("resolve_datarequests",r).then((e=>e)).catch((e=>{console.error(e)})),await t().fetchData(),t().setSelectedRecords([]),t().setIndeterminate(!1)},fetchData:async()=>{if(t().fetching)return;e({fetching:!0});let a={};a.per_page=t().paginationPerPage,a.page=t().pagination.currentPage,a.order=t().order.toUpperCase(),a.orderBy=t().orderBy,a.search=t().searchValue,a.status=t().status;const{records:r,totalRecords:o,totalOpen:n}=await s.doAction("get_datarequests",a).then((e=>e)).catch((e=>{console.error(e)}));e((()=>({recordsLoaded:!0,records:r,totalRecords:o,totalOpen:n,fetching:!1})))},startExport:async()=>{e({generating:!0,progress:0,exportLink:""})},fetchExportDatarequestsProgress:async(t,a,r)=>{(t=void 0!==t&&t)||e({generating:!0});let o={};o.startDate=a,o.endDate=r,o.statusOnly=t;const{progress:n,exportLink:c,noData:d}=await s.doAction("export_datarequests",o).then((e=>e)).catch((e=>{console.error(e)}));let l=!1;n<100&&(l=!0),e({progress:n,exportLink:c,generating:l,noData:d})}})))}}]);