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) {
|
switch (selectedItem.type) {
|
||||||
case "cities":
|
case "cities":
|
||||||
setValue("hotel", undefined)
|
setValue("hotel", undefined)
|
||||||
setValue("city", selectedItem.name)
|
setValue("city", selectedItem.cityIdentifier)
|
||||||
|
|
||||||
break
|
break
|
||||||
case "hotels":
|
case "hotels":
|
||||||
|
|||||||
@@ -60,7 +60,8 @@ export const getDestinationsAutoCompleteRoute = safeProtectedServiceProcedure
|
|||||||
|
|
||||||
const selectedCity = locations.find(
|
const selectedCity = locations.find(
|
||||||
(location) =>
|
(location) =>
|
||||||
location.type === "cities" && location.name === input.selectedCity
|
location.type === "cities" &&
|
||||||
|
location.cityIdentifier === input.selectedCity
|
||||||
)
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ export const autoCompleteLocationSchema = z.object({
|
|||||||
searchTokens: z.array(z.string()),
|
searchTokens: z.array(z.string()),
|
||||||
destination: z.string(),
|
destination: z.string(),
|
||||||
url: z.string().optional(),
|
url: z.string().optional(),
|
||||||
|
cityIdentifier: z.string().optional(),
|
||||||
})
|
})
|
||||||
|
|
||||||
export type AutoCompleteLocation = z.infer<typeof autoCompleteLocationSchema>
|
export type AutoCompleteLocation = z.infer<typeof autoCompleteLocationSchema>
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ export function filterAutoCompleteLocations<T extends AutoCompleteLocation>(
|
|||||||
({
|
({
|
||||||
id: x.item.id,
|
id: x.item.id,
|
||||||
name: x.item.name,
|
name: x.item.name,
|
||||||
|
cityIdentifier: x.item.cityIdentifier,
|
||||||
destination: x.item.destination,
|
destination: x.item.destination,
|
||||||
searchTokens: x.item.searchTokens,
|
searchTokens: x.item.searchTokens,
|
||||||
type: x.item.type,
|
type: x.item.type,
|
||||||
|
|||||||
@@ -18,5 +18,7 @@ export function mapLocationToAutoCompleteLocation(
|
|||||||
location.type === "hotels"
|
location.type === "hotels"
|
||||||
? location.relationships.city.name
|
? location.relationships.city.name
|
||||||
: location.country,
|
: location.country,
|
||||||
|
cityIdentifier:
|
||||||
|
location.type === "cities" ? location.cityIdentifier : undefined,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -474,6 +474,10 @@ export const locationsSchema = z.object({
|
|||||||
if (!node.operaId) {
|
if (!node.operaId) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (!node.cityIdentifier) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -66,7 +66,9 @@ export async function getHotelSearchDetails(
|
|||||||
|
|
||||||
const city = cityName
|
const city = cityName
|
||||||
? (locations.find(
|
? (locations.find(
|
||||||
(location) => location.name.toLowerCase() === cityName.toLowerCase()
|
(location) =>
|
||||||
|
"cityIdentifier" in location &&
|
||||||
|
location.cityIdentifier?.toLowerCase() === cityName.toLowerCase()
|
||||||
) ?? null)
|
) ?? null)
|
||||||
: null
|
: null
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user