diff --git a/components/composed/TicketDownloadCard.tsx b/components/composed/TicketDownloadCard.tsx index 9334ddd..8422be7 100644 --- a/components/composed/TicketDownloadCard.tsx +++ b/components/composed/TicketDownloadCard.tsx @@ -26,6 +26,21 @@ type TicketDownloadCardProps = { const DEFAULT_BRAND_COLOR = "#6366f1" +/** + * Extracts just the host from the recovery URL (e.g. "waitlight.fr"), so the + * hint text always names whatever domain the QR code actually points to — + * previously this was a hardcoded string that stayed "waitlight.app" even + * when recoverUrl pointed somewhere else entirely (a Preview deployment, a + * different environment), which is misleading on a real, physical ticket. + */ +function hostFromUrl(url: string): string { + try { + return new URL(url).host + } catch { + return "" + } +} + /** * The visual captured to PNG when a customer downloads their ticket. Pure * presentation — no state, no network calls — so it renders identically @@ -124,7 +139,7 @@ const TicketDownloadCard = forwardRef( {recoveryCode} - Prénom + code sur waitlight.app + Prénom + code sur {hostFromUrl(recoverUrl)} {/* SVG, not Canvas: html-to-image serializes the DOM/SVG