"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[4268,2805],{76648:(e,t,a)=>{a.r(t),a.d(t,{default:()=>d});var n=a(51280),o=a(87287),l=a(88496),c=a(25536),i=a(15832),r=a(93396),p=a(92805),s=a(38924);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"}))))}))},92805:(e,t,a)=>{a.r(t),a.d(t,{upload:()=>o});var n=a(66564);const o=(e,t,a)=>{let o=new FormData;return o.append("data",t),void 0!==a&&o.append("details",JSON.stringify(a)),n.c.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}})}}}]);