import{h as f,$ as v,g as w,k as F,i as N,j as t,_ as d}from"./main.2.9.0.js";import{u as g}from"./Note.NSUdvR3c.js";import{u as y,e as E,b as o}from"./react-router.DMwpH23k.js";import{S as k}from"./SnackMsg.DYSD96P4.js";import{S as C,I as L,s as $}from"./Integrations.DL8wqGct.js";import{I as D,h as R,c as M}from"./InstasentCommonFunc.CY5oGi9Y.js";import{I as P}from"./InstasentIntegLayout.Bv1IrSXi.js";import"./react-vendor.P7K3d6op.js";import"./CopyIcn.CEA_lFLo.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./ProUtilHelpers.CHf_DzPf.js";import"./TagifyInput.KPPRQJ1B.js";import"./lodash.DCvQBX3r.js";function tt({allIntegURL:u}){const x=y(),{id:A}=E(),[m,T]=f(v),[e,a]=f(w),[h,q]=o.useState(!1),[I,j]=o.useState((e==null?void 0:e.name)||""),[l,c]=o.useState({list:!1,field:!1,auth:!1}),[_,n]=o.useState({show:!1}),p=F(N),b=()=>{if(!M(e)){n({show:!0,msg:d("Please map mandatory fields","bit-integrations")});return}$({flow:m,allIntegURL:u,conf:e,navigate:x,edit:1,setSnackbar:n})};o.useEffect(()=>{a(s=>g(s,i=>{const r=i.action||"send_sms";i.action=r,i.instasentFields=D[r]||[]}))},[]);const S=s=>{j(s.target.value),a(i=>g(i,r=>{r.name=s.target.value}))};return t.jsxs("div",{style:{width:900},children:[t.jsx(k,{snack:_,setSnackbar:n}),t.jsxs("div",{className:"flx mt-3",children:[t.jsx("b",{className:"wdt-200 d-in-b",children:d("Integration Name:","bit-integrations")}),t.jsx("input",{className:"btcd-paper-inp w-5",onChange:S,name:"name",value:I,type:"text",placeholder:d("Integration Name...","bit-integrations")})]}),t.jsx("br",{}),t.jsx(C,{entity:m.triggered_entity,setSnackbar:n}),t.jsx(P,{formID:m.triggered_entity_id,formFields:p,handleInput:s=>R(s,e,a,l,c),instasentConf:e,setInstasentConf:a,loading:l,setLoading:c,setSnackbar:n}),t.jsx(L,{edit:!0,saveConfig:b,disabled:e.field_map.length<1,isLoading:h,dataConf:e,setDataConf:a,formFields:p}),t.jsx("br",{})]})}export{tt as default};
