1import{u as y,X as w,r as i,$ as N,j as e,H as v,a0 as s,B as n,I as k}from"./index-BnQtn7LC.js";import{T as C}from"./textarea-BeNcNZM9.js";import{u as S}from"./useRole-DsVZXBkW.js";import{c as A}from"./conciergeApi-8mQuAksM.js";function E(){const[,m]=y(),{me:t,refresh:x,loading:u}=w(),{isAuthed:p,isConcierge:h,isConciergePending:b}=S(),[l,g]=i.useState(""),[c,f]=i.useState(""),[r,o]=i.useState(!1),{toast:d}=N();if(u)return e.jsx("div",{className:"min-h-screen bg-black text-white p-8 flex items-center justify-center",children:e.jsx("div",{className:"text-sm text-gray-400",children:"Loadingâ¦"})});if(!p)return e.jsxs("div",{className:"min-h-screen bg-black text-white flex flex-col",children:[e.jsx(v,{}),e.jsx("div",{className:"flex-1 flex items-center justify-center p-6",children:e.jsxs(s,{className:"bg-white text-black p-8 max-w-md w-full",children:[e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Please sign in"}),e.jsx("p",{className:"text-sm text-gray-600 mb-6",children:"Sign in to apply for a Concierge account. You'll come right back here after."}),e.jsx(n,{onClick:()=>window.dispatchEvent(new Event("openLoginDialog")),className:"w-full",children:"Sign in"})]})})]});if(h)return e.jsx("div",{className:"min-h-screen bg-black text-white p-8 flex items-center justify-center",children:e.jsxs(s,{className:"bg-white text-black p-8 max-w-md w-full",children:[e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"You're approved"}),e.jsx("p",{className:"text-sm text-gray-600 mb-6",children:"Your Concierge account is already active."}),e.jsx(n,{onClick:()=>m("/concierge"),className:"w-full",children:"Open Concierge Dashboard"})]})});const j=async()=>{o(!0);try{await A("/api/concierge/apply",{method:"POST",body:JSON.stringify({company:l||null,note:c||null})}),d({title:"Application submitted",description:"We'll review your application shortly."}),await x()}catch(a){d({title:"Could not submit",description:(a==null?void 0:a.message)||"Please try again.",variant:"destructive"})}finally{o(!1)}};return e.jsx("div",{className:"min-h-screen bg-black text-white p-4 sm:p-8",children:e.jsxs("div",{className:"max-w-xl mx-auto",children:[e.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Apply for Concierge"}),e.jsx("p",{className:"text-gray-400 mb-6",children:"Book rides on behalf of clients with a saved roster, multi-active rides, and a unified dashboard. Applications are reviewed manually."}),b&&e.jsxs(s,{className:"bg-amber-50 text-amber-900 border-amber-300 p-4 mb-6",children:["Your application is ",e.jsx("b",{children:"pending review"}),". You can update it below."]}),e.jsxs(s,{className:"bg-white text-black p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Company (optional)"}),e.jsx(k,{"data-testid":"input-concierge-company",placeholder:"e.g. Mandarin Oriental Bangkok",value:l,onChange:a=>g(a.target.value)})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Tell us about your needs"}),e.jsx(C,{"data-testid":"input-concierge-note",placeholder:"Volume, typical clients, anything else helpfulâ¦",rows:5,value:c,onChange:a=>f(a.target.value)})]}),e.jsxs("div",{className:"text-xs text-gray-500",children:["Signed in as ",e.jsx("b",{children:(t==null?void 0:t.displayName)||(t==null?void 0:t.phone)||(t==null?void 0:t.email)})]}),e.jsx(n,{"data-testid":"button-submit-concierge-application",onClick:j,disabled:r,className:"w-full",children:r?"Submittingâ¦":"Submit application"})]})]})})}export{E as default};
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.