var j=Object.defineProperty;var u=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var h=(a,e,s)=>e in a?j(a,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[e]=s,f=(a,e)=>{for(var s in e||(e={}))S.call(e,s)&&h(a,s,e[s]);if(u)for(var s of u(e))v.call(e,s)&&h(a,s,e[s]);return a};import{j as o,_ as I}from"./main.2.8.10.js";import{u as y,e as w,b as c}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as N}from"./SnackMsg.7BjcJK1j.js";import{S as B}from"./Steps.B84Ui3GU.js";import{I as C,s as E}from"./Integrations.BFhED4ck.js";import{h as L,c as x,a as M}from"./FreshdeskCommonFunc.BBcgq9uB.js";import{B as T}from"./BackIcn.BFDZx8No.js";import A from"./FreshdeskAuthorization.CE0KdUjv.js";import{F as D}from"./FreshdeskIntegLayout.BI6sk_bu.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function et({formFields:a,setFlow:e,flow:s,allIntegURL:F}){const g=y(),{formID:_}=w(),[m,p]=c.useState(!1),[i,l]=c.useState(1),[k,r]=c.useState({show:!1}),[t,n]=c.useState({name:"Freshdesk",type:"Freshdesk",app_domain:"",api_key:"",field_map:[{formField:"",freshdeskFormField:""}],field_map_contact:[{formField:"",contactFreshdeskFormField:""}],freshdesk_id:"",ticketFields:[],contactFields:[],contactShow:"",status:"",priority:"",updateContact:"",actions:{}}),b=d=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),t.name!==""&&l(d)};return o.jsxs("div",{children:[o.jsx(N,{snack:k,setSnackbar:r}),o.jsx("div",{className:"txt-center mt-2",children:o.jsx(B,{step:3,active:i})}),o.jsx(A,{formID:_,freshdeskConf:t,setFreshdeskConf:n,step:i,setstep:l,isLoading:m,setIsLoading:p,setSnackbar:r}),o.jsxs("div",{className:"btcd-stp-page",style:f({},i===2&&{width:900,height:"auto",overflow:"visible"}),children:[o.jsx(D,{formFields:a,handleInput:d=>L(d,t,n),freshdeskConf:t,setFreshdeskConf:n,isLoading:m,setIsLoading:p,setSnackbar:r}),x(t==null?void 0:t.field_map_contact),o.jsxs("button",{onClick:()=>b(3),disabled:!t.priority||!t.status||!x(t==null?void 0:t.field_map)||t.contactShow&&!M(t==null?void 0:t.field_map_contact),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[I("Next","bit-integrations"),o.jsx(T,{className:"ml-1 rev-icn"})]})]}),o.jsx(C,{step:i,saveConfig:()=>E({flow:s,setFlow:e,allIntegURL:F,conf:t,navigate:g,setIsLoading:p,setSnackbar:r}),isLoading:m,dataConf:t,setDataConf:n,formFields:a})]})}export{et as default};
