var F=Object.defineProperty;var b=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var h=(a,t,e)=>t in a?F(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,g=(a,t)=>{for(var e in t||(t={}))H.call(t,e)&&h(a,e,t[e]);if(b)for(var e of b(t))N.call(t,e)&&h(a,e,t[e]);return a};import{u as y,r as i,j as o}from"./main-406.js";import{d as I,_ as w,I as L,s as P,c as d}from"./bi.394.85.js";import{S as A}from"./bi.68.941.js";import E from"./bi.564.259.js";import{H as M}from"./bi.884.773.js";import{h as z,c as x}from"./bi.995.772.js";import"./bi.46.744.js";import"./bi.150.760.js";import"./bi.704.707.js";import"./bi.701.708.js";function V({formFields:a,setFlow:t,flow:e,allIntegURL:v}){const S=y(),[j,u]=i.useState(!1),[n,f]=i.useState(1),[k,c]=i.useState({show:!1}),[r,m]=i.useState({auth:!1,customFields:!1,hubSpotFields:!1}),[s,p]=i.useState({name:"Hubspot",type:"Hubspot",api_key:"",field_map:[{formField:"",hubspotField:""}],hubSpotFields:[],actions:{}}),C=()=>{u(!0),P({flow:e,setFlow:t,allIntegURL:v,conf:s,navigate:S,setIsLoading:u,setSnackbar:c})},_=l=>{if(!x(s)){d.error("Please map mandatory fields");return}if(s.actionName==="ticket"){if(s.pipeline===void 0){d.error("Please select a pipeline");return}if(s.stage===void 0){d.error("Please select a stage");return}}s.field_map.length>0&&f(l)};return o.jsxs("div",{children:[o.jsx(I,{snack:k,setSnackbar:c}),o.jsx("div",{className:"txt-center mt-2",children:o.jsx(A,{step:3,active:n})}),o.jsx(E,{hubspotConf:s,setHubspotConf:p,step:n,setstep:f,loading:r,setLoading:m}),o.jsxs("div",{className:"btcd-stp-page",style:g({},n===2&&{width:900,height:"auto",overflow:"visible"}),children:[o.jsx(M,{formFields:a,handleInput:l=>z(l,s,p),hubspotConf:s,setHubspotConf:p,setSnackbar:c,loading:r,setLoading:m}),r.hubSpotFields&&o.jsxs("button",{onClick:()=>_(3),disabled:!x(s),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[w("Next","bit-integrations")," "," ",o.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),r.hubSpotFields&&o.jsx(L,{step:n,saveConfig:()=>C(),isLoading:j,dataConf:s,setDataConf:p,formFields:a})]})}export{V as default};
