Fix/SW-902 update response city availability * fix(SW-902): update response for API changes * fix(SW-902): add total row for pricePerStay * fix(SW-902): fix optional requestedPrice * fix(SW-902): fix bookingCode output * feat(SW-903): fix sorting Approved-by: Pontus Dreij Approved-by: Niclas Edenvin
23 lines
938 B
TypeScript
23 lines
938 B
TypeScript
import type { HotelData } from "@/types/components/hotelReservation/selectHotel/hotelCardListingProps"
|
|
import type { HotelPin } from "@/types/components/hotelReservation/selectHotel/map"
|
|
|
|
export function getHotelPins(hotels: HotelData[]): HotelPin[] {
|
|
return hotels.map((hotel) => ({
|
|
coordinates: {
|
|
lat: hotel.hotelData.location.latitude,
|
|
lng: hotel.hotelData.location.longitude,
|
|
},
|
|
name: hotel.hotelData.name,
|
|
publicPrice: hotel.price?.public?.localPrice.pricePerNight ?? null,
|
|
memberPrice: hotel.price?.member?.localPrice.pricePerNight ?? null,
|
|
currency: hotel.price?.public?.localPrice.currency || null,
|
|
images: [
|
|
hotel.hotelData.hotelContent.images,
|
|
...(hotel.hotelData.gallery?.heroImages ?? []),
|
|
],
|
|
amenities: hotel.hotelData.detailedFacilities.slice(0, 3),
|
|
ratings: hotel.hotelData.ratings?.tripAdvisor.rating ?? null,
|
|
operaId: hotel.hotelData.operaId,
|
|
}))
|
|
}
|