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.9.0.js";import{u as y,e as w,b as c}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{S as N}from"./SnackMsg.DYSD96P4.js";import{S as B}from"./Steps.BYe8zHkm.js";import{I as C,s as E}from"./Integrations.DL8wqGct.js";import{h as L,c as x,a as M}from"./FreshdeskCommonFunc.Cmq8WzI3.js";import{B as T}from"./BackIcn._8Wofmn2.js";import A from"./FreshdeskAuthorization.CWkdCpAd.js";import{F as D}from"./FreshdeskIntegLayout.Aq4PN8RA.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TutorialLink.CFG7bS5c.js";import"./TagifyInput.KPPRQJ1B.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};
