var S=Object.defineProperty;var h=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var u=(a,s,e)=>s in a?S(a,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[s]=e,f=(a,s)=>{for(var e in s||(s={}))b.call(s,e)&&u(a,e,s[e]);if(h)for(var e of h(s))v.call(s,e)&&u(a,e,s[e]);return a};import{j as o,_ as I}from"./main.2.8.1.js";import{u as y,h as w,d as c}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{S as N}from"./SnackMsg.S8DrwLlT.js";import{S as B}from"./Steps.1hz7v9Vj.js";import{I as C,s as E}from"./Integrations.D2bgBas2.js";import{h as L,c as x,a as M}from"./FreshdeskCommonFunc.CTTAxnqC.js";import{B as T}from"./BackIcn._kGL_vVw.js";import A from"./FreshdeskAuthorization.r6bF-5M9.js";import{F as D}from"./FreshdeskIntegLayout.Cjdm15O0.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./tutorialLinks.kMkIDzcD.js";import"./TutorialLink.BAFX--T3.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";function st({formFields:a,setFlow:s,flow:e,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:{}}),j=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:()=>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:[I("Next","bit-integrations"),o.jsx(T,{className:"ml-1 rev-icn"})]})]}),o.jsx(C,{step:i,saveConfig:()=>E({flow:e,setFlow:s,allIntegURL:F,conf:t,navigate:g,setIsLoading:p,setSnackbar:r}),isLoading:m,dataConf:t,setDataConf:n,formFields:a})]})}export{st as default};
