Merged in fix/SW-2838-in-select-hotel-lang-switch- (pull request #2261)

fix: SW-2838 Use of city identifier instead of city name

* fix: SW-2838 Updated selection to city identifier instead of city name


Approved-by: Christian Andolf
Approved-by: Linus Flood
This commit is contained in:
Hrishikesh Vaipurkar
2025-06-03 07:58:00 +00:00
parent 3d80f9fecb
commit f9e838e77a
7 changed files with 14 additions and 3 deletions

View File

@@ -69,7 +69,7 @@ export function Search({
switch (selectedItem.type) {
case "cities":
setValue("hotel", undefined)
setValue("city", selectedItem.name)
setValue("city", selectedItem.cityIdentifier)
break
case "hotels":

View File

@@ -60,7 +60,8 @@ export const getDestinationsAutoCompleteRoute = safeProtectedServiceProcedure
const selectedCity = locations.find(
(location) =>
location.type === "cities" && location.name === input.selectedCity
location.type === "cities" &&
location.cityIdentifier === input.selectedCity
)
return {

View File

@@ -7,6 +7,7 @@ export const autoCompleteLocationSchema = z.object({
searchTokens: z.array(z.string()),
destination: z.string(),
url: z.string().optional(),
cityIdentifier: z.string().optional(),
})
export type AutoCompleteLocation = z.infer<typeof autoCompleteLocationSchema>

View File

@@ -49,6 +49,7 @@ export function filterAutoCompleteLocations<T extends AutoCompleteLocation>(
({
id: x.item.id,
name: x.item.name,
cityIdentifier: x.item.cityIdentifier,
destination: x.item.destination,
searchTokens: x.item.searchTokens,
type: x.item.type,

View File

@@ -18,5 +18,7 @@ export function mapLocationToAutoCompleteLocation(
location.type === "hotels"
? location.relationships.city.name
: location.country,
cityIdentifier:
location.type === "cities" ? location.cityIdentifier : undefined,
}
}

View File

@@ -474,6 +474,10 @@ export const locationsSchema = z.object({
if (!node.operaId) {
return false
}
} else {
if (!node.cityIdentifier) {
return false
}
}
return true
})

View File

@@ -66,7 +66,9 @@ export async function getHotelSearchDetails(
const city = cityName
? (locations.find(
(location) => location.name.toLowerCase() === cityName.toLowerCase()
(location) =>
"cityIdentifier" in location &&
location.cityIdentifier?.toLowerCase() === cityName.toLowerCase()
) ?? null)
: null