var k=Object.defineProperty;var l=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var u=(s,t,e)=>t in s?k(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,h=(s,t)=>{for(var e in t||(t={}))w.call(t,e)&&u(s,e,t[e]);if(l)for(var e of l(t))S.call(t,e)&&u(s,e,t[e]);return s};import{u as N,k as C,r,j as a}from"./main-406.js";import{d as T,_ as W,I as _,s as D}from"./bi.394.85.js";import{S as F}from"./bi.68.941.js";import P from"./bi.783.339.js";import{h as E,c as L}from"./bi.56.800.js";import{W as B}from"./bi.215.801.js";import"./bi.46.744.js";import"./bi.150.760.js";import"./bi.141.747.js";/* empty css          */import"./bi.704.707.js";import"./bi.701.708.js";function Y({formFields:s,setFlow:t,flow:e,allIntegURL:f}){const b=N(),{formID:g}=C(),[c,m]=r.useState(!1),[i,d]=r.useState(1),[x,n]=r.useState({show:!1}),j=[{key:"phone",label:"Phone",required:!0}],v=[{id:"2",label:"Template"}],[o,p]=r.useState({name:"WhatsApp",type:"WhatsApp",numberID:"",businessAccountID:"",messageType:v,messageTypeId:"",body:"",templateName:"",token:"",field_map:[{formField:"",whatsAppFormField:""}],whatsAppFields:j,address_field:[],actions:{}}),A=()=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),L(o)){n({show:!0,msg:"Please map fields to continue."});return}d(3)},I=o.messageTypeId==="1"?o.body==="":o.templateName==="";return a.jsxs("div",{children:[a.jsx(T,{snack:x,setSnackbar:n}),a.jsx("div",{className:"txt-center mt-2",children:a.jsx(F,{step:3,active:i})}),a.jsx(P,{formID:g,whatsAppConf:o,setWhatsAppConf:p,step:i,setstep:d,isLoading:c,setIsLoading:m,setSnackbar:n}),a.jsxs("div",{className:"btcd-stp-page",style:h({},i===2&&{width:900,height:"auto",overflow:"visible"}),children:[a.jsx(B,{formFields:s,handleInput:y=>E(y,o,p),whatsAppConf:o,setWhatsAppConf:p,isLoading:c,setIsLoading:m,setSnackbar:n}),a.jsxs("button",{onClick:()=>A(),disabled:I,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[W("Next","bit-integrations")," "," ",a.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),a.jsx(_,{step:i,saveConfig:()=>D({flow:e,setFlow:t,allIntegURL:f,navigate:b,conf:o,setIsLoading:m,setSnackbar:n}),isLoading:c,dataConf:o,setDataConf:p,formFields:s})]})}export{Y as default};
