import{h as m,$ as k,g as b,k as D,i as S,j as t,_ as s,z as a}from"./main.2.8.10.js";import{u as I,b as l}from"./react-router.DMwpH23k.js";import{S as j}from"./SnackMsg.7BjcJK1j.js";import{S as R,I as y,s as C}from"./Integrations.BFhED4ck.js";import{D as N}from"./DokanIntegLayout.DzcOIfWx.js";import{h as f,T as n,c as p}from"./dokanCommonFunctions.DuV-8vlZ.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./CopyIcn.BnhKHfEP.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function K({allIntegURL:g}){const u=I(),[r,v]=m(k),[e,o]=m(b),[E,w]=l.useState(!1),[x,T]=l.useState({auth:!1,euFields:!1,vendors:!1}),[_,i]=l.useState({show:!1}),c=D(S),h=()=>{if(!e.selectedTask){a.error(s("Please select a task!","bit-integrations"));return}if((e.selectedTask===n.UPDATE_VENDOR||e.selectedTask===n.WITHDRAW_REQUEST)&&!e.selectedVendor){a.error(s("Please select a vendor!","bit-integrations"));return}if(e.selectedTask!==n.DELETE_VENDOR&&!p(e)){a.error(s("Please map mandatory fields!","bit-integrations"));return}if(e.selectedTask===n.DELETE_VENDOR&&!e.selectedVendor&&!p(e)){a.error(s("Please select a topic or map fields!","bit-integrations"));return}if(e.selectedTask===n.WITHDRAW_REQUEST&&!e.selectedPaymentMethod){a.error(s("Please select a payment method!","bit-integrations"));return}C({flow:r,allIntegURL:g,conf:e,navigate:u,edit:1,setSnackbar:i})};return t.jsxs("div",{style:{width:900},children:[t.jsx(j,{snack:_,setSnackbar:i}),t.jsxs("div",{className:"flx mt-3",children:[t.jsx("b",{className:"wdt-200 d-in-b",children:s("Integration Name:","bit-integrations")}),t.jsx("input",{className:"btcd-paper-inp w-5",onChange:d=>f(d,e,o),name:"name",defaultValue:e.name||"",type:"text",placeholder:s("Integration Name...","bit-integrations")})]}),t.jsx("br",{}),t.jsx(R,{entity:r.triggered_entity,setSnackbar:i}),t.jsx(N,{formID:r.triggered_entity_id,formFields:c,handleInput:d=>f(d,e,o),dokanConf:e,setDokanConf:o,loading:x,setLoading:T,setSnackbar:i}),t.jsx(y,{edit:!0,saveConfig:h,isLoading:E,dataConf:e,setDataConf:o,formFields:c}),t.jsx("br",{})]})}export{K as default};
