var C=Object.defineProperty;var w=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var v=(s,t,e)=>t in s?C(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,j=(s,t)=>{for(var e in t||(t={}))I.call(t,e)&&v(s,e,t[e]);if(w)for(var e of w(t))N.call(t,e)&&v(s,e,t[e]);return s};import{_ as f,j as i,z as u}from"./main.2.8.10.js";import{u as _,b as c}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as B}from"./SnackMsg.7BjcJK1j.js";import{S as F}from"./Steps.B84Ui3GU.js";import{I as q,g as z}from"./Integrations.BFhED4ck.js";import{h as E}from"./TwilioCommonFunc.oRsszp5W.js";import L from"./TwilioAuthorization.BLVBIArz.js";import{T as M}from"./TwilioIntegLayout.0sVu64Pq.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";function $({formFields:s,setFlow:t,flow:e,allIntegURL:g}){const b=_(),[m,a]=c.useState(!1),[r,x]=c.useState(1),[y,p]=c.useState({show:!1}),T=[{key:"To",label:f("To","bit-integrations"),required:!0},{key:"Body",label:f("Message Body","bit-integrations"),required:!0}],[o,n]=c.useState({name:"Twilio",type:"Twilio",sid:"",token:"",body:"",to:"",from_num:"",field_map:[{formField:"",twilioField:"To"},{formField:"",twilioField:"Body"}],twilioFields:T}),S=()=>{a(!0),z(e,t,g,o,b,"","",a).then(d=>{var h;d.success?(u.success((h=d.data)==null?void 0:h.msg),b(g)):u.error(d.data||d)})},k=l=>{if(o.to===""&&o.body===""){u.error("Please select To and Body field , it is required");return}x(l)};return i.jsxs("div",{children:[i.jsx(B,{snack:y,setSnackbar:p}),i.jsx("div",{className:"txt-center mt-2",children:i.jsx(F,{step:3,active:r})}),i.jsx(L,{twilioConf:o,setTwilioConf:n,step:r,setstep:x,isLoading:m,setIsLoading:a,setSnackbar:p}),i.jsxs("div",{className:"btcd-stp-page",style:j({},r===2&&{width:900,height:"auto",overflow:"visible"}),children:[i.jsx(M,{formFields:s,handleInput:l=>E(l,o,n),twilioConf:o,setTwilioConf:n,isLoading:m,setIsLoading:a,setSnackbar:p}),i.jsxs("button",{onClick:()=>k(3),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[f("Next","bit-integrations"),"  ",i.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),i.jsx(q,{step:r,saveConfig:()=>S(),isLoading:m,dataConf:o,setDataConf:n,formFields:s})]})}export{$ as default};
