UNPKG

@xiag-stc/react-basket

Version:

Order basket view: period of stay blocks containing the hotel blocks containing the room blocks; guest data forms with variations for Airline- and Airport-TO-s

54 lines (50 loc) 2.02 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = function (basket) { return basket.periods.reduce(function (periodsAgg, period) { return period.hotels.reduce(function (hotelsAgg, hotel) { return hotel.rooms.reduce(function (roomsAgg, room) { return roomsAgg.concat(unit(period, hotel, room)); }, hotelsAgg); }, periodsAgg); }, []); }; var _reactTaxes = require('@stc-b2b/react-taxes'); function unit(period, hotel, room) { return { uniqueToken: room.uniqueToken, periodOfStay: period.periodOfStay, hotel: { id: hotel.id, ratingStars: hotel.ratingStars, isSuperior: hotel.isSuperior, name: hotel.name, streetAddress: hotel.streetAddress, postalCode: hotel.postalCode, cityLocalized: hotel.cityLocalized, phoneNumber: hotel.phoneNumber, emailAddress: hotel.emailAddress }, roomType: { id: room.roomType.id, code: room.roomType.code, shortDescriptionLocalized: room.roomType.shortDescriptionLocalized, longDescriptionLocalized: room.roomType.longDescriptionLocalized, bedTypeCode: room.roomType.bedTypeCode }, ratePlan: { id: room.ratePlan.id, code: room.ratePlan.code, longDescriptionLocalized: room.ratePlan.longDescriptionLocalized, mealPlanCode: room.ratePlan.mealPlanCode, cancellationDeadline: room.ratePlan.cancellationDeadline, guaranteeType: room.ratePlan.guaranteeType }, occupancyRoomCounts: room.occupancyRoomCounts, rateIncludesTaxes: room.ratePlan.excludedTaxes.length === 0, prepaidTaxesTotal: (0, _reactTaxes.totalTax)(period.periodOfStay, room.occupancyRoomCounts, room.prepayTaxes ? room.ratePlan.excludedTaxes : []), guestData: room.guestData }; }