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.9.0.js";import{u as k,e as w,b as d}from"./react-router.DMwpH23k.js";import{S as y}from"./SnackMsg.DYSD96P4.js";import"./Note.NSUdvR3c.js";import"./CopyIcn.CEA_lFLo.js";import{S as N,I as v,s as F}from"./Integrations.DL8wqGct.js";import{h as m,c as f}from"./ZendeskCommonFunc.Twt_BTG5.js";import{Z as R}from"./ZendeskIntegLayout.xrTbvdXK.js";import"./react-vendor.P7K3d6op.js";import"./Table.BfF8RYFZ.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};
