import{h as f,$ as I,g as _,k as w,i as C,j as t,_ as s,q as r}from"./main.2.8.10.js";import{u as P,e as v,b as l}from"./react-router.DMwpH23k.js";import{S as y}from"./SnackMsg.7BjcJK1j.js";import"./Note.DalStCGz.js";import"./CopyIcn.BnhKHfEP.js";import{S as F,I as N,s as k}from"./Integrations.BFhED4ck.js";import{h as p,c as g}from"./SalesflareCommonFunc.CSSJgQek.js";import{S as E}from"./SalesflareIntegLayout.CEY_ea_7.js";import"./react-vendor.P7K3d6op.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";function K({allIntegURL:u}){const x=P(),{id:L}=v(),[n,$]=f(I),[e,i]=f(_),[c,d]=l.useState(!1),[S,b]=l.useState({}),[h,a]=l.useState({show:!1}),m=w(C),j=()=>{if(!g(e)){a({show:!0,msg:s("Please map mandatory fields","bit-integrations")});return}if(e.actionName==="opportunities"){if(!e.selectedAccount){r.error(s("Please select an Account","bit-integrations"));return}if(!e.selectedPipeline){r.error(s("Please select a Pipeline","bit-integrations"));return}if(e.selectedPipeline&&!e.selectedStage){r.error(s("Please select a Stage","bit-integrations"));return}}k({flow:n,allIntegURL:u,conf:e,navigate:x,edit:1,setIsLoading:d,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=>p(o,e,i),name:"name",value:e.name,type:"text",placeholder:s("Integration Name...","bit-integrations")})]}),t.jsx("br",{}),t.jsx(F,{entity:n.triggered_entity,setSnackbar:a}),t.jsx(E,{formID:n.triggered_entity_id,formFields:m,handleInput:o=>p(o,e,i),salesflareConf:e,setSalesflareConf:i,loading:S,setLoading:b,isLoading:c,setIsLoading:d,setSnackbar:a}),t.jsx(N,{edit:!0,saveConfig:j,disabled:!g(e),isLoading:c,dataConf:e,setDataConf:i,formFields:m}),t.jsx("br",{})]})}export{K as default};
