var b=Object.defineProperty;var u=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var h=(a,s,e)=>s in a?b(a,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[s]=e,f=(a,s)=>{for(var e in s||(s={}))S.call(s,e)&&h(a,e,s[e]);if(u)for(var e of u(s))v.call(s,e)&&h(a,e,s[e]);return a};import{u as I,k as y,r as d,j as o}from"./main-406.js";import{d as w,_ as N,I as B,s as C}from"./bi.394.85.js";import{S as E}from"./bi.68.941.js";import{h as L,c as x,a as M}from"./bi.342.781.js";import{B as T}from"./bi.46.744.js";import A from"./bi.574.273.js";import{F as D}from"./bi.851.780.js";import"./bi.150.760.js";import"./bi.704.707.js";import"./bi.701.708.js";function V({formFields:a,setFlow:s,flow:e,allIntegURL:F}){const g=I(),{formID:k}=y(),[p,m]=d.useState(!1),[i,l]=d.useState(1),[_,n]=d.useState({show:!1}),[t,c]=d.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:{}}),j=r=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),r===3&&t.name!==""&&l(r)};return o.jsxs("div",{children:[o.jsx(w,{snack:_,setSnackbar:n}),o.jsx("div",{className:"txt-center mt-2",children:o.jsx(E,{step:3,active:i})}),o.jsx(A,{formID:k,freshdeskConf:t,setFreshdeskConf:c,step:i,setstep:l,isLoading:p,setIsLoading:m,setSnackbar:n}),o.jsxs("div",{className:"btcd-stp-page",style:f({},i===2&&{width:900,height:"auto",overflow:"visible"}),children:[o.jsx(D,{formFields:a,handleInput:r=>L(r,t,c),freshdeskConf:t,setFreshdeskConf:c,isLoading:p,setIsLoading:m,setSnackbar:n}),x(t==null?void 0:t.field_map_contact),o.jsxs("button",{onClick:()=>j(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:[N("Next","bit-integrations"),o.jsx(T,{className:"ml-1 rev-icn"})]})]}),o.jsx(B,{step:i,saveConfig:()=>C({flow:e,setFlow:s,allIntegURL:F,conf:t,navigate:g,setIsLoading:m,setSnackbar:n}),isLoading:p,dataConf:t,setDataConf:c,formFields:a})]})}export{V as default};
