var S=Object.defineProperty;var f=Object.getOwnPropertySymbols;var v=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;var u=(s,e,t)=>e in s?S(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,x=(s,e)=>{for(var t in e||(e={}))v.call(e,t)&&u(s,t,e[t]);if(f)for(var t of f(e))k.call(e,t)&&u(s,t,e[t]);return s};import{G as I,r,j as o,S as b,z as F}from"./main-343.js";import"./bf-649-79.js";import{S as C}from"./bf-149-261.js";import{a7 as N}from"./bf-659-81.js";import{I as B}from"./bf-58-184.js";import{N as q}from"./bf-713-109.js";import z from"./bf-91-126.js";import{a as L,c as M}from"./bf-166-183.js";import{T as P}from"./bf-167-226.js";import"./bf-974-82.js";import"./bf-594-113.js";function V({formFields:s,setIntegration:e,integrations:t,allIntegURL:g}){const w=I(),[p,n]=r.useState(!1),[a,c]=r.useState(1),[h,l]=r.useState({show:!1}),T=[{key:"To",label:"To",required:!0},{key:"Body",label:"Message Body",required:!0}],[i,d]=r.useState({name:"Twilio",type:"Twilio",sid:"",token:"",from_num:"",field_map:[{formField:"",twilioField:"To"},{formField:"",twilioField:"Body"}],twilioFields:T}),j=()=>{n(!0),N(t,e,g,i,w)},y=m=>{if(!M(i)){F.error("Please map mandatory fields");return}i.field_map.length>0&&c(m)};return document.querySelector(".btcd-s-wrp").scrollTop=0,o.jsxs("div",{children:[o.jsx(b,{snack:h,setSnackbar:l}),o.jsx("div",{className:"txt-center w-9 mt-2 cal-width",children:o.jsx(C,{step:3,active:a})}),o.jsx(z,{twilioConf:i,setTwilioConf:d,step:a,setstep:c,isLoading:p,setIsLoading:n,setSnackbar:l}),o.jsxs("div",{className:"btcd-stp-page",style:x({},a===2&&{width:900,height:"auto",overflow:"visible"}),children:[o.jsx(P,{formFields:s,handleInput:m=>L(m,i,d),twilioConf:i,setTwilioConf:d,isLoading:p,setIsLoading:n,setSnackbar:l}),o.jsx(q,{nextPageHandler:()=>y(3)})]}),o.jsx(B,{step:a,saveConfig:()=>j()})]})}export{V as default};
