"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[6828,5208,1096],{65208:(e,t,r)=>{r.r(t),r.d(t,{default:()=>d});var a=r(30809),o=r(25506),n=r(63612),s=r(31228),c=r(51928);const d=(0,a.Su)((e=>({startDate:(0,o.default)((0,n.default)((0,s.c)(new Date,7)),"yyyy-MM-dd"),setStartDate:t=>e((e=>({startDate:t}))),endDate:(0,o.default)((0,c.default)((0,s.c)(new Date,1)),"yyyy-MM-dd"),setEndDate:t=>e((e=>({endDate:t}))),range:"last-7-days",setRange:t=>e((e=>({range:t})))})))},6828:(e,t,r)=>{r.r(t),r.d(t,{default:()=>l});var a=r(51280),o=r(93396),n=r(88496),s=r(61096),c=r(15832),d=r(65208);const l=(0,n.memo)((()=>{const{noData:e,startExport:t,exportLink:l,fetchExportRecordsOfConsentProgress:i,generating:g,progress:u}=(0,s.default)(),[p,f]=(0,n.useState)(null),{startDate:m,endDate:h}=(0,d.default)();return(0,n.useEffect)((()=>{Promise.all([r.e(416),r.e(364),r.e(6749),r.e(5944)]).then(r.bind(r,45944)).then((({default:e})=>{f((()=>e))}))}),[]),(0,n.useEffect)((()=>{i(!0)}),[]),(0,n.useEffect)((()=>{u<100&&g&&i(!1,m,h)}),[u]),(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"},p&&(0,a.createElement)(p,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"})," ",u,"%")))),u>=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")))))}))},61096:(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var a=r(30809),o=r(61744);const n=(0,a.Su)(((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})}})))}}]);