"use strict";(self.webpackChunkcomplianz_gdpr=self.webpackChunkcomplianz_gdpr||[]).push([[3785,4101],{43785:(e,t,n)=>{n.r(t),n.d(t,{default:()=>d});var a=n(51609),o=n(56427),l=n(86087),c=n(4219),i=n(45111),r=n(27723),p=n(74101),s=n(52043);const d=(0,l.memo)((function(){const{removeHelpNotice:e,addHelpNotice:t,fetchFieldsData:n,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,a.createElement)("div",{className:"cmplz-import-form"},(0,a.createElement)("div",{className:"cmplz-import-button-container"},u&&u.name,(0,a.createElement)(o.FormFileUpload,{accept:"",icon:(0,a.createElement)(i.default,{name:"upload",color:"black"}),onChange:e=>g(e.currentTarget.files[0])},(0,r.__)("Select file","complianz-gdpr")),(0,a.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?n(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,a.createElement)(i.default,{name:"loading",color:"grey"}))))}))},74101:(e,t,n)=>{n.r(t),n.d(t,{upload:()=>o});var a=n(71083);const o=(e,t,n)=>{let o=new FormData;return o.append("data",t),void 0!==n&&o.append("details",JSON.stringify(n)),a.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}})}}}]);