PageSourceSearch

https://tournois-padel-ac-roissy.lovable.app/assets/PayCourtShare-Cj1uGji3.js

js tournois-padel-ac-roissy.lovable.app collected 2026-10-03 03:53:00 UTC 3,451 bytes, 1 lines download raw bytes

1import{K as S,r as a,s as g,j as e,g as k,q as n,B as w}from"./index-DnLpPdJu.js";import{E as _}from"./EmbeddedCheckoutInline-B49NLBfC.js";import{L as j}from"./loader-circle-p4PmW0Hd.js";import{M as P}from"./map-pin-ByK1t2i2.js";import{C as E}from"./calendar-r-k-P1fG.js";import{C as L}from"./clock-I4IgI4BL.js";import{C as F}from"./circle-check-CAnLWdwS.js";import{C as D}from"./credit-card-B_bvnvi0.js";const y=t=>(t/100).toLocaleString("fr-FR",{minimumFractionDigits:2,maximumFractionDigits:2}),O=()=>{const{token:t}=S(),[r,b]=a.useState(null),[c,u]=a.useState(!0),[d,N]=a.useState(null),[x,p]=a.useState(!1),[C,o]=a.useState(!1),[l,f]=a.useState(null);a.useEffect(()=>{t&&(async()=>{var i;u(!0);const{data:s,error:m}=await g.functions.invoke("pay-court-share",{body:{token:t}});if(u(!1),m||s!=null&&s.error){N((s==null?void 0:s.error)??"Lien invalide ou expiré.");return}b(s.summary),(i=s.summary)!=null&&i.already_paid&&o(!0)})()},[t]);const v=async()=>{if(!t)return;p(!0);const{data:s,error:m}=await g.functions.invoke("pay-court-share",{body:{token:t,action:"checkout"}});if(p(!1),m||s!=null&&s.error)return n.error((s==null?void 0:s.error)??"Paiement impossible.");if(s!=null&&s.free)return o(!0),n.success("Aucune part à régler — validé !");const i=s==null?void 0:s.client_secret,h=s==null?void 0:s.publishable_key;i&&h?f({clientSecret:i,publishableKey:h}):n.error("Paiement indisponible.")};return e.jsx("div",{className:"container max-w-md py-10 px-4",children:e.jsxs(k,{className:"p-6",children:[e.jsx("h1",{className:"font-display text-2xl mb-1",children:"Régler ma part"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-5",children:"Paiement sécurisé de votre part de la réservation."}),c&&e.jsxs("div",{className:"flex items-center justify-center py-10 text-muted-foreground",children:[e.jsx(j,{className:"h-5 w-5 animate-spin mr-2"})," Chargement…"]}),!c&&d&&e.jsx("div",{className:"text-sm text-destructive py-6",children:d}),!c&&r&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rounded-lg border p-4 space-y-2 mb-5",children:[e.jsxs("div",{className:"font-display text-lg flex items-center gap-1.5",children:[e.jsx(P,{className:"h-4 w-4 text-primary"}),r.court_name]}),r.booking_date&&e.jsxs("div",{className:"text-sm text-muted-foreground flex items-center gap-1.5",children:[e.jsx(E,{className:"h-3.5 w-3.5"}),new Date(r.booking_date).toLocaleDateString("fr-FR"),e.jsx(L,{className:"h-3.5 w-3.5 ml-2"}),String(r.start_time??"").slice(0,5)]}),r.organizer_name&&e.jsxs("div",{className:"text-sm",children:["Organisé par ",e.jsx("strong",{children:r.organizer_name})]}),e.jsxs("div",{className:"pt-2 mt-2 border-t flex items-baseline justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Ma part"}),e.jsxs("span",{className:"font-display text-2xl",children:[y(r.share_cents)," €"]})]})]}),C?e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-success/10 text-success px-4 py-3 text-sm font-medium",children:[e.jsx(F,{className:"h-5 w-5"})," Votre part est réglée. Merci !"]}):l?e.jsx(_,{clientSecret:l.clientSecret,publishableKey:l.publishableKey,onComplete:()=>{f(null),o(!0),n.success("Paiement reçu, merci !")}}):e.jsxs(w,{className:"w-full",size:"lg",onClick:v,disabled:x,children:[x?e.jsx(j,{className:"h-4 w-4 animate-spin mr-2"}):e.jsx(D,{className:"h-4 w-4 mr-2"}),"Payer ma part (",y(r.share_cents)," €)"]})]})]})})};export{O 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.