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: {