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