var k=Object.defineProperty;var f=Object.getOwnPropertySymbols;var C=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var g=(s,t,e)=>t in s?k(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,b=(s,t)=>{for(var e in t||(t={}))C.call(t,e)&&g(s,e,t[e]);if(f)for(var e of f(t))T.call(t,e)&&g(s,e,t[e]);return s};import{k as M,f as N,_ as i,j as a}from"./main.2.8.10.js";import{u as W,e as D,b as m}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as P}from"./SnackMsg.7BjcJK1j.js";import{S as E}from"./Steps.B84Ui3GU.js";import{I as L,s as R}from"./Integrations.BFhED4ck.js";import B from"./WhatsAppAuthorization.CrKJvliY.js";import{f as q,h as z,c as h}from"./WhatsAppCommonFunc.WYMLPRCD.js";import{W as F}from"./WhatsAppIntegLayout.DUFSF6ga.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./BackIcn.BFDZx8No.js";import"./TutorialLink.D6K_DiHL.js";import"./TinyMCE.febRbUdQ.js";/* empty css                */import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";import"./ProUtilHelpers.CtRYkgop.js";function ct({formFields:s,setFlow:t,flow:e,allIntegURL:x}){const v=W(),{formID:j}=D(),[c,l]=m.useState(!1),[p,d]=m.useState(1),[w,n]=m.useState({show:!1}),_=M(N),{isPro:$}=_,u=[{key:"phone",label:"Recipient's Phone",required:!0}],A=[{name:"template",label:i("Template Message","bit-integrations"),is_pro:!1},{name:"text",label:i("Text Message","bit-integrations"),is_pro:!0},{name:"contact",label:i("Contact Message","bit-integrations"),is_pro:!0},{name:"media",label:i("Media Message","bit-integrations"),is_pro:!0}],S=["image/jpeg","image/png","text/plain","application/pdf","application/vnd.ms-powerpoint","application/msword","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","audio/aac","audio/mp4","audio/mpeg","audio/amr","audio/ogg","audio/opus","video/mp4","video/3gp","image/webp"],[o,r]=m.useState({name:"WhatsApp",type:"WhatsApp",numberID:"",businessAccountID:"",messageTypes:A,mediaTypes:S,messageType:"",body:"",templateName:"",token:"",field_map:q(u),whatsAppFields:u,address_field:[],actions:{},allTemplates:[]}),y=()=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),h(o)){n({show:!0,msg:i("Please map fields to continue.","bit-integrations")});return}d(3)};return a.jsxs("div",{children:[a.jsx(P,{snack:w,setSnackbar:n}),a.jsx("div",{className:"txt-center mt-2",children:a.jsx(E,{step:3,active:p})}),a.jsx(B,{formID:j,whatsAppConf:o,setWhatsAppConf:r,step:p,setstep:d,isLoading:c,setIsLoading:l,setSnackbar:n}),a.jsxs("div",{className:"btcd-stp-page",style:b({},p===2&&{width:900,height:"auto",overflow:"visible"}),children:[a.jsx(F,{formFields:s,handleInput:I=>z(I,o,r),whatsAppConf:o,setWhatsAppConf:r,isLoading:c,setIsLoading:l,setSnackbar:n}),a.jsxs("button",{onClick:()=>y(),disabled:h(o),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[i("Next","bit-integrations"),"  ",a.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),a.jsx(L,{step:p,saveConfig:()=>R({flow:e,setFlow:t,allIntegURL:x,navigate:v,conf:o,setIsLoading:l,setSnackbar:n}),isLoading:c,dataConf:o,setDataConf:r,formFields:s})]})}export{ct as default};
