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