import{j as t,_ as l}from"./main.2.8.10.js";import{u as j,e as k,b as o}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as I}from"./BackIcn.BFDZx8No.js";import{S}from"./SnackMsg.7BjcJK1j.js";import{S as v}from"./Steps.B84Ui3GU.js";import{s as C,K}from"./KeapIntegLayout.C-AYkjlb.js";import w from"./KeapAuthorization.H-rpEkP0.js";import{I as N,s as _}from"./Integrations.BFhED4ck.js";import{c as y,h as E,b as F}from"./KeapCommonFunc.BwjOCCrE.js";import"./react-vendor.P7K3d6op.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";import"./Note.DalStCGz.js";import"./TutorialLink.D6K_DiHL.js";function W({formFields:p,setFlow:d,flow:f,allIntegURL:u}){const g=j(),{formID:m}=k(),[i,r]=o.useState(!1),[s,c]=o.useState(1),[h,a]=o.useState({show:!1}),[e,n]=o.useState({name:"Keap",type:"Keap",clientId:"",clientSecret:"",keapId:"",field_map:[{formField:"",keapField:""}],contactFields:y,customFields:[],actions:{}});o.useEffect(()=>{window.opener&&C("keap")},[]);const x=()=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!F(e)){a({show:!0,msg:l("Please map fields to continue.","bit-integrations")});return}e.field_map.length>0&&c(3)};return t.jsxs("div",{children:[t.jsx(S,{snack:h,setSnackbar:a}),t.jsx("div",{className:"txt-center mt-2",children:t.jsx(v,{step:3,active:s})}),t.jsx(w,{formID:m,keapConf:e,setKeapConf:n,step:s,setstep:c,setSnackbar:a,isLoading:i,setIsLoading:r}),t.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto"},children:[t.jsx(K,{formID:m,formFields:p,handleInput:b=>E(b,e,n),keapConf:e,setKeapConf:n,isLoading:i,setIsLoading:r,setSnackbar:a}),t.jsxs("button",{onClick:()=>x(),disabled:e.field_map.length<2,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[l("Next","bit-integrations"),t.jsx(I,{className:"ml-1 rev-icn"})]})]}),t.jsx(N,{step:s,saveConfig:()=>_({flow:f,setFlow:d,allIntegURL:u,navigate:g,conf:e,setIsLoading:r,setSnackbar:a}),isLoading:i,dataConf:e,setDataConf:n,formFields:p})]})}export{W as default};
