var I=Object.defineProperty;var h=Object.getOwnPropertySymbols;var C=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var v=(a,e,s)=>e in a?I(a,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[e]=s,j=(a,e)=>{for(var s in e||(e={}))C.call(e,s)&&v(a,s,e[s]);if(h)for(var s of h(e))T.call(e,s)&&v(a,s,e[s]);return a};import{j as i,_ as k,z as c}from"./main.2.9.0.js";import{u as E,b as o}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{S as L}from"./SnackMsg.DYSD96P4.js";import{S as F}from"./Steps.BYe8zHkm.js";import{I as M,g as P}from"./Integrations.DL8wqGct.js";import z from"./ZendeskSupportAuthorization.BIbvxHM9.js";import{Z as A}from"./ZendeskSupportIntegLayout.DlUAQwOM.js";import{c as N}from"./ZendeskSupportCommonFunc.CsKw2ZlJ.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TutorialLink.CFG7bS5c.js";import"./ProUtilHelpers.CHf_DzPf.js";import"./TagifyInput.KPPRQJ1B.js";import"./lodash.DCvQBX3r.js";import"./GlobalIntegrationHelper.B6YI8w_n.js";import"./ActionProFeatureLabels.gUp7_RXn.js";function it({formFields:a,setFlow:e,flow:s,allIntegURL:d}){const l=E(),[Z,u]=o.useState(!1),[g,f]=o.useState({}),[r,x]=o.useState(1),[y,p]=o.useState({show:!1}),[t,m]=o.useState({name:"Zendesk Support",type:"ZendeskSupport",subdomain:"",email:"",apiToken:"",field_map:[{formField:"",zendeskSupportField:""}],actionName:"",utilities:{}}),_=()=>{u(!0),P(s,e,d,t,l,"","",u).then(n=>{var S;n.success?(c.success((S=n.data)==null?void 0:S.msg),l(d)):c.error(n.data||n)})},w=b=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!N(t)){c.error(k("Please map mandatory fields","bit-integrations"));return}t.field_map.length>0&&x(b)};return i.jsxs("div",{children:[i.jsx(L,{snack:y,setSnackbar:p}),i.jsx("div",{className:"txt-center mt-2",children:i.jsx(F,{step:3,active:r})}),i.jsx(z,{zendeskSupportConf:t,setZendeskSupportConf:m,step:r,setStep:x,loading:g,setLoading:f,setSnackbar:p}),i.jsxs("div",{className:"btcd-stp-page",style:j({},r===2&&{width:900,height:"auto",overflow:"visible"}),children:[i.jsx(A,{formFields:a,zendeskSupportConf:t,setZendeskSupportConf:m,loading:g,setLoading:f,setSnackbar:p}),(t==null?void 0:t.actionName)&&i.jsxs("button",{onClick:()=>w(3),disabled:!N(t),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[k("Next","bit-integrations"),"  ",i.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),(t==null?void 0:t.actionName)&&i.jsx(M,{step:r,saveConfig:()=>_(),isLoading:Z,dataConf:t,setDataConf:m,formFields:a})]})}export{it as default};
