import{j as t,_ as m}from"./main.2.8.10.js";import{u as j,e as F,b as a}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as C}from"./BackIcn.BFDZx8No.js";import{S}from"./SnackMsg.7BjcJK1j.js";import{I,g as y}from"./Integrations.BFhED4ck.js";import _ from"./FluentCartAuthorization.Cm5dqg-A.js";import{F as k,c as v}from"./FluentCartIntegLayout.3gBMjDX0.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./ProUtilHelpers.CtRYkgop.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";import"./GlobalIntegrationHelper.Belqr4OT.js";function O({formFields:d,setFlow:g,flow:f,allIntegURL:x}){const h=j(),{formID:c}=F(),[n,o]=a.useState(!1),[s,p]=a.useState(1),[b,i]=a.useState({show:!1}),[e,l]=a.useState({name:"FluentCart",type:"FluentCart",field_map:[{formField:"",fluentCartField:""}],actions:{},mainAction:""}),u=r=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),r===3){if(e.mainAction==="create_coupon"&&!(e!=null&&e.discountType)){i({show:!0,msg:m("Please select discount Type to continue.","bit-integrations")});return}if(!v(e)){i({show:!0,msg:m("Please map all required fields to continue.","bit-integrations")});return}e.name!==""&&e.field_map.length>0&&p(r)}else p(r)};return t.jsxs("div",{children:[t.jsx(S,{snack:b,setSnackbar:i}),t.jsx("div",{className:"txt-center mt-2"}),t.jsx(_,{formID:c,fluentCartConf:e,setFluentCartConf:l,step:s,nextPage:u,isLoading:n,setIsLoading:o,setSnackbar:i}),t.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto",minHeight:s===2&&"500px"},children:[t.jsx(k,{formID:c,formFields:d,fluentCartConf:e,setFluentCartConf:l,setSnackbar:i,setIsLoading:o,isLoading:n}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>u(3),disabled:e.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[m("Next","bit-integrations"),t.jsx(C,{className:"ml-1 rev-icn"})]})]}),t.jsx(I,{step:s,saveConfig:()=>y(f,g,x,e,h,"","",o),isLoading:n})]})}export{O as default};
