var k=Object.defineProperty;var g=Object.getOwnPropertySymbols;var C=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var f=(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)&&f(s,e,t[e]);if(g)for(var e of g(t))T.call(t,e)&&f(s,e,t[e]);return s};import{k as M,g as N,_ as i,j as a}from"./main.2.8.1.js";import{u as W,h as D,d as m}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{S as P}from"./SnackMsg.S8DrwLlT.js";import{S as E}from"./Steps.1hz7v9Vj.js";import{I as L,s as R}from"./Integrations.D2bgBas2.js";import B from"./WhatsAppAuthorization.Jx3uQw1Q.js";import{f as q,h as z,c as h}from"./WhatsAppCommonFunc.cJ_EoVHR.js";import{W as F}from"./WhatsAppIntegLayout.MmZB8fnL.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./BackIcn._kGL_vVw.js";import"./tutorialLinks.kMkIDzcD.js";import"./TutorialLink.BAFX--T3.js";import"./TinyMCE.Dcvv5APO.js";/* empty css                */import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";import"./ProUtilHelpers.fQlR3mWW.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};
