var K=Object.defineProperty;var y=Object.getOwnPropertySymbols;var P=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var f=(a,s,i)=>s in a?K(a,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[s]=i,m=(a,s)=>{for(var i in s||(s={}))P.call(s,i)&&f(a,i,s[i]);if(y)for(var i of y(s))T.call(s,i)&&f(a,i,s[i]);return a};import{_ as e,s as A,j as t,b as C}from"./main.2.9.0.js";import{b}from"./react-router.DMwpH23k.js";import{B as E}from"./BackIcn._8Wofmn2.js";import{y as N,a9 as F}from"./Note.NSUdvR3c.js";import{r as B}from"./ConvertKitCommonFunc.C5tdHJeN.js";import{T as $}from"./TutorialLink.CFG7bS5c.js";import"./react-vendor.P7K3d6op.js";import"./CopyIcn.CEA_lFLo.js";function Q({formID:a,convertKitConf:s,setConvertKitConf:i,step:u,setstep:v,setSnackbar:g,isInfo:d,isLoading:c,setIsLoading:p}){const[o,S]=b.useState(!1),[h,x]=b.useState({name:"",api_secret:""}),[_,k]=b.useState(!1),z=()=>{const r=m({},s);if(!r.name||!r.api_secret){x({name:r.name?"":e("Integration name can't be empty","bit-integrations"),api_secret:r.api_secret?"":e("Access API Secret Key can't be empty","bit-integrations")});return}p("auth");const l={api_secret:r.api_secret};C(l,"convertKit_authorize").then(n=>{n!=null&&n.success&&(S(!0),g({show:!0,msg:e("Authorized Successfully","bit-integrations")})),k(!0),p(!1)})},j=r=>{const l=m({},s),n=m({},h);n[r.target.name]="",l[r.target.name]=r.target.value,x(n),i(l)},w=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),B(s,i,p,g),v(2)},I=`
            <h4>${e("Get api secret key","bit-integrations")}</h4>
            <ul>
                <li>${A(e("First go to your %s dashboard.","bit-integrations"),"Kit(ConvertKit)")}</li>
                <li>${e('Click "Settings", Then click "Advanced"',"bit-integrations")}</li>
            </ul>`;return t.jsxs("div",{className:"btcd-stp-page",style:{width:u===1&&900,height:u===1&&"auto"},children:[t.jsx($,{linkKey:"convertKit"}),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:j,name:"name",value:s.name,type:"text",placeholder:e("Integration Name...","bit-integrations"),disabled:d}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:h.name}),t.jsx("div",{className:"mt-3 wdt-200",children:t.jsx("b",{children:e("Access API Secret Key:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:j,name:"api_secret",value:s.api_secret,type:"text",placeholder:e("Access API Secret Key...","bit-integrations"),disabled:d}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:h.api_secret}),t.jsxs("small",{className:"d-blk mt-3",children:[e("To Get API Secret Key, Please Visit","bit-integrations")," ",t.jsx("a",{className:"btcd-link",href:"https://app.convertkit.com/account_settings/advanced_settings",target:"_blank",rel:"noreferrer",children:A(e("%s API Token","bit-integrations"),"Kit(ConvertKit)")})]}),t.jsx("br",{}),t.jsx("br",{}),c==="auth"&&t.jsxs("div",{className:"flx mt-5",children:[t.jsx(N,{size:25,clr:"#022217",className:"mr-2"}),e("Checking API Secret Key","bit-integrations"),"!!!"]}),_&&!o&&!c&&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 Secret key is invalid","bit-integrations")]}),!d&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:z,className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:o||c,children:[o?e("Authorized ✔","bit-integrations"):e("Authorize","bit-integrations"),c&&t.jsx(N,{size:20,clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>w(),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(F,{note:I})]})}export{Q as default};
