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