import{u as h,k,r as a,j as e}from"./main-406.js";import{d as x,_ as S,I as q,s as C}from"./bi.394.85.js";import{B as j}from"./bi.46.744.js";import{S as v}from"./bi.68.941.js";import{s as I,K as N}from"./bi.862.779.js";import B from"./bi.153.262.js";import{h as A,c as L}from"./bi.374.778.js";import"./bi.704.707.js";import"./bi.701.708.js";import"./bi.150.760.js";function Z({formFields:d,setFlow:c,flow:u,allIntegURL:f}){const m=h(),{formID:o}=k(),[l,n]=a.useState(!1),[t,p]=a.useState(1),[b,i]=a.useState({show:!1}),g=[{key:"given_name",label:"First Name",required:!0},{key:"middle_name",label:"Last Name",required:!1},{key:"job_title",label:"job_title",required:!1},{key:"email_addresses",label:"Email Addresses",required:!0},{key:"phone_numbers",label:"Phone Numbers",required:!1},{key:"billing_country_code",label:"Billing Country Code",required:!1},{key:"billing_locality",label:"Billing Country",required:!1},{key:"billing_first_address_street",label:"Billing Address Street (Line 1)",required:!1},{key:"billing_second_address_street",label:"Billing Address Street (Line 2)",required:!1},{key:"billing_zip_code",label:"Billing Zip Code",required:!1},{key:"shipping_country_code",label:"Shipping Country Code",required:!1},{key:"shipping_locality",label:"Shipping Country",required:!1},{key:"shipping_first_address_street",label:"Shipping Address Street (Line 1)",required:!1},{key:"shipping_second_address_street",label:"Shipping Address Street (Line 2)",required:!1},{key:"shipping_zip_code",label:"Shipping Zip Code",required:!1},{key:"anniversary",label:"Anniversary",required:!1},{key:"birthday",label:"Birthday",required:!1},{key:"fax_numbers",label:"Fax Numbers",required:!1}],[s,r]=a.useState({name:"Keap",type:"Keap",clientId:"",clientSecret:"",keapId:"",field_map:[{formField:"",keapField:""}],contactFields:g,customFields:[],actions:{}});a.useEffect(()=>{window.opener&&I("keap")},[]);const y=()=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!L(s)){i({show:!0,msg:"Please map fields to continue."});return}s.field_map.length>0&&p(3)};return e.jsxs("div",{children:[e.jsx(x,{snack:b,setSnackbar:i}),e.jsx("div",{className:"txt-center mt-2",children:e.jsx(v,{step:3,active:t})}),e.jsx(B,{formID:o,keapConf:s,setKeapConf:r,step:t,setstep:p,setSnackbar:i,isLoading:l,setIsLoading:n}),e.jsxs("div",{className:"btcd-stp-page",style:{width:t===2&&900,height:t===2&&"auto"},children:[e.jsx(N,{formID:o,formFields:d,handleInput:_=>A(_,s,r),keapConf:s,setKeapConf:r,isLoading:l,setIsLoading:n,setSnackbar:i}),e.jsxs("button",{onClick:()=>y(),disabled:s.field_map.length<2,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[S("Next","bit-integrations"),e.jsx(j,{className:"ml-1 rev-icn"})]})]}),e.jsx(q,{step:t,saveConfig:()=>C({flow:u,setFlow:c,allIntegURL:f,navigate:m,conf:s,setIsLoading:n,setSnackbar:i}),isLoading:l,dataConf:s,setDataConf:r,formFields:d})]})}export{Z as default};
