From 30077acf9d3104acc354fe26c24ef0db66f18607 Mon Sep 17 00:00:00 2001 From: yotakii Date: Tue, 10 Mar 2026 14:06:25 +0300 Subject: [PATCH] edit booking confirmation --- client/src/pages/BookingConfirmation.js | 26 ++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/client/src/pages/BookingConfirmation.js b/client/src/pages/BookingConfirmation.js index 123374e..409c64e 100644 --- a/client/src/pages/BookingConfirmation.js +++ b/client/src/pages/BookingConfirmation.js @@ -35,26 +35,38 @@ const BookingConfirmation = () => { const WA_LINK = useMemo(() => `https://wa.me/${WA_NUMBER}?text=${waText}`, [WA_NUMBER, waText]); useEffect(() => { - if (request?.autoOpenWhatsApp) { - window.open(WA_LINK, '_blank', 'noopener,noreferrer'); - } + // ✅ Auto open WhatsApp (more reliable than window.open): redirect same tab + if (!request?.autoOpenWhatsApp) return; + if (!WA_LINK) return; + + // prevent loop on refresh/back + const key = `wa_opened_${request.bookingNumber || request.phone || 'latest'}`; + if (sessionStorage.getItem(key)) return; + sessionStorage.setItem(key, '1'); + + const t = setTimeout(() => { + window.location.href = WA_LINK; + }, 600); + + return () => clearTimeout(t); }, [request, WA_LINK]); return ( - Booking Request Sent + Confirm Your Booking on WhatsApp - We received your request ✅ + Almost done — please send the WhatsApp message ✅ - Thank you! Our team will contact you soon. You can also confirm faster via WhatsApp. + Your request has been recorded. To complete the booking, tap Open WhatsApp below and press Send. + Our team will reply to confirm availability. {request && ( @@ -112,4 +124,4 @@ const BookingConfirmation = () => { ); }; -export default BookingConfirmation; +export default BookingConfirmation; \ No newline at end of file