import{b as f,$ as I,h as _,k as w,i as C,j as t,_ as s,q as r}from"./main.2.8.1.js";import{u as P,h as v,d as l}from"./react-router-dom.9mCuUg3q.js";import{S as y}from"./SnackMsg.S8DrwLlT.js";import"./Note.BeM7sN-p.js";import{S as F,I as N,s as k}from"./Integrations.D2bgBas2.js";import{h as p,c as g}from"./SalesflareCommonFunc.D4IBx_yA.js";import{S as E}from"./SalesflareIntegLayout.JwLzSNgk.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";function J({allIntegURL:u}){const x=P(),{id:L}=v(),[n,$]=f(I),[e,i]=f(_),[d,c]=l.useState(!1),[h,S]=l.useState({}),[b,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:c,setSnackbar:a})};return t.jsxs("div",{style:{width:900},children:[t.jsx(y,{snack:b,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:h,setLoading:S,isLoading:d,setIsLoading:c,setSnackbar:a}),t.jsx(N,{edit:!0,saveConfig:j,disabled:!g(e),isLoading:d,dataConf:e,setDataConf:i,formFields:m}),t.jsx("br",{})]})}export{J as default};
