import{b as l,$ as j,h as S,k as I,i as _,j as t,_ as s,q as r}from"./main.2.8.1.js";import{u as k,h as w,d}from"./react-router-dom.9mCuUg3q.js";import{S as y}from"./SnackMsg.S8DrwLlT.js";import"./Note.BeM7sN-p.js";import{S as N,I as v,s as F}from"./Integrations.D2bgBas2.js";import{h as m,c as f}from"./ZendeskCommonFunc.DBXSjfPv.js";import{Z as R}from"./ZendeskIntegLayout.b4laRQZ3.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";function H({allIntegURL:p}){const g=k(),{id:M}=w(),[i,P]=l(j),[e,n]=l(S),[u,E]=d.useState(!1),[x,h]=d.useState({}),[b,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:b,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:h,setSnackbar:a}),t.jsx(v,{edit:!0,saveConfig:C,disabled:!f(e),isLoading:u,dataConf:e,setDataConf:n,formFields:c}),t.jsx("br",{})]})}export{H as default};
