var I=Object.defineProperty;var x=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var C=(i,t,s)=>t in i?I(i,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[t]=s,_=(i,t)=>{for(var s in t||(t={}))O.call(t,s)&&C(i,s,t[s]);if(x)for(var s of x(t))F.call(t,s)&&C(i,s,t[s]);return i};import{_ as e,j as a,z as p}from"./main.2.8.10.js";import{u as w,b as r}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as E}from"./SnackMsg.7BjcJK1j.js";import{S as L}from"./Steps.B84Ui3GU.js";import{I as P,g as z}from"./Integrations.BFhED4ck.js";import M from"./OmniSendAuthorization.DuGetuK7.js";import{g as T,h as A,c as B}from"./OmniSendCommonFunc.C9bUO03G.js";import{O as D}from"./OmniSendIntegLayout.DSuyBVms.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./ActionProFeatureComponent.ByowZIj8.js";import"./ActionProFeatureLabels.BzMNdAoD.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function re({formFields:i,setFlow:t,flow:s,allIntegURL:u}){const f=w(),[v,b]=r.useState(!1),[g,h]=r.useState({channel:!1,field:!1,auth:!1}),[o,y]=r.useState(1),[j,c]=r.useState({show:!1}),S=[{key:"email",label:e("Email","bit-integrations"),required:!1},{key:"phone_number",label:e("Phone Number","bit-integrations"),required:!1},{key:"firstName",label:e("First Name","bit-integrations"),required:!1},{key:"lastName",label:e("Last Name","bit-integrations"),required:!1},{key:"country",label:e("Country","bit-integrations"),required:!1},{key:"countryCode",label:e("Country Code","bit-integrations"),required:!1},{key:"state",label:e("State","bit-integrations"),required:!1},{key:"city",label:e("City","bit-integrations"),required:!1},{key:"address",label:e("Address","bit-integrations"),required:!1},{key:"postalCode",label:e("Postal Code","bit-integrations"),required:!1},{key:"gender",label:e("Gender","bit-integrations"),required:!1},{key:"birthdate",label:e("Birth Date","bit-integrations"),required:!1}],[n,l]=r.useState({name:"OmniSend",type:"OmniSend",api_key:"",field_map:T(S),custom_field_map:[{formField:"",omniSendFormField:""}],channels:"",channel_types:[],email_status:"",sms_status:"",omniSend_fields:S,actions:{}}),q=()=>{b(!0),z(s,t,u,n,f,"","",b).then(m=>{var k;m.success?(p.success((k=m.data)==null?void 0:k.msg),f(u)):p.error(m.data||m)})},N=d=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!B(n)){p.error(e("Please map mandatory fields","bit-integrations"));return}n.field_map.length>0&&y(d)};return a.jsxs("div",{children:[a.jsx(E,{snack:j,setSnackbar:c}),a.jsx("div",{className:"txt-center mt-2",children:a.jsx(L,{step:3,active:o})}),a.jsx(M,{omniSendConf:n,setOmniSendConf:l,step:o,setstep:y,loading:g,setLoading:h,setSnackbar:c}),a.jsxs("div",{className:"btcd-stp-page",style:_({},o===2&&{width:900,height:"auto",overflow:"visible"}),children:[a.jsx(D,{formFields:i,handleInput:d=>A(d,n,l),omniSendConf:n,setOmniSendConf:l,loading:g,setLoading:h,setSnackbar:c}),a.jsxs("button",{onClick:()=>N(3),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[e("Next","bit-integrations"),"  ",a.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),a.jsx(P,{step:o,saveConfig:()=>q(),isLoading:v,dataConf:n,setDataConf:l,formFields:i})]})}export{re as default};
