"use strict";(self.webpackChunkcomplianz_gdpr=self.webpackChunkcomplianz_gdpr||[]).push([[6875,4098],{36875:(e,t,n)=>{n.r(t),n.d(t,{default:()=>d});var o=n(51609),c=n(27723),a=n(54098),r=n(45111);const d=(0,n(86087).memo)((({label:e,field:t})=>{const{generateProofOfConsent:n,generating:d}=(0,a.default)();return(0,o.createElement)("div",{className:"cmplz-field-button"},(0,c.__)("Create Proof of Consent","complianz-gdpr"),(0,o.createElement)("button",{disabled:d,className:"button button-default cmplz-field-button",onClick:()=>n()},(0,c.__)("Generate","complianz-gdpr"),d&&(0,o.createElement)(r.default,{name:"loading",color:"grey"})))}))},54098:(e,t,n)=>{n.r(t),n.d(t,{default:()=>a});var o=n(81621),c=n(9588);const a=(0,o.vt)(((e,t)=>({documentsLoaded:!1,fetching:!1,generating:!1,documents:[],downloadUrl:"",regions:[],fields:[],deleteDocuments:async n=>{let o=t().documents.filter((e=>n.includes(e.id)));e((e=>({documents:e.documents.filter((e=>!n.includes(e.id)))})));let a={};a.documents=o,await c.doAction("delete_proof_of_consent_documents",a).then((e=>e)).catch((e=>{console.error(e)}))},generateProofOfConsent:async()=>{e({generating:!0}),await c.doAction("generate_proof_of_consent",{}).then((e=>e)).catch((e=>{console.error(e)})),await t().fetchData(),e({generating:!1})},fetchData:async()=>{if(t().fetching)return;e({fetching:!0});const{documents:n,regions:o,download_url:a}=await c.doAction("get_proof_of_consent_documents",{}).then((e=>e)).catch((e=>{console.error(e)}));e((e=>({documentsLoaded:!0,documents:n,regions:o,downloadUrl:a,fetching:!1})))}})))}}]);