PageSourceSearch

https://ludusmagnus.replit.app/assets/BookScan-Wp0nnAb8.js

js ludusmagnus.replit.app collected 2026-10-03 03:56:47 UTC 7,861 bytes, 4 lines download raw bytes

1import{u as A,a as F,r as n,j as e,N as P,C as f,m as k,n as w,o as b,B as v}from"./index-6iznneeq.js";import{u as I}from"./useQuery-DFbnK9yN.js";import{u as C}from"./useMutation-CYp8f-YE.js";import{I as $}from"./input-GIPW9QDl.js";import{C as S}from"./calendar-DaS56YfH.js";import{A as q}from"./arrow-left-Ca0PlnQu.js";import{C as B}from"./clock-C2IRNDvG.js";import{C as K}from"./check-CDZnR4VG.js";import{U as Y}from"./user-D2VWJfaJ.js";import"./utils-km2FGkQ4.js";function X(){const{toast:p}=A(),g=F(),[l,c]=n.useState("email"),[m,T]=n.useState(""),[i,N]=n.useState(null),[o,j]=n.useState(null),[d,y]=n.useState(null),x=C({mutationFn:async t=>{const r=await fetch("/api/book-scan/validate-email",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:t})}),s=await r.json();if(!r.ok)throw new Error(s.error||"Email not found");return s},onSuccess:t=>{N(t),t.existingBooking?(y({slotTime:t.existingBooking.slotTime,memberName:`${t.firstName} ${t.lastName}`}),c("confirmation")):c("slots")},onError:t=>{p({title:"Not Found",description:t.message,variant:"destructive"})}}),{data:E=[],isLoading:O}=I({queryKey:["/api/book-scan/slots"],queryFn:async()=>{const t=await fetch("/api/book-scan/slots");if(!t.ok)throw new Error("Failed to fetch slots");return t.json()},enabled:l==="slots"}),h=C({mutationFn:async({bookingToken:t,slotTime:r})=>{const s=await fetch("/api/book-scan/book",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({bookingToken:t,slotTime:r})}),a=await s.json();if(!s.ok)throw new Error(a.error||"Failed to book");return a},onSuccess:t=>{y({slotTime:t.booking.slotTime,memberName:t.memberName}),c("confirmation"),g.invalidateQueries({queryKey:["/api/book-scan/slots"]})},onError:t=>{p({title:"Booking Failed",description:t.message,variant:"destructive"}),g.invalidateQueries({queryKey:["/api/book-scan/slots"]})}}),u=t=>{const[r,s]=t.split(":"),a=parseInt(r),M=a>=12?"PM":"AM";return`${a>12?a-12:a}:${s} ${M}`};return e.jsxs("div",{className:"min-h-screen bg-[#0a0a0a]",children:[e.jsx(P,{}),e.jsx("div",{className:"pt-40 pb-20 px-4",children:e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-10",children:[e.jsxs("h1",{className:"font-anton text-4xl md:text-5xl text-white mb-3","data-testid":"text-page-title",children:["BODY SCAN ",e.jsx("span",{className:"text-[#ffc003]",children:"BOOKING"})]}),e.jsxs("div",{className:"inline-flex items-center gap-3 bg-[#ffc003] text-black font-bold text-lg px-6 py-3 mb-2",children:[e.jsx(S,{className:"w-5 h-5 shrink-0"}),"Saturday 1st August • 7:00 AM – 10:00 AM"]}),e.jsx("p",{className:"text-gray-500 text-sm",children:"Book your timeslot below"})]}),l==="email"&&e.jsxs(f,{className:"bg-[#1a1a1a] border-[#333]",children:[e.jsx(k,{children:e.jsx(w,{className:"text-white text-center",children:"Enter Your Email"})}),e.jsxs(b,{children:[e.jsx("p",{className:"text-gray-400 text-sm text-center mb-6",children:"Enter the email you used to sign up for the FORGED Challenge"}),e.jsxs("form",{onSubmit:t=>{t.preventDefault(),m.trim()&&x.mutate(m.trim())},className:"space-y-4",children:[e.jsx($,{type:"email",value:m,onChange:t=>T(t.target.value),placeholder:"[email protected]",className:"bg-[#0a0a0a] border-[#333] text-white text-center text-lg h-14",required:!0,"data-testid":"input-email"}),e.jsx(v,{type:"submit",disabled:x.isPending||!m.trim(),className:"w-full bg-[#ffc003] text-black hover:bg-[#e6ad00] font-bold text-lg h-14","data-testid":"button-validate-email",children:x.isPending?"Checking...":"Find My Account"})]})]})]}),l==="slots"&&i&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("button",{onClick:()=>{c("email"),N(null),j(null)},className:"text-gray-400 hover:text-white flex items-center gap-2 text-sm","data-testid":"button-back",children:[e.jsx(q,{className:"w-4 h-4"})," Back"]}),e.jsxs("p",{className:"text-gray-400 text-sm",children:["Booking for"," ",e.jsxs("span",{className:"text-[#ffc003] font-bold",children:[i.firstName," ",i.lastName]})]})]}),e.jsxs(f,{className:"bg-[#1a1a1a] border-[#333]",children:[e.jsxs(k,{children:[e.jsx(w,{className:"text-white text-center",children:"Select Your Timeslot"}),e.jsx("p",{className:"text-gray-400 text-sm text-center",children:"Saturday 12th September • 7:00–9:00 AM • 6-minute slots • 1 person per slot"})]}),e.jsxs(b,{children:[O?e.jsx("p",{className:"text-gray-400 text-center py-8",children:"Loading slots..."}
1):e.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-5 gap-2","data-testid":"slot-grid",children:E.map(t=>e.jsxs("button",{disabled:t.booked,onClick:()=>j(t.time===o?null:t.time),className:`
2                            py-3 px-2 text-sm font-bold transition-all border
3                            ${t.booked?"bg-[#222] border-[#333] text-gray-600 cursor-not-allowed":o===t.time?"bg-[#ffc003] border-[#ffc003] text-black":"bg-[#0a0a0a] border-[#444] text-white hover:border-[#ffc003] hover:text-[#ffc003]"}
4                          `,"data-testid":`slot-${t.time}`,children:[e.jsx(B,{className:"w-3.5 h-3.5 mx-auto mb-1"}),u(t.time),t.booked&&e.jsx("span",{className:"block text-[10px] mt-0.5 text-gray-500",children:"Booked"})]},t.time))}),o&&e.jsx("div",{className:"mt-6 pt-6 border-t border-[#333]",children:e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"Selected slot"}),e.jsx("p",{className:"text-white text-xl font-bold",children:u(o)})]}),e.jsx(v,{onClick:()=>h.mutate({bookingToken:i.bookingToken,slotTime:o}),disabled:h.isPending,className:"bg-[#ffc003] text-black hover:bg-[#e6ad00] font-bold text-lg px-8 h-12","data-testid":"button-confirm-booking",children:h.isPending?"Booking...":"Confirm Booking"})]})})]})]})]}),l==="confirmation"&&d&&e.jsx(f,{className:"bg-[#1a1a1a] border-[#ffc003]",children:e.jsx(b,{className:"pt-8 pb-8",children:e.jsxs("div",{className:"text-center space-y-6",children:[e.jsx("div",{className:"w-16 h-16 bg-[#ffc003] rounded-full flex items-center justify-center mx-auto",children:e.jsx(K,{className:"w-8 h-8 text-black"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-anton text-3xl text-white mb-2","data-testid":"text-confirmation-title",children:i?.existingBooking?"YOUR BOOKING":"BOOKING CONFIRMED"}),e.jsx("p",{className:"text-gray-400",children:i?.existingBooking?"You already have a body scan booking":"Your body scan has been booked"})]}),e.jsxs("div",{className:"bg-[#0a0a0a] border border-[#333] p-6 space-y-4 max-w-sm mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Y,{className:"w-5 h-5 text-[#ffc003]"}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-gray-500 text-xs uppercase tracking-wider",children:"Name"}),e.jsx("p",{className:"text-white font-bold","data-testid":"text-confirmed-name",children:d.memberName})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(S,{className:"w-5 h-5 text-[#ffc003]"}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-gray-500 text-xs uppercase tracking-wider",children:"Date"}),e.jsx("p",{className:"text-white font-bold","data-testid":"text-confirmed-date",children:"Saturday 1st August 2026"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(B,{className:"w-5 h-5 text-[#ffc003]"}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-gray-500 text-xs uppercase tracking-wider",children:"Time"}),e.jsx("p",{className:"text-white font-bold text-xl","data-testid":"text-confirmed-time",children:u(d.slotTime)})]})]})]}),e.jsx("p",{className:"text-gray-500 text-sm",children:"Please arrive a few minutes early for your scan"})]})})})]})})]})}export{X 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.