@qite/tide-booking-component 1.0.26 → 1.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6566,7 +6566,9 @@ var priceDetailsApi = {
6566
6566
 
6567
6567
  var updatePackageDetails = function (packageDetails, changedLines) {
6568
6568
  return __assign(__assign({}, packageDetails), { options: packageDetails.options.map(function (opt) {
6569
- return __assign(__assign({}, opt), { groups: opt.isSelected
6569
+ return __assign(__assign({}, opt), { rooms: opt.isSelected
6570
+ ? updateRooms(opt.rooms, changedLines)
6571
+ : opt.rooms, groups: opt.isSelected
6570
6572
  ? updateBookingGroups(opt.groups, changedLines)
6571
6573
  : opt.groups, optionUnits: opt.isSelected
6572
6574
  ? updateOptionUnits(opt.optionUnits, changedLines)
@@ -6575,6 +6577,13 @@ var updatePackageDetails = function (packageDetails, changedLines) {
6575
6577
  : opt.optionPax });
6576
6578
  }) });
6577
6579
  };
6580
+ // ROOMS
6581
+ var updateRooms = function (rooms, changedLines) {
6582
+ return rooms.map(function (room) { return (__assign(__assign({}, room), { options: room.options.map(function (option) {
6583
+ var _a, _b;
6584
+ return (__assign(__assign({}, option), { price: (_b = (_a = changedLines.find(function (x) { return x.entryLineGuid == option.entryLineGuid; })) === null || _a === void 0 ? void 0 : _a.price) !== null && _b !== void 0 ? _b : option.price }));
6585
+ }) })); });
6586
+ };
6578
6587
  // PAX
6579
6588
  var updateOptionPax = function (pax, changedLines) {
6580
6589
  return pax.map(function (p) { return (__assign(__assign({}, p), { groups: updatePaxGroups(p.groups, changedLines) })); });
@@ -6555,7 +6555,9 @@ var priceDetailsApi = {
6555
6555
 
6556
6556
  var updatePackageDetails = function (packageDetails, changedLines) {
6557
6557
  return __assign(__assign({}, packageDetails), { options: packageDetails.options.map(function (opt) {
6558
- return __assign(__assign({}, opt), { groups: opt.isSelected
6558
+ return __assign(__assign({}, opt), { rooms: opt.isSelected
6559
+ ? updateRooms(opt.rooms, changedLines)
6560
+ : opt.rooms, groups: opt.isSelected
6559
6561
  ? updateBookingGroups(opt.groups, changedLines)
6560
6562
  : opt.groups, optionUnits: opt.isSelected
6561
6563
  ? updateOptionUnits(opt.optionUnits, changedLines)
@@ -6564,6 +6566,13 @@ var updatePackageDetails = function (packageDetails, changedLines) {
6564
6566
  : opt.optionPax });
6565
6567
  }) });
6566
6568
  };
6569
+ // ROOMS
6570
+ var updateRooms = function (rooms, changedLines) {
6571
+ return rooms.map(function (room) { return (__assign(__assign({}, room), { options: room.options.map(function (option) {
6572
+ var _a, _b;
6573
+ return (__assign(__assign({}, option), { price: (_b = (_a = changedLines.find(function (x) { return x.entryLineGuid == option.entryLineGuid; })) === null || _a === void 0 ? void 0 : _a.price) !== null && _b !== void 0 ? _b : option.price }));
6574
+ }) })); });
6575
+ };
6567
6576
  // PAX
6568
6577
  var updateOptionPax = function (pax, changedLines) {
6569
6578
  return pax.map(function (p) { return (__assign(__assign({}, p), { groups: updatePaxGroups(p.groups, changedLines) })); });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qite/tide-booking-component",
3
- "version": "1.0.26",
3
+ "version": "1.0.27",
4
4
  "description": "React BookingWizard component for Tide",
5
5
  "main": "build/build-cjs/index.js",
6
6
  "module": "build/build-esm/index.js",
@@ -66,6 +66,6 @@
66
66
  "uuid": "^8.3.2"
67
67
  },
68
68
  "dependencies": {
69
- "@qite/tide-client": "1.1.24"
69
+ "@qite/tide-client": "1.1.25"
70
70
  }
71
71
  }
@@ -7,6 +7,7 @@ import {
7
7
  BookingOptionUnit,
8
8
  PerUnitPackageOption,
9
9
  PerBookingPackageOption,
10
+ BookingPackageRoom,
10
11
  } from "@qite/tide-client/build/types";
11
12
  import { BookingPackageOption } from "@qite/tide-client/build/types/offer/booking-v2/shared/booking-package-option";
12
13
 
@@ -19,6 +20,9 @@ export const updatePackageDetails = (
19
20
  options: packageDetails.options.map((opt) => {
20
21
  return {
21
22
  ...opt,
23
+ rooms: opt.isSelected
24
+ ? updateRooms(opt.rooms, changedLines)
25
+ : opt.rooms,
22
26
  groups: opt.isSelected
23
27
  ? updateBookingGroups(opt.groups, changedLines)
24
28
  : opt.groups,
@@ -33,6 +37,17 @@ export const updatePackageDetails = (
33
37
  };
34
38
  };
35
39
 
40
+ // ROOMS
41
+ const updateRooms = (rooms: BookingPackageRoom[], changedLines: ChangedLine[]) => {
42
+ return rooms.map(room => ({
43
+ ...room,
44
+ options: room.options.map(option => ({
45
+ ...option,
46
+ price: changedLines.find(x => x.entryLineGuid == option.entryLineGuid)?.price ?? option.price
47
+ }))
48
+ }))
49
+ }
50
+
36
51
  // PAX
37
52
  const updateOptionPax = (
38
53
  pax: BookingOptionPax[],