import{b as p,$ as y,h as j,k as F,i as S,j as t,_ as s,q as r}from"./main.2.8.1.js";import{u as I,d as l}from"./react-router-dom.9mCuUg3q.js";import{S as _}from"./SnackMsg.S8DrwLlT.js";import"./Note.BeM7sN-p.js";import{S as C,I as N,s as v}from"./Integrations.D2bgBas2.js";import{h as m,c as f}from"./FlowluCommonFunc.DQrPv-Z9.js";import{F as P}from"./FlowluIntegLayout.BvZjg6HO.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";function G({allIntegURL:u}){I();const[a,k]=p(y),[e,n]=p(j),[g,c]=l.useState(!1),[x,b]=l.useState({}),[h,i]=l.useState({show:!1}),d=F(S),w=()=>{if(!f(e)){i({show:!0,msg:s("Please map mandatory fields","bit-integrations")});return}if(e.actionName==="account"&&!e.selectedAccountType){r.error(s("Please select an Account Type","bit-integrations"));return}if(e.actionName==="opportunity"){if(!e.selectedPipeline){r.error(s("Please select a Opportunity Pipeline","bit-integrations"));return}if(!e.selectedOpportunityStage){r.error(s("Please select a Opportunity Stage","bit-integrations"));return}}v({flow:a,allIntegURL:u,conf:e,edit:1,setIsLoading:c,setSnackbar:i})};return t.jsxs("div",{style:{width:900},children:[t.jsx(_,{snack:h,setSnackbar:i}),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(C,{entity:a.triggered_entity,setSnackbar:i}),t.jsx(P,{formID:a.triggered_entity_id,formFields:d,handleInput:o=>m(o,e,n),flowluConf:e,setFlowluConf:n,loading:x,setLoading:b,setIsLoading:c,setSnackbar:i}),t.jsx(N,{edit:!0,saveConfig:w,disabled:!f(e),isLoading:g,dataConf:e,setDataConf:n,formFields:d}),t.jsx("br",{})]})}export{G as default};
