var N=Object.defineProperty;var h=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable;var g=(i,t,e)=>t in i?N(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,x=(i,t)=>{for(var e in t||(t={}))_.call(t,e)&&g(i,e,t[e]);if(h)for(var e of h(t))y.call(t,e)&&g(i,e,t[e]);return i};import{j as o,_ as l,z as d}from"./main.2.8.10.js";import{u as I,b as a}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as w}from"./SnackMsg.7BjcJK1j.js";import{S as L}from"./Steps.B84Ui3GU.js";import{I as P,s as z}from"./Integrations.BFhED4ck.js";import A from"./HubspotAuthorization.c4n85akw.js";import{H as E}from"./HubspotIntegLayout.CevtojPk.js";import{h as M,c as v}from"./HubspotCommonFunc.6U9zlXn-.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./BackIcn.BFDZx8No.js";import"./TutorialLink.D6K_DiHL.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";import"./ActionProFeatureLabels.BzMNdAoD.js";function st({formFields:i,setFlow:t,flow:e,allIntegURL:S}){const j=I(),[k,u]=a.useState(!1),[n,f]=a.useState(1),[C,c]=a.useState({show:!1}),[r,b]=a.useState({auth:!1,customFields:!1,hubSpotFields:!1}),[s,p]=a.useState({name:"Hubspot",type:"Hubspot",api_key:"",field_map:[{formField:"",hubspotField:""}],hubSpotFields:[],actions:{}}),F=()=>{u(!0),z({flow:e,setFlow:t,allIntegURL:S,conf:s,navigate:j,setIsLoading:u,setSnackbar:c})},H=m=>{if(!v(s)){d.error(l("Please map mandatory fields","bit-integrations"));return}if(s.actionName==="ticket"){if(s.pipeline===void 0){d.error(l("Please select a pipeline","bit-integrations"));return}if(s.stage===void 0){d.error(l("Please select a stage","bit-integrations"));return}}s.field_map.length>0&&f(m)};return o.jsxs("div",{children:[o.jsx(w,{snack:C,setSnackbar:c}),o.jsx("div",{className:"txt-center mt-2",children:o.jsx(L,{step:3,active:n})}),o.jsx(A,{hubspotConf:s,setHubspotConf:p,step:n,setstep:f,loading:r,setLoading:b}),o.jsxs("div",{className:"btcd-stp-page",style:x({},n===2&&{width:900,height:"auto",overflow:"visible"}),children:[o.jsx(E,{formFields:i,handleInput:m=>M(m,s,p),hubspotConf:s,setHubspotConf:p,setSnackbar:c,loading:r,setLoading:b}),r.hubSpotFields&&o.jsxs("button",{onClick:()=>H(3),disabled:!v(s),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[l("Next","bit-integrations"),"  ",o.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),r.hubSpotFields&&o.jsx(P,{step:n,saveConfig:()=>F(),isLoading:k,dataConf:s,setDataConf:p,formFields:i})]})}export{st as default};
