Merged in feat/SW-2903-tokens (pull request #2508)

feat(SW-2358): Use personal token if logged in

* feat(SW-2903): Use personal token if logged in

* Avoid encoding values in cookie

* Fix tests


Approved-by: Anton Gunnarsson
This commit is contained in:
Linus Flood
2025-07-08 11:24:31 +00:00
committed by Anton Gunnarsson
parent 5d9006bfdc
commit b35ceafc00
9 changed files with 118 additions and 67 deletions

View File

@@ -2,6 +2,7 @@ import { cookies } from "next/headers"
import { notFound } from "next/navigation"
import { dt } from "@scandic-hotels/common/dt"
import { logger } from "@scandic-hotels/common/logger"
import * as maskValue from "@scandic-hotels/common/utils/maskValue"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast"
@@ -18,7 +19,9 @@ import {
getSavedPaymentCardsSafely,
} from "@/lib/trpc/memoizedRequests"
import AdditionalInfoForm from "@/components/HotelReservation/FindMyBooking/AdditionalInfoForm"
import AdditionalInfoForm, {
type AdditionalInfoCookieValue,
} from "@/components/HotelReservation/FindMyBooking/AdditionalInfoForm"
import accessBooking, {
ACCESS_GRANTED,
ERROR_BAD_REQUEST,
@@ -68,9 +71,10 @@ export default async function MyStay(props: {
if (isLoggedIn) {
bookingConfirmation = await getBookingConfirmation(refId)
} else if (bv) {
const params = new URLSearchParams(bv)
const firstName = params.get("firstName")
const email = params.get("email")
logger.info(`MyStay: bv`, bv)
const values = JSON.parse(bv) as AdditionalInfoCookieValue
const firstName = values.firstName
const email = values.email
if (firstName && email) {
bookingConfirmation = await findBooking(