1import{a as k,u as S,Z as w,r,j as e,_ as B,B as m,ar as C,as as v,S as A,aO as O,n as I,aI as N,b9 as P}from"./index-fb3c7097.js";import{c as F}from"./confirmStripeOnboarding-6146049c.js";const L=a=>k.post("/stripe/create-stripe-account",a),D=()=>{var d;const a=S(),{data:s}=w(),[i,l]=r.useState(!1),p=async()=>{l(!0);try{const t=await F();window.location.href=t==null?void 0:t.onboardingUrl}catch(t){console.log(t==null?void 0:t.message),a("/owner/stripe-onboarding")}finally{l(!1)}};return e.jsx(B,{title:"Bookings",children:s.data&&!((d=s==null?void 0:s.data)!=null&&d.stripeAccountId)&&!(s!=null&&s.data.stripeOnboard)?e.jsx("div",{className:"container my-4 rounded-lg p-4 bgdark no-subscription",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h6",{className:"f-26 semi-bold mb-4",children:"Please complete your Stripe onboarding first!"}),e.jsx("div",{children:e.jsx(m,{className:"rounded-full px-5",onClick:()=>a("/owner/stripe-onboarding"),children:"Click here to start process"})})]})}):e.jsx("div",{className:"container my-4 rounded-lg p-4 bgdark no-subscription",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h6",{className:"f-26 semi-bold mb-4",children:"Your have not completed your Stripe onboarding"}),e.jsx("div",{children:e.jsx(m,{className:"rounded-full px-5",isLoading:i,disabled:i,onClick:p,children:"Click here to complete the process"})})]})})})},U=C({email:v().min(1,"Email is required").email("Invalid email address"),paypalEmail:v().min(1,"Paypal Email is required").email("Invalid Paypal email address")}),R=()=>{var u,h,x,b,g,j,y,f;S();const a=w(),[s,i]=r.useState(!1),[l,p]=r.useState(!1),[d,t]=r.useState([]);r.useState(!1);const E=async o=>{try{i(!0);const{onboardingUrl:n}=await L(o);window.location.href=n,i(!1)}finally{i(!1)}};return r.useEffect(()=>{const n=Object.values(P).map(c=>({label:c.country,value:c.countryCode}));t(n)},[]),console.log("wehfuiwehfui",(u=a==null?void 0:a.data)==null?void 0:u.data),e.jsxs(e.Fragment,{children:[l&&e.jsx(A,{}),e.jsx(e.Fragment,{children:!((x=(h=a==null?void 0:a.data)==null?void 0:h.data)!=null&&x.stripeAccountId)&&!((b=a==null?void 0:a.data)!=null&&b.data.stripeOnboard)?e.jsxs(O,{title:"Add Bank Details",children:[e.jsx("h5",{className:"semi-bold f-32 text-white",children:"Add Bank Details"}),e.jsx("p",{className:"f-20 semi-bold mb-1 gray",children:"Please enter the following details"}),e.jsx("div",{className:"dashboard-card gray border-0 rounded add-user-form mt-4 ",children:e.jsx("div",{className:"my-4 p-4 bg-black rounded user-box",children:!l&&e.jsx(I,{schema:U,onSubmit:E,options:{defaultValues:{email:((j=(g=a==null?void 0:a.data)==null?void 0:g.data)==null?void 0:j.email)??"",paypalEmail:((f=(y=a==null?void 0:a.data)==null?void 0:y.data)==null?void 0:f.email)??""}},children:({register:o,formState:n,control:c})=>e.jsx(e.Fragment,{children:e.jsxs("div",{className:"row mt-4",children:[e.jsx("div",{className:"col-12 col-md-6 mb-4",children:e.jsx(N,{error:n.errors.email,registration:o("email"),type:"text",label:"Stripe Email",placeholder:"Email"})}),e.jsx("div",{className:"col-12 col-md-6 mb-4",children:e.jsx(N,{error:n.errors.paypalEmail,registration:o("paypalEmail"),type:"text",label:"Paypal Email",placeholder:"Paypal Email"})}),e.jsx("div",{className:"row mt-4",children:e.jsx("div",{className:"col-12 text-center",children:e.jsx(m,{isLoading:s,disabled:s,type:"submit",className:"px-5 rounded-full",children:"Save"})})})]})})})})})]}):e.jsx(D,{})})]})};export{R as StripeOnBoarding};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.