From ee741cc0e8457692db042890d78034fc5227ce11 Mon Sep 17 00:00:00 2001 From: Linus Flood Date: Wed, 26 Mar 2025 13:01:14 +0000 Subject: [PATCH] Merged in hotfix/mystays-url (pull request #1644) Revert mystays booking url * Revert mystays booking url Approved-by: Michael Zetterberg --- apps/scandic-web/server/routers/user/utils.ts | 47 ++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/apps/scandic-web/server/routers/user/utils.ts b/apps/scandic-web/server/routers/user/utils.ts index 6fd3b2fce..833fcd246 100644 --- a/apps/scandic-web/server/routers/user/utils.ts +++ b/apps/scandic-web/server/routers/user/utils.ts @@ -75,12 +75,57 @@ async function updateStaysBookingUrl( // Construct full URL with domain const domain = homeHrefs[env.NODE_ENV][lang] - const bookingUrl = new URL(bookingUrlPath, domain) + let bookingUrl = new URL(bookingUrlPath, domain) // Update TLD based on language if (lang !== Lang.en) bookingUrl.host = bookingUrl.host.replace(".com", `.${lang}`) + if (env.HIDE_FOR_NEXT_RELEASE) { + // Temporary Url, domain and lang support for current web + let bookingUrl = new URL( + "/hotelreservation/my-booking", + env.PUBLIC_URL || "https://www.scandichotels.com" // fallback to production for ephemeral envs (like deploy previews) + ) + switch (lang) { + case Lang.sv: + bookingUrl.host = bookingUrl.host.replace(".com", ".se") + bookingUrl.pathname = "/hotelreservation/din-bokning" + break + case Lang.no: + bookingUrl.host = bookingUrl.host.replace(".com", ".no") + bookingUrl.pathname = "/hotelreservation/my-booking" + break + case Lang.da: + bookingUrl.host = bookingUrl.host.replace(".com", ".dk") + bookingUrl.pathname = "/hotelreservation/min-booking" + break + case Lang.fi: + bookingUrl.host = bookingUrl.host.replace(".com", ".fi") + bookingUrl.pathname = "/varaa-hotelli/varauksesi" + break + case Lang.de: + bookingUrl.host = bookingUrl.host.replace(".com", ".de") + bookingUrl.pathname = "/hotelreservation/my-booking" + break + default: + break + } + + if (!!encryptedBookingValue) { + bookingUrl.searchParams.set("RefId", encryptedBookingValue) + } else { + bookingUrl.searchParams.set( + "lastName", + apiJson.data.attributes.lastName + ) + bookingUrl.searchParams.set( + "bookingId", + d.attributes.confirmationNumber + ) + } + } + return { ...d, attributes: {