"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[7161,8432,54],{38432:(e,t,r)=>{r.r(t),r.d(t,{default:()=>d});var a=r(81621),o=r(72346),n=r(31127),s=r(979),c=r(66212);const d=(0,a.vt)((e=>({startDate:(0,o.default)((0,n.default)((0,s.A)(new Date,7)),"yyyy-MM-dd"),setStartDate:t=>e((e=>({startDate:t}))),endDate:(0,o.default)((0,c.default)((0,s.A)(new Date,1)),"yyyy-MM-dd"),setEndDate:t=>e((e=>({endDate:t}))),range:"last-7-days",setRange:t=>e((e=>({range:t})))})))},87161:(e,t,r)=>{r.r(t),r.d(t,{default:()=>l});var a=r(51609),o=r(27723),n=r(86087),s=r(40054),c=r(45111),d=r(38432);const l=(0,n.memo)((()=>{const{noData:e,startExport:t,exportLink:l,fetchExportRecordsOfConsentProgress:i,generating:g,progress:p}=(0,s.default)(),[u,f]=(0,n.useState)(null),{startDate:m,endDate:h}=(0,d.default)();return(0,n.useEffect)((()=>{Promise.all([r.e(20),r.e(393),r.e(799),r.e(7660)]).then(r.bind(r,95279)).then((({default:e})=>{f((()=>e))}))}),[]),(0,n.useEffect)((()=>{i(!0)}),[]),(0,n.useEffect)((()=>{p<100&&g&&i(!1,m,h)}),[p]),(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",{className:"cmplz-field-button cmplz-table-header"},(0,a.createElement)("div",{className:"cmplz-table-header-controls"},u&&(0,a.createElement)(u,null),(0,a.createElement)("button",{disabled:g,className:"button button-default cmplz-field-button",onClick:()=>t()},(0,o.__)("Export to CSV","complianz-gdpr"),g&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(c.default,{name:"loading",color:"grey"})," ",p,"%")))),p>=100&&(""!==l||e)&&(0,a.createElement)("div",{className:"cmplz-selected-document"},!e&&(0,o.__)("Your Records Of Consent Export has been completed.","complianz-gdpr"),e&&(0,o.__)("Your selection does not contain any data.","complianz-gdpr"),(0,a.createElement)("div",{className:"cmplz-selected-document-controls"},!e&&(0,a.createElement)("a",{className:"button button-default",download:!0,href:l},(0,o.__)("Download","complianz-gdpr")))))}))},40054:(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var a=r(81621),o=r(9588);const n=(0,a.vt)(((e,t)=>({recordsLoaded:!1,fetching:!1,generating:!1,progress:!1,records:[],exportLink:"",downloadUrl:"",regions:[],fields:[],noData:!1,totalRecords:0,searchValue:"",setSearchValue:t=>e({searchValue: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 r=>{let a=t().records.filter((e=>r.includes(e.id)));e((e=>({records:e.records.filter((e=>!r.includes(e.id)))})));let n={};n.records=a,await o.doAction("delete_records_of_consent",n).then((e=>e)).catch((e=>{console.error(e)}))},fetchData:async()=>{if(t().fetching)return;e({fetching:!0});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;const{records:a,totalRecords:n,regions:s,download_url:c}=await o.doAction("get_records_of_consent",r).then((e=>e)).catch((e=>{console.error(e)}));e((()=>({recordsLoaded:!0,records:a,regions:s,totalRecords:n,downloadUrl:c,fetching:!1})))},startExport:async()=>{e({generating:!0,progress:0,exportLink:""})},fetchExportRecordsOfConsentProgress:async(t,r,a)=>{(t=void 0!==t&&t)||e({generating:!0});let n={};n.startDate=r,n.endDate=a,n.statusOnly=t;const{progress:s,exportLink:c,noData:d}=await o.doAction("export_records_of_consent",n).then((e=>e)).catch((e=>{console.error(e)}));let l=!1;s<100&&(l=!0),e({progress:s,exportLink:c,generating:l,noData:d})}})))}}]);