"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[54],{40054:(e,r,o)=>{o.r(r),o.d(r,{default:()=>a});var t=o(81621),n=o(9588);const a=(0,t.vt)((e,r)=>({recordsLoaded:!1,fetching:!1,generating:!1,progress:!1,records:[],exportLink:"",downloadUrl:"",regions:[],fields:[],noData:!1,totalRecords:0,searchValue:"",setSearchValue:r=>e({searchValue:r}),paginationPerPage:10,pagination:{currentPage:1},setPagination:r=>e({pagination:r}),orderBy:"ID",setOrderBy:r=>e({orderBy:r}),order:"DESC",setOrder:r=>e({order:r}),deleteRecords:async o=>{let t=r().records.filter(e=>o.includes(e.id));e(e=>({records:e.records.filter(e=>!o.includes(e.id))}));let a={};a.records=t,await n.doAction("delete_records_of_consent",a).then(e=>e).catch(e=>{console.error(e)})},fetchData:async()=>{if(r().fetching)return;e({fetching:!0});let o={};o.per_page=r().paginationPerPage,o.page=r().pagination.currentPage,o.order=r().order.toUpperCase(),o.orderBy=r().orderBy,o.search=r().searchValue;const{records:t,totalRecords:a,regions:s,download_url:c}=await n.doAction("get_records_of_consent",o).then(e=>e).catch(e=>{console.error(e)});e(()=>({recordsLoaded:!0,records:t,regions:s,totalRecords:a,downloadUrl:c,fetching:!1}))},downloadRecordProof:async e=>{const r=await n.doAction("get_record_of_consent_pdf_url",{id:e}).catch(e=>{console.error(e)});return r?.url||""},startExport:async()=>{e({generating:!0,progress:0,exportLink:""})},fetchExportRecordsOfConsentProgress:async(r,o,t)=>{(r=void 0!==r&&r)||e({generating:!0});let a={};a.startDate=o,a.endDate=t,a.statusOnly=r;const{progress:s,exportLink:c,noData:d}=await n.doAction("export_records_of_consent",a).then(e=>e).catch(e=>{console.error(e)});let i=!1;s<100&&(i=!0),e({progress:s,exportLink:c,generating:i,noData:d})}}))}}]);