import{h as l,$ as j,g as S,k as I,i as _,j as t,_ as s,q as r}from"./main.2.8.10.js";import{u as k,e as w,b as d}from"./react-router.DMwpH23k.js";import{S as y}from"./SnackMsg.7BjcJK1j.js";import"./Note.DalStCGz.js";import"./CopyIcn.BnhKHfEP.js";import{S as N,I as v,s as F}from"./Integrations.BFhED4ck.js";import{h as m,c as f}from"./ZendeskCommonFunc.D0eLVJw_.js";import{Z as R}from"./ZendeskIntegLayout.BKkx21LN.js";import"./react-vendor.P7K3d6op.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";function J({allIntegURL:p}){const g=k(),{id:M}=w(),[i,P]=l(j),[e,n]=l(S),[u,E]=d.useState(!1),[x,b]=d.useState({}),[h,a]=d.useState({show:!1}),c=I(_),C=()=>{if(!f(e)){a({show:!0,msg:s("Please map mandatory fields","bit-integrations")});return}if(e.actionName==="lead"||e.actionName==="deal"){if(!e.selectedCRMCompany){r.error(s("Please select a company","bit-integrations"));return}if(!e.selectedCRMContact){r.error(s("Please select a contact","bit-integrations"));return}if(!e.selectedCRMSources&&e.actionName==="lead"){r.error(s("Please select a Source","bit-integrations"));return}}F({flow:i,allIntegURL:p,conf:e,navigate:g,edit:1,setSnackbar:a})};return t.jsxs("div",{style:{width:900},children:[t.jsx(y,{snack:h,setSnackbar:a}),t.jsxs("div",{className:"flx mt-3",children:[t.jsx("b",{className:"wdt-200 d-in-b",children:s("Integration Name:","bit-integrations")}),t.jsx("input",{className:"btcd-paper-inp w-5",onChange:o=>m(o,e,n),name:"name",value:e.name,type:"text",placeholder:s("Integration Name...","bit-integrations")})]}),t.jsx("br",{}),t.jsx(N,{entity:i.triggered_entity,setSnackbar:a}),t.jsx(R,{formID:i.triggered_entity_id,formFields:c,handleInput:o=>m(o,e,n),zendeskConf:e,setZendeskConf:n,loading:x,setLoading:b,setSnackbar:a}),t.jsx(v,{edit:!0,saveConfig:C,disabled:!f(e),isLoading:u,dataConf:e,setDataConf:n,formFields:c}),t.jsx("br",{})]})}export{J as default};
