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