var _=Object.defineProperty;var f=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var g=(s,t,e)=>t in s?_(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,b=(s,t)=>{for(var e in t||(t={}))y.call(t,e)&&g(s,e,t[e]);if(f)for(var e of f(t))I.call(t,e)&&g(s,e,t[e]);return s};import{_ as o,j as a}from"./main.2.8.1.js";import{u as N,h as w,d as c}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{S as A}from"./SnackMsg.S8DrwLlT.js";import{S as F}from"./Steps.1hz7v9Vj.js";import{I as q,s as E}from"./Integrations.D2bgBas2.js";import{h as L,c as P}from"./SureCartCommonFunc.CXfk-Ps-.js";import{B}from"./BackIcn._kGL_vVw.js";import T from"./SureCartAuthorization.B_bJDX_7.js";import{S as D}from"./SureCartIntegLayout.BHSEK8IX.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./tutorialLinks.kMkIDzcD.js";import"./TutorialLink.BAFX--T3.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";function st({formFields:s,setFlow:t,flow:e,allIntegURL:C}){const h=N(),{formID:S}=w(),[n,u]=c.useState(!1),[m,p]=c.useState(1),[x,i]=c.useState({show:!1}),j=[{key:"customer_first_name",label:o("Customer First Name","bit-integrations"),required:!0},{key:"customer_email",label:o("Customer Email","bit-integrations"),required:!0},{key:"customer_last_name",label:o("Customer Last Name","bit-integrations"),required:!1},{key:"customer_phone",label:o("Customer Phone","bit-integrations"),required:!1}],k=[{key:"1",label:"Create Customer"}],[r,l]=c.useState({name:"SureCart",type:"SureCart",mainAction:"",api_key:"",field_map:[{formField:"",SureCartFormField:""}],customerFields:j,allActions:k,actions:{}}),v=d=>{if(!P(r.field_map)){i({show:!0,msg:o("Please map fields to continue.","bit-integrations")});return}setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),p(3)};return a.jsxs("div",{children:[a.jsx(A,{snack:x,setSnackbar:i}),a.jsx("div",{className:"txt-center mt-2",children:a.jsx(F,{step:3,active:m})}),a.jsx(T,{formID:S,sureCartConf:r,setSureCartConf:l,step:m,setStep:p,isLoading:n,setIsLoading:u,setSnackbar:i}),a.jsxs("div",{className:"btcd-stp-page",style:b({},m===2&&{width:900,height:"auto",overflow:"visible"}),children:[a.jsx(D,{formFields:s,handleInput:d=>L(d,r,l),sureCartConf:r,setSureCartConf:l,isLoading:n,setIsLoading:u,setSnackbar:i}),a.jsxs("button",{onClick:()=>v(),disabled:!r.mainAction||n,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[o("Next","bit-integrations"),a.jsx(B,{className:"ml-1 rev-icn"})]})]}),a.jsx(q,{step:m,saveConfig:()=>E({flow:e,setFlow:t,allIntegURL:C,conf:r,navigate:h,setIsLoading:u,setSnackbar:i}),isLoading:n,dataConf:r,setDataConf:l,formFields:s})]})}export{st as default};
