import{b as p,h as S,$ as N,k as y,i as C,j as t,_ as n}from"./main.2.8.1.js";import{u as D,h as P,d as o}from"./react-router-dom.9mCuUg3q.js";import{S as k}from"./SnackMsg.S8DrwLlT.js";import{u as E}from"./Note.BeM7sN-p.js";import{S as F,I as L,s as R}from"./Integrations.D2bgBas2.js";import{h as $,c as A,a as M}from"./PipeDriveCommonFunc.BoH2jjRe.js";import{P as q}from"./PipeDriveIntegLayout.CnTMcOWN.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";import"./ActionProFeatureComponent.D5pbe8PT.js";function Z({allIntegURL:u}){const f=D(),{id:z}=P(),[e,s]=p(S),[r,g]=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:g,allIntegURL:u,conf:e,navigate:f,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{Z as default};
