"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[3785,4101],{43785:(e,t,a)=>{a.r(t),a.d(t,{default:()=>d});var n=a(51609),o=a(56427),l=a(86087),c=a(4219),i=a(45111),r=a(27723),p=a(74101),s=a(52043);const d=(0,l.memo)((function(){const{removeHelpNotice:e,addHelpNotice:t,fetchFieldsData:a,showSavedSettingsNotice:d}=(0,c.default)(),{selectedSubMenuItem:m}=(0,s.default)(),[u,g]=(0,l.useState)(!1),[_,f]=(0,l.useState)(!0),[z,h]=(0,l.useState)(!1);return(0,l.useEffect)((()=>{u&&("application/json"!==u.type?(f(!0),t("import_settings","warning",(0,r.__)("You can only upload .json files","complianz-gdpr"),(0,r.__)("Incorrect extension","complianz-gdpr"),!1)):(f(!1),e("import_settings")))}),[u]),(0,n.createElement)("div",{className:"cmplz-import-form"},(0,n.createElement)("div",{className:"cmplz-import-button-container"},u&&u.name,(0,n.createElement)(o.FormFileUpload,{accept:"",icon:(0,n.createElement)(i.default,{name:"upload",color:"black"}),onChange:e=>g(e.currentTarget.files[0])},(0,r.__)("Select file","complianz-gdpr")),(0,n.createElement)("button",{disabled:_,className:"button button-default",onClick:e=>(f(!0),h(!0),void(0,p.upload)("import_settings",u).then((e=>(e.data.success?a(m).then((()=>{d((0,r.__)("Settings imported","complianz-gdpr"))})):t("import_settings","warning",(0,r.__)("You can only upload .json files","complianz-gdpr"),(0,r.__)("Incorrect extension","complianz-gdpr"),!1),h(!1),g(!1),!0))).catch((e=>{console.error(e)})))},(0,r.__)("Import","complianz-gdpr"),z&&(0,n.createElement)(i.default,{name:"loading",color:"grey"}))))}))},74101:(e,t,a)=>{a.r(t),a.d(t,{upload:()=>o});var n=a(71083);const o=(e,t,a)=>{let o=new FormData;return o.append("data",t),void 0!==a&&o.append("details",JSON.stringify(a)),n.A.post(cmplz_settings.admin_url+"?page=complianz&cmplz_upload_file=1&action="+e,o,{headers:{"Content-Type":"multipart/form-data","X-WP-Nonce":cmplz_settings.nonce}})}}}]);