fix(booking-import): read the seat that KItinerary gives

KItinerary writes a flight seat as airplaneSeat and a ticket seat as
reservedTicket.ticketedSeat.seatNumber, the schema.org fields, and it
removes seat and seatNumber from a script result. segmentDetail read only
seat and seatNumber, so an imported booking lost its seat.

segmentDetail now also reads airplaneSeat, and then the ticket seat when
no other key has a value. seat and seatNumber stay first, so a booking
that already has a seat gets the same result.
This commit is contained in:
aaronspruit
2026-11-06 08:47:09 -08:00
committed by Maurice
parent 8f3a8bd670
commit 7ae9198a43
2 changed files with 26 additions and 1 deletions
@@ -709,7 +709,12 @@ function segmentDetail(r: KiReservation): {
}
return undefined;
};
const seat = pick('seat', 'seatNumber');
// KItinerary writes a flight seat as airplaneSeat and a rail seat as
// reservedTicket.ticketedSeat.seatNumber, and drops any other seat key.
const ticket = r.reservedTicket as { ticketedSeat?: { seatNumber?: unknown } } | undefined;
const ticketSeat = ticket?.ticketedSeat?.seatNumber;
const seat =
pick('seat', 'seatNumber', 'airplaneSeat') ?? (ticketSeat != null && ticketSeat !== '' ? ticketSeat : undefined);
const cls = pick('class', 'bookingClass', 'fareClass', 'serviceClass', 'seatingType');
const platform = pick('platform', 'departurePlatform');
const price = pick('price', 'priceAmount', 'totalPrice', 'total');