import{u as I,k as _,d as m,r as o,h as w,j as t}from"./main-406.js";import{$ as C,g as P,h as v,d as y,_ as r,i as F,I as N,W as l,s as k}from"./bi.394.85.js";import{h as g,c as p}from"./bi.104.919.js";import{S as E}from"./bi.332.920.js";function M({allIntegURL:u}){const x=I();_();const[n,L]=m(C),[e,a]=m(P),[d,c]=o.useState(!1),[h,S]=o.useState({}),[j,s]=o.useState({show:!1}),f=w(v),b=()=>{if(!p(e)){s({show:!0,msg:r("Please map mandatory fields","bit-integrations")});return}if(e.actionName==="opportunities"){if(!e.selectedAccount){l.error("Please select an Account");return}if(!e.selectedPipeline){l.error("Please select a Pipeline");return}if(e.selectedPipeline&&!e.selectedStage){l.error("Please select a Stage");return}}k({flow:n,allIntegURL:u,conf:e,navigate:x,edit:1,setIsLoading:c,setSnackbar:s})};return t.jsxs("div",{style:{width:900},children:[t.jsx(y,{snack:j,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:i=>g(i,e,a),name:"name",value:e.name,type:"text",placeholder:r("Integration Name...","bit-integrations")})]}),t.jsx("br",{}),t.jsx(F,{entity:n.triggered_entity,setSnackbar:s}),t.jsx(E,{formID:n.triggered_entity_id,formFields:f,handleInput:i=>g(i,e,a),salesflareConf:e,setSalesflareConf:a,loading:h,setLoading:S,isLoading:d,setIsLoading:c,setSnackbar:s}),t.jsx(N,{edit:!0,saveConfig:b,disabled:!p(e),isLoading:d,dataConf:e,setDataConf:a,formFields:f}),t.jsx("br",{})]})}export{M as default};
