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.9.0.js";import{u as I,b as a}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{S as w}from"./SnackMsg.DYSD96P4.js";import{S as L}from"./Steps.BYe8zHkm.js";import{I as P,s as z}from"./Integrations.DL8wqGct.js";import A from"./HubspotAuthorization.DBv1DYEF.js";import{H as E}from"./HubspotIntegLayout.Bj23emZJ.js";import{h as M,c as v}from"./HubspotCommonFunc.Cud3xLx-.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./BackIcn._8Wofmn2.js";import"./TutorialLink.CFG7bS5c.js";import"./TagifyInput.KPPRQJ1B.js";import"./lodash.DCvQBX3r.js";import"./ActionProFeatureLabels.gUp7_RXn.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};
