var K=Object.defineProperty;var g=Object.getOwnPropertySymbols;var v=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var x=(s,i,a)=>i in s?K(s,i,{enumerable:!0,configurable:!0,writable:!0,value:a}):s[i]=a,b=(s,i)=>{for(var a in i||(i={}))v.call(i,a)&&x(s,a,i[a]);if(g)for(var a of g(i))P.call(i,a)&&x(s,a,i[a]);return s};import{_ as e,j as t}from"./main.2.8.1.js";import{d as y}from"./react-router-dom.9mCuUg3q.js";import{z,a9 as I}from"./Note.BeM7sN-p.js";import{h as L}from"./KlaviyoCommonFunc.CO9ZvDMN.js";import{t as T}from"./tutorialLinks.kMkIDzcD.js";import{T as j}from"./TutorialLink.BAFX--T3.js";import"./CopyIcn.3gZpHton.js";import"./Integrations.D2bgBas2.js";import"./SnackMsg.S8DrwLlT.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";function J({klaviyoConf:s,setKlaviyoConf:i,step:a,setStep:N,isInfo:r,loading:o,setLoading:k}){const[l,A]=y.useState(!1),[c,d]=y.useState({name:"",authKey:""}),{klaviyo:n}=T,u=m=>{const h=b({},s),p=b({},c);p[m.target.name]="",h[m.target.name]=m.target.value,d(p),i(h)},w=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),N(2)},f=`
  <h4>${e("Step of get API Key:","bit-integrations")}</h4>
  <ul>
    <li>${e("Goto Settings and click on","bit-integrations")} <a href="https://www.klaviyo.com/account#api-keys-tab" target='_blank'>${e("API Keys.","bit-integrations")}</a></li>
    <li>${e("Click on Create Private API key.","bit-integrations")}</li>
    <li>${e("Copy the <b>Private API Key</b> and paste into <b>API Key</b> field of your authorization form.","bit-integrations")}</li>
    <li>${e("Finally, click <b>Authorize</b> button.","bit-integrations")}</li>
</ul>
`;return t.jsxs("div",{className:"btcd-stp-page",style:{width:a===1&&900,height:a===1&&"auto"},children:[t.jsx(j,{title:"Klaviyo",youTubeLink:n==null?void 0:n.youTubeLink}),t.jsx(j,{title:"Klaviyo",docLink:n==null?void 0:n.docLink}),t.jsxs("div",{className:"mt-2",children:[t.jsx("div",{className:"my-1",children:t.jsx("b",{children:e("Integration Name:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 my-1 mx-0",onChange:u,name:"name",value:s.name,type:"text",placeholder:e("Integration Name...","bit-integrations"),disabled:r}),t.jsx("div",{className:"my-1",children:t.jsx("b",{children:e("API Key:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 my-1 mx-0",onChange:u,name:"authKey",value:s.authKey,type:"text",placeholder:e("API Key...","bit-integrations"),disabled:r}),c.authKey&&t.jsx("div",{className:"mt-1 mb-2 error-msg",children:c.authKey}),t.jsxs("small",{className:"d-blk mt-1",children:[e("To get API key, please visit","bit-integrations")," ",t.jsx("a",{className:"btcd-link",href:"https://www.klaviyo.com/account#api-keys-tab",target:"_blank",rel:"noreferrer",children:e("here.","bit-integrations")})]}),!r&&t.jsxs("div",{className:"w-6 d-flx flx-between ",children:[t.jsxs("button",{onClick:()=>L(s,i,d,A,o,k),className:"btn btcd-btn-lg purple sh-sm",type:"button",disabled:l||o.auth,children:[l?e("Authorized ✔","bit-integrations"):e("Authorize","bit-integrations"),o.auth&&t.jsx(z,{size:"20",clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:w,className:"btn btcd-btn-lg purple sh-sm",type:"button",disabled:!l,children:[e("Next","bit-integrations"),t.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),t.jsx(I,{note:f})]})]})}export{J as default};
