import{b as d,$ as j,h as I,k as _,i as w,j as t,_ as a,q as l}from"./main.2.8.1.js";import{u as y,h as R,d as r}from"./react-router-dom.9mCuUg3q.js";import{S}from"./SnackMsg.S8DrwLlT.js";import"./Note.BeM7sN-p.js";import{S as M,I as N,s as v}from"./Integrations.D2bgBas2.js";import{h as m,c}from"./CopperCRMCommonFunc.ZVeVjNfY.js";import{C as F}from"./CopperCRMIntegLayout.RKc90CVl.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";function O({allIntegURL:f}){const g=y(),{id:P}=R(),[o,k]=d(j),[e,i]=d(I),[u,E]=r.useState(!1),[C,x]=r.useState({}),[h,s]=r.useState({show:!1}),p=_(w),b=()=>{if(!c(e)){s({show:!0,msg:a("Please map mandatory fields","bit-integrations")});return}if(e.actionName==="opportunity"){if(!e.selectedCRMPeople){l.error(a("Please select a people","bit-integrations"));return}if(!e.selectedCRMPipelines&&e.actionName==="opportunity"){l.error(a("Please select a Pipeline","bit-integrations"));return}}v({flow:o,allIntegURL:f,conf:e,navigate:g,edit:1,setSnackbar:s})};return t.jsxs("div",{style:{width:900},children:[t.jsx(S,{snack:h,setSnackbar:s}),t.jsxs("div",{className:"flx mt-3",children:[t.jsx("b",{className:"wdt-200 d-in-b",children:a("Integration Name:","bit-integrations")}),t.jsx("input",{className:"btcd-paper-inp w-5",onChange:n=>m(n,e,i),name:"name",value:e.name,type:"text",placeholder:a("Integration Name...","bit-integrations")})]}),t.jsx("br",{}),t.jsx(M,{entity:o.triggered_entity,setSnackbar:s}),t.jsx(F,{formID:o.triggered_entity_id,formFields:p,handleInput:n=>m(n,e,i),copperCRMConf:e,setCopperCRMConf:i,loading:C,setLoading:x,setSnackbar:s}),t.jsx(N,{edit:!0,saveConfig:b,disabled:!c(e),isLoading:u,dataConf:e,setDataConf:i,formFields:p}),t.jsx("br",{})]})}export{O as default};
