1import{u as F,r as d,o as O,j as t,S as V,L as z,v as R,B as q,s as f}from"./index-BEdw6oF3.js";import{u as H,S as Y,f as p,a as G}from"./calendar-CDBAxCqQ.js";import{P as K,C as Q,B as X}from"./BookingConfirmation-rx5g4fVb.js";import{u as J,E as U}from"./useBookingSession-DW2P4hGV.js";import{c as l}from"./clarity-BX5SeH3k.js";import{S as Z,a as ee,b as te,c as ae,d as ne}from"./select-BrhzaSwA.js";import{A}from"./arrow-left-DZhV24i-.js";import"./chevron-right-Dj9m75u1.js";import"./useBooking-DuMHpTnZ.js";import"./user-DHqkyNui.js";import"./circle-check-DqBiWjZ2.js";import"./types-CF5MOdYs.js";import"./label-BnjPmtSD.js";const re=["b9169a0e-7c1d-4be5-b4fc-d7da579e060c","ff7729d1-88d4-4673-bbe7-3be760b73325","3def1010-29ae-411b-b2a0-ab7ec1e9124e","15982ce7-21f0-4588-8d02-b3df1647b0f7","d476d17d-dcd3-4dab-9267-625725e3d672","1a3c6306-b84d-442c-a1cc-db4fbe4636ce","c3212ae3-4816-478f-a4db-1c6f741fc787","d4acbaf4-739a-47d3-9298-93b86983c8b9","8b7ae8dd-f0a0-420b-956c-8acac8c51f68","2f8df26c-d2ff-466c-bc58-6c47e6415d53","b1cf9422-9625-4478-b93e-c1f734b1b17f","6aeb81bd-ea3f-45ca-9149-4ee90e09299a","3e3c3b99-18b6-4eba-ba0d-7af19c2a3186","6d03305c-cedf-411c-a556-9cd6fdb1b5c0","58ee5c59-2dd4-41bf-ad12-f1d330154157","3a83b213-76e2-4d69-882d-5961170a30bc","d2ca2dc5-2a28-48d0-8c19-b8c67333c41b","9cc19084-24f0-476a-852e-b014c6b93702","a13a637f-c38f-47e7-bf09-ea5453948f96","4ef3801c-e5f8-4847-9834-ced1cadacb36","3beb4291-8062-4bd0-b993-2b29e70e6eb7","92f09739-3c32-4bad-b97c-0df72bb8ffd8","a8609b2f-e804-4f5a-b69d-788274d1cc87"],he=()=>{const{toast:g}=F(),[n,u]=d.useState(1),[a,h]=d.useState(null),[r,_]=d.useState(null),[s,S]=d.useState(null),[i,j]=d.useState(null),[c,y]=d.useState(null),{sessionId:M,initSession:v,updateSession:w,completeSession:T}=J(),{data:m,isLoading:$}=O({queryKey:["waxing-booking-services"],queryFn:async()=>{const{data:e,error:o}=await f.from("services").select("*").in("id",re).eq("active",!0).order("price",{ascending:!0});if(o)throw o;return e}});d.useEffect(()=>{v()},[v]),d.useEffect(()=>{w({step:n,selectedService:a,selectedProvider:r,selectedDate:s,selectedTime:i,selectedAddOns:[],clientDetails:c?{firstName:c.first_name,lastName:c.last_name,email:c.email||null,phone:c.phone}:null})},[n,a,r,s,i,c,w]);const k=H({mutationFn:async e=>{var I;const{data:o,error:b}=await f.rpc("create_booking_client",{p_first_name:e.first_name,p_last_name:e.last_name,p_email:e.email||null,p_phone:e.phone});if(b)throw b;const E=new Date(i),L=G(E,a.duration_minutes);let B="Source: Waxing Instant Booking";e.referred_by&&(B+=` 2Referred by: ${e.referred_by}`);const{data:D,error:C}=await f.rpc("create_booking_appointment",{p_client_id:o,p_service_id:a.id,p_provider_id:(r==null?void 0:r.id)||null,p_start_time:E.toISOString(),p_end_time:L.toISOString(),p_notes:B,p_status:"confirmed"});if(C)throw C;if((I=e.referred_by)!=null&&I.trim())try{await f.from("referrals").insert({referrer_name:e.referred_by.trim(),referred_client_id:o,referred_appointment_id:D,appointment_completed:!1})}catch(x){console.error(x)}try{await f.functions.invoke("send-booking-confirmation",{body:{clientName:`${e.first_name} ${e.last_name}`,clientEmail:e.email||"",clientPhone:e.phone,serviceName:a.name,providerName:r?`${r.first_name} ${r.last_name}`:"Any Available Provider",appointmentDate:p(s,"EEEE, MMMM d, yyyy"),appointmentTime:p(new Date(i),"h:mm a"),duration:a.duration_minutes,price:a.price}})}catch(x){console.error(x)}return{clientId:o,appointmentId:D}},onSuccess:(e,o)=>{y(o),T(),l.bookingCompleted((a==null?void 0:a.name)||"",(a==null?void 0:a.price)||0),u(4),g({title:"Appointment Booked!",description:o.email?"A confirmation email has been sent.":"Your appointment has been confirmed."})},onError:e=>{g({title:"Booking Failed",description:e.message,variant:"destructive"})}}),P=e=>{h(e),l.serviceSelected(e.name,"Waxing",e.price||0),u(2)},N=()=>{if(l.stepBack(n),n===1){window.history.back();return}u(Math.max(1,n-1))},W=()=>{u(1),h(null),_(null),S(null),j(null),y(null)};return t.jsxs(t.Fragment,{children:[t.jsx(U,{isEnabled:n>1&&n<4,sessionId:M,selectedService:a,selectedProvider:r,selectedDate:s,selectedTime:i,currentStep:n}),t.jsx(V,{title:"Book Waxing Services | Vigour Wellness Houston",description:"Book your professional waxing service in Houston. From Brazilian to full body waxing, experience smooth, long-lasting results.",canonical:"https://vigourwellnesstx.com/book/waxing",noIndex:!0}),t.jsx("header",{className:"fixed top-0 left-0 right-0 z-50 bg-background/95 backdrop-blur-md border-b border-border/50 py-4",children:t.jsx("div",{className:"container mx-auto px-6",children:t.jsx("div",{className:"flex items-center justify-center",children:t.jsx(z,{to:"/",children:t.jsx("img",{src:R,alt:"Vigour Wellness",className:"h-10 md:h-12 w-auto",width:186,height:70,loading:"lazy"})})})})}),t.jsx("main",{id:"main-content",className:"min-h-screen bg-background pt-20 md:pt-24 pb-12",children:t.jsx("div",{className:"container mx-auto px-4 md:px-6",children:t.jsxs("div",{className:"max-w-3xl mx-auto",children:[n>1&&n<4&&t.jsxs(q,{variant:"ghost",onClick:N,className:"mb-6 text-muted-foreground hover:text-foreground",children:[t.jsx(A,{className:"w-4 h-4 mr-2"})," Back"]}),n===1&&t.jsxs("div",{className:"space-y-6",children:[t.jsxs("button",{onClick:N,className:"flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors group",children:[t.jsx(A,{className:"w-4 h-4 group-hover:-translate-x-1 transition-transform"}),t.jsx("span",{children:"Back"})]}),t.jsxs("div",{className:"text-center mb-6",children:[t.jsx("h1",{className:"text-2xl md:text-4xl font-serif text-foreground mb-2",children:"Book Your Waxing Instantly"}),t.jsx("p",{className:"text-muted-foreground",children:"Real-time availability. Confirmed in seconds."}),t.jsx("p",{className:"text-xs text-gold mt-2 font-medium",children:"Secure your spot today."})]}),$?t.jsx(Y,{className:"h-12 w-full"}):t.jsxs(Z,{value:(a==null?void 0:a.id)||"",onValueChange:e=>{const o=m==null?void 0:m.find(b=>b.id===e);o&&P(o)},children:[t.jsx(ee,{className:"w-full h-12 bg-card border-border",children:t.jsx(te,{placeholder:"Choose a waxing service..."})}),t.jsx(ae,{className:"bg-card border-border z-50 max-h-[300px]",children:m==null?void 0:m.map(e=>t.jsx(ne,{value:e.id,className:"cursor-pointer focus:bg-gold/10",children:t.jsxs("div",{className:"flex items-center justify-between w-full gap-4",children:[t.jsx("span",{children:e.name}),t.jsx("span",{className:"text-gold font-medium",children:e.price?`$${e.price}`:""})]})},e.id))})]})]}),n===2&&a&&t.jsx(K,{service:a,selectedProvider:r,selectedDate:s,selectedTime:i,onProviderSelect:e=>{_(e),l.providerSelected(e?`${e.first_name} ${e.last_name}`:"Any",!e)},onDateSelect:e=>{S(e),l.dateSelected(p(e,"yyyy-MM-dd"),p(e,"EEEE"))},onTimeSelect:e=>{j(e),l.timeSelected(p(new Date(e),"h:mm a"))},onConfirm:()=>{s&&i&&(l.dateTimeConfirmed(),u(3))},totalDuration:a.duration_minutes}),n===3&&a&&s&&i&&t.jsx(Q,{service:a,provider:r,selectedDate:s,selectedTime:i,onSubmit:e=>{l.formSubmitted(),k.mutate(e)},isSubmitting:k.isPending,addOns:[],totalDuration:a.duration_minutes}),n===4&&a&&s&&i&&c&&t.jsx(X,{service:a,provider:r,selectedDate:s,selectedTime:i,clientDetails:c,onNewBooking:W,addOns:[],totalDuration:a.duration_minutes})]})})})]})};export{he 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.