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:
@@ -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":
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -18,5 +18,7 @@ export function mapLocationToAutoCompleteLocation(
|
||||
location.type === "hotels"
|
||||
? location.relationships.city.name
|
||||
: location.country,
|
||||
cityIdentifier:
|
||||
location.type === "cities" ? location.cityIdentifier : undefined,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,6 +474,10 @@ export const locationsSchema = z.object({
|
||||
if (!node.operaId) {
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
if (!node.cityIdentifier) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user