var F=Object.defineProperty;var x=Object.getOwnPropertySymbols;var L=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var _=(a,i,s)=>i in a?F(a,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[i]=s,v=(a,i)=>{for(var s in i||(i={}))L.call(i,s)&&_(a,s,i[s]);if(x)for(var s of x(i))T.call(i,s)&&_(a,s,i[s]);return a};import{_ as e,j as n,z as d}from"./main.2.8.10.js";import{u as w,b as r}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as E}from"./SnackMsg.7BjcJK1j.js";import{S as P}from"./Steps.B84Ui3GU.js";import{I as z,g as A}from"./Integrations.BFhED4ck.js";import M from"./WoodpeckerAuthorization.BjGhs_vT.js";import{h as B,c as N}from"./WoodpeckerCommonFunc.Cux5XQUE.js";import{W as D}from"./WoodpeckerIntegLayout.CH7Wyu-7.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";function ie({formFields:a,setFlow:i,flow:s,allIntegURL:c}){const m=w(),[f,u]=r.useState(!1),[y,k]=r.useState({}),[l,q]=r.useState(1),[S,g]=r.useState({show:!1}),j=[{key:"first_name",label:e("First Name","bit-integrations"),required:!1},{key:"last_name",label:e("Last Name","bit-integrations"),required:!1},{key:"company",label:e("Company","bit-integrations"),required:!1},{key:"industry",label:e("Industry","bit-integrations"),required:!1},{key:"website",label:e("Website","bit-integrations"),required:!1},{key:"email",label:e("Email","bit-integrations"),required:!0},{key:"phone",label:e("Phone","bit-integrations"),required:!1},{key:"linkedin_url",label:e("Linkedin URL","bit-integrations"),required:!1},{key:"tags",label:e("Tags","bit-integrations"),required:!1},{key:"title",label:e("Title","bit-integrations"),required:!1},{key:"address",label:e("Address","bit-integrations"),required:!1},{key:"city",label:e("City","bit-integrations"),required:!1},{key:"state",label:e("State","bit-integrations"),required:!1},{key:"country",label:e("Country","bit-integrations"),required:!1},{key:"snipet1",label:e("snipet1","bit-integrations"),required:!1},{key:"snipet2",label:e("snipet2","bit-integrations"),required:!1},{key:"snipet3",label:e("snipet3","bit-integrations"),required:!1},{key:"snipet4",label:e("snipet4","bit-integrations"),required:!1},{key:"snippet1",label:e("snippet1","bit-integrations"),required:!1},{key:"snippet2",label:e("snippet2","bit-integrations"),required:!1},{key:"snippet3",label:e("snippet3","bit-integrations"),required:!1},{key:"snippet4",label:e("snippet4","bit-integrations"),required:!1},{key:"snippet5",label:e("snippet5","bit-integrations"),required:!1},{key:"snippet6",label:e("snippet6","bit-integrations"),required:!1},{key:"snippet7",label:e("snippet7","bit-integrations"),required:!1},{key:"snippet8",label:e("snippet8","bit-integrations"),required:!1},{key:"snippet9",label:e("snippet9","bit-integrations"),required:!1},{key:"snippet10",label:e("snippet10","bit-integrations"),required:!1},{key:"snippet11",label:e("snippet11","bit-integrations"),required:!1},{key:"snippet12",label:e("snippet12","bit-integrations"),required:!1},{key:"snippet13",label:e("snippet13","bit-integrations"),required:!1},{key:"snippet14",label:e("snippet14","bit-integrations"),required:!1},{key:"snippet15",label:e("snippet15","bit-integrations"),required:!1}],C=[{key:"name",label:e("Company Name","bit-integrations"),required:!0}],[t,o]=r.useState({name:"Woodpecker",type:"Woodpecker",api_key:"",field_map:[{formField:"",woodpeckerFormField:""}],actionName:"",actionId:"",prospectsFields:j,companyFields:C,actions:{}}),I=()=>{u(!0),A(s,i,c,t,m,"","",u).then(b=>{var h;b.success?(d.success((h=b.data)==null?void 0:h.msg),m(c)):d.error(b.data||b)})},W=p=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!N(t)){d.error(e("Please map mandatory fields","bit-integrations"));return}if(t.actionName==="adding_prospects_to_the_campaign"&&!t.selectedCampaign){d.error(e("Please select a Campaign","bit-integrations"));return}t.field_map.length>0&&q(p)};return n.jsxs("div",{children:[n.jsx(E,{snack:S,setSnackbar:g}),n.jsx("div",{className:"txt-center mt-2",children:n.jsx(P,{step:3,active:l})}),n.jsx(M,{woodpeckerConf:t,setWoodpeckerConf:o,step:l,setStep:q,loading:y,setLoading:k,setSnackbar:g}),n.jsxs("div",{className:"btcd-stp-page",style:v({},l===2&&{width:900,height:"auto",overflow:"visible"}),children:[n.jsx(D,{formFields:a,handleInput:p=>B(p,t,o),woodpeckerConf:t,setWoodpeckerConf:o,loading:y,setLoading:k,isLoading:f,setIsLoading:u,setSnackbar:g}),(t==null?void 0:t.actionName)&&n.jsxs("button",{onClick:()=>W(3),disabled:!N(t),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[e("Next","bit-integrations"),"  ",n.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),(t==null?void 0:t.actionName)&&n.jsx(z,{step:l,saveConfig:()=>I(),isLoading:f,dataConf:t,setDataConf:o,formFields:a})]})}export{ie as default};
