var G=Object.defineProperty;var S=Object.getOwnPropertySymbols;var L=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var x=(s,t,i)=>t in s?G(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,_=(s,t)=>{for(var i in t||(t={}))L.call(t,i)&&x(s,i,t[i]);if(S)for(var i of S(t))w.call(t,i)&&x(s,i,t[i]);return s};import{_ as e,j as a,z as m}from"./main.2.8.10.js";import{u as E,b as n}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as I}from"./SnackMsg.7BjcJK1j.js";import{S as P}from"./Steps.B84Ui3GU.js";import{I as A,g as z}from"./Integrations.BFhED4ck.js";import T from"./SendGridAuthorization.BNuLt2ox.js";import{c as q}from"./SendGridCommonFunc.BAzcKyKN.js";import{S as M}from"./SendGridIntegLayout.BbKmY1wV.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function ie({formFields:s,setFlow:t,flow:i,allIntegURL:b}){const u=E(),[v,p]=n.useState(!1),[f,g]=n.useState({auth:!1,customFields:!1,lists:!1}),[o,y]=n.useState(1),[j,d]=n.useState({show:!1}),C=[{key:"email",label:e("Email","bit-integrations"),required:!0},{key:"first_name",label:e("First Name","bit-integrations"),required:!1},{key:"last_name",label:e("Last Name","bit-integrations"),required:!1},{key:"alternate_emails",label:e("Alternate Emails","bit-integrations"),required:!1},{key:"address_line_1",label:e("Address Line 1","bit-integrations"),required:!1},{key:"address_line_2",label:e("Address Line 2","bit-integrations"),required:!1},{key:"city",label:e("City","bit-integrations"),required:!1},{key:"state_province_region",label:e("State Province Region","bit-integrations"),required:!1},{key:"postal_code",label:e("Postal Code","bit-integrations"),required:!1},{key:"country",label:e("Country","bit-integrations"),required:!1},{key:"phone_number",label:e("Phone Number","bit-integrations"),required:!1},{key:"whatsapp",label:e("Whatsapp","bit-integrations"),required:!1},{key:"line",label:e("Line","bit-integrations"),required:!1},{key:"facebook",label:e("Facebook","bit-integrations"),required:!1},{key:"unique_name",label:e("Unique Name","bit-integrations"),required:!1}],[r,c]=n.useState({name:"SendGrid",type:"SendGrid",apiKey:"",field_map:[{formField:"",sendGridFormField:""}],staticFields:C,lists:[],customFields:[],selectedLists:"",groups:[],actions:{}}),N=()=>{p(!0),z(i,t,b,r,u,"","",p).then(l=>{var h;l.success?(m.success((h=l.data)==null?void 0:h.msg),u(b)):m.error(l.data||l)})},F=k=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!q(r)){m.error(e("Please map mandatory fields","bit-integrations"));return}r.field_map.length>0&&y(k)};return a.jsxs("div",{children:[a.jsx(I,{snack:j,setSnackbar:d}),a.jsx("div",{className:"txt-center mt-2",children:a.jsx(P,{step:3,active:o})}),a.jsx(T,{sendGridConf:r,setSendGridConf:c,step:o,setStep:y,loading:f,setLoading:g,setSnackbar:d}),a.jsxs("div",{className:"btcd-stp-page",style:_({},o===2&&{width:900,height:"auto",overflow:"visible"}),children:[a.jsx(M,{formFields:s,sendGridConf:r,setSendGridConf:c,loading:f,setLoading:g,setSnackbar:d}),a.jsxs("button",{onClick:()=>F(3),disabled:!q(r),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(A,{step:o,saveConfig:()=>N(),isLoading:v,dataConf:r,setDataConf:c,formFields:s})]})}export{ie as default};
