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