var K=Object.defineProperty;var j=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var _=(n,i,s)=>i in n?K(n,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[i]=s,m=(n,i)=>{for(var s in i||(i={}))w.call(i,s)&&_(n,s,i[s]);if(j)for(var s of j(i))S.call(i,s)&&_(n,s,i[s]);return n};import{_ as e,j as t,b as T}from"./main.2.8.10.js";import{b as d}from"./react-router.DMwpH23k.js";import{B as E}from"./BackIcn.BFDZx8No.js";import{y as k,a9 as $}from"./Note.DalStCGz.js";import{a as B}from"./ZagoMailCommonFunc.ey3CW4KV.js";import{T as C}from"./TutorialLink.D6K_DiHL.js";import"./react-vendor.P7K3d6op.js";import"./CopyIcn.BnhKHfEP.js";function J({formID:n,zagoMailConf:i,setZagoMailConf:s,step:h,setstep:f,setSnackbar:g,isInfo:b,isLoading:l,setIsLoading:p}){const[o,A]=d.useState(!1),[u,x]=d.useState({name:"",api_public_key:""}),[N,P]=d.useState(!1),v=()=>{const a=m({},i);if(!a.name||!a.api_public_key){x({name:a.name?"":e("Integration name can't be empty","bit-integrations"),api_public_key:a.api_public_key?"":e("API Public Key can't be empty","bit-integrations")});return}p("auth");const c={api_public_key:a.api_public_key};T(c,"zagoMail_authorize").then(r=>{r!=null&&r.success&&(A(!0),g({show:!0,msg:e("Authorized Successfully","bit-integrations")})),P(!0),p(!1)})},y=a=>{const c=m({},i),r=m({},u);r[a.target.name]="",c[a.target.name]=a.target.value,x(r),s(c)},I=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),B(i,s,p,g),f(2)},z=`
            <h4>${e("Get API Public Key","bit-integrations")}</h4>
            <ul>
                <li>${e("First go to your ZagoMail dashboard.","bit-integrations")}</li>
                <li>${e("Click on the top top right corner","bit-integrations")}</li>
                <li>${e("Then click on API","bit-integrations")}</li>
            </ul>`;return t.jsxs("div",{className:"btcd-stp-page",style:{width:h===1&&900,height:h===1&&"auto"},children:[t.jsx(C,{linkKey:"zagoMail"}),t.jsx("div",{className:"mt-3 wdt-200",children:t.jsx("b",{children:e("Integration Name:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:y,name:"name",value:i.name,type:"text",placeholder:e("Integration Name...","bit-integrations"),disabled:b}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:u.name}),t.jsx("div",{className:"mt-3 wdt-200",children:t.jsx("b",{children:e("Access API Public Key Key:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:y,name:"api_public_key",value:i.api_public_key,type:"text",placeholder:e("Access API Public Key Key...","bit-integrations"),disabled:b}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:u.api_public_key}),t.jsxs("small",{className:"d-blk mt-3",children:[e("To Get API Public Key Key, Please Visit","bit-integrations")," ",t.jsx("a",{className:"btcd-link",href:"https://app.zagomail.com/user/api-keys/index",target:"_blank",rel:"noreferrer",children:e("ZagoMail API Token","bit-integrations")})]}),t.jsx("br",{}),t.jsx("br",{}),l==="auth"&&t.jsxs("div",{className:"flx mt-5",children:[t.jsx(k,{size:25,clr:"#022217",className:"mr-2"}),e("Checking API Public Key Key!!!","bit-integrations")]}),N&&!o&&!l&&t.jsxs("div",{className:"flx mt-5",style:{color:"red"},children:[t.jsx("span",{className:"btcd-icn mr-2",style:{fontSize:30,marginTop:-5},children:"×"}),e("Sorry, API Public Key key is invalid","bit-integrations")]}),!b&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:v,className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:o||l,children:[o?e("Authorized ✔","bit-integrations"):e("Authorize","bit-integrations"),l&&t.jsx(k,{size:20,clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>I(),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!o,children:[e("Next","bit-integrations"),t.jsx(E,{className:"ml-1 rev-icn"})]})]}),t.jsx($,{note:z})]})}export{J as default};
