var F=Object.defineProperty;var h=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var x=(n,e,a)=>e in n?F(n,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[e]=a,f=(n,e)=>{for(var a in e||(e={}))y.call(e,a)&&x(n,a,e[a]);if(h)for(var a of h(e))N.call(e,a)&&x(n,a,e[a]);return n};import{b as _,h as k,$ as D,k as E,i as P,j as s,_ as r}from"./main.2.8.1.js";import{u as R,h as $,d as b}from"./react-router-dom.9mCuUg3q.js";import{S as L}from"./SnackMsg.S8DrwLlT.js";import{S as M,I as q,s as A}from"./Integrations.D2bgBas2.js";import{h as T,c as z,a as B}from"./FreshSalesCommonFunc.pSo9D8KC.js";import{F as G}from"./FreshSalesIntegLayout.BLVFbQO8.js";import"./Note.BeM7sN-p.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./ActionProFeatureLabels.CuihmlQ8.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";function se({allIntegURL:n}){const e=R(),{id:a}=$(),[t,l]=_(k),[m,j]=_(D),[u,d]=b.useState(!1),[w,o]=b.useState({show:!1}),g=E(P),C=(i,I,v)=>{const c=f({},I),{name:p}=i.target;i.target.value!==""?c[p]=i.target.value:delete c[p],v(f({},c))},S=()=>{if(!z(t)){o({show:!0,msg:r("Please map mandatory fields","bit-integrations")});return}if(!B(t)){["Deal","Contact"].includes(t.moduleData.module)&&o({show:!0,msg:r("Please select a account or a contact","bit-integrations")}),t.moduleData.module==="Contacts"&&o({show:!0,msg:r("Please select a account","bit-integrations")});return}A({flow:m,setFlow:j,allIntegURL:n,conf:t,navigate:e,edit:1,setIsLoading:d,setSnackbar:o})};return s.jsxs("div",{style:{width:900},children:[s.jsx(L,{snack:w,setSnackbar:o}),s.jsxs("div",{className:"flx mt-3",children:[s.jsx("b",{className:"wdt-200 ",children:r("Integration Name:","bit-integrations")}),s.jsx("input",{className:"btcd-paper-inp w-5",onChange:i=>C(i,t,l),name:"name",value:t.name,type:"text",placeholder:r("Integration Name...","bit-integrations")})]}),s.jsx("br",{}),s.jsx(M,{entity:m.triggered_entity,setSnackbar:o}),s.jsx(G,{formID:m.triggered_entity_id,formFields:g,handleInput:i=>T(i,t,l,m.triggered_entity_id,d,o),freshSalesConf:t,setFreshSalesConf:l,isLoading:u,setIsLoading:d,setSnackbar:o}),s.jsx(q,{edit:!0,saveConfig:S,disabled:t.moduleData.module===""||t.field_map.length<1,isLoading:u,dataConf:t,setDataConf:l,formFields:g}),s.jsx("br",{})]})}export{se as default};
