import{j as t,_ as l}from"./main.2.9.0.js";import{u as j,e as k,b as o}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as I}from"./BackIcn._8Wofmn2.js";import{S}from"./SnackMsg.DYSD96P4.js";import{S as v}from"./Steps.BYe8zHkm.js";import{s as C,K}from"./KeapIntegLayout.DAuWX3ve.js";import w from"./KeapAuthorization.DJTrlN__.js";import{I as N,s as _}from"./Integrations.DL8wqGct.js";import{c as y,h as E,b as F}from"./KeapCommonFunc.DRCBVG_Q.js";import"./react-vendor.P7K3d6op.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TagifyInput.KPPRQJ1B.js";import"./lodash.DCvQBX3r.js";import"./Note.NSUdvR3c.js";import"./TutorialLink.CFG7bS5c.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};
