import{h as f,$ as _,g as b,k as h,i as j,j as t,_ as s,z as a}from"./main.2.9.0.js";import{u as k,b as d}from"./react-router.DMwpH23k.js";import{S as C}from"./SnackMsg.DYSD96P4.js";import{S as I,I as y,s as E}from"./Integrations.DL8wqGct.js";import{V as w}from"./VoxelIntegLayout.talCAw5X.js";import{h as m,T as n,P as A,c as F}from"./VoxelCommonFunctions.4nW0KITs.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./CopyIcn.CEA_lFLo.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TagifyInput.KPPRQJ1B.js";import"./lodash.DCvQBX3r.js";function B({allIntegURL:p}){const g=k(),[r,N]=f(_),[e,o]=f(b),[u,v]=d.useState(!1),[x,T]=d.useState({auth:!1,PostTypes:!1,postFields:!1,posts:!1}),[P,i]=d.useState({show:!1}),c=h(j),S=()=>{if(!e.selectedTask){a.error(s("Please select a task!","bit-integrations"));return}if((e.selectedTask===n.NEW_POST||e.selectedTask===n.UPDATE_POST)&&!e.selectedPostType){a.error(s("Please select a post type!","bit-integrations"));return}if(A.includes(e.selectedTask)&&!e.selectedPostStatus){a.error(s("Please select a post status!","bit-integrations"));return}if((e.selectedTask===n.UPDATE_POST||e.selectedTask===n.UPDATE_COLLECTION_POST)&&!e.selectedPost){a.error(s("Please select a post!","bit-integrations"));return}if(!F(e)){a.error(s("Please map mandatory fields!","bit-integrations"));return}E({flow:r,allIntegURL:p,conf:e,navigate:g,edit:1,setSnackbar:i})};return t.jsxs("div",{style:{width:900},children:[t.jsx(C,{snack:P,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:l=>m(l,e,o),name:"name",defaultValue:e.name||"",type:"text",placeholder:s("Integration Name...","bit-integrations")})]}),t.jsx("br",{}),t.jsx(I,{entity:r.triggered_entity,setSnackbar:i}),t.jsx(w,{formID:r.triggered_entity_id,formFields:c,handleInput:l=>m(l,e,o),voxelConf:e,setVoxelConf:o,loading:x,setLoading:T,setSnackbar:i}),t.jsx(y,{edit:!0,saveConfig:S,disabled:!1,isLoading:u,dataConf:e,setDataConf:o,formFields:c}),t.jsx("br",{})]})}export{B as default};
