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.8.10.js";import{u as E,b as o}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as L}from"./SnackMsg.7BjcJK1j.js";import{S as F}from"./Steps.B84Ui3GU.js";import{I as M,g as P}from"./Integrations.BFhED4ck.js";import z from"./ZendeskSupportAuthorization.a7KI0EXN.js";import{Z as A}from"./ZendeskSupportIntegLayout.SuGYW0c2.js";import{c as N}from"./ZendeskSupportCommonFunc.Z63BtkwO.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./ProUtilHelpers.CtRYkgop.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";import"./GlobalIntegrationHelper.Belqr4OT.js";import"./ActionProFeatureLabels.BzMNdAoD.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};
