import{h as p,g as S,$ as N,k as y,i as C,j as t,_ as n}from"./main.2.8.10.js";import{u as D,e as P,b as o}from"./react-router.DMwpH23k.js";import{S as k}from"./SnackMsg.7BjcJK1j.js";import{u as E}from"./Note.DalStCGz.js";import"./CopyIcn.BnhKHfEP.js";import{S as F,I as L,s as R}from"./Integrations.BFhED4ck.js";import{h as $,c as A,a as M}from"./PipeDriveCommonFunc.Bgp8U4Wc.js";import{P as q}from"./PipeDriveIntegLayout.Cc3IJ9ew.js";import"./react-vendor.P7K3d6op.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";import"./ActionProFeatureComponent.ByowZIj8.js";function ee({allIntegURL:u}){const g=D(),{id:z}=P(),[e,s]=p(S),[r,f]=p(N),[d,m]=o.useState(!1),[h,a]=o.useState({show:!1}),[l,x]=o.useState(0),c=y(C),[b,j]=o.useState((e==null?void 0:e.name)||""),v=()=>{if(!A(e)){a({show:!0,msg:n("Please map mandatory fields","bit-integrations")});return}if(!M(e)){["Leads","Deals","Activities","Notes"].includes(e.moduleData.module)&&a({show:!0,msg:n("Please select a organization or a person","bit-integrations")});return}R({flow:r,setFlow:f,allIntegURL:u,conf:e,navigate:g,edit:1,setIsLoading:m,setSnackbar:a})},I=i=>{j(i.target.value),s(_=>E(_,w=>{w.name=i.target.value}))};return t.jsxs("div",{style:{width:900},children:[t.jsx(k,{snack:h,setSnackbar:a}),t.jsxs("div",{className:"flx mt-3",children:[t.jsx("b",{className:"wdt-200 ",children:n("Integration Name:","bit-integrations")}),t.jsx("input",{className:"btcd-paper-inp w-5",onChange:I,name:"name",value:b,type:"text",placeholder:n("Integration Name...","bit-integrations")})]}),t.jsx("br",{}),t.jsx(F,{entity:r.triggered_entity,setSnackbar:a}),t.jsx(q,{tab:l,settab:x,formID:r.triggered_entity_id,formFields:c,handleInput:i=>$(i,l,e,s,m,a),pipeDriveConf:e,setPipeDriveConf:s,isLoading:d,setIsLoading:m,setSnackbar:a}),t.jsx(L,{edit:!0,saveConfig:v,disabled:e.moduleData.module===""||e.field_map.length<1,isLoading:d,dataConf:e,setDataConf:s,formFields:c}),t.jsx("br",{})]})}export{ee as default};
