var F=Object.defineProperty;var p=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var x=(n,e,t)=>e in n?F(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,u=(n,e)=>{for(var t in e||(e={}))y.call(e,t)&&x(n,t,e[t]);if(p)for(var t of p(e))N.call(e,t)&&x(n,t,e[t]);return n};import{u as k,k as D,d as j,r as w,h as E,j as s}from"./main-333.js";import{g as P,$ as R,h as $,d as L,_ as r,i as M,I as q,s as A}from"./bi.636.93.js";import{h as T,c as z,a as B}from"./bi.305.892.js";import{F as G}from"./bi.696.893.js";import"./bi.535.730.js";import"./bi.286.731.js";function W({allIntegURL:n}){const e=k(),{id:t}=D(),[a,l]=j(P),[c,C]=j(R),[f,d]=w.useState(!1),[b,o]=w.useState({show:!1}),g=E($),I=(i,S,v)=>{const m=u({},S),{name:h}=i.target;i.target.value!==""?m[h]=i.target.value:delete m[h],v(u({},m))},_=()=>{if(!z(a)){o({show:!0,msg:r("Please map mandatory fields","bit-integrations")});return}if(!B(a)){["Deal","Contact"].includes(a.moduleData.module)&&o({show:!0,msg:r("Please select a account or a contact","bit-integrations")}),a.moduleData.module==="Contacts"&&o({show:!0,msg:r("Please select a account","bit-integrations")});return}A({flow:c,setFlow:C,allIntegURL:n,conf:a,navigate:e,id:t,edit:1,setIsLoading:d,setSnackbar:o})};return s.jsxs("div",{style:{width:900},children:[s.jsx(L,{snack:b,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=>I(i,a,l),name:"name",value:a.name,type:"text",placeholder:r("Integration Name...","bit-integrations")})]}),s.jsx("br",{}),s.jsx(M,{entity:c.triggered_entity,setSnackbar:o}),s.jsx(G,{formID:c.triggered_entity_id,formFields:g,handleInput:i=>T(i,a,l,d,o),freshSalesConf:a,setFreshSalesConf:l,isLoading:f,setIsLoading:d,setSnackbar:o}),s.jsx(q,{edit:!0,saveConfig:_,disabled:a.moduleData.module===""||a.field_map.length<1,isLoading:f,dataConf:a,setDataConf:l,formFields:g}),s.jsx("br",{})]})}export{W as default};
