PageSourceSearch

https://denekt.com/assets/Reserver-D9cI54vq.js

js denekt.com collected 2026-10-04 17:45:41 UTC 6,022 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-ui-Cc3LfMzt.js";import{e as A,r,L as p}from"./vendor-react-CRevFlg9.js";import{h as q,S as _,C as P,a as h}from"./index-CJYdpUa3.js";import{L as B}from"./loader-circle-Dr445XB8.js";import{C as F}from"./circle-alert-1G0Oml8D.js";import{C as I}from"./circle-check-big-BxPTYy0p.js";import{A as O}from"./arrow-left-BAcziuqj.js";import"./vendor-supabase-DRR_Es6B.js";const v=m=>{const s=new Date(m),u=s.toLocaleDateString("fr-FR",{weekday:"long",day:"numeric",month:"long",year:"numeric"}),o=s.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"});return{date:u,time:o}},Q=()=>{const[m]=A(),s=m.get("token"),{toast:u}=q(),[o,b]=r.useState(!0),[j,N]=r.useState([]),[c,L]=r.useState(""),[x,D]=r.useState(null),[S,k]=r.useState("pending"),[f,w]=r.useState(null),[y,C]=r.useState(!1),[n,R]=r.useState(null);r.useEffect(()=>{if(!s){b(!1),w("Lien invalide");return}(async()=>{var l,d;const{data:t,error:i}=await h.functions.invoke("book-slot",{body:{action:"list",token:s}});if(i||t!=null&&t.error)w((t==null?void 0:t.error)||"Lien invalide");else{L(((l=t.booking)==null?void 0:l.name)||""),k(((d=t.booking)==null?void 0:d.status)||"pending"),D(t.currentSlot||null);const g=new Date;g.setDate(g.getDate()+21);const E=(t.slots||[]).filter(T=>new Date(T.slot_datetime)>=g);N(E)}b(!1)})()},[s]);const z=async a=>{var l;if(!s||y)return;C(!0);const{data:t,error:i}=await h.functions.invoke("book-slot",{body:{action:"book",token:s,slotId:a}});if(i||t!=null&&t.error){u({title:"Réservation impossible",description:(t==null?void 0:t.error)||"Réessayez dans un instant.",variant:"destructive"});const d=await h.functions.invoke("book-slot",{body:{action:"list",token:s}});(l=d.data)!=null&&l.slots&&N(d.data.slots)}else R({slotDate:t.slotDate,slotTime:t.slotTime}),k("confirmed");C(!1)};return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(_,{title:"Réserver votre créneau",description:"Espace de réservation personnel pour la lecture structurelle, séance de 90 min.",path:"/reserver",noIndex:!0}),e.jsxs("div",{className:"max-w-xl mx-auto px-6 pt-28 pb-16",children:[e.jsx(p,{to:"/",className:"font-serif text-lg text-foreground hover:text-accent transition-colors",children:"Denekt"}),e.jsxs("div",{className:"mt-12",children:[e.jsx("p",{className:"font-sans text-[11px] font-medium tracking-[0.25em] uppercase text-accent mb-6",children:"Réservation de la séance"}),o&&e.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[e.jsx(B,{className:"w-4 h-4 animate-spin"})," Chargement…"]}),!o&&f&&e.jsxs("div",{className:"animate-fade-in",children:[e.jsx(F,{className:"w-8 h-8 text-muted-foreground mb-6"}),e.jsx("h1",{className:"font-serif text-xl md:text-2xl font-light text-foreground mb-4 leading-snug",children:"Cet espace de réservation requiert un lien personnel."}),e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed mb-8",children:"Le lien vous est envoyé par mail après confirmation du paiement de la séance."}),e.jsx(p,{to:"/",className:"text-sm text-accent hover:text-foreground transition-colors underline underline-offset-4",children:"Retour au site"})]}),!o&&!f&&(n||S==="confirmed"&&x)&&e.jsxs("div",{className:"animate-fade-in",children:[e.jsx(I,{className:"w-8 h-8 text-accent mb-6"}),e.jsx("h1",{className:"font-serif text-xl md:text-2xl font-light text-foreground mb-4 leading-snug",children:c?`${c}, votre créneau est réservé.`:"Votre créneau est réservé."}),e.jsxs("div",{className:"border border-border/50 rounded-sm p-5 mb-6 bg-muted/30",children:[e.jsx("p",{className:"text-sm text-foreground font-medium leading-relaxed mb-1",children:(n==null?void 0:n.slotDate)??v(x.slot_datetime).date}),e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:(n==null?void 0:n.slotTime)??v(x.slot_datetime).time})]}),e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed mb-3",children:"Une confirmation vient d'arriver dans votre boîte mail."}),e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed mb-8",children:"Le lien de visio ou les coordonnées téléphoniques vous parviendront peu avant la séance."}),e.jsxs(p,{to:"/",className:"px-5 py-2.5 text-xs font-sans font-medium tracking-[0.1em] uppercase border border-border rounded-sm text-muted-foreground hover:text-foreground hover:border-accent transition-colors inline-flex items-center justify-center gap-2",children:[e.jsx(O,{className:"w-3.5 h-3.5"}),"Retour au site"]})]}),!o&&!f&&!n&&S!=="confirmed"&&e.jsxs("div",{className:"animate-fade-in",children:[e.jsx("h1",{className:"font-serif text-xl md:text-2xl font-light text-foreground mb-3 leading-snug",children:c?`${c}, choisissez votre créneau.`:"Choisissez votre créneau."}),e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed mb-8",children:"Sélectionnez le créneau qui ajuste votre temps. Une confirmation vous parvient par mail dès la réservation posée."}),j.length===0?e.jsxs("div",{className:"border border-border/50 rounded-sm p-5 bg-muted/30",children:[e.jsx("p",{className:"text-sm text-foreground font-medium leading-relaxed mb-2",children:"Aucun créneau ouvert pour l'instant."}),e.jsxs("p",{className:"text-sm text-muted-foreground leading-relaxed",children:["De nouveaux créneaux sont ouverts régulièrement. Vous pouvez revenir sur ce lien dans les jours qui viennent. Pour une demande spécifique, écrivez à ",P,"."]})]}):e.jsx("div",{className:"space-y-3",children:j.map(a=>{const{date:t,time:i}=v(a.slot_datetime);return e.jsxs("button",{onClick:()=>z(a.id),disabled:y,className:"w-full text-left px-5 py-4 border border-border rounded-sm transition-all hover:border-accent hover:bg-accent/5 disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx("p",{className:"text-sm text-foreground font-medium leading-relaxed capitalize",children:t}),e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed mt-1",children:i})]},a.id)})})]})]})]})]})};export{Q 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.