var _=Object.defineProperty;var d=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var f=(s,e,t)=>e in s?_(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,C=(s,e)=>{for(var t in e||(e={}))y.call(e,t)&&f(s,t,e[t]);if(d)for(var t of d(e))I.call(e,t)&&f(s,t,e[t]);return s};import{u as N,k as w,r as l,j as a}from"./main-333.js";import{d as A,_ as h,I as F,s as q}from"./bi.636.93.js";import{S as E}from"./bi.563.969.js";import{h as L,c as P}from"./bi.274.875.js";import{B}from"./bi.429.767.js";import T from"./bi.67.307.js";import{S as D}from"./bi.743.874.js";import"./bi.318.783.js";import"./bi.535.730.js";import"./bi.286.731.js";function W({formFields:s,setFlow:e,flow:t,allIntegURL:g}){const x=N(),{formID:S}=w(),[i,c]=l.useState(!1),[n,u]=l.useState(1),[b,o]=l.useState({show:!1}),k=[{key:"customer_first_name",label:"Customer First Name ",required:!0},{key:"customer_email",label:"Customer Email ",required:!0},{key:"customer_last_name",label:"Customer Last Name ",required:!1},{key:"customer_phone",label:"Customer Phone ",required:!1}],j=[{key:"1",label:"Create Customer"}],[r,m]=l.useState({name:"SureCart",type:"SureCart",mainAction:"",api_key:"",field_map:[{formField:"",SureCartFormField:""}],customerFields:k,allActions:j,actions:{}}),v=p=>{if(!P(r.field_map)){o({show:!0,msg:h("Please map fields to continue.","bit-integrations")});return}setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),u(3)};return a.jsxs("div",{children:[a.jsx(A,{snack:b,setSnackbar:o}),a.jsx("div",{className:"txt-center mt-2",children:a.jsx(E,{step:3,active:n})}),a.jsx(T,{formID:S,sureCartConf:r,setSureCartConf:m,step:n,setStep:u,isLoading:i,setIsLoading:c,setSnackbar:o}),a.jsxs("div",{className:"btcd-stp-page",style:C({},n===2&&{width:900,height:"auto",overflow:"visible"}),children:[a.jsx(D,{formFields:s,handleInput:p=>L(p,r,m),sureCartConf:r,setSureCartConf:m,isLoading:i,setIsLoading:c,setSnackbar:o}),a.jsxs("button",{onClick:()=>v(),disabled:!r.mainAction||i,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[h("Next","bit-integrations"),a.jsx(B,{className:"ml-1 rev-icn"})]})]}),a.jsx(F,{step:n,saveConfig:()=>q({flow:t,setFlow:e,allIntegURL:g,conf:r,navigate:x,setIsLoading:c,setSnackbar:o}),isLoading:i,dataConf:r,setDataConf:m,formFields:s})]})}export{W as default};
