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{h as _,g as k,$ as D,k as E,i as P,j as s,_ as r}from"./main.2.8.10.js";import{u as R,e as $,b}from"./react-router.DMwpH23k.js";import{S as L}from"./SnackMsg.7BjcJK1j.js";import{S as M,I as q,s as A}from"./Integrations.BFhED4ck.js";import{h as T,c as z,a as B}from"./FreshSalesCommonFunc.CZmNZVGv.js";import{F as G}from"./FreshSalesIntegLayout.D8JqaHLL.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./CopyIcn.BnhKHfEP.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./ActionProFeatureLabels.BzMNdAoD.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function ne({allIntegURL:n}){const e=R(),{id:a}=$(),[t,l]=_(k),[m,j]=_(D),[g,c]=b.useState(!1),[w,o]=b.useState({show:!1}),u=E(P),C=(i,I,v)=>{const d=f({},I),{name:p}=i.target;i.target.value!==""?d[p]=i.target.value:delete d[p],v(f({},d))},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:c,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:u,handleInput:i=>T(i,t,l,m.triggered_entity_id,c,o),freshSalesConf:t,setFreshSalesConf:l,isLoading:g,setIsLoading:c,setSnackbar:o}),s.jsx(q,{edit:!0,saveConfig:S,disabled:t.moduleData.module===""||t.field_map.length<1,isLoading:g,dataConf:t,setDataConf:l,formFields:u}),s.jsx("br",{})]})}export{ne as default};
