File: /var/www/html/wordpress/wp-content/plugins/bit-integrations/assets/bi.894.449.js
var V=Object.defineProperty;var h=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var v=(a,t,s)=>t in a?V(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s,k=(a,t)=>{for(var s in t||(t={}))A.call(t,s)&&v(a,s,t[s]);if(h)for(var s of h(t))N.call(t,s)&&v(a,s,t[s]);return a};import{u as O,r as n,j as o}from"./main-685.js";import"./bi.451.455.js";import{_ as r,V as i}from"./bi.878.0.js";import{S as I}from"./bi.674.13.js";import{S as w}from"./bi.347.1012.js";import{I as L,g as D}from"./bi.776.3.js";import{c as _,T as p,P as F}from"./bi.244.1000.js";import{V as K}from"./bi.160.999.js";import M from"./bi.742.292.js";import"./bi.327.9.js";import"./bi.601.11.js";import"./bi.825.14.js";import"./bi.768.751.js";import"./bi.666.752.js";import"./bi.703.796.js";function se({formFields:a,setFlow:t,flow:s,allIntegURL:f}){const u=O(),[j,g]=n.useState(!1),[T,x]=n.useState({auth:!1,postTypes:!1,postFields:!1,posts:!1}),[l,P]=n.useState(1),[y,d]=n.useState({show:!1}),[e,m]=n.useState({name:"Voxel",type:"Voxel",field_map:[],selectedTask:"",postTypes:[],selectedPostType:"",selectedPostStatus:"",voxelFields:[],actions:{},posts:[],selectedPost:""}),C=()=>{g(!0),D(s,t,f,e,u,"","",g).then(c=>{var b;c.success?(i.success((b=c.data)==null?void 0:b.msg),u(f)):i.error(c.data||c)})},E=S=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!e.selectedTask){i.error(r("Please select a task!","bit-integrations"));return}if((e.selectedTask===p.NEW_POST||e.selectedTask===p.UPDATE_POST)&&!e.selectedPostType){i.error(r("Please select a post type!","bit-integrations"));return}if(F.includes(e.selectedTask)&&!e.selectedPostStatus){i.error(r("Please select a post status!","bit-integrations"));return}if((e.selectedTask===p.UPDATE_POST||e.selectedTask===p.UPDATE_COLLECTION_POST)&&!e.selectedPost){i.error(r("Please select a post!","bit-integrations"));return}if(!_(e)){i.error(r("Please map mandatory fields!","bit-integrations"));return}e.field_map.length>0&&P(S)};return o.jsxs("div",{children:[o.jsx(I,{snack:y,setSnackbar:d}),o.jsx("div",{className:"txt-center mt-2",children:o.jsx(w,{step:3,active:l})}),o.jsx(M,{voxelConf:e,setVoxelConf:m,step:l,setStep:P,loading:T,setLoading:x,setSnackbar:d}),o.jsxs("div",{className:"btcd-stp-page",style:k({},l===2&&{width:900,height:"auto",overflow:"visible"}),children:[o.jsx(K,{formFields:a,voxelConf:e,setVoxelConf:m,loading:T,setLoading:x,setSnackbar:d}),o.jsxs("button",{onClick:()=>E(3),disabled:!_(e),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[r("Next","bit-integrations")," ",o.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),o.jsx(L,{step:l,saveConfig:()=>C(),isLoading:j,dataConf:e,setDataConf:m,formFields:a})]})}export{se as default};