@sabstravtech/obtservices 0.0.22051001 → 0.0.26051001

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.
Files changed (142) hide show
  1. package/angular/components/basket-panel.d.ts +1 -0
  2. package/angular/fetchers.d.ts +3 -0
  3. package/angular/lib/vendor/fetchers/get-companies.fetcher.d.ts +7 -0
  4. package/angular/lib/vendor/fetchers/get-company.fetcher.d.ts +7 -0
  5. package/angular/lib/vendor/fetchers/get-user-guests.fetcher.d.ts +7 -0
  6. package/angular/lib/vendor/services/enterprise-basket.service.d.ts +2 -1
  7. package/angular/lib/vendor/services/logon.service.d.ts +2 -1
  8. package/angular/lib/vendor/services/user.service.d.ts +7 -3
  9. package/angular/lib/vendor/types/graphql.angular.types.d.ts +268 -85
  10. package/angular/lib/vendor/updaters/create-guest-updater.d.ts +6 -0
  11. package/angular/sabstravtech-obtservices-angular.metadata.json +1 -1
  12. package/angular/updaters.d.ts +1 -0
  13. package/base/fetchers.d.ts +3 -0
  14. package/base/lib/vendor/classes/base-enterprise.d.ts +5 -1
  15. package/base/lib/vendor/classes/basket-info-mi-details.impl.d.ts +2 -0
  16. package/base/lib/vendor/classes/bookable-basket.d.ts +2 -0
  17. package/base/lib/vendor/classes/cabhire-enterprise-search.d.ts +4 -3
  18. package/base/lib/vendor/classes/carhire-enterprise-search.d.ts +4 -3
  19. package/base/lib/vendor/classes/eurostar-enterprise-search.d.ts +4 -4
  20. package/base/lib/vendor/classes/fast-track-enterprise-search.d.ts +3 -3
  21. package/base/lib/vendor/classes/flight-enterprise-search.d.ts +5 -5
  22. package/base/lib/vendor/classes/helpers.d.ts +6 -1
  23. package/base/lib/vendor/classes/hotel-enterprise-search.d.ts +6 -3
  24. package/base/lib/vendor/classes/irl-enterprise-search.d.ts +4 -4
  25. package/base/lib/vendor/classes/lounges-enterprise-search.d.ts +3 -3
  26. package/base/lib/vendor/classes/management-info-and-valid.d.ts +1 -1
  27. package/base/lib/vendor/classes/modal-types.enum.d.ts +1 -0
  28. package/base/lib/vendor/classes/parking-enterprise-search.d.ts +3 -3
  29. package/base/lib/vendor/classes/rail-enterprise-search.d.ts +9 -7
  30. package/base/lib/vendor/classes/supplementary-booking-info-impl.d.ts +5 -3
  31. package/base/lib/vendor/fetchers/get-companies.fetcher.d.ts +21 -0
  32. package/base/lib/vendor/fetchers/get-company.fetcher.d.ts +20 -0
  33. package/base/lib/vendor/fetchers/get-user-guests.fetcher.d.ts +20 -0
  34. package/base/lib/vendor/interfaces/Icabhire-enterprise-search.d.ts +1 -0
  35. package/base/lib/vendor/interfaces/Icarhire-enterprise-search.d.ts +3 -2
  36. package/base/lib/vendor/interfaces/Ienterprise-basket.service.d.ts +6 -5
  37. package/base/lib/vendor/interfaces/Ieurostar-enterprise-search.d.ts +1 -0
  38. package/base/lib/vendor/interfaces/Ifast-track-enterprise-search.d.ts +7 -5
  39. package/base/lib/vendor/interfaces/Iflight-enterprise-search.d.ts +2 -1
  40. package/base/lib/vendor/interfaces/Ihotel-enterprise-search.d.ts +5 -2
  41. package/base/lib/vendor/interfaces/Iirl-enterprise-search.d.ts +4 -3
  42. package/base/lib/vendor/interfaces/Ilounges-enterprise-search.d.ts +1 -0
  43. package/base/lib/vendor/interfaces/Iparking-enterprise-search.d.ts +1 -0
  44. package/base/lib/vendor/interfaces/Irail-enterprise-search.d.ts +5 -2
  45. package/base/lib/vendor/interfaces/Isearch.service.d.ts +4 -2
  46. package/base/lib/vendor/interfaces/Isupplementary-booking-info-impl.d.ts +3 -2
  47. package/base/lib/vendor/interfaces/Iuser.service.d.ts +1 -0
  48. package/base/lib/vendor/interfaces/car-hire-search-arg.interface.d.ts +2 -3
  49. package/base/lib/vendor/interfaces/summary-interface.d.ts +2 -0
  50. package/base/lib/vendor/interfaces/user.data.d.ts +1 -0
  51. package/base/lib/vendor/models/traveller.object.d.ts +1 -1
  52. package/base/lib/vendor/services/enterprise-basket.service.d.ts +18 -7
  53. package/base/lib/vendor/services/logon.service.d.ts +5 -1
  54. package/base/lib/vendor/services/search.service.d.ts +25 -22
  55. package/base/lib/vendor/services/url.service.d.ts +2 -0
  56. package/base/lib/vendor/services/user.service.d.ts +21 -5
  57. package/base/lib/vendor/services/webtoken.service.d.ts +4 -0
  58. package/base/lib/vendor/types/graphql.types.d.ts +245 -84
  59. package/base/lib/vendor/types/types.d.ts +16 -2
  60. package/base/lib/vendor/updaters/create-guest-updater.d.ts +19 -0
  61. package/base/sabstravtech-obtservices-base.d.ts +1 -1
  62. package/base/sabstravtech-obtservices-base.metadata.json +1 -1
  63. package/base/updaters.d.ts +1 -0
  64. package/bundles/sabstravtech-obtservices-angular.umd.js +366 -176
  65. package/bundles/sabstravtech-obtservices-angular.umd.js.map +1 -1
  66. package/bundles/sabstravtech-obtservices-angular.umd.min.js +1 -1
  67. package/bundles/sabstravtech-obtservices-angular.umd.min.js.map +1 -1
  68. package/bundles/sabstravtech-obtservices-base.umd.js +2019 -956
  69. package/bundles/sabstravtech-obtservices-base.umd.js.map +1 -1
  70. package/bundles/sabstravtech-obtservices-base.umd.min.js +2 -2
  71. package/bundles/sabstravtech-obtservices-base.umd.min.js.map +1 -1
  72. package/esm2015/angular/components/basket-panel.js +16 -7
  73. package/esm2015/angular/fetchers.js +4 -1
  74. package/esm2015/angular/lib/vendor/fetchers/get-companies.fetcher.js +25 -0
  75. package/esm2015/angular/lib/vendor/fetchers/get-company.fetcher.js +25 -0
  76. package/esm2015/angular/lib/vendor/fetchers/get-user-guests.fetcher.js +25 -0
  77. package/esm2015/angular/lib/vendor/services/enterprise-basket.service.js +8 -5
  78. package/esm2015/angular/lib/vendor/services/http-call.service.js +1 -1
  79. package/esm2015/angular/lib/vendor/services/logon.service.js +8 -5
  80. package/esm2015/angular/lib/vendor/services/search.service.js +1 -1
  81. package/esm2015/angular/lib/vendor/services/user.service.js +21 -9
  82. package/esm2015/angular/lib/vendor/services/webtoken.service.js +6 -2
  83. package/esm2015/angular/lib/vendor/types/graphql.angular.types.js +296 -70
  84. package/esm2015/angular/lib/vendor/updaters/create-guest-updater.js +22 -0
  85. package/esm2015/angular/updaters.js +2 -1
  86. package/esm2015/base/fetchers.js +4 -1
  87. package/esm2015/base/lib/vendor/classes/base-enterprise.js +8 -2
  88. package/esm2015/base/lib/vendor/classes/basket-info-mi-details.impl.js +14 -1
  89. package/esm2015/base/lib/vendor/classes/bookable-basket.js +27 -6
  90. package/esm2015/base/lib/vendor/classes/cabhire-enterprise-search.js +66 -11
  91. package/esm2015/base/lib/vendor/classes/carhire-enterprise-search.js +108 -61
  92. package/esm2015/base/lib/vendor/classes/eurostar-enterprise-search.js +115 -33
  93. package/esm2015/base/lib/vendor/classes/fast-track-enterprise-search.js +31 -10
  94. package/esm2015/base/lib/vendor/classes/flight-enterprise-search.js +196 -57
  95. package/esm2015/base/lib/vendor/classes/helpers.js +19 -3
  96. package/esm2015/base/lib/vendor/classes/hotel-enterprise-search.js +145 -36
  97. package/esm2015/base/lib/vendor/classes/irl-enterprise-search.js +100 -30
  98. package/esm2015/base/lib/vendor/classes/lounges-enterprise-search.js +40 -8
  99. package/esm2015/base/lib/vendor/classes/management-info-and-valid.js +13 -9
  100. package/esm2015/base/lib/vendor/classes/modal-types.enum.js +2 -1
  101. package/esm2015/base/lib/vendor/classes/parking-enterprise-search.js +39 -7
  102. package/esm2015/base/lib/vendor/classes/rail-enterprise-search.js +131 -20
  103. package/esm2015/base/lib/vendor/classes/supplementary-booking-info-impl.js +42 -4
  104. package/esm2015/base/lib/vendor/fetchers/get-companies.fetcher.js +11 -0
  105. package/esm2015/base/lib/vendor/fetchers/get-company.fetcher.js +11 -0
  106. package/esm2015/base/lib/vendor/fetchers/get-user-guests.fetcher.js +11 -0
  107. package/esm2015/base/lib/vendor/interfaces/Icabhire-enterprise-search.js +1 -1
  108. package/esm2015/base/lib/vendor/interfaces/Icarhire-enterprise-search.js +1 -1
  109. package/esm2015/base/lib/vendor/interfaces/Ienterprise-basket.service.js +1 -1
  110. package/esm2015/base/lib/vendor/interfaces/Ieurostar-enterprise-search.js +1 -1
  111. package/esm2015/base/lib/vendor/interfaces/Ifast-track-enterprise-search.js +1 -1
  112. package/esm2015/base/lib/vendor/interfaces/Iflight-enterprise-search.js +1 -1
  113. package/esm2015/base/lib/vendor/interfaces/Ihotel-enterprise-search.js +2 -1
  114. package/esm2015/base/lib/vendor/interfaces/Iirl-enterprise-search.js +1 -1
  115. package/esm2015/base/lib/vendor/interfaces/Ilounges-enterprise-search.js +1 -1
  116. package/esm2015/base/lib/vendor/interfaces/Iparking-enterprise-search.js +1 -1
  117. package/esm2015/base/lib/vendor/interfaces/Irail-enterprise-search.js +1 -1
  118. package/esm2015/base/lib/vendor/interfaces/Isearch.service.js +1 -1
  119. package/esm2015/base/lib/vendor/interfaces/Isupplementary-booking-info-impl.js +1 -1
  120. package/esm2015/base/lib/vendor/interfaces/Iuser.service.js +1 -1
  121. package/esm2015/base/lib/vendor/interfaces/car-hire-search-arg.interface.js +1 -1
  122. package/esm2015/base/lib/vendor/interfaces/summary-interface.js +1 -1
  123. package/esm2015/base/lib/vendor/interfaces/user.data.js +1 -1
  124. package/esm2015/base/lib/vendor/models/traveller.object.js +1 -1
  125. package/esm2015/base/lib/vendor/services/enterprise-basket.service.js +93 -30
  126. package/esm2015/base/lib/vendor/services/http-call.service.js +1 -1
  127. package/esm2015/base/lib/vendor/services/logon.service.js +37 -3
  128. package/esm2015/base/lib/vendor/services/requires-reason.service.js +14 -10
  129. package/esm2015/base/lib/vendor/services/search.service.js +77 -102
  130. package/esm2015/base/lib/vendor/services/url.service.js +3 -1
  131. package/esm2015/base/lib/vendor/services/user.service.js +45 -11
  132. package/esm2015/base/lib/vendor/services/webtoken.service.js +8 -1
  133. package/esm2015/base/lib/vendor/types/graphql.types.js +7 -2
  134. package/esm2015/base/lib/vendor/types/types.js +31 -14
  135. package/esm2015/base/lib/vendor/updaters/create-guest-updater.js +11 -0
  136. package/esm2015/base/sabstravtech-obtservices-base.js +1 -1
  137. package/esm2015/base/updaters.js +2 -1
  138. package/fesm2015/sabstravtech-obtservices-angular.js +449 -141
  139. package/fesm2015/sabstravtech-obtservices-angular.js.map +1 -1
  140. package/fesm2015/sabstravtech-obtservices-base.js +1383 -410
  141. package/fesm2015/sabstravtech-obtservices-base.js.map +1 -1
  142. package/package.json +1 -1
@@ -11,9 +11,10 @@
11
11
  var Ajv__default = /*#__PURE__*/_interopDefaultLegacy(Ajv);
12
12
 
13
13
  var BaseEnterpriseSearch = /** @class */ (function () {
14
- function BaseEnterpriseSearch(storageService, helpers) {
14
+ function BaseEnterpriseSearch(storageService, helpers, searchService) {
15
15
  this.storageService = storageService;
16
16
  this.helpers = helpers;
17
+ this.searchService = searchService;
17
18
  this._cheapestResultPrice = {
18
19
  amount: null,
19
20
  currencyCode: null
@@ -45,6 +46,11 @@
45
46
  enumerable: false,
46
47
  configurable: true
47
48
  });
49
+ BaseEnterpriseSearch.prototype.performSearch = function () {
50
+ this.searchService.search_objects[this.type].chosen = true;
51
+ this.searchService.determineHighestSearchPriority();
52
+ this.searchService.startSearches();
53
+ };
48
54
  BaseEnterpriseSearch.prototype.processResults = function (results) {
49
55
  return results;
50
56
  };
@@ -175,7 +181,8 @@
175
181
  ModalTypes.ModalFlightFareComponent = new ModalTypes('ModalFlightFareComponent');
176
182
  ModalTypes.FlightExtrasDialogComponent = new ModalTypes('FlightExtrasDialogComponent');
177
183
  ModalTypes.OfflineRequestDialogComponent = new ModalTypes('OfflineRequestDialogComponent');
178
- ModalTypes.RequiresReasonDialogComponent = new ModalTypes('RequiresReasonDialogComponent');
184
+ ModalTypes.RequiresReasonDialogComponent = new ModalTypes('RequiresReasonDialogComponent');
185
+ ModalTypes.DifferentInvokdedUserComponent = new ModalTypes('DifferentInvokdedUserComponent');
179
186
 
180
187
  var BaseNetworkCall = /** @class */ (function () {
181
188
  function BaseNetworkCall(modelService) {
@@ -900,6 +907,11 @@
900
907
  IrlTravellerStatus["Placeholder"] = "placeholder";
901
908
  IrlTravellerStatus["Complete"] = "complete";
902
909
  })(IrlTravellerStatus || (IrlTravellerStatus = {}));
910
+ var LeadPassengerType;
911
+ (function (LeadPassengerType) {
912
+ LeadPassengerType["User"] = "USER";
913
+ LeadPassengerType["Guest"] = "GUEST";
914
+ })(LeadPassengerType || (LeadPassengerType = {}));
903
915
  var LogLevelType;
904
916
  (function (LogLevelType) {
905
917
  LogLevelType["Error"] = "ERROR";
@@ -935,7 +947,7 @@
935
947
  (function (PreferenceKey) {
936
948
  PreferenceKey["MealRequest"] = "MEAL_REQUEST";
937
949
  PreferenceKey["SeatingPreference"] = "SEATING_PREFERENCE";
938
- PreferenceKey["SpeacialNeed"] = "SPEACIAL_NEED";
950
+ PreferenceKey["SpecialNeed"] = "SPECIAL_NEED";
939
951
  PreferenceKey["SeatLocation"] = "SEAT_LOCATION";
940
952
  PreferenceKey["SeatPosition"] = "SEAT_POSITION";
941
953
  PreferenceKey["SeatDirection"] = "SEAT_DIRECTION";
@@ -1087,8 +1099,8 @@
1087
1099
  }
1088
1100
  ];
1089
1101
  };
1090
- FreeTextManagementInfo.prototype.save = function (basketid, userId) {
1091
- this.basketService.setMiFreeValue(basketid, this, this.selectedValues[0] ? this.selectedValues[0].freeValue : '', userId);
1102
+ FreeTextManagementInfo.prototype.save = function (basketid, userId, guest) {
1103
+ this.basketService.setMiFreeValue(basketid, this, this.selectedValues[0] ? this.selectedValues[0].freeValue : '', userId, guest);
1092
1104
  };
1093
1105
  FreeTextManagementInfo.prototype.hasErrors = function (value) {
1094
1106
  var _this = this;
@@ -1137,17 +1149,20 @@
1137
1149
  if (((_a = _this.values) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1138
1150
  _this.avaliableItems = _this.values;
1139
1151
  }
1152
+ else {
1153
+ console.error('No values for AutoSugest field');
1154
+ }
1140
1155
  return _this;
1141
1156
  }
1142
1157
  AutoSugestManagementInfo.prototype.getValue = function () {
1143
1158
  return this.selectedValues[0] ? this.selectedValues[0].value.id : '__NONE';
1144
1159
  };
1145
- AutoSugestManagementInfo.prototype.hasErrors = function (id) {
1160
+ AutoSugestManagementInfo.prototype.hasErrors = function (value) {
1146
1161
  return __awaiter(this, void 0, void 0, function () {
1147
- return __generator(this, function (_b) {
1162
+ return __generator(this, function (_c) {
1148
1163
  try {
1149
1164
  return [2 /*return*/, !this.avaliableItems.find(function (value1) {
1150
- return value1.id === id;
1165
+ return value1.id === value.id;
1151
1166
  })
1152
1167
  ? { hasErrors: true }
1153
1168
  : null];
@@ -1188,8 +1203,9 @@
1188
1203
  this.selectedValues = [];
1189
1204
  }
1190
1205
  };
1191
- AutoSugestManagementInfo.prototype.save = function (basketid, userid) {
1192
- this.basketService.setMiSelectedValue(basketid, this, this.selectedValues[0].value.id, userid);
1206
+ AutoSugestManagementInfo.prototype.save = function (basketid, userid, guest) {
1207
+ var _a, _b;
1208
+ this.basketService.setMiSelectedValue(basketid, this, this.selectedValues[0] ? (_b = (_a = this.selectedValues[0]) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.id : '', userid, guest);
1193
1209
  };
1194
1210
  return AutoSugestManagementInfo;
1195
1211
  }(ManagementInfoAndIsValid));
@@ -1229,7 +1245,7 @@
1229
1245
  };
1230
1246
  DropdownManagementInfo.prototype.hasErrors = function (id) {
1231
1247
  return __awaiter(this, void 0, void 0, function () {
1232
- return __generator(this, function (_b) {
1248
+ return __generator(this, function (_c) {
1233
1249
  try {
1234
1250
  return [2 /*return*/, !this.avaliableItems.find(function (value1) {
1235
1251
  return value1.id === id;
@@ -1268,8 +1284,8 @@
1268
1284
  this.selectedValues = [];
1269
1285
  }
1270
1286
  };
1271
- DropdownManagementInfo.prototype.save = function (basketid, userid) {
1272
- this.basketService.setMiSelectedValue(basketid, this, this.selectedValues[0].value.id, userid);
1287
+ DropdownManagementInfo.prototype.save = function (basketid, userid, guest) {
1288
+ this.basketService.setMiSelectedValue(basketid, this, this.selectedValues[0].value.id || '', userid, guest);
1273
1289
  };
1274
1290
  return DropdownManagementInfo;
1275
1291
  }(ManagementInfoAndIsValid));
@@ -1324,7 +1340,20 @@
1324
1340
  };
1325
1341
  return userAccum;
1326
1342
  }, {});
1343
+ this.miPerGuest = item.guests.reduce(function (userAccum, user) {
1344
+ userAccum[user.id] = {
1345
+ managementInfo: _this.helpers
1346
+ .clone(perUser)
1347
+ .map(function (miItem) {
1348
+ var miItemObj = makeManagamentInfo(miItem, _this.basketService);
1349
+ _this.isValidObservers.push(miItemObj);
1350
+ return miItemObj;
1351
+ })
1352
+ };
1353
+ return userAccum;
1354
+ }, {});
1327
1355
  this.users = Object.keys(this.miPerUser);
1356
+ this.guests = Object.keys(this.miPerGuest);
1328
1357
  }
1329
1358
  return BasketInfoMiDetailsImpl;
1330
1359
  }());
@@ -1370,6 +1399,7 @@
1370
1399
  BookingStatus[BookingStatus["ApprovedBook"] = 13] = "ApprovedBook";
1371
1400
  BookingStatus[BookingStatus["PartiallyBooked"] = 14] = "PartiallyBooked";
1372
1401
  BookingStatus[BookingStatus["Complete"] = 15] = "Complete";
1402
+ BookingStatus[BookingStatus["Expired"] = 16] = "Expired";
1373
1403
  })(exports.BookingStatus || (exports.BookingStatus = {}));
1374
1404
  (function (SchemaFormat) {
1375
1405
  SchemaFormat["array"] = "array";
@@ -1450,10 +1480,18 @@
1450
1480
  'Breakfast Costs',
1451
1481
  'no breakfast'
1452
1482
  ];
1483
+ var AccessibleIncluded = [
1484
+ 'Accessibility',
1485
+ 'Accessible and Disabled',
1486
+ 'Accessible',
1487
+ 'Disabled'
1488
+ ];
1453
1489
  var excludedPattern = '(' + BreakBastExcluded.join(')|(') + ')';
1454
1490
  var includedPattern = '(' + BreakFastIncluded.join(')|(') + ')';
1491
+ var includedAccessibilityPattern = '(' + AccessibleIncluded.join(')|(') + ')';
1455
1492
  var includedExpression = new RegExp(includedPattern, 'i');
1456
1493
  var excludedExpression = new RegExp(excludedPattern, 'i');
1494
+ var includedAccessibilityExpression = new RegExp(includedAccessibilityPattern, 'i');
1457
1495
  (function (SearchHandler) {
1458
1496
  SearchHandler["AVAILABILITY"] = "Availability";
1459
1497
  SearchHandler["FEMALE_FRIENDLY"] = "SOLO Female Friendly";
@@ -1487,7 +1525,8 @@
1487
1525
  extra: 'extra',
1488
1526
  hotelName: 'hotelName',
1489
1527
  priceRange: 'priceRange',
1490
- breakfastType: 'breakfastType'
1528
+ breakfastType: 'breakfastType',
1529
+ accessibleRoomType: 'accessibleRoomType'
1491
1530
  };
1492
1531
  (function (ServiceProvider) {
1493
1532
  ServiceProvider["Confirma"] = "Conferma";
@@ -1529,20 +1568,20 @@
1529
1568
  { label: 'Raw Vegeterian', type: exports.ɵf.MealRequest },
1530
1569
  { label: 'Seafood', type: exports.ɵf.MealRequest },
1531
1570
  { label: 'Vegan Vegeterian', type: exports.ɵf.MealRequest },
1532
- { label: 'Vegeterain Lacto-Ovo', type: exports.ɵf.MealRequest },
1571
+ { label: 'Vegeterian Lacto-Ovo', type: exports.ɵf.MealRequest },
1533
1572
  { label: 'Aisle', type: exports.ɵf.SeatingPreference },
1534
1573
  { label: 'Window', type: exports.ɵf.SeatingPreference },
1535
- { label: 'Bassinet', type: exports.ɵf.SpeacialNeed },
1536
- { label: 'Bicycle', type: exports.ɵf.SpeacialNeed },
1537
- { label: 'Blind passenger', type: exports.ɵf.SpeacialNeed },
1538
- { label: 'Deaf passenger', type: exports.ɵf.SpeacialNeed },
1539
- { label: 'Meet and assist', type: exports.ɵf.SpeacialNeed },
1540
- { label: 'Wheelchair, can ascend steps', type: exports.ɵf.SpeacialNeed },
1541
- { label: 'Wheelchair, can walk to seat', type: exports.ɵf.SpeacialNeed },
1542
- { label: 'Wheelchair, manual', type: exports.ɵf.SpeacialNeed },
1543
- { label: 'Wheelchair, must be carried', type: exports.ɵf.SpeacialNeed },
1544
- { label: 'Wheelchair, with dry battery', type: exports.ɵf.SpeacialNeed },
1545
- { label: 'Wheelchair, with wet battery', type: exports.ɵf.SpeacialNeed },
1574
+ { label: 'Bassinet', type: exports.ɵf.SpecialNeed },
1575
+ { label: 'Bicycle', type: exports.ɵf.SpecialNeed },
1576
+ { label: 'Blind passenger', type: exports.ɵf.SpecialNeed },
1577
+ { label: 'Deaf passenger', type: exports.ɵf.SpecialNeed },
1578
+ { label: 'Meet and assist', type: exports.ɵf.SpecialNeed },
1579
+ { label: 'Wheelchair, can ascend steps', type: exports.ɵf.SpecialNeed },
1580
+ { label: 'Wheelchair, can walk to seat', type: exports.ɵf.SpecialNeed },
1581
+ { label: 'Wheelchair, manual', type: exports.ɵf.SpecialNeed },
1582
+ { label: 'Wheelchair, must be carried', type: exports.ɵf.SpecialNeed },
1583
+ { label: 'Wheelchair, with dry battery', type: exports.ɵf.SpecialNeed },
1584
+ { label: 'Wheelchair, with wet battery', type: exports.ɵf.SpecialNeed },
1546
1585
  { label: 'Quiet', type: exports.ɵf.SeatLocation },
1547
1586
  { label: 'Business', type: exports.ɵf.SeatLocation },
1548
1587
  { label: 'Family', type: exports.ɵf.SeatLocation },
@@ -3201,7 +3240,13 @@
3201
3240
  { label: 'Zimex Aviation', value: 'C4' },
3202
3241
  { label: 'Zoom Airlines', value: 'Z4' },
3203
3242
  { label: 'Zuliana De Aviacion', value: 'OD' }
3204
- ];
3243
+ ];
3244
+ (function (DifferentInvokdedUserReasons) {
3245
+ DifferentInvokdedUserReasons[DifferentInvokdedUserReasons["continue"] = 0] = "continue";
3246
+ DifferentInvokdedUserReasons[DifferentInvokdedUserReasons["newBasket"] = 1] = "newBasket";
3247
+ DifferentInvokdedUserReasons[DifferentInvokdedUserReasons["cancel"] = 2] = "cancel";
3248
+ DifferentInvokdedUserReasons[DifferentInvokdedUserReasons["research"] = 3] = "research";
3249
+ })(exports.DifferentInvokdedUserReasons || (exports.DifferentInvokdedUserReasons = {}));
3205
3250
 
3206
3251
  var BookableBasket = /** @class */ (function () {
3207
3252
  function BookableBasket(basketService, helpers) {
@@ -3243,7 +3288,13 @@
3243
3288
  this.basketService.subsribeToBasket(id, {
3244
3289
  next: function (basket) {
3245
3290
  _this.basket.next(basket);
3246
- _this.updateBasket(basket);
3291
+ // before updating the basket check if there is an expired basket item/s
3292
+ if (_this.expiredItemInTheBasket()) {
3293
+ _this.status.next(exports.BookingStatus.Expired);
3294
+ }
3295
+ else {
3296
+ _this.updateBasket(basket);
3297
+ }
3247
3298
  },
3248
3299
  error: function (error) {
3249
3300
  _this.basket.error(error);
@@ -3255,6 +3306,14 @@
3255
3306
  }
3256
3307
  });
3257
3308
  };
3309
+ BookableBasket.prototype.expiredItemInTheBasket = function () {
3310
+ this.isUpdating.next(false);
3311
+ var expiredItemInTheBasket;
3312
+ this.basket.subscribe(function (basket) {
3313
+ expiredItemInTheBasket = basket.basketItems.some(function (item) { return item.expired; });
3314
+ });
3315
+ return expiredItemInTheBasket;
3316
+ };
3258
3317
  BookableBasket.prototype.updateBasket = function (basket) {
3259
3318
  this.isUpdating.next(false);
3260
3319
  switch (basket.status) {
@@ -3423,16 +3482,18 @@
3423
3482
  };
3424
3483
  BookableBasket.prototype._splitTravellers = function (basketItem) {
3425
3484
  var _this = this;
3426
- return (basketItem.userPassengerTypes || []).reduce(function (accum, user, index) {
3485
+ return (basketItem.userPassengerTypes.concat(basketItem.guestPassengerTypes) || []).reduce(function (accum, user, index) {
3486
+ var userPassenger = _this._findUser(basketItem.users, Number(user.id));
3487
+ var guestPassenger = _this._findGuest(basketItem.guests, Number(user.id));
3427
3488
  switch (user.passengerType) {
3428
3489
  case PassengerType.Adult:
3429
- accum.adults.push(_this._findUser(basketItem.users, Number(user.id)));
3490
+ accum.adults.push(userPassenger || guestPassenger);
3430
3491
  break;
3431
3492
  case PassengerType.Child:
3432
- accum.children.push(_this._findUser(basketItem.users, Number(user.id)));
3493
+ accum.children.push(userPassenger || guestPassenger);
3433
3494
  break;
3434
3495
  case PassengerType.Infant:
3435
- accum.infants.push(_this._findUser(basketItem.users, Number(user.id)));
3496
+ accum.infants.push(userPassenger || guestPassenger);
3436
3497
  break;
3437
3498
  }
3438
3499
  return accum;
@@ -3443,6 +3504,11 @@
3443
3504
  return Number(user.id) === id;
3444
3505
  });
3445
3506
  };
3507
+ BookableBasket.prototype._findGuest = function (users, id) {
3508
+ return users.find(function (user) {
3509
+ return Number(user.id) === id;
3510
+ });
3511
+ };
3446
3512
  BookableBasket.prototype.getId = function () {
3447
3513
  return this.id;
3448
3514
  };
@@ -3531,9 +3597,13 @@
3531
3597
  var LOUNGES_MAX_INFANT_AGE_YEARS = 0;
3532
3598
  var METRES_TO_MILES_CONVERSION = 1609;
3533
3599
  var TIME_BASE = 60;
3600
+ var GROUP_TICKET_CODES = ['GS', 'AIG', 'GRP', 'GU3', 'GU4', 'GUC', 'MPG', '2TR', 'SGU'];
3534
3601
  var BaseHelperRoutines = /** @class */ (function () {
3535
3602
  function BaseHelperRoutines() {
3536
3603
  }
3604
+ BaseHelperRoutines.prototype.isGroupTicket = function (code) {
3605
+ return GROUP_TICKET_CODES.includes(code.toUpperCase().trim());
3606
+ };
3537
3607
  BaseHelperRoutines.prototype.minToHour = function (dur) {
3538
3608
  return Math.floor(dur / 60) + "h " + dur % 60 + "m";
3539
3609
  };
@@ -4259,7 +4329,14 @@
4259
4329
  return value ? this.toStrings(value, schema) : isRequired ? {} : null;
4260
4330
  case 'array':
4261
4331
  return value; // TODO write array translation
4332
+ case 'date-time':
4333
+ if (value.year) {
4334
+ value = this.formatIsoDate(this.ngDateToMoment(value));
4335
+ }
4336
+ return value;
4337
+ break;
4262
4338
  default:
4339
+ console.warn("+++ unknown schema type " + schema.type + " | returning value as is +++");
4263
4340
  return value;
4264
4341
  }
4265
4342
  };
@@ -4314,13 +4391,18 @@
4314
4391
  return miItem.isValid();
4315
4392
  }));
4316
4393
  };
4317
- BaseHelperRoutines.prototype.isMiValid = function (miPerItem, miPerUser) {
4394
+ BaseHelperRoutines.prototype.isMiValid = function (miPerItem, miPerUser, miPerGuest) {
4318
4395
  var _this = this;
4319
4396
  var userMis = Object.values(miPerUser || {});
4397
+ var guestMis = Object.values(miPerGuest || {});
4320
4398
  return (this.miIsValid(miPerItem) &&
4321
4399
  (userMis.length === 0 ||
4322
4400
  !!userMis.find(function (userMis1) {
4323
4401
  return _this.miIsValid(userMis1.managementInfo);
4402
+ })) &&
4403
+ (guestMis.length === 0 ||
4404
+ !!guestMis.find(function (userMis1) {
4405
+ return _this.miIsValid(userMis1.managementInfo);
4324
4406
  })));
4325
4407
  };
4326
4408
  BaseHelperRoutines.prototype.needsMi = function (basket, needsToViewMi) {
@@ -4328,7 +4410,7 @@
4328
4410
  return (basket.basketInfoMiDetails.length > 0 &&
4329
4411
  (needsToViewMi ||
4330
4412
  !basket.basketInfoMiDetails.find(function (miDetail) {
4331
- return _this.isMiValid(miDetail.miPerItem, miDetail.miPerUser);
4413
+ return _this.isMiValid(miDetail.miPerItem, miDetail.miPerUser, miDetail.miPerGuest);
4332
4414
  })));
4333
4415
  };
4334
4416
  BaseHelperRoutines.prototype.findService = function (services, id) {
@@ -4967,9 +5049,8 @@
4967
5049
  var CabHireEnterpriseSearch = /** @class */ (function (_super) {
4968
5050
  __extends(CabHireEnterpriseSearch, _super);
4969
5051
  function CabHireEnterpriseSearch(cabfetcher, helpers, storageService, searchService, basketService) {
4970
- var _this = _super.call(this, storageService, helpers) || this;
5052
+ var _this = _super.call(this, storageService, helpers, searchService) || this;
4971
5053
  _this.cabfetcher = cabfetcher;
4972
- _this.searchService = searchService;
4973
5054
  _this.basketService = basketService;
4974
5055
  _this.type = ServiceType.Cab;
4975
5056
  _this.airportChange = new rxjs.Subject();
@@ -5558,8 +5639,12 @@
5558
5639
  adults: this.tempParams.adults,
5559
5640
  children: this.tempParams.children,
5560
5641
  departs: this.tempParams.departs,
5561
- fromLocation: simplifiedLocation ? this.createCabHireLocation(this.tempParams.fromAddress) : this.tempParams.fromAddress,
5562
- toLocation: simplifiedLocation ? this.createCabHireLocation(this.tempParams.toAddress) : this.tempParams.toAddress,
5642
+ fromLocation: simplifiedLocation
5643
+ ? this.createCabHireLocation(this.tempParams.fromAddress)
5644
+ : this.tempParams.fromAddress,
5645
+ toLocation: simplifiedLocation
5646
+ ? this.createCabHireLocation(this.tempParams.toAddress)
5647
+ : this.tempParams.toAddress,
5563
5648
  infants: 0,
5564
5649
  vehicleType: this.vehicleType,
5565
5650
  vias: this._vias
@@ -5646,13 +5731,13 @@
5646
5731
  'administrative_area_level_2',
5647
5732
  'locality'
5648
5733
  ]),
5649
- PostCode: this.getAddressFromPlaceDetails(location, ['postal_code']),
5734
+ PostCode: this.getAddressFromPlaceDetails(location, ['postcode']),
5650
5735
  Country: this.getAddressFromPlaceDetails(location, ['country']),
5651
5736
  placeDescription: placeDescription
5652
5737
  };
5653
5738
  };
5654
5739
  CabHireEnterpriseSearch.prototype.getAddressFromPlaceDetails = function (placeDetails, types) {
5655
- var e_1, _b;
5740
+ var e_1, _e;
5656
5741
  var addressProp = null;
5657
5742
  if (placeDetails && Array.isArray(placeDetails)) {
5658
5743
  var _loop_1 = function (type) {
@@ -5675,7 +5760,7 @@
5675
5760
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
5676
5761
  finally {
5677
5762
  try {
5678
- if (types_1_1 && !types_1_1.done && (_b = types_1.return)) _b.call(types_1);
5763
+ if (types_1_1 && !types_1_1.done && (_e = types_1.return)) _e.call(types_1);
5679
5764
  }
5680
5765
  finally { if (e_1) throw e_1.error; }
5681
5766
  }
@@ -5730,6 +5815,48 @@
5730
5815
  // TODO flights haven't been done yet.
5731
5816
  }
5732
5817
  };
5818
+ CabHireEnterpriseSearch.prototype.updateSearchFromExpiredBasketItem = function (basketItem) {
5819
+ var _this = this;
5820
+ var _a, _b, _c, _d;
5821
+ var searchCabHireQuery = basketItem.searchQuery;
5822
+ if (searchCabHireQuery) {
5823
+ this.departs = moment__default['default'](searchCabHireQuery.departs);
5824
+ this.vehicleType = searchCabHireQuery.vehicleType;
5825
+ this.fromAddress = this.convertAddressLocation(searchCabHireQuery.fromLocation.address, searchCabHireQuery.fromLocation.postcode);
5826
+ this.toAddress = this.convertAddressLocation(searchCabHireQuery.toLocation.address, searchCabHireQuery.toLocation.postcode);
5827
+ if (searchCabHireQuery.vias) {
5828
+ var viasFrom = searchCabHireQuery.vias;
5829
+ if (viasFrom[0]) {
5830
+ this.viasFrom = this.convertAddressLocation((_a = viasFrom[0]) === null || _a === void 0 ? void 0 : _a.address, (_b = viasFrom[0]) === null || _b === void 0 ? void 0 : _b.postcode);
5831
+ }
5832
+ var viasTo = searchCabHireQuery.vias;
5833
+ if (viasTo[1]) {
5834
+ this.viasTo = this.convertAddressLocation((_c = viasTo[1]) === null || _c === void 0 ? void 0 : _c.address, (_d = viasTo[1]) === null || _d === void 0 ? void 0 : _d.postcode);
5835
+ }
5836
+ }
5837
+ }
5838
+ // add Travellers
5839
+ if (basketItem.users) {
5840
+ basketItem.users.forEach(function (user) {
5841
+ _this.searchService.addTraveller(user);
5842
+ });
5843
+ }
5844
+ };
5845
+ CabHireEnterpriseSearch.prototype.convertAddressLocation = function (address, postcode) {
5846
+ var locationArray = address.split(',');
5847
+ var street = '';
5848
+ var town = locationArray[locationArray.length - 2];
5849
+ for (var index = 1; index < locationArray.length - 2; index++) {
5850
+ street += locationArray[index] + ' ';
5851
+ }
5852
+ return {
5853
+ Country: address.slice(-2),
5854
+ House: locationArray[0],
5855
+ PostCode: postcode,
5856
+ Street: street,
5857
+ Town: town
5858
+ };
5859
+ };
5733
5860
  CabHireEnterpriseSearch.prototype.getTransType = function () {
5734
5861
  var _a;
5735
5862
  var transTypeIndex = this.tempParams.vehicleType;
@@ -5737,54 +5864,59 @@
5737
5864
  };
5738
5865
  CabHireEnterpriseSearch.prototype.addCabHireToBasket = function (cabHireQuote, cabHireQuery) {
5739
5866
  return __awaiter(this, void 0, void 0, function () {
5740
- var intBasket, basket, termsAndConditions;
5741
- return __generator(this, function (_b) {
5742
- switch (_b.label) {
5867
+ var intBasket, basket, termsAndConditions, whatHappened;
5868
+ return __generator(this, function (_e) {
5869
+ switch (_e.label) {
5743
5870
  case 0:
5744
5871
  if (cabHireQuote.unavailable) {
5745
- return [2 /*return*/, Promise.resolve(false)];
5872
+ return [2 /*return*/, Promise.resolve(exports.DifferentInvokdedUserReasons.cancel)];
5746
5873
  }
5747
5874
  return [4 /*yield*/, this.basketService.getDefaultBasket()];
5748
5875
  case 1:
5749
- intBasket = _b.sent();
5876
+ intBasket = _e.sent();
5750
5877
  basket = intBasket === null || intBasket === void 0 ? void 0 : intBasket.subject.value;
5751
5878
  termsAndConditions = this.getTermsAndCond(cabHireQuote);
5752
- if (basket) {
5753
- return [2 /*return*/, this.basketService.addToBasket({
5754
- adults: cabHireQuery.adults,
5755
- basket: basket.id,
5756
- service: cabHireQuote.sourceId.toString(),
5757
- detail: {
5758
- id: cabHireQuote.id,
5759
- departs: cabHireQuote.departs,
5760
- supplierName: cabHireQuote.supplierName,
5761
- estimatedCO2: cabHireQuote.estimatedCO2,
5762
- fromLocation: {
5763
- address: cabHireQuery.fromLocation.address,
5764
- postcode: cabHireQuery.fromLocation.postcode,
5765
- latitude: cabHireQuote.fromLocation.latitude,
5766
- longitude: cabHireQuote.fromLocation.longitude
5767
- },
5768
- toLocation: {
5769
- address: cabHireQuery.toLocation.address,
5770
- postcode: cabHireQuery.toLocation.postcode,
5771
- latitude: cabHireQuote.toLocation.latitude,
5772
- longitude: cabHireQuote.toLocation.longitude
5773
- },
5774
- vehicleType: cabHireQuery.vehicleType,
5775
- tripDistanceMetres: cabHireQuote.tripDistanceMetres,
5776
- tripDurationSeconds: cabHireQuote.tripDurationSeconds,
5777
- termsAndCond: termsAndConditions
5879
+ if (!basket) return [3 /*break*/, 3];
5880
+ return [4 /*yield*/, this.basketService.addToBasket({
5881
+ adults: cabHireQuery.adults,
5882
+ basket: basket.id,
5883
+ service: cabHireQuote.sourceId.toString(),
5884
+ detail: {
5885
+ id: cabHireQuote.id,
5886
+ departs: cabHireQuote.departs,
5887
+ supplierName: cabHireQuote.supplierName,
5888
+ estimatedCO2: cabHireQuote.estimatedCO2,
5889
+ fromLocation: {
5890
+ address: cabHireQuery.fromLocation.address,
5891
+ postcode: cabHireQuery.fromLocation.postcode,
5892
+ latitude: cabHireQuote.fromLocation.latitude,
5893
+ longitude: cabHireQuote.fromLocation.longitude
5894
+ },
5895
+ toLocation: {
5896
+ address: cabHireQuery.toLocation.address,
5897
+ postcode: cabHireQuery.toLocation.postcode,
5898
+ latitude: cabHireQuote.toLocation.latitude,
5899
+ longitude: cabHireQuote.toLocation.longitude
5778
5900
  },
5779
- price: cabHireQuote.price,
5780
- currency: cabHireQuote.currency,
5781
- searchQuery: cabHireQuery,
5782
- co2PerItem: cabHireQuote.co2PerItem,
5783
- co2PerPassenger: cabHireQuote.co2PerPassenger,
5784
- outboundDate: cabHireQuery.departs.format()
5785
- }, intBasket, this.searchService, this.travellers, cabHireQuote.requiresReason)];
5901
+ vehicleType: cabHireQuery.vehicleType,
5902
+ tripDistanceMetres: cabHireQuote.tripDistanceMetres,
5903
+ tripDurationSeconds: cabHireQuote.tripDurationSeconds,
5904
+ termsAndCond: termsAndConditions
5905
+ },
5906
+ price: cabHireQuote.price,
5907
+ currency: cabHireQuote.currency,
5908
+ searchQuery: cabHireQuery,
5909
+ co2PerItem: cabHireQuote.co2PerItem,
5910
+ co2PerPassenger: cabHireQuote.co2PerPassenger,
5911
+ outboundDate: cabHireQuery.departs.format()
5912
+ }, intBasket, this.searchService, this.travellers, cabHireQuote.requiresReason)];
5913
+ case 2:
5914
+ whatHappened = _e.sent();
5915
+ if (whatHappened === exports.DifferentInvokdedUserReasons.research) {
5916
+ this.performSearch();
5786
5917
  }
5787
- return [2 /*return*/, Promise.resolve(false)]; // TODO should this throw an error?
5918
+ return [2 /*return*/, whatHappened];
5919
+ case 3: return [2 /*return*/, exports.DifferentInvokdedUserReasons.cancel];
5788
5920
  }
5789
5921
  });
5790
5922
  });
@@ -5838,14 +5970,20 @@
5838
5970
  CabHireEnterpriseSearch.prototype.applyFavourite = function (fav) {
5839
5971
  return __awaiter(this, void 0, void 0, function () {
5840
5972
  var _this = this;
5841
- return __generator(this, function (_b) {
5973
+ return __generator(this, function (_e) {
5842
5974
  if (fav.fromLocation.Street && fav.toLocation.Street) {
5843
5975
  this.mode = exports.TaxiFormMode.ADDRESS;
5844
5976
  }
5845
5977
  else {
5846
5978
  this.mode = exports.TaxiFormMode.STATION;
5847
- this.airportSearchType = fav.fromLocation.Street ? exports.AirportSearchMode.DROPOFF : exports.AirportSearchMode.PICKUP;
5848
- this.searchService.getAirportsList(!fav.fromLocation.Street ? fav.fromLocation.House : fav.toLocation.House).subscribe(function (airport) {
5979
+ this.airportSearchType = fav.fromLocation.Street
5980
+ ? exports.AirportSearchMode.DROPOFF
5981
+ : exports.AirportSearchMode.PICKUP;
5982
+ this.searchService
5983
+ .getAirportsList(!fav.fromLocation.Street
5984
+ ? fav.fromLocation.House
5985
+ : fav.toLocation.House)
5986
+ .subscribe(function (airport) {
5849
5987
  _this.airport = airport[0];
5850
5988
  });
5851
5989
  }
@@ -5889,11 +6027,10 @@
5889
6027
  __extends(CarhireEnterpriseSearch, _super);
5890
6028
  // ! - End of getters and setters
5891
6029
  function CarhireEnterpriseSearch(carhirefetcher, carHireAvailabilityDetailFetcher, helpers, basketService, storageService, searchService) {
5892
- var _this = _super.call(this, storageService, helpers) || this;
6030
+ var _this = _super.call(this, storageService, helpers, searchService) || this;
5893
6031
  _this.carhirefetcher = carhirefetcher;
5894
6032
  _this.carHireAvailabilityDetailFetcher = carHireAvailabilityDetailFetcher;
5895
6033
  _this.basketService = basketService;
5896
- _this.searchService = searchService;
5897
6034
  // ! - Hardcoded Data
5898
6035
  _this._carTypeCodes = [
5899
6036
  ['B', '2-3 Door', CarHireType.TwoToThreeDoor],
@@ -6751,21 +6888,21 @@
6751
6888
  this.dropoff_datetime = moment__default['default'](recentSearch.searchArgs.dropoffDateTime);
6752
6889
  this.pickup_datetime = moment__default['default'](recentSearch.searchArgs.pickupDateTime);
6753
6890
  if (recentSearch.searchArgs.city) {
6754
- this.getParamsForCarbyCity(recentSearch);
6891
+ this.getParamsForCarbyCity(recentSearch.searchArgs.city);
6755
6892
  }
6756
6893
  else if (recentSearch.searchArgs.airport) {
6757
- this.getParamsForCarbyAirport(recentSearch);
6894
+ this.getParamsForCarbyAirport(recentSearch.searchArgs.airport);
6758
6895
  }
6759
6896
  else if (recentSearch.searchArgs.depot) {
6760
- this.getParamsForCarbyPostCode(recentSearch);
6897
+ this.getParamsForCarbyPostCode(recentSearch.searchArgs.depot);
6761
6898
  }
6762
6899
  };
6763
- CarhireEnterpriseSearch.prototype.getParamsForCarbyAirport = function (recentSearch) {
6900
+ CarhireEnterpriseSearch.prototype.getParamsForCarbyAirport = function (airport) {
6764
6901
  var _this = this;
6765
6902
  this.locationType = exports.LocationTypes.Airport;
6766
6903
  rxjs.combineLatest([
6767
- this.searchService.getAirportByCode(recentSearch.searchArgs.airport.pickupCode),
6768
- this.searchService.getAirportByCode(recentSearch.searchArgs.airport.dropoffCode)
6904
+ this.searchService.getAirportByCode(airport.pickupCode),
6905
+ this.searchService.getAirportByCode(airport.dropoffCode)
6769
6906
  ]).subscribe(function (_o) {
6770
6907
  var _p = __read(_o, 2), departLocation = _p[0], arriveLocation = _p[1];
6771
6908
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
@@ -6792,73 +6929,73 @@
6792
6929
  }
6793
6930
  });
6794
6931
  };
6795
- CarhireEnterpriseSearch.prototype.getParamsForCarbyCity = function (recentSearch) {
6932
+ CarhireEnterpriseSearch.prototype.getParamsForCarbyCity = function (city) {
6796
6933
  this.locationType = exports.LocationTypes.City;
6797
- this.chosenDistance = recentSearch.searchArgs.city.chosenDistance;
6934
+ this.chosenDistance = city.chosenDistance;
6798
6935
  this.cityPickup = {
6799
- countryCode: recentSearch.searchArgs.city.pickupCountryCode,
6800
- id: recentSearch.searchArgs.city.pickupCity,
6801
- name: recentSearch.searchArgs.city.pickupName,
6936
+ countryCode: city.pickupCountryCode,
6937
+ id: city.pickupCity,
6938
+ name: city.pickupName,
6802
6939
  type: exports.LocationTypes.City,
6803
- latitude: recentSearch.searchArgs.city.pickupLatitude,
6804
- longitude: recentSearch.searchArgs.city.pickupLongitude
6940
+ latitude: city.pickupLatitude,
6941
+ longitude: city.pickupLongitude
6805
6942
  };
6806
6943
  this.cityDropoff = {
6807
- countryCode: recentSearch.searchArgs.city.dropoffCountryCode,
6808
- id: recentSearch.searchArgs.city.dropoffCity,
6809
- name: recentSearch.searchArgs.city.dropOffName,
6944
+ countryCode: city.dropoffCountryCode,
6945
+ id: city.dropoffCity,
6946
+ name: city.dropOffName,
6810
6947
  type: exports.LocationTypes.City,
6811
- latitude: recentSearch.searchArgs.city.dropOffLatitude,
6812
- longitude: recentSearch.searchArgs.city.dropOffLongitude
6948
+ latitude: city.dropOffLatitude,
6949
+ longitude: city.dropOffLongitude
6813
6950
  };
6814
6951
  this.cityDropoffDepot = {
6815
- addressLines: [recentSearch.searchArgs.city.dropOffAddressLines],
6816
- cityName: recentSearch.searchArgs.city.dropOffCityName,
6817
- extendedLocationCode: recentSearch.searchArgs.city.dropOffExtendedLocationCode,
6818
- locationCode: recentSearch.searchArgs.city.dropOffLocationCode,
6819
- vendor: recentSearch.searchArgs.city.dropOffVendor,
6820
- vendorCode: recentSearch.searchArgs.city.dropOffVendorCode
6952
+ addressLines: [city.dropOffAddressLines],
6953
+ cityName: city.dropOffCityName,
6954
+ extendedLocationCode: city.dropOffExtendedLocationCode,
6955
+ locationCode: city.dropOffLocationCode,
6956
+ vendor: city.dropOffVendor,
6957
+ vendorCode: city.dropOffVendorCode
6821
6958
  };
6822
6959
  this.cityPickupDepot = {
6823
- addressLines: [recentSearch.searchArgs.city.pickupAddressLines],
6824
- cityName: recentSearch.searchArgs.city.pickupCityName,
6825
- extendedLocationCode: recentSearch.searchArgs.city.pickupExtendedLocationCode,
6826
- locationCode: recentSearch.searchArgs.city.pickupLocationCode,
6827
- vendor: recentSearch.searchArgs.city.pickupVendor,
6828
- vendorCode: recentSearch.searchArgs.city.pickupVendorCode
6960
+ addressLines: [city.pickupAddressLines],
6961
+ cityName: city.pickupCityName,
6962
+ extendedLocationCode: city.pickupExtendedLocationCode,
6963
+ locationCode: city.pickupLocationCode,
6964
+ vendor: city.pickupVendor,
6965
+ vendorCode: city.pickupVendorCode
6829
6966
  };
6830
6967
  this.searchService.startSearches();
6831
6968
  };
6832
- CarhireEnterpriseSearch.prototype.getParamsForCarbyPostCode = function (recentSearch) {
6969
+ CarhireEnterpriseSearch.prototype.getParamsForCarbyPostCode = function (depot) {
6833
6970
  this.locationType = exports.LocationTypes.Postcode;
6834
- this.chosenDistance = recentSearch.searchArgs.depot.chosenDistance;
6971
+ this.chosenDistance = depot.chosenDistance;
6835
6972
  this.postcodeDropoff = {
6836
- addressLines: [recentSearch.searchArgs.depot.dropoffAddressLines],
6837
- vendorCode: recentSearch.searchArgs.depot.vendorCode,
6838
- locationCode: recentSearch.searchArgs.depot.dropOffLocationCode,
6839
- extendedLocationCode: recentSearch.searchArgs.depot.dropOffExtendedLocationCode,
6840
- cityName: recentSearch.searchArgs.depot.dropoffCityName,
6841
- vendor: recentSearch.searchArgs.depot.dropoffVendor
6973
+ addressLines: [depot.dropoffAddressLines],
6974
+ vendorCode: depot.vendorCode,
6975
+ locationCode: depot.dropOffLocationCode,
6976
+ extendedLocationCode: depot.dropOffExtendedLocationCode,
6977
+ cityName: depot.dropoffCityName,
6978
+ vendor: depot.dropoffVendor
6842
6979
  };
6843
6980
  this.postcodeDropoffRaw = {
6844
- name: recentSearch.searchArgs.depot.dropoffPostCode,
6981
+ name: depot.dropoffPostCode,
6845
6982
  type: exports.LocationTypes.Postcode,
6846
- latitude: recentSearch.searchArgs.depot.dropoffLatitude,
6847
- longitude: recentSearch.searchArgs.depot.dropoffLongitude
6983
+ latitude: depot.dropoffLatitude,
6984
+ longitude: depot.dropoffLongitude
6848
6985
  };
6849
6986
  this.postcodePickup = {
6850
- addressLines: [recentSearch.searchArgs.depot.pickupAddressLines],
6851
- vendorCode: recentSearch.searchArgs.depot.vendorCode,
6852
- locationCode: recentSearch.searchArgs.depot.pickupLocationCode,
6853
- extendedLocationCode: recentSearch.searchArgs.depot.pickupExtendedLocationCode,
6854
- cityName: recentSearch.searchArgs.depot.pickupCityName,
6855
- vendor: recentSearch.searchArgs.depot.pickupVendor
6987
+ addressLines: [depot.pickupAddressLines],
6988
+ vendorCode: depot.vendorCode,
6989
+ locationCode: depot.pickupLocationCode,
6990
+ extendedLocationCode: depot.pickupExtendedLocationCode,
6991
+ cityName: depot.pickupCityName,
6992
+ vendor: depot.pickupVendor
6856
6993
  };
6857
6994
  this.postcodePickupRaw = {
6858
- name: recentSearch.searchArgs.depot.pickupPostCode,
6995
+ name: depot.pickupPostCode,
6859
6996
  type: exports.LocationTypes.Postcode,
6860
- latitude: recentSearch.searchArgs.depot.pickupLatitude,
6861
- longitude: recentSearch.searchArgs.depot.pickupLongitude
6997
+ latitude: depot.pickupLatitude,
6998
+ longitude: depot.pickupLongitude
6862
6999
  };
6863
7000
  this.searchService.startSearches();
6864
7001
  };
@@ -7151,6 +7288,47 @@
7151
7288
  return max;
7152
7289
  }, Number.MIN_SAFE_INTEGER);
7153
7290
  };
7291
+ CarhireEnterpriseSearch.prototype.updateSearchFromExpiredBasketItem = function (basketItem) {
7292
+ var _this = this;
7293
+ var searchCarHireQuery = basketItem.searchQuery;
7294
+ if (searchCarHireQuery) {
7295
+ this.chosenVendor = searchCarHireQuery.vendor;
7296
+ this.carClass = searchCarHireQuery.class;
7297
+ this.carType = searchCarHireQuery.type;
7298
+ this.transmission = searchCarHireQuery.transmission;
7299
+ this.airCon = searchCarHireQuery.aircon;
7300
+ this.estimatedMileage = searchCarHireQuery.estimatedDailyDistance;
7301
+ this.dropoff_datetime = moment__default['default'](searchCarHireQuery.dropoffDateTime);
7302
+ this.pickup_datetime = moment__default['default'](searchCarHireQuery.pickupDateTime);
7303
+ if (searchCarHireQuery.city) {
7304
+ this.getParamsForCarbyCity(searchCarHireQuery.city);
7305
+ }
7306
+ else if (searchCarHireQuery.airport) {
7307
+ this.getParamsForCarbyAirport(searchCarHireQuery.airport);
7308
+ }
7309
+ else if (searchCarHireQuery.depot) {
7310
+ this.updateSearchForCarbyPostCode(searchCarHireQuery, basketItem.detail);
7311
+ }
7312
+ }
7313
+ // add Travellers
7314
+ if (basketItem.users) {
7315
+ basketItem.users.forEach(function (user) {
7316
+ _this.searchService.addTraveller(user);
7317
+ });
7318
+ }
7319
+ };
7320
+ CarhireEnterpriseSearch.prototype.updateSearchForCarbyPostCode = function (depot, detail) {
7321
+ this.locationType = exports.LocationTypes.Postcode;
7322
+ this.chosenDistance = depot.chosenDistance;
7323
+ this.postcodeDropoffRaw = {
7324
+ name: detail.dropOffLocation.postcode,
7325
+ type: exports.LocationTypes.Postcode
7326
+ };
7327
+ this.postcodePickupRaw = {
7328
+ name: detail.pickUpLocation.postcode,
7329
+ type: exports.LocationTypes.Postcode
7330
+ };
7331
+ };
7154
7332
  CarhireEnterpriseSearch.prototype.updateFromPreviousSearches = function (previousItems) {
7155
7333
  var _a;
7156
7334
  console.log('PREPOPULATING CARHIRE FORM');
@@ -7258,67 +7436,72 @@
7258
7436
  CarhireEnterpriseSearch.prototype.addCarHireToBasket = function (carHireVehicleAvailibility, carHireQuery) {
7259
7437
  var _a, _b;
7260
7438
  return __awaiter(this, void 0, void 0, function () {
7261
- var intBasket, basket, co2PerItem, co2PerPassenger, displayRecord, identifiers, sourceId, price, termsAndConditions;
7439
+ var intBasket, basket, co2PerItem, co2PerPassenger, displayRecord, identifiers, sourceId, price, termsAndConditions, whatHappened;
7262
7440
  return __generator(this, function (_o) {
7263
7441
  switch (_o.label) {
7264
7442
  case 0:
7265
7443
  if (carHireVehicleAvailibility.unavailable) {
7266
- return [2 /*return*/, Promise.resolve(false)];
7444
+ return [2 /*return*/, Promise.resolve(exports.DifferentInvokdedUserReasons.cancel)];
7267
7445
  }
7268
7446
  return [4 /*yield*/, this.basketService.getDefaultBasket()];
7269
7447
  case 1:
7270
7448
  intBasket = _o.sent();
7271
7449
  basket = intBasket === null || intBasket === void 0 ? void 0 : intBasket.subject.value;
7272
- if (basket) {
7273
- co2PerItem = carHireVehicleAvailibility.co2PerItem, co2PerPassenger = carHireVehicleAvailibility.co2PerPassenger, displayRecord = carHireVehicleAvailibility.displayRecord, identifiers = carHireVehicleAvailibility.identifiers, sourceId = carHireVehicleAvailibility.sourceId;
7274
- price = parseFloat((_b = (_a = displayRecord === null || displayRecord === void 0 ? void 0 : displayRecord.charges[0]) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : '0');
7275
- termsAndConditions = this.getTermsAndCond(carHireVehicleAvailibility, carHireQuery);
7276
- return [2 /*return*/, this.basketService.addToBasket({
7277
- adults: this.adults,
7278
- basket: basket.id,
7279
- service: sourceId.toString(),
7280
- detail: {
7281
- pickUpDatetime: displayRecord.pickup,
7282
- dropOffDatetime: displayRecord.dropoff,
7283
- pickUpLocation: {
7284
- iata: this.locationType === exports.LocationTypes.Airport
7285
- ? identifiers.locationCode
7286
- : '',
7287
- name: displayRecord.pickupLocation.name,
7288
- address: displayRecord.pickupLocation.topLine + ", " + displayRecord.pickupLocation.city,
7289
- postcode: displayRecord.pickupLocation.postCode
7290
- },
7291
- dropOffLocation: {
7292
- iata: this.locationType === exports.LocationTypes.Airport
7293
- ? identifiers.dropOffLocation
7294
- : '',
7295
- name: displayRecord.returnLocation.name,
7296
- address: displayRecord.returnLocation.topLine + ", " + displayRecord.returnLocation.city,
7297
- postcode: displayRecord.returnLocation.postCode
7298
- },
7299
- car: {
7300
- type: displayRecord.vehicle.type,
7301
- manualTransmission: displayRecord.vehicle.transmission.includes(CarHireTransmission.Manual)
7302
- },
7303
- vendorName: displayRecord.vendor.name,
7304
- identifiers: {
7305
- dropOffLocation: identifiers.dropOffLocation,
7306
- locationCode: identifiers.locationCode,
7307
- locationName: identifiers.locationName,
7308
- vehType: identifiers.vehType,
7309
- vendor: identifiers.vendor
7310
- },
7311
- termsAndCond: termsAndConditions
7450
+ if (!basket) return [3 /*break*/, 3];
7451
+ co2PerItem = carHireVehicleAvailibility.co2PerItem, co2PerPassenger = carHireVehicleAvailibility.co2PerPassenger, displayRecord = carHireVehicleAvailibility.displayRecord, identifiers = carHireVehicleAvailibility.identifiers, sourceId = carHireVehicleAvailibility.sourceId;
7452
+ price = parseFloat((_b = (_a = displayRecord === null || displayRecord === void 0 ? void 0 : displayRecord.charges[0]) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : '0');
7453
+ termsAndConditions = this.getTermsAndCond(carHireVehicleAvailibility, carHireQuery);
7454
+ return [4 /*yield*/, this.basketService.addToBasket({
7455
+ adults: this.adults,
7456
+ basket: basket.id,
7457
+ service: sourceId.toString(),
7458
+ detail: {
7459
+ pickUpDatetime: displayRecord.pickup,
7460
+ dropOffDatetime: displayRecord.dropoff,
7461
+ pickUpLocation: {
7462
+ iata: this.locationType === exports.LocationTypes.Airport
7463
+ ? identifiers.locationCode
7464
+ : '',
7465
+ name: displayRecord.pickupLocation.name,
7466
+ address: displayRecord.pickupLocation.topLine + ", " + displayRecord.pickupLocation.city,
7467
+ postcode: displayRecord.pickupLocation.postCode
7468
+ },
7469
+ dropOffLocation: {
7470
+ iata: this.locationType === exports.LocationTypes.Airport
7471
+ ? identifiers.dropOffLocation
7472
+ : '',
7473
+ name: displayRecord.returnLocation.name,
7474
+ address: displayRecord.returnLocation.topLine + ", " + displayRecord.returnLocation.city,
7475
+ postcode: displayRecord.returnLocation.postCode
7312
7476
  },
7313
- price: price,
7314
- currency: 'GBP',
7315
- searchQuery: carHireQuery,
7316
- co2PerItem: co2PerItem,
7317
- co2PerPassenger: co2PerPassenger,
7318
- outboundDate: new Date(displayRecord.pickup).toISOString()
7319
- }, intBasket, this.searchService, this.travellers, carHireVehicleAvailibility.requiresReason)];
7477
+ car: {
7478
+ type: displayRecord.vehicle.type,
7479
+ manualTransmission: displayRecord.vehicle.transmission.includes(CarHireTransmission.Manual)
7480
+ },
7481
+ vendorName: displayRecord.vendor.name,
7482
+ identifiers: {
7483
+ dropOffLocation: identifiers.dropOffLocation,
7484
+ locationCode: identifiers.locationCode,
7485
+ locationName: identifiers.locationName,
7486
+ vehType: identifiers.vehType,
7487
+ vendor: identifiers.vendor
7488
+ },
7489
+ termsAndCond: termsAndConditions
7490
+ },
7491
+ price: price,
7492
+ currency: 'GBP',
7493
+ searchQuery: carHireQuery,
7494
+ co2PerItem: co2PerItem,
7495
+ co2PerPassenger: co2PerPassenger,
7496
+ outboundDate: new Date(displayRecord.pickup).toISOString()
7497
+ }, intBasket, this.searchService, this.travellers, carHireVehicleAvailibility.requiresReason)];
7498
+ case 2:
7499
+ whatHappened = _o.sent();
7500
+ if (whatHappened === exports.DifferentInvokdedUserReasons.research) {
7501
+ this.performSearch();
7320
7502
  }
7321
- return [2 /*return*/, Promise.resolve(false)];
7503
+ return [2 /*return*/, whatHappened];
7504
+ case 3: return [2 /*return*/, Promise.resolve(exports.DifferentInvokdedUserReasons.cancel)];
7322
7505
  }
7323
7506
  });
7324
7507
  });
@@ -7410,11 +7593,15 @@
7410
7593
  this.chosenVendor = fav.vendor;
7411
7594
  this.carType = fav.type;
7412
7595
  this.return_to_pickup = fav.airport.pickupCode == fav.airport.dropoffCode;
7413
- this.searchService.getAirportsList(fav.airport.pickupCode).subscribe(function (results) {
7596
+ this.searchService
7597
+ .getAirportsList(fav.airport.pickupCode)
7598
+ .subscribe(function (results) {
7414
7599
  _this.pickup_location = results.find(function (a) { return a.gateway == fav.airport.pickupCode; });
7415
7600
  });
7416
7601
  if (!this.return_to_pickup)
7417
- this.searchService.getAirportsList(fav.airport.dropoffCode).subscribe(function (results) {
7602
+ this.searchService
7603
+ .getAirportsList(fav.airport.dropoffCode)
7604
+ .subscribe(function (results) {
7418
7605
  _this.dropoff_location = results.find(function (a) { return a.gateway == fav.airport.dropoffCode; });
7419
7606
  });
7420
7607
  return [2 /*return*/];
@@ -7553,11 +7740,10 @@
7553
7740
  __extends(FlightEnterpriseSearch, _super);
7554
7741
  function FlightEnterpriseSearch(flightfetcher, helpers, userService, basketService, storageService, searchService, applyFlightRules, modalService) {
7555
7742
  var _o, _p;
7556
- var _this = _super.call(this, storageService, helpers) || this;
7743
+ var _this = _super.call(this, storageService, helpers, searchService) || this;
7557
7744
  _this.flightfetcher = flightfetcher;
7558
7745
  _this.userService = userService;
7559
7746
  _this.basketService = basketService;
7560
- _this.searchService = searchService;
7561
7747
  _this.applyFlightRules = applyFlightRules;
7562
7748
  _this.modalService = modalService;
7563
7749
  _this.type = ServiceType.Flight;
@@ -8264,6 +8450,7 @@
8264
8450
  inlegsCount: 0,
8265
8451
  dataSource: '',
8266
8452
  preferred: false,
8453
+ preferredMessage: '',
8267
8454
  outboundFlightNumber: '',
8268
8455
  operator: '',
8269
8456
  operatorFull: '',
@@ -8284,7 +8471,7 @@
8284
8471
  }
8285
8472
  // ! using a reduce because not all flights actually exist and we were seeing undefined in the flight list
8286
8473
  brands[brand].forEach(function (flightNum) {
8287
- var _a, _b;
8474
+ var _a, _b, _c, _d, _e, _f;
8288
8475
  var flight = groupedObject[flightNum];
8289
8476
  if (flight) {
8290
8477
  if (isOutBound || treatOutboundsAsOutbounds) {
@@ -8304,7 +8491,13 @@
8304
8491
  returnObject.maxPrice > maxprice
8305
8492
  ? returnObject.maxPrice
8306
8493
  : maxprice;
8307
- if ((_b = (_a = returnObject.classes[correctBrand]) === null || _a === void 0 ? void 0 : _a.flights) === null || _b === void 0 ? void 0 : _b.length) {
8494
+ returnObject.preferred =
8495
+ ((_a = _this._ruleActionSummary.journeyWhenSelected[flight.journeyHash]) === null || _a === void 0 ? void 0 : _a.companyPreferred) || ((_b = _this._ruleActionSummary.whenSelectedAlone[flight.journeyHash]) === null || _b === void 0 ? void 0 : _b.companyPreferred) ||
8496
+ false;
8497
+ returnObject.preferredMessage =
8498
+ ((_c = _this._ruleActionSummary.journeyWhenSelected[flight.journeyHash]) === null || _c === void 0 ? void 0 : _c.companyPreferredMessage) || ((_d = _this._ruleActionSummary.whenSelectedAlone[flight.journeyHash]) === null || _d === void 0 ? void 0 : _d.companyPreferredMessage) ||
8499
+ '';
8500
+ if ((_f = (_e = returnObject.classes[correctBrand]) === null || _e === void 0 ? void 0 : _e.flights) === null || _f === void 0 ? void 0 : _f.length) {
8308
8501
  returnObject.classes[correctBrand].flights.push(flight);
8309
8502
  returnObject.classes[correctBrand].minprice = Math.min(returnObject.classes[correctBrand].minprice, minprice);
8310
8503
  returnObject.classes[correctBrand].maxprice = Math.max(returnObject.classes[correctBrand].maxprice, maxprice);
@@ -8706,6 +8899,103 @@
8706
8899
  FlightEnterpriseSearch.prototype.updateFromPreviousSearches = function (_previousItems) {
8707
8900
  // Flights can not be search after other products so no defaults can be set.
8708
8901
  };
8902
+ FlightEnterpriseSearch.prototype.updateSearchFromExpiredBasketItem = function (basketItem) {
8903
+ var _this = this;
8904
+ var searchFlightsQuery = basketItem.searchQuery;
8905
+ if (searchFlightsQuery.outboundDate) {
8906
+ var outboundTimeWindow = searchFlightsQuery.outboundDepartureTimeWindow
8907
+ ? searchFlightsQuery.outboundDepartureTimeWindow
8908
+ : searchFlightsQuery.outboundArrivalTimeWindow;
8909
+ this.outBoundDate = this.convertRecentSearchDateTime(searchFlightsQuery.outboundDate, outboundTimeWindow);
8910
+ }
8911
+ if (searchFlightsQuery.returnDate) {
8912
+ var returnTimeWindow = searchFlightsQuery.returnDepartureTimeWindow
8913
+ ? searchFlightsQuery.returnDepartureTimeWindow
8914
+ : searchFlightsQuery.returnArrivalTimeWindow;
8915
+ this.inboundDate = this.convertRecentSearchDateTime(searchFlightsQuery.returnDate, returnTimeWindow);
8916
+ }
8917
+ this.fareType = searchFlightsQuery.fareType;
8918
+ this.maxConnections = searchFlightsQuery.maxConnections;
8919
+ if (searchFlightsQuery.outboundCabinClass) {
8920
+ this.cabinClass =
8921
+ searchFlightsQuery.outboundCabinClass;
8922
+ }
8923
+ if (searchFlightsQuery.returnCabinClass) {
8924
+ this.returnCabinClass =
8925
+ searchFlightsQuery.returnCabinClass;
8926
+ }
8927
+ this.includeNearbyAirports = searchFlightsQuery.includeNearbyAirports
8928
+ ? true
8929
+ : false;
8930
+ this.chosenSearchType = searchFlightsQuery.returnTrip
8931
+ ? exports.FlightSearchType.return
8932
+ : exports.FlightSearchType.oneWay;
8933
+ if (searchFlightsQuery.outboundDepartureTimeWindow) {
8934
+ this.outTimeCriteria = exports.TimeWindow.Depart;
8935
+ }
8936
+ else if (searchFlightsQuery.outboundArrivalTimeWindow) {
8937
+ this.outTimeCriteria = exports.TimeWindow.Arrive;
8938
+ }
8939
+ else {
8940
+ this.outTimeCriteria = exports.TimeWindow.Anytime;
8941
+ }
8942
+ if (searchFlightsQuery.returnDepartureTimeWindow) {
8943
+ this.inTimeCriteria = exports.TimeWindow.Depart;
8944
+ }
8945
+ else if (searchFlightsQuery.returnArrivalTimeWindow) {
8946
+ this.inTimeCriteria = exports.TimeWindow.Arrive;
8947
+ }
8948
+ else {
8949
+ this.inTimeCriteria = exports.TimeWindow.Anytime;
8950
+ }
8951
+ rxjs.combineLatest([
8952
+ this.searchService.getAirportByCode(searchFlightsQuery.originAirport),
8953
+ this.searchService.getAirportByCode(searchFlightsQuery.destinationAirport)
8954
+ ]).subscribe(function (_o) {
8955
+ var _p = __read(_o, 2), departLocation = _p[0], arriveLocation = _p[1];
8956
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
8957
+ if (departLocation && arriveLocation) {
8958
+ _this.departLocation = {
8959
+ destination: departLocation.iataMatch.name,
8960
+ gateway: departLocation.iataMatch.iata,
8961
+ terminals: _this.searchService.processTerminals(departLocation.iataMatch.terminals),
8962
+ country: (_b = (_a = departLocation.iataMatch) === null || _a === void 0 ? void 0 : _a.locationDetails) === null || _b === void 0 ? void 0 : _b.country,
8963
+ postcode: (_d = (_c = departLocation.iataMatch) === null || _c === void 0 ? void 0 : _c.locationDetails) === null || _d === void 0 ? void 0 : _d.postcode,
8964
+ countryCode: (_f = (_e = departLocation.iataMatch) === null || _e === void 0 ? void 0 : _e.locationDetails) === null || _f === void 0 ? void 0 : _f.countryCode
8965
+ };
8966
+ _this.arriveLocation = {
8967
+ destination: arriveLocation.iataMatch.name,
8968
+ gateway: arriveLocation.iataMatch.iata,
8969
+ terminals: _this.searchService.processTerminals(arriveLocation.iataMatch.terminals),
8970
+ country: (_h = (_g = arriveLocation.iataMatch) === null || _g === void 0 ? void 0 : _g.locationDetails) === null || _h === void 0 ? void 0 : _h.country,
8971
+ postcode: (_k = (_j = arriveLocation.iataMatch) === null || _j === void 0 ? void 0 : _j.locationDetails) === null || _k === void 0 ? void 0 : _k.postcode,
8972
+ countryCode: (_m = (_l = arriveLocation.iataMatch) === null || _l === void 0 ? void 0 : _l.locationDetails) === null || _m === void 0 ? void 0 : _m.countryCode
8973
+ };
8974
+ if (searchFlightsQuery.preferredCarriers) {
8975
+ var carriers = searchFlightsQuery.preferredCarriers;
8976
+ var preferredCarriers_2 = [];
8977
+ carriers.map(function (preferredCarry) {
8978
+ _this.searchService
8979
+ .getAirlinesList(preferredCarry)
8980
+ .subscribe(function (items) {
8981
+ items.map(function (item) {
8982
+ if (item.code === preferredCarry) {
8983
+ preferredCarriers_2.push(item);
8984
+ }
8985
+ });
8986
+ _this.preferredCarriers = preferredCarriers_2;
8987
+ });
8988
+ });
8989
+ }
8990
+ }
8991
+ });
8992
+ // add Travellers
8993
+ if (basketItem.users) {
8994
+ basketItem.users.forEach(function (user) {
8995
+ _this.searchService.addTraveller(user);
8996
+ });
8997
+ }
8998
+ };
8709
8999
  FlightEnterpriseSearch.prototype.getTotalBaggage = function (result) {
8710
9000
  var total = 0;
8711
9001
  var parsedAdditional = JSON.parse(result.additional);
@@ -8945,21 +9235,30 @@
8945
9235
  })));
8946
9236
  };
8947
9237
  var selectedRuleSummary = this._ruleActionSummary.dualSingleWhenSelected[(_b = this.selectedGroupFlight) === null || _b === void 0 ? void 0 : _b.journeyHash] || {};
9238
+ var hasField = function (flight, field, def) {
9239
+ return (_this.helpers.fieldFromObject(_this._ruleActionSummary, [
9240
+ 'journeyWhenSelected',
9241
+ flight.journeyHash,
9242
+ field
9243
+ ]) ||
9244
+ _this.helpers.fieldFromObject(_this._ruleActionSummary, [
9245
+ 'whenSelectedAlone',
9246
+ flight.journeyHash,
9247
+ field
9248
+ ]) ||
9249
+ _this.helpers.fieldFromObject(selectedRuleSummary, [
9250
+ flight.journeyHash,
9251
+ field
9252
+ ]) ||
9253
+ def);
9254
+ };
8948
9255
  var setSelected = function (flight) {
8949
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
9256
+ var _a;
8950
9257
  flight.selected = flight.uid === ((_a = _this.selectedGroupFlight) === null || _a === void 0 ? void 0 : _a.uid);
8951
- flight.unavailable =
8952
- ((_b = _this._ruleActionSummary.journeyWhenSelected[flight.journeyHash]) === null || _b === void 0 ? void 0 : _b.unavailable) || ((_c = _this._ruleActionSummary.whenSelectedAlone[flight.journeyHash]) === null || _c === void 0 ? void 0 : _c.unavailable) || ((_d = selectedRuleSummary[flight.journeyHash]) === null || _d === void 0 ? void 0 : _d.unavailable) ||
8953
- false;
8954
- flight.unavailableMessage =
8955
- ((_e = _this._ruleActionSummary.journeyWhenSelected[flight.journeyHash]) === null || _e === void 0 ? void 0 : _e.unavailableMessage) || ((_f = _this._ruleActionSummary.whenSelectedAlone[flight.journeyHash]) === null || _f === void 0 ? void 0 : _f.unavailableMessage) ||
8956
- '';
8957
- flight.requiresReason =
8958
- ((_g = _this._ruleActionSummary.journeyWhenSelected[flight.journeyHash]) === null || _g === void 0 ? void 0 : _g.requiresReason) || ((_h = _this._ruleActionSummary.whenSelectedAlone[flight.journeyHash]) === null || _h === void 0 ? void 0 : _h.requiresReason) || ((_j = selectedRuleSummary[flight.journeyHash]) === null || _j === void 0 ? void 0 : _j.requiresReason) ||
8959
- false;
8960
- flight.requiresReasonMessage =
8961
- ((_k = _this._ruleActionSummary.journeyWhenSelected[flight.journeyHash]) === null || _k === void 0 ? void 0 : _k.requiresReasonMessage) || ((_l = _this._ruleActionSummary.whenSelectedAlone[flight.journeyHash]) === null || _l === void 0 ? void 0 : _l.requiresReasonMessage) ||
8962
- '';
9258
+ flight.unavailable = hasField(flight, 'unavailable', false);
9259
+ flight.unavailableMessage = hasField(flight, 'unavailableMessage', '');
9260
+ flight.requiresReason = hasField(flight, 'requiresReason', false);
9261
+ flight.requiresReasonMessage = hasField(flight, 'requiresReasonMessage', '');
8963
9262
  return flight;
8964
9263
  };
8965
9264
  if (this.isGroupedFlights(this.fullResults)) {
@@ -9160,24 +9459,38 @@
9160
9459
  }, selectedFlight.outboundFlights[0].dateTimeDeparting);
9161
9460
  };
9162
9461
  FlightEnterpriseSearch.prototype.doBooking = function (intBasket, selectedFlight, schemaDetails, outboundDate, inboundDate) {
9163
- var sourceId = selectedFlight.sourceId, co2PerItem = selectedFlight.co2PerItem, co2PerPassenger = selectedFlight.co2PerPassenger, total = selectedFlight.total;
9164
- var booking = {
9165
- adults: this.adults,
9166
- basket: intBasket.id,
9167
- children: this.children,
9168
- co2PerItem: co2PerItem,
9169
- co2PerPassenger: co2PerPassenger,
9170
- currency: total.currency,
9171
- detail: schemaDetails,
9172
- price: total.price,
9173
- searchQuery: this.resultQuery,
9174
- service: sourceId.toString(),
9175
- outboundDate: outboundDate
9176
- };
9177
- if (inboundDate) {
9178
- booking.inboundDate = inboundDate;
9179
- }
9180
- this.basketService.addToBasket(booking, intBasket, this.searchService, this.travellers, selectedFlight.requiresReason);
9462
+ return __awaiter(this, void 0, void 0, function () {
9463
+ var sourceId, co2PerItem, co2PerPassenger, total, booking, whatHappened;
9464
+ return __generator(this, function (_o) {
9465
+ switch (_o.label) {
9466
+ case 0:
9467
+ sourceId = selectedFlight.sourceId, co2PerItem = selectedFlight.co2PerItem, co2PerPassenger = selectedFlight.co2PerPassenger, total = selectedFlight.total;
9468
+ booking = {
9469
+ adults: this.adults,
9470
+ basket: intBasket.id,
9471
+ children: this.children,
9472
+ co2PerItem: co2PerItem,
9473
+ co2PerPassenger: co2PerPassenger,
9474
+ currency: total.currency,
9475
+ detail: schemaDetails,
9476
+ price: total.price,
9477
+ searchQuery: this.resultQuery,
9478
+ service: sourceId.toString(),
9479
+ outboundDate: outboundDate
9480
+ };
9481
+ if (inboundDate) {
9482
+ booking.inboundDate = inboundDate;
9483
+ }
9484
+ return [4 /*yield*/, this.basketService.addToBasket(booking, intBasket, this.searchService, this.travellers, selectedFlight.requiresReason)];
9485
+ case 1:
9486
+ whatHappened = _o.sent();
9487
+ if (whatHappened === exports.DifferentInvokdedUserReasons.research) {
9488
+ this.performSearch();
9489
+ }
9490
+ return [2 /*return*/, whatHappened];
9491
+ }
9492
+ });
9493
+ });
9181
9494
  };
9182
9495
  FlightEnterpriseSearch.prototype.makeSchemaFlights = function (selectedFlight, flightGroup, groupIndex, segmentIndex) {
9183
9496
  return Object.assign(Object.assign({}, selectedFlight), { journeyInfo: {
@@ -9193,7 +9506,7 @@
9193
9506
  switch (_o.label) {
9194
9507
  case 0:
9195
9508
  if (flightQuote.unavailable) {
9196
- return [2 /*return*/, Promise.resolve(false)];
9509
+ return [2 /*return*/, Promise.resolve(exports.DifferentInvokdedUserReasons.cancel)];
9197
9510
  }
9198
9511
  return [4 /*yield*/, this.basketService.getDefaultBasket()];
9199
9512
  case 1:
@@ -9235,7 +9548,7 @@
9235
9548
  }
9236
9549
  return [2 /*return*/, this.basketService.addToBasket(booking, intBasket, this.searchService, this.travellers, flightQuote.requiresReason)];
9237
9550
  }
9238
- return [2 /*return*/, Promise.resolve(false)]; // TODO should this throw an error?
9551
+ return [2 /*return*/, Promise.resolve(exports.DifferentInvokdedUserReasons.cancel)]; // TODO should this throw an error?
9239
9552
  }
9240
9553
  });
9241
9554
  });
@@ -9247,27 +9560,31 @@
9247
9560
  FlightEnterpriseSearch.prototype._applyFilter = function () {
9248
9561
  this.applyFilters(this.currentFilters, this.currentSort);
9249
9562
  };
9250
- FlightEnterpriseSearch.prototype.openFlightFareRules = function (rules, flights) {
9563
+ FlightEnterpriseSearch.prototype.openFlightFareRules = function (rules, flights, options, flightDetail) {
9251
9564
  var _this = this;
9565
+ if (options === void 0) { options = null; }
9566
+ if (flightDetail === void 0) { flightDetail = null; }
9252
9567
  // first check if there are rules
9253
9568
  var doCall = !Object.values(rules).find(function (rule) { return rule.length; });
9254
9569
  if (doCall) {
9255
9570
  var rulesFromCall = this.searchService.getFlightFareRules(flights[0]);
9256
9571
  rulesFromCall.subscribe(function (data) {
9257
- _this.modalService.open(ModalTypes.ModalFlightFareComponent, null, {
9572
+ _this.modalService.open(ModalTypes.ModalFlightFareComponent, options, {
9258
9573
  rules: data.results[0],
9259
9574
  from: flights[0].originAirport,
9260
- to: flights[flights.length - 1].destinationAirport
9575
+ to: flights[flights.length - 1].destinationAirport,
9576
+ flight: flightDetail
9261
9577
  });
9262
9578
  }, function (err) {
9263
9579
  console.log(err);
9264
9580
  });
9265
9581
  }
9266
9582
  else {
9267
- this.modalService.open(ModalTypes.ModalFlightFareComponent, null, {
9583
+ this.modalService.open(ModalTypes.ModalFlightFareComponent, options, {
9268
9584
  rules: rules,
9269
9585
  from: flights[0].originAirport,
9270
- to: flights[flights.length - 1].destinationAirport
9586
+ to: flights[flights.length - 1].destinationAirport,
9587
+ flight: flightDetail
9271
9588
  });
9272
9589
  }
9273
9590
  };
@@ -9424,22 +9741,36 @@
9424
9741
  return __generator(this, function (_o) {
9425
9742
  switch (_o.label) {
9426
9743
  case 0:
9427
- this.chosenSearchType = fav.multiDestination ? exports.FlightSearchType.multiCity : fav.returnTrip ? exports.FlightSearchType.return : exports.FlightSearchType.oneWay;
9744
+ this.chosenSearchType = fav.multiDestination
9745
+ ? exports.FlightSearchType.multiCity
9746
+ : fav.returnTrip
9747
+ ? exports.FlightSearchType.return
9748
+ : exports.FlightSearchType.oneWay;
9428
9749
  if (!(this.chosenSearchType == exports.FlightSearchType.multiCity)) return [3 /*break*/, 2];
9429
9750
  return [4 /*yield*/, Promise.all(fav.multiDestination.map(function (a) { return __awaiter(_this, void 0, void 0, function () {
9430
9751
  var destination, _o, _p;
9431
9752
  return __generator(this, function (_q) {
9432
9753
  switch (_q.label) {
9433
9754
  case 0:
9434
- destination = { date: undefined, dest: undefined, orig: undefined };
9755
+ destination = {
9756
+ date: undefined,
9757
+ dest: undefined,
9758
+ orig: undefined
9759
+ };
9435
9760
  _o = destination;
9436
- return [4 /*yield*/, this.searchService.getAirportsList(a.orig).toPromise().then(function (origResults) {
9761
+ return [4 /*yield*/, this.searchService
9762
+ .getAirportsList(a.orig)
9763
+ .toPromise()
9764
+ .then(function (origResults) {
9437
9765
  return origResults.find(function (b) { return b.gateway == a.orig; });
9438
9766
  })];
9439
9767
  case 1:
9440
9768
  _o.orig = _q.sent();
9441
9769
  _p = destination;
9442
- return [4 /*yield*/, this.searchService.getAirportsList(a.dest).toPromise().then(function (destResults) {
9770
+ return [4 /*yield*/, this.searchService
9771
+ .getAirportsList(a.dest)
9772
+ .toPromise()
9773
+ .then(function (destResults) {
9443
9774
  return destResults.find(function (b) { return b.gateway == a.dest; });
9444
9775
  })];
9445
9776
  case 2:
@@ -9453,19 +9784,26 @@
9453
9784
  this.multiDestination = multi;
9454
9785
  return [3 /*break*/, 3];
9455
9786
  case 2:
9456
- this.searchService.getAirportsList(fav.originAirport).subscribe(function (results) {
9787
+ this.searchService
9788
+ .getAirportsList(fav.originAirport)
9789
+ .subscribe(function (results) {
9457
9790
  _this.departLocation = results.find(function (a) { return a.gateway == fav.originAirport; });
9458
9791
  });
9459
- this.searchService.getAirportsList(fav.destinationAirport).subscribe(function (results) {
9792
+ this.searchService
9793
+ .getAirportsList(fav.destinationAirport)
9794
+ .subscribe(function (results) {
9460
9795
  _this.arriveLocation = results.find(function (a) { return a.gateway == fav.destinationAirport; });
9461
9796
  });
9462
9797
  _o.label = 3;
9463
9798
  case 3:
9464
9799
  this.cabinClass = fav.outboundCabinClass[0];
9465
- this.returnCabinClass = this.chosenSearchType != exports.FlightSearchType.return ? null : fav.returnCabinClass[0];
9800
+ this.returnCabinClass =
9801
+ this.chosenSearchType != exports.FlightSearchType.return
9802
+ ? null
9803
+ : fav.returnCabinClass[0];
9466
9804
  this.includeNearbyAirports = fav.includeNearbyAirports;
9467
- this.adults = fav.passengers.filter(function (a) { return a.type == "ADULT"; }).length;
9468
- this.children = fav.passengers.filter(function (a) { return a.type == "CHILD"; }).length;
9805
+ this.adults = fav.passengers.filter(function (a) { return a.type == 'ADULT'; }).length;
9806
+ this.children = fav.passengers.filter(function (a) { return a.type == 'CHILD'; }).length;
9469
9807
  return [2 /*return*/];
9470
9808
  }
9471
9809
  });
@@ -9499,6 +9837,8 @@
9499
9837
  URLS["CONFIRMA_INFO_URL"] = "/confermainfo/Info.aspx?mode=hotel&key=MICROSSABS&id=";
9500
9838
  URLS["RECOVER_PASSWORD_URL"] = "password/getResetToken";
9501
9839
  URLS["RESET_PASSWORD"] = "password/resetByToken";
9840
+ URLS["BECOME_USER"] = "startUserSupport";
9841
+ URLS["END_BECOME_USER"] = "endUserSupport";
9502
9842
  URLS["ADMIN_USER_PANEL"] = "https://admin-staging.ctmlightning.co.uk/user";
9503
9843
  })(exports.URLS || (exports.URLS = {}));
9504
9844
 
@@ -9512,6 +9852,7 @@
9512
9852
  this.extra = [];
9513
9853
  this.hotelName = '';
9514
9854
  this.breakfastType = [];
9855
+ this.accessibleRoomType = [];
9515
9856
  }
9516
9857
  return HotelFilters;
9517
9858
  }());
@@ -9530,13 +9871,12 @@
9530
9871
  var HotelEnterpriseSearch = /** @class */ (function (_super) {
9531
9872
  __extends(HotelEnterpriseSearch, _super);
9532
9873
  function HotelEnterpriseSearch(hotelFetcher, helpers, userService, environment, avaliabilityService, basketService, storageService, searchService, httpCallService, quickListFetcher, getRailStationFetcher, applyHotelRulesFetcher) {
9533
- var _this = _super.call(this, storageService, helpers) || this;
9874
+ var _this = _super.call(this, storageService, helpers, searchService) || this;
9534
9875
  _this.hotelFetcher = hotelFetcher;
9535
9876
  _this.userService = userService;
9536
9877
  _this.environment = environment;
9537
9878
  _this.avaliabilityService = avaliabilityService;
9538
9879
  _this.basketService = basketService;
9539
- _this.searchService = searchService;
9540
9880
  _this.httpCallService = httpCallService;
9541
9881
  _this.quickListFetcher = quickListFetcher;
9542
9882
  _this.getRailStationFetcher = getRailStationFetcher;
@@ -9545,6 +9885,7 @@
9545
9885
  _this.location_types = new rxjs.BehaviorSubject([]);
9546
9886
  _this.offices = new rxjs.BehaviorSubject([]);
9547
9887
  _this.lastActivePage = new rxjs.BehaviorSubject(null);
9888
+ _this.jitRulesReceived = new rxjs.BehaviorSubject(false);
9548
9889
  _this.galleries = {};
9549
9890
  _this.occupied = 0;
9550
9891
  _this.results_details = {
@@ -9607,7 +9948,8 @@
9607
9948
  _this.hasPreferred(hotel) &&
9608
9949
  _this.breakfastTypeFilter(hotel) &&
9609
9950
  _this.getExtraFilter(hotel) &&
9610
- _this.getAmenitiesFilter(hotel));
9951
+ _this.getAmenitiesFilter(hotel) &&
9952
+ _this.accessibleRoomTypeFilter(hotel));
9611
9953
  }); };
9612
9954
  _this.results.next(_this.resultsFilterMethod(_this.fullResults));
9613
9955
  };
@@ -9641,6 +9983,7 @@
9641
9983
  _this.results_details.chains.add(hotelResult.group);
9642
9984
  });
9643
9985
  _this.fullResults = results;
9986
+ _this.jitRulesReceived.next(false);
9644
9987
  _this.results.next(results);
9645
9988
  _this._isValid();
9646
9989
  _this.userService.changeUser.subscribe(function (user) {
@@ -10015,6 +10358,15 @@
10015
10358
  }
10016
10359
  return hotel;
10017
10360
  });
10361
+ travleResults.forEach(function (hotel) {
10362
+ if (hotel.availableRates) {
10363
+ hotel.jitRemoveResultRule = false;
10364
+ _this.jitRulesReceived.next(true);
10365
+ }
10366
+ else {
10367
+ hotel.jitRemoveResultRule = true;
10368
+ }
10369
+ });
10018
10370
  _this.results.next(travleResults);
10019
10371
  });
10020
10372
  };
@@ -10119,7 +10471,7 @@
10119
10471
  // Calculating Occupancy
10120
10472
  var occupancy = this.no_of_occupants / this.no_of_rooms;
10121
10473
  if (!(occupancy === 1 || occupancy === 2)) {
10122
- this.validationMessages.push('Occupants per room must be 1 or 2, if you have an odd number of travellers (greater than one), the no of rooms must be equal');
10474
+ this.validationMessages.push('Occupants per room must be 1 or 2; if you have an odd number of travellers (greater than one); the no of rooms must be equal');
10123
10475
  }
10124
10476
  console.log(this.validationMessages);
10125
10477
  this.isValid.next(this.validationMessages.length === 0);
@@ -10127,6 +10479,7 @@
10127
10479
  };
10128
10480
  HotelEnterpriseSearch.prototype.startSearch = function () {
10129
10481
  this.results.next([]);
10482
+ this.jitRulesReceived.next(false);
10130
10483
  this.avaliabilityService.reset();
10131
10484
  if (this.isValid.value) {
10132
10485
  this._originalUserSearch = Object.freeze(this.helpers.clone(this.tempParams));
@@ -10410,31 +10763,40 @@
10410
10763
  HotelEnterpriseSearch.prototype.breakfastTypeFilter = function (hotel) {
10411
10764
  if (!this.filters.breakfastType.length)
10412
10765
  return true;
10413
- var hotelObject = this.avaliabilityService.getAvailabilityForId(this.makeHotelAvalilityObject(hotel), hotel);
10414
- if (!hotelObject && !hotelObject.value)
10766
+ var hotelObjectValue = this.getHotelObjectValue(hotel);
10767
+ if (!hotelObjectValue || !(hotelObjectValue === null || hotelObjectValue === void 0 ? void 0 : hotelObjectValue.rooms))
10415
10768
  return false;
10416
- var hotelObjectValue = hotelObject.value;
10417
10769
  var isBreakfastIncluded = this.filters.breakfastType.includes(exports.SearchHandler.BREAKFAST_INCLUDED);
10418
10770
  var isBreakfastExcluded = this.filters.breakfastType.includes(exports.SearchHandler.BREAKFAST_NOT_INCLUDED);
10419
- if (hotelObjectValue === null || hotelObjectValue === void 0 ? void 0 : hotelObjectValue.rooms) {
10420
- var breakfastMatches = hotelObjectValue.rooms.filter(function (rooms) {
10421
- if (isBreakfastIncluded && isBreakfastExcluded) {
10422
- return rooms;
10423
- }
10424
- else if (isBreakfastIncluded) {
10425
- return (rooms.rateDescription.match(includedExpression) &&
10426
- !rooms.rateDescription.match(excludedExpression));
10427
- }
10428
- else if (isBreakfastExcluded) {
10429
- return (!rooms.rateDescription.match(includedExpression) ||
10430
- rooms.rateDescription.match(excludedExpression));
10431
- }
10432
- });
10433
- return !!breakfastMatches.length;
10434
- }
10435
- else {
10771
+ var breakfastMatches = hotelObjectValue.rooms.filter(function (rooms) {
10772
+ if (isBreakfastIncluded && isBreakfastExcluded) {
10773
+ return rooms;
10774
+ }
10775
+ else if (isBreakfastIncluded) {
10776
+ return (rooms.rateDescription.match(includedExpression) &&
10777
+ !rooms.rateDescription.match(excludedExpression));
10778
+ }
10779
+ else if (isBreakfastExcluded) {
10780
+ return (!rooms.rateDescription.match(includedExpression) ||
10781
+ rooms.rateDescription.match(excludedExpression));
10782
+ }
10783
+ });
10784
+ return !!breakfastMatches.length;
10785
+ };
10786
+ HotelEnterpriseSearch.prototype.accessibleRoomTypeFilter = function (hotel) {
10787
+ if (!this.filters.accessibleRoomType.length)
10788
+ return true;
10789
+ var hotelObjectValue = this.getHotelObjectValue(hotel);
10790
+ if (!hotelObjectValue || !(hotelObjectValue === null || hotelObjectValue === void 0 ? void 0 : hotelObjectValue.rooms))
10436
10791
  return false;
10437
- }
10792
+ var matches = hotelObjectValue.rooms.filter(function (rooms) { return rooms.rateDescription.match(includedAccessibilityExpression) ||
10793
+ rooms.roomDescription.match(includedAccessibilityExpression) ||
10794
+ rooms.roomType.match(includedAccessibilityExpression); });
10795
+ return !!matches.length;
10796
+ };
10797
+ HotelEnterpriseSearch.prototype.getHotelObjectValue = function (hotel) {
10798
+ var hotelObject = this.avaliabilityService.getAvailabilityForId(this.makeHotelAvalilityObject(hotel), hotel);
10799
+ return !hotelObject && !hotelObject.value ? null : hotelObject.value;
10438
10800
  };
10439
10801
  HotelEnterpriseSearch.prototype.byMostExpensive = function () {
10440
10802
  this.sortByPrice(false);
@@ -10547,6 +10909,81 @@
10547
10909
  this.localFilters.hotelName = '';
10548
10910
  this.localFilters.breakfastType = [];
10549
10911
  };
10912
+ HotelEnterpriseSearch.prototype.updateSearchFromExpiredBasketItem = function (basketItem) {
10913
+ var _this = this;
10914
+ var _a, _b, _c, _d;
10915
+ var searchHotelQuery = basketItem.searchQuery;
10916
+ this.currency = searchHotelQuery.currency;
10917
+ this.distance = searchHotelQuery.distance;
10918
+ this.no_of_rooms = searchHotelQuery.rooms;
10919
+ this.checkin_date = moment__default['default'](searchHotelQuery.startDate);
10920
+ this.checkout_date = moment__default['default'](searchHotelQuery.endDate);
10921
+ this.hotel_name = searchHotelQuery.hotelName;
10922
+ if (searchHotelQuery.groupName) {
10923
+ this.hotel_chain = {
10924
+ name: searchHotelQuery.groupName
10925
+ };
10926
+ }
10927
+ if (searchHotelQuery.iata) {
10928
+ this.location_type_select = exports.LocationTypes.Airport;
10929
+ this.searchService
10930
+ .getAirportByCode(searchHotelQuery.iata)
10931
+ .subscribe(function (iata) {
10932
+ var airport = {
10933
+ airport: {
10934
+ gateway: iata.iataMatch.iata
10935
+ }
10936
+ };
10937
+ _this.location = Object.assign(Object.assign({}, airport), iata.iataMatch);
10938
+ });
10939
+ }
10940
+ else if (searchHotelQuery.latitude && searchHotelQuery.longitude) {
10941
+ this.location_type_select = exports.LocationTypes.City;
10942
+ this.location = {
10943
+ name: ((_b = (_a = basketItem.detail) === null || _a === void 0 ? void 0 : _a.hotelAaddress) === null || _b === void 0 ? void 0 : _b.town) ? (_d = (_c = basketItem.detail) === null || _c === void 0 ? void 0 : _c.hotelAaddress) === null || _d === void 0 ? void 0 : _d.town : '',
10944
+ latitude: searchHotelQuery.latitude,
10945
+ longitude: searchHotelQuery.longitude
10946
+ };
10947
+ }
10948
+ else if (searchHotelQuery.postOrZipCode) {
10949
+ this.location_type_select = exports.LocationTypes.Postcode;
10950
+ this.postcode = {
10951
+ name: searchHotelQuery.postOrZipCode,
10952
+ type: exports.LocationTypes.Postcode
10953
+ };
10954
+ }
10955
+ else if (searchHotelQuery.officeId) {
10956
+ this.location_type_select = exports.LocationTypes.Office;
10957
+ this.searchService
10958
+ .getOffice(searchHotelQuery.officeId)
10959
+ .pipe(operators.take(1))
10960
+ .subscribe(function (office) {
10961
+ _this.office = {
10962
+ id: office.id,
10963
+ name: office.name
10964
+ };
10965
+ });
10966
+ }
10967
+ else if (searchHotelQuery.trainStationCode) {
10968
+ this.location_type_select = exports.LocationTypes.TrainStation;
10969
+ this.getRailStationByCode(searchHotelQuery.trainStationCode).subscribe(function (trainsStation) {
10970
+ _this.trainsStation = Object.assign(Object.assign({}, trainsStation), { type: exports.LocationTypes.TrainStation });
10971
+ });
10972
+ }
10973
+ else if (searchHotelQuery.countryCode) {
10974
+ this.location_type_select = exports.LocationTypes.Shortlist;
10975
+ this.country = {
10976
+ cCode: searchHotelQuery.countryCode,
10977
+ cName: ''
10978
+ };
10979
+ }
10980
+ // add Travellers
10981
+ if (basketItem.users) {
10982
+ basketItem.users.forEach(function (user) {
10983
+ _this.searchService.addTraveller(user);
10984
+ });
10985
+ }
10986
+ };
10550
10987
  HotelEnterpriseSearch.prototype.updateFromPreviousSearches = function (previousItems) {
10551
10988
  var _a, _b;
10552
10989
  console.log('PREPOPULATING HOTEL FORM');
@@ -10754,7 +11191,7 @@
10754
11191
  };
10755
11192
  HotelEnterpriseSearch.prototype.addHotelRoomToBasket = function (hotel, hotelRoom, hotelQuery, travellers) {
10756
11193
  return __awaiter(this, void 0, void 0, function () {
10757
- var searchQuery, detailRooms, intBasket, basket, paxPerRoom, roomArray_1, numberToSplit_1, bookedTravellersChunks_1, hotelAaddress_1, termsAndConditions_1;
11194
+ var searchQuery, detailRooms, intBasket, basket, paxPerRoom, roomArray, numberToSplit_1, bookedTravellersChunks_1, hotelAaddress_1, termsAndConditions_1;
10758
11195
  var _this = this;
10759
11196
  return __generator(this, function (_g) {
10760
11197
  switch (_g.label) {
@@ -10763,7 +11200,7 @@
10763
11200
  console.log(hotelRoom);
10764
11201
  console.log(hotelQuery);
10765
11202
  if (hotel.unavailable) {
10766
- return [2 /*return*/, Promise.resolve(false)];
11203
+ return [2 /*return*/, exports.DifferentInvokdedUserReasons.cancel];
10767
11204
  }
10768
11205
  // modify the 'startDate' and 'endDate' properties to have ISO format
10769
11206
  hotelQuery.startDate = new Date(hotelQuery.startDate).toISOString();
@@ -10786,49 +11223,67 @@
10786
11223
  basket = intBasket === null || intBasket === void 0 ? void 0 : intBasket.subject.value;
10787
11224
  if (basket) {
10788
11225
  paxPerRoom = this.tempParams.no_of_occupants;
10789
- roomArray_1 = new Array(this.tempParams.no_of_rooms).fill('TEST');
11226
+ roomArray = new Array(this.tempParams.no_of_rooms).fill('TEST');
10790
11227
  numberToSplit_1 = this.tempParams.no_of_rooms === paxPerRoom ? 1 : 2;
10791
11228
  bookedTravellersChunks_1 = ___default['default'].chunk(this.travellers, numberToSplit_1);
10792
11229
  hotelAaddress_1 = hotel.address;
10793
11230
  termsAndConditions_1 = this.getTermsAndCond(hotelRoom, hotelQuery);
10794
11231
  // bookedTravellersChunks.forEach((chunk: Traveller[], index: number) => {
10795
- roomArray_1.forEach(function (chunk, index) {
10796
- _this.basketService.addToBasket({
10797
- adults: numberToSplit_1,
10798
- basket: basket.id,
10799
- service: hotel.sourceId.toString(),
10800
- detail: {
10801
- hotelAddress: {
10802
- streetName: hotelAaddress_1.addressLine1,
10803
- town: hotelAaddress_1.addressLine2,
10804
- county: hotelAaddress_1.addressLine3,
10805
- postcode: hotelAaddress_1.postOrZipCode,
10806
- countryCode: hotelAaddress_1.countryCode
10807
- },
10808
- hotelDescription: hotel.group,
10809
- hotelId: hotel.id,
10810
- hotelName: hotel.name,
10811
- // this should always be 1 as we book 1 room as a time
10812
- numberOfRooms: 1,
10813
- rooms: detailRooms,
10814
- termsAndCond: termsAndConditions_1
10815
- },
10816
- // no longer * no of rooms as each room is added 1 by 1
10817
- price: hotelRoom.total,
10818
- currency: hotelRoom.currencyCode,
10819
- searchQuery: searchQuery,
10820
- outboundDate: hotelQuery.startDate
10821
- }, intBasket, _this.searchService,
10822
- // this is an array of 1 or 2 travellers which go in 1 room
10823
- // chunk
10824
- bookedTravellersChunks_1[index] || [], hotelRoom.requiresReason);
10825
- // if (index === bookedTravellersChunks.length - 1) {
10826
- if (index === roomArray_1.length - 1) {
10827
- return Promise.resolve(true);
10828
- }
10829
- });
11232
+ return [2 /*return*/, roomArray.reduce(function (current, chunk, index) { return __awaiter(_this, void 0, void 0, function () {
11233
+ var wh;
11234
+ return __generator(this, function (_g) {
11235
+ switch (_g.label) {
11236
+ case 0: return [4 /*yield*/, current];
11237
+ case 1:
11238
+ switch (_g.sent()) {
11239
+ case exports.DifferentInvokdedUserReasons.cancel:
11240
+ return [2 /*return*/, exports.DifferentInvokdedUserReasons.cancel];
11241
+ case exports.DifferentInvokdedUserReasons.research:
11242
+ return [2 /*return*/, exports.DifferentInvokdedUserReasons.research];
11243
+ case exports.DifferentInvokdedUserReasons.continue:
11244
+ case exports.DifferentInvokdedUserReasons.newBasket:
11245
+ break;
11246
+ }
11247
+ return [4 /*yield*/, this.basketService.addToBasket({
11248
+ adults: numberToSplit_1,
11249
+ basket: basket.id,
11250
+ service: hotel.sourceId.toString(),
11251
+ detail: {
11252
+ hotelAddress: {
11253
+ streetName: hotelAaddress_1.addressLine1,
11254
+ town: hotelAaddress_1.addressLine2,
11255
+ county: hotelAaddress_1.addressLine3,
11256
+ postcode: hotelAaddress_1.postOrZipCode,
11257
+ countryCode: hotelAaddress_1.countryCode
11258
+ },
11259
+ hotelDescription: hotel.group,
11260
+ hotelId: hotel.id,
11261
+ hotelName: hotel.name,
11262
+ // this should always be 1 as we book 1 room as a time
11263
+ numberOfRooms: 1,
11264
+ rooms: detailRooms,
11265
+ termsAndCond: termsAndConditions_1
11266
+ },
11267
+ // no longer * no of rooms as each room is added 1 by 1
11268
+ price: hotelRoom.total,
11269
+ currency: hotelRoom.currencyCode,
11270
+ searchQuery: searchQuery,
11271
+ outboundDate: hotelQuery.startDate
11272
+ }, intBasket, this.searchService,
11273
+ // this is an array of 1 or 2 travellers which go in 1 room
11274
+ // chunk
11275
+ bookedTravellersChunks_1[index] || [], hotelRoom.requiresReason)];
11276
+ case 2:
11277
+ wh = _g.sent();
11278
+ if (wh === exports.DifferentInvokdedUserReasons.research) {
11279
+ this.performSearch();
11280
+ }
11281
+ return [2 /*return*/, wh];
11282
+ }
11283
+ });
11284
+ }); }, exports.DifferentInvokdedUserReasons.continue)];
10830
11285
  }
10831
- return [2 /*return*/, Promise.resolve(false)];
11286
+ return [2 /*return*/, exports.DifferentInvokdedUserReasons.cancel];
10832
11287
  }
10833
11288
  });
10834
11289
  });
@@ -10880,7 +11335,12 @@
10880
11335
  this.no_of_rooms = fav.rooms;
10881
11336
  this.distance = fav.distance;
10882
11337
  this.currency = fav.currency;
10883
- location = { latitude: fav.latitude, longitude: fav.longitude, countryCode: fav.countryCode, name: fav.cityName };
11338
+ location = {
11339
+ latitude: fav.latitude,
11340
+ longitude: fav.longitude,
11341
+ countryCode: fav.countryCode,
11342
+ name: fav.cityName
11343
+ };
10884
11344
  if (fav.trainStationCode)
10885
11345
  location.type = exports.LocationTypes.TrainStation;
10886
11346
  else if (fav.officeId)
@@ -10909,10 +11369,9 @@
10909
11369
  var LoungesEnterpriseSearch = /** @class */ (function (_super) {
10910
11370
  __extends(LoungesEnterpriseSearch, _super);
10911
11371
  function LoungesEnterpriseSearch(loungefetcher, helpers, basketService, storageService, searchService) {
10912
- var _this = _super.call(this, storageService, helpers) || this;
11372
+ var _this = _super.call(this, storageService, helpers, searchService) || this;
10913
11373
  _this.loungefetcher = loungefetcher;
10914
11374
  _this.basketService = basketService;
10915
- _this.searchService = searchService;
10916
11375
  _this.type = ServiceType.Lounge;
10917
11376
  _this.terminals = new rxjs.BehaviorSubject([]);
10918
11377
  _this._flightNumber = null;
@@ -11241,55 +11700,89 @@
11241
11700
  }
11242
11701
  }
11243
11702
  };
11703
+ LoungesEnterpriseSearch.prototype.updateSearchFromExpiredBasketItem = function (basketItem) {
11704
+ var _this = this;
11705
+ var searchLoungesQuery = basketItem.searchQuery;
11706
+ if (searchLoungesQuery) {
11707
+ this.arrivalDatetime = moment__default['default'](searchLoungesQuery.arrivalDatetime);
11708
+ this.terminal = searchLoungesQuery.terminal;
11709
+ this.searchService
11710
+ .getAirportByCode(searchLoungesQuery.locationCode)
11711
+ .subscribe(function (airport) {
11712
+ var _a, _b, _c, _d, _e, _f;
11713
+ if (airport) {
11714
+ _this.locationCode = {
11715
+ country: (_b = (_a = airport.iataMatch) === null || _a === void 0 ? void 0 : _a.locationDetails) === null || _b === void 0 ? void 0 : _b.country,
11716
+ countryCode: (_d = (_c = airport.iataMatch) === null || _c === void 0 ? void 0 : _c.locationDetails) === null || _d === void 0 ? void 0 : _d.countryCode,
11717
+ destination: airport.iataMatch.name,
11718
+ gateway: airport.iataMatch.iata,
11719
+ postcode: (_f = (_e = airport.iataMatch) === null || _e === void 0 ? void 0 : _e.locationDetails) === null || _f === void 0 ? void 0 : _f.postcode,
11720
+ terminals: _this.searchService.processTerminals(airport.iataMatch.terminals)
11721
+ };
11722
+ }
11723
+ });
11724
+ }
11725
+ // add Travellers
11726
+ if (basketItem.users) {
11727
+ basketItem.users.forEach(function (user) {
11728
+ _this.searchService.addTraveller(user);
11729
+ });
11730
+ }
11731
+ };
11244
11732
  LoungesEnterpriseSearch.prototype.addLoungeToBasket = function (loungeQuote, loungeQuery) {
11245
11733
  var _a;
11246
11734
  return __awaiter(this, void 0, void 0, function () {
11247
- var intBasket, basket, termsAndConditions;
11735
+ var intBasket, basket, termsAndConditions, whatHappened;
11248
11736
  return __generator(this, function (_g) {
11249
11737
  switch (_g.label) {
11250
11738
  case 0:
11251
11739
  if (loungeQuote.unavailable) {
11252
- return [2 /*return*/, Promise.resolve(false)];
11740
+ return [2 /*return*/, Promise.resolve(exports.DifferentInvokdedUserReasons.cancel)];
11253
11741
  }
11254
11742
  return [4 /*yield*/, this.basketService.getDefaultBasket()];
11255
11743
  case 1:
11256
11744
  intBasket = _g.sent();
11257
11745
  basket = intBasket === null || intBasket === void 0 ? void 0 : intBasket.subject.value;
11258
11746
  termsAndConditions = this.getTermsAndCond(loungeQuote);
11259
- if (basket) {
11260
- return [2 /*return*/, this.basketService.addToBasket({
11261
- adults: loungeQuery.adults,
11262
- children: loungeQuery.children,
11263
- infants: loungeQuery.infants,
11264
- basket: basket.id,
11265
- service: loungeQuote.sourceId.toString(),
11266
- detail: {
11267
- arrivalDatetime: loungeQuery.arrivalDatetime.format(),
11268
- locationCode: loungeQuote.code,
11269
- name: loungeQuote.name,
11270
- airportIata: loungeQuery === null || loungeQuery === void 0 ? void 0 : loungeQuery.locationCode,
11271
- logo: loungeQuote.lounge.logo,
11272
- introduction: loungeQuote.lounge.introduction,
11273
- covidCopy: loungeQuote.lounge.misc.covidCopy,
11274
- cancellationInfo: loungeQuote.lounge.cancellationInfo,
11275
- admendmentsInfo: loungeQuote.lounge.amendmentsInfo,
11276
- checkInInfo: loungeQuote.lounge.checkInInfo,
11277
- dressCode: loungeQuote.lounge.dressCode,
11278
- foodAndBeverage: loungeQuote.lounge.foodAndBeverage,
11279
- whatsIncludedFood: loungeQuote.lounge.whatsIncludedFood,
11280
- whatsIncludedDrinks: loungeQuote.lounge.whatsIncludedDrinks,
11281
- whatsIncludedExtras: loungeQuote.lounge.whatsIncludedExtras,
11282
- groupInfo: loungeQuote.lounge.groupInfo,
11283
- terminal: (_a = loungeQuote.lounge.terminal) === null || _a === void 0 ? void 0 : _a.toString(),
11284
- termsAndCond: termsAndConditions
11285
- },
11286
- price: loungeQuote.price,
11287
- currency: loungeQuote.currency,
11288
- searchQuery: loungeQuery,
11289
- outboundDate: loungeQuery.arrivalDatetime.format()
11290
- }, intBasket, this.searchService, this.travellers, loungeQuote.requiresReason)];
11747
+ if (!basket) return [3 /*break*/, 3];
11748
+ return [4 /*yield*/, this.basketService.addToBasket({
11749
+ adults: loungeQuery.adults,
11750
+ children: loungeQuery.children,
11751
+ infants: loungeQuery.infants,
11752
+ basket: basket.id,
11753
+ service: loungeQuote.sourceId.toString(),
11754
+ detail: {
11755
+ arrivalDatetime: loungeQuery.arrivalDatetime.format(),
11756
+ locationCode: loungeQuote.code,
11757
+ name: loungeQuote.name,
11758
+ airportIata: loungeQuery === null || loungeQuery === void 0 ? void 0 : loungeQuery.locationCode,
11759
+ logo: loungeQuote.lounge.logo,
11760
+ introduction: loungeQuote.lounge.introduction,
11761
+ covidCopy: loungeQuote.lounge.misc.covidCopy,
11762
+ cancellationInfo: loungeQuote.lounge.cancellationInfo,
11763
+ admendmentsInfo: loungeQuote.lounge.amendmentsInfo,
11764
+ checkInInfo: loungeQuote.lounge.checkInInfo,
11765
+ dressCode: loungeQuote.lounge.dressCode,
11766
+ foodAndBeverage: loungeQuote.lounge.foodAndBeverage,
11767
+ whatsIncludedFood: loungeQuote.lounge.whatsIncludedFood,
11768
+ whatsIncludedDrinks: loungeQuote.lounge.whatsIncludedDrinks,
11769
+ whatsIncludedExtras: loungeQuote.lounge.whatsIncludedExtras,
11770
+ groupInfo: loungeQuote.lounge.groupInfo,
11771
+ terminal: (_a = loungeQuote.lounge.terminal) === null || _a === void 0 ? void 0 : _a.toString(),
11772
+ termsAndCond: termsAndConditions
11773
+ },
11774
+ price: loungeQuote.price,
11775
+ currency: loungeQuote.currency,
11776
+ searchQuery: loungeQuery,
11777
+ outboundDate: loungeQuery.arrivalDatetime.format()
11778
+ }, intBasket, this.searchService, this.travellers, loungeQuote.requiresReason)];
11779
+ case 2:
11780
+ whatHappened = _g.sent();
11781
+ if (whatHappened === exports.DifferentInvokdedUserReasons.research) {
11782
+ this.performSearch();
11291
11783
  }
11292
- return [2 /*return*/, Promise.resolve(false)]; // TODO should this throw an error?
11784
+ return [2 /*return*/, whatHappened];
11785
+ case 3: return [2 /*return*/, exports.DifferentInvokdedUserReasons.cancel]; // TODO should this throw an error?
11293
11786
  }
11294
11787
  });
11295
11788
  });
@@ -11409,10 +11902,9 @@
11409
11902
  var ParkingEnterpriseSearch = /** @class */ (function (_super) {
11410
11903
  __extends(ParkingEnterpriseSearch, _super);
11411
11904
  function ParkingEnterpriseSearch(parkingfetcher, helpers, basketService, storageService, searchService) {
11412
- var _this = _super.call(this, storageService, helpers) || this;
11905
+ var _this = _super.call(this, storageService, helpers, searchService) || this;
11413
11906
  _this.parkingfetcher = parkingfetcher;
11414
11907
  _this.basketService = basketService;
11415
- _this.searchService = searchService;
11416
11908
  _this.type = ServiceType.Parking;
11417
11909
  _this.terminals = new rxjs.BehaviorSubject([]);
11418
11910
  _this.listViewToggle = new rxjs.BehaviorSubject(null);
@@ -11812,6 +12304,35 @@
11812
12304
  }
11813
12305
  this.results.next(results);
11814
12306
  };
12307
+ ParkingEnterpriseSearch.prototype.updateSearchFromExpiredBasketItem = function (basketItem) {
12308
+ var _this = this;
12309
+ var searchParkingQuery = basketItem.searchQuery;
12310
+ this.arrivalDatetime = moment__default['default'](searchParkingQuery.arrivalDatetime);
12311
+ this.departDatetime = moment__default['default'](searchParkingQuery.departDatetime);
12312
+ this.outFlightNumber = searchParkingQuery.outFlightNumber;
12313
+ this.terminal = searchParkingQuery.terminal;
12314
+ this.searchService
12315
+ .getAirportByCode(searchParkingQuery.locationCode)
12316
+ .subscribe(function (airport) {
12317
+ var _a, _b, _c, _d, _e, _f;
12318
+ if (airport) {
12319
+ _this.locationCode = {
12320
+ country: (_b = (_a = airport.iataMatch) === null || _a === void 0 ? void 0 : _a.locationDetails) === null || _b === void 0 ? void 0 : _b.country,
12321
+ countryCode: (_d = (_c = airport.iataMatch) === null || _c === void 0 ? void 0 : _c.locationDetails) === null || _d === void 0 ? void 0 : _d.countryCode,
12322
+ destination: airport.iataMatch.name,
12323
+ gateway: airport.iataMatch.iata,
12324
+ postcode: (_f = (_e = airport.iataMatch) === null || _e === void 0 ? void 0 : _e.locationDetails) === null || _f === void 0 ? void 0 : _f.postcode,
12325
+ terminals: _this.searchService.processTerminals(airport.iataMatch.terminals)
12326
+ };
12327
+ }
12328
+ });
12329
+ // add Travellers
12330
+ if (basketItem.users) {
12331
+ basketItem.users.forEach(function (user) {
12332
+ _this.searchService.addTraveller(user);
12333
+ });
12334
+ }
12335
+ };
11815
12336
  ParkingEnterpriseSearch.prototype.updateFromPreviousSearches = function (previousItems) {
11816
12337
  var _a;
11817
12338
  console.log('PREPOPULATING PARKING FORM');
@@ -11840,7 +12361,7 @@
11840
12361
  };
11841
12362
  ParkingEnterpriseSearch.prototype.addParkingToBasket = function (parkingQuote, parkingQuery) {
11842
12363
  return __awaiter(this, void 0, void 0, function () {
11843
- var intBasket, basket, termsAndConditions;
12364
+ var intBasket, basket, termsAndConditions, whatHappened;
11844
12365
  return __generator(this, function (_g) {
11845
12366
  switch (_g.label) {
11846
12367
  case 0: return [4 /*yield*/, this.basketService.getDefaultBasket()];
@@ -11848,28 +12369,33 @@
11848
12369
  intBasket = _g.sent();
11849
12370
  basket = intBasket === null || intBasket === void 0 ? void 0 : intBasket.subject.value;
11850
12371
  termsAndConditions = this.getTermsAndCond(parkingQuote);
11851
- if (basket) {
11852
- return [2 /*return*/, this.basketService.addToBasket({
11853
- adults: 1,
11854
- basket: basket.id,
11855
- service: parkingQuote.sourceId.toString(),
11856
- detail: {
11857
- arrivalDatetime: parkingQuery.arrivalDatetime.format(),
11858
- departDatetime: parkingQuery.departDatetime.format(),
11859
- locationCode: parkingQuote.carPark.code,
11860
- name: parkingQuote.carPark.name,
11861
- requiredInfo: parkingQuote.requiredInfo,
11862
- airportIata: parkingQuery.locationCode,
11863
- termsAndCond: termsAndConditions
11864
- },
11865
- price: parkingQuote.price,
11866
- currency: parkingQuote.currency,
11867
- searchQuery: parkingQuery,
11868
- outboundDate: parkingQuery.arrivalDatetime.format(),
11869
- inboundDate: parkingQuery.departDatetime.format()
11870
- }, intBasket, this.searchService, this.travellers, parkingQuote.requiresReason)];
12372
+ if (!basket) return [3 /*break*/, 3];
12373
+ return [4 /*yield*/, this.basketService.addToBasket({
12374
+ adults: 1,
12375
+ basket: basket.id,
12376
+ service: parkingQuote.sourceId.toString(),
12377
+ detail: {
12378
+ arrivalDatetime: parkingQuery.arrivalDatetime.format(),
12379
+ departDatetime: parkingQuery.departDatetime.format(),
12380
+ locationCode: parkingQuote.carPark.code,
12381
+ name: parkingQuote.carPark.name,
12382
+ requiredInfo: parkingQuote.requiredInfo,
12383
+ airportIata: parkingQuery.locationCode,
12384
+ termsAndCond: termsAndConditions
12385
+ },
12386
+ price: parkingQuote.price,
12387
+ currency: parkingQuote.currency,
12388
+ searchQuery: parkingQuery,
12389
+ outboundDate: parkingQuery.arrivalDatetime.format(),
12390
+ inboundDate: parkingQuery.departDatetime.format()
12391
+ }, intBasket, this.searchService, this.travellers, parkingQuote.requiresReason)];
12392
+ case 2:
12393
+ whatHappened = _g.sent();
12394
+ if (whatHappened === exports.DifferentInvokdedUserReasons.research) {
12395
+ this.performSearch();
11871
12396
  }
11872
- return [2 /*return*/, Promise.resolve(false)];
12397
+ return [2 /*return*/, whatHappened];
12398
+ case 3: return [2 /*return*/, exports.DifferentInvokdedUserReasons.cancel];
11873
12399
  }
11874
12400
  });
11875
12401
  });
@@ -12022,10 +12548,9 @@
12022
12548
  var EurostarEnterpriseSearch = /** @class */ (function (_super) {
12023
12549
  __extends(EurostarEnterpriseSearch, _super);
12024
12550
  function EurostarEnterpriseSearch(eurostarFetcher, helpers, userService, basketService, storageService, searchService, modalService) {
12025
- var _this = _super.call(this, storageService, helpers) || this;
12551
+ var _this = _super.call(this, storageService, helpers, searchService) || this;
12026
12552
  _this.eurostarFetcher = eurostarFetcher;
12027
12553
  _this.basketService = basketService;
12028
- _this.searchService = searchService;
12029
12554
  _this.modalService = modalService;
12030
12555
  _this.type = ServiceType.Eurostar;
12031
12556
  _this.avaliableClasses = new rxjs.BehaviorSubject([]);
@@ -12777,7 +13302,7 @@
12777
13302
  }
12778
13303
  // this is stuff for matching cabin classes
12779
13304
  if (!this.checkCabinMatchisValid()) {
12780
- this.validationMessages.push('The types of cabin classes selected are not compatible. Examples of compatible cabin classes; Any - Any, Standard - Standard, Business - Business');
13305
+ this.validationMessages.push('The types of cabin classes selected are not compatible. Examples of compatible cabin classes; Any - Any; Standard - Standard; Business - Business');
12781
13306
  }
12782
13307
  }
12783
13308
  this.isValid.next(this.validationMessages.length === 0);
@@ -13096,15 +13621,83 @@
13096
13621
  };
13097
13622
  return [sortedResults];
13098
13623
  };
13099
- EurostarEnterpriseSearch.prototype.updateFromPreviousSearches = function (previousItems) {
13100
- var _a;
13101
- var flightItem = (_a = previousItems[ServiceType.Flight]) === null || _a === void 0 ? void 0 : _a.searchQuery;
13102
- if (flightItem) {
13103
- // TODO flights haven't been done yet.
13624
+ EurostarEnterpriseSearch.prototype.updateSearchFromExpiredBasketItem = function (basketItem) {
13625
+ var _this = this;
13626
+ var searchEuroStarQuery = basketItem.searchQuery;
13627
+ if (searchEuroStarQuery.outboundDate) {
13628
+ var outboundTimeWindow = searchEuroStarQuery.outboundDepartureTimeWindow
13629
+ ? searchEuroStarQuery.outboundDepartureTimeWindow
13630
+ : searchEuroStarQuery.outboundArrivalTimeWindow;
13631
+ this.outBoundDate = this.convertRecentSearchDateTime(searchEuroStarQuery.outboundDate, outboundTimeWindow);
13632
+ }
13633
+ if (searchEuroStarQuery.returnDate) {
13634
+ var returnTimeWindow = searchEuroStarQuery.returnDepartureTimeWindow
13635
+ ? searchEuroStarQuery.returnDepartureTimeWindow
13636
+ : searchEuroStarQuery.returnArrivalTimeWindow;
13637
+ this.inboundDate = this.convertRecentSearchDateTime(searchEuroStarQuery.returnDate, returnTimeWindow);
13638
+ }
13639
+ this.fareType = searchEuroStarQuery.fareType;
13640
+ this.maxConnections = searchEuroStarQuery.maxConnections;
13641
+ if (searchEuroStarQuery.outboundCabinClass) {
13642
+ this.cabinClass = searchEuroStarQuery
13643
+ .outboundCabinClass[0];
13644
+ }
13645
+ if (searchEuroStarQuery.returnCabinClass) {
13646
+ this.returnCabinClass = searchEuroStarQuery
13647
+ .returnCabinClass[0];
13648
+ }
13649
+ this.includeNearbyAirports = searchEuroStarQuery.includeNearbyAirports;
13650
+ this.chosenSearchType = searchEuroStarQuery.returnTrip
13651
+ ? exports.EurostarSearchType.return
13652
+ : exports.EurostarSearchType.oneWay;
13653
+ if (searchEuroStarQuery.outboundDepartureTimeWindow) {
13654
+ this.outTimeCriteria = exports.TimeWindow.Depart;
13104
13655
  }
13105
- };
13106
- EurostarEnterpriseSearch.prototype.getTotalBaggage = function (result) {
13107
- var total = 0;
13656
+ else if (searchEuroStarQuery.outboundArrivalTimeWindow) {
13657
+ this.outTimeCriteria = exports.TimeWindow.Arrive;
13658
+ }
13659
+ else {
13660
+ this.outTimeCriteria = exports.TimeWindow.Anytime;
13661
+ }
13662
+ if (searchEuroStarQuery.returnDepartureTimeWindow) {
13663
+ this.inTimeCriteria = exports.TimeWindow.Depart;
13664
+ }
13665
+ else if (searchEuroStarQuery.returnArrivalTimeWindow) {
13666
+ this.inTimeCriteria = exports.TimeWindow.Arrive;
13667
+ }
13668
+ else {
13669
+ this.inTimeCriteria = exports.TimeWindow.Anytime;
13670
+ }
13671
+ if (searchEuroStarQuery.originAirport) {
13672
+ this.searchService
13673
+ .lookupEurostarStations(searchEuroStarQuery.originAirport)
13674
+ .subscribe(function (stations) {
13675
+ _this.departLocation = stations[0];
13676
+ });
13677
+ }
13678
+ if (searchEuroStarQuery.destinationAirport) {
13679
+ this.searchService
13680
+ .lookupEurostarStations(searchEuroStarQuery.destinationAirport)
13681
+ .subscribe(function (stations) {
13682
+ _this.arriveLocation = stations[0];
13683
+ });
13684
+ }
13685
+ // add Travellers
13686
+ if (basketItem.users) {
13687
+ basketItem.users.forEach(function (user) {
13688
+ _this.searchService.addTraveller(user);
13689
+ });
13690
+ }
13691
+ };
13692
+ EurostarEnterpriseSearch.prototype.updateFromPreviousSearches = function (previousItems) {
13693
+ var _a;
13694
+ var flightItem = (_a = previousItems[ServiceType.Flight]) === null || _a === void 0 ? void 0 : _a.searchQuery;
13695
+ if (flightItem) {
13696
+ // TODO flights haven't been done yet.
13697
+ }
13698
+ };
13699
+ EurostarEnterpriseSearch.prototype.getTotalBaggage = function (result) {
13700
+ var total = 0;
13108
13701
  var parsedAdditional = JSON.parse(result.additional);
13109
13702
  if (parsedAdditional && parsedAdditional.outboundFlights) {
13110
13703
  parsedAdditional.outboundFlights.forEach(function (flight) {
@@ -13403,24 +13996,38 @@
13403
13996
  }, { amount: Number.MAX_SAFE_INTEGER, currencyCode: currency });
13404
13997
  };
13405
13998
  EurostarEnterpriseSearch.prototype.doBooking = function (intBasket, selectedFlight, schemaDetails, outboundDate, inboundDate, price, requiresReason) {
13406
- var sourceId = selectedFlight.sourceId, co2PerItem = selectedFlight.co2PerItem, co2PerPassenger = selectedFlight.co2PerPassenger, total = selectedFlight.total;
13407
- var booking = {
13408
- adults: this.adults,
13409
- basket: intBasket.id,
13410
- children: this.children,
13411
- co2PerItem: co2PerItem,
13412
- co2PerPassenger: co2PerPassenger,
13413
- currency: total.currency,
13414
- detail: schemaDetails,
13415
- price: price,
13416
- searchQuery: this.resultQuery,
13417
- service: sourceId.toString(),
13418
- outboundDate: outboundDate
13419
- };
13420
- if (inboundDate) {
13421
- booking.inboundDate = inboundDate;
13422
- }
13423
- this.basketService.addToBasket(booking, intBasket, this.searchService, this.travellers, requiresReason);
13999
+ return __awaiter(this, void 0, void 0, function () {
14000
+ var sourceId, co2PerItem, co2PerPassenger, total, booking, whatHappened;
14001
+ return __generator(this, function (_e) {
14002
+ switch (_e.label) {
14003
+ case 0:
14004
+ sourceId = selectedFlight.sourceId, co2PerItem = selectedFlight.co2PerItem, co2PerPassenger = selectedFlight.co2PerPassenger, total = selectedFlight.total;
14005
+ booking = {
14006
+ adults: this.adults,
14007
+ basket: intBasket.id,
14008
+ children: this.children,
14009
+ co2PerItem: co2PerItem,
14010
+ co2PerPassenger: co2PerPassenger,
14011
+ currency: total.currency,
14012
+ detail: schemaDetails,
14013
+ price: price,
14014
+ searchQuery: this.resultQuery,
14015
+ service: sourceId.toString(),
14016
+ outboundDate: outboundDate
14017
+ };
14018
+ if (inboundDate) {
14019
+ booking.inboundDate = inboundDate;
14020
+ }
14021
+ return [4 /*yield*/, this.basketService.addToBasket(booking, intBasket, this.searchService, this.travellers, requiresReason)];
14022
+ case 1:
14023
+ whatHappened = _e.sent();
14024
+ if (whatHappened === exports.DifferentInvokdedUserReasons.research) {
14025
+ this.performSearch();
14026
+ }
14027
+ return [2 /*return*/, whatHappened];
14028
+ }
14029
+ });
14030
+ });
13424
14031
  };
13425
14032
  EurostarEnterpriseSearch.prototype.makeSchemaFlights = function (selectedFlight, flightGroup, groupIndex, segmentIndex) {
13426
14033
  return Object.assign(Object.assign({}, selectedFlight), { journeyInfo: {
@@ -13496,51 +14103,56 @@
13496
14103
  };
13497
14104
  EurostarEnterpriseSearch.prototype.addEurostarJourneysToBasket = function (eurostarQuote) {
13498
14105
  return __awaiter(this, void 0, void 0, function () {
13499
- var intBasket, basket, sourceId, co2PerItem, co2PerPassenger, total, outboundDate, inboundDate, termsAndConditions, schemaDetails, booking;
14106
+ var intBasket, basket, sourceId, co2PerItem, co2PerPassenger, total, outboundDate, inboundDate, termsAndConditions, schemaDetails, booking, whatHappened;
13500
14107
  var _this = this;
13501
14108
  return __generator(this, function (_e) {
13502
14109
  switch (_e.label) {
13503
14110
  case 0:
13504
14111
  if (eurostarQuote.unavailable) {
13505
- return [2 /*return*/, Promise.resolve(false)];
14112
+ return [2 /*return*/, Promise.resolve(exports.DifferentInvokdedUserReasons.cancel)];
13506
14113
  }
13507
14114
  return [4 /*yield*/, this.basketService.getDefaultBasket()];
13508
14115
  case 1:
13509
14116
  intBasket = _e.sent();
13510
14117
  basket = intBasket === null || intBasket === void 0 ? void 0 : intBasket.subject.value;
13511
- if (basket) {
13512
- sourceId = eurostarQuote.sourceId, co2PerItem = eurostarQuote.co2PerItem, co2PerPassenger = eurostarQuote.co2PerPassenger, total = eurostarQuote.total;
13513
- outboundDate = moment__default['default'](eurostarQuote.outboundFlights[0].dateTimeDeparting);
13514
- inboundDate = eurostarQuote.inboundFlights.length
13515
- ? moment__default['default'](eurostarQuote.inboundFlights[0].dateTimeDeparting)
13516
- : null;
13517
- termsAndConditions = this.getTermsAndCond(eurostarQuote);
13518
- schemaDetails = {
13519
- outboundFlights: __spread(eurostarQuote.outboundFlights.map(function (flight, segmentIndex) { return _this.makeSchemaFlights(flight, 'outbound', 0, segmentIndex); })),
13520
- inboundFlights: __spread(eurostarQuote.inboundFlights.map(function (flight, segmentIndex) { return _this.makeSchemaFlights(flight, 'inbound', 0, segmentIndex); })),
13521
- termsAndCond: termsAndConditions,
13522
- journeyType: 'single'
13523
- };
13524
- booking = {
13525
- adults: this.adults,
13526
- basket: intBasket.id,
13527
- children: this.children,
13528
- co2PerItem: co2PerItem,
13529
- co2PerPassenger: co2PerPassenger,
13530
- currency: total.currency,
13531
- detail: schemaDetails,
13532
- price: total.price,
13533
- searchQuery: this.resultQuery,
13534
- service: sourceId.toString(),
13535
- outboundDate: outboundDate.format()
13536
- };
13537
- if (inboundDate) {
13538
- booking.inboundDate = inboundDate.format();
13539
- schemaDetails.journeyType = 'roundtrip';
13540
- }
13541
- return [2 /*return*/, this.basketService.addToBasket(booking, intBasket, this.searchService, this.travellers, eurostarQuote.requiresReason)];
14118
+ if (!basket) return [3 /*break*/, 3];
14119
+ sourceId = eurostarQuote.sourceId, co2PerItem = eurostarQuote.co2PerItem, co2PerPassenger = eurostarQuote.co2PerPassenger, total = eurostarQuote.total;
14120
+ outboundDate = moment__default['default'](eurostarQuote.outboundFlights[0].dateTimeDeparting);
14121
+ inboundDate = eurostarQuote.inboundFlights.length
14122
+ ? moment__default['default'](eurostarQuote.inboundFlights[0].dateTimeDeparting)
14123
+ : null;
14124
+ termsAndConditions = this.getTermsAndCond(eurostarQuote);
14125
+ schemaDetails = {
14126
+ outboundFlights: __spread(eurostarQuote.outboundFlights.map(function (flight, segmentIndex) { return _this.makeSchemaFlights(flight, 'outbound', 0, segmentIndex); })),
14127
+ inboundFlights: __spread(eurostarQuote.inboundFlights.map(function (flight, segmentIndex) { return _this.makeSchemaFlights(flight, 'inbound', 0, segmentIndex); })),
14128
+ termsAndCond: termsAndConditions,
14129
+ journeyType: 'single'
14130
+ };
14131
+ booking = {
14132
+ adults: this.adults,
14133
+ basket: intBasket.id,
14134
+ children: this.children,
14135
+ co2PerItem: co2PerItem,
14136
+ co2PerPassenger: co2PerPassenger,
14137
+ currency: total.currency,
14138
+ detail: schemaDetails,
14139
+ price: total.price,
14140
+ searchQuery: this.resultQuery,
14141
+ service: sourceId.toString(),
14142
+ outboundDate: outboundDate.format()
14143
+ };
14144
+ if (inboundDate) {
14145
+ booking.inboundDate = inboundDate.format();
14146
+ schemaDetails.journeyType = 'roundtrip';
14147
+ }
14148
+ return [4 /*yield*/, this.basketService.addToBasket(booking, intBasket, this.searchService, this.travellers, eurostarQuote.requiresReason)];
14149
+ case 2:
14150
+ whatHappened = _e.sent();
14151
+ if (whatHappened === exports.DifferentInvokdedUserReasons.research) {
14152
+ this.performSearch();
13542
14153
  }
13543
- return [2 /*return*/, Promise.resolve(false)]; // TODO should this throw an error?
14154
+ return [2 /*return*/, whatHappened];
14155
+ case 3: return [2 /*return*/, Promise.resolve(exports.DifferentInvokdedUserReasons.cancel)];
13544
14156
  }
13545
14157
  });
13546
14158
  });
@@ -13697,16 +14309,22 @@
13697
14309
  return __generator(this, function (_e) {
13698
14310
  this.fareType = fav.fareType;
13699
14311
  this.includeNearbyAirports = fav.includeNearbyAirports;
13700
- this.chosenSearchType = fav.returnTrip ? exports.EurostarSearchType.return : exports.EurostarSearchType.oneWay;
13701
- this.searchService.getAirportsList(fav.originAirport).subscribe(function (results) {
14312
+ this.chosenSearchType = fav.returnTrip
14313
+ ? exports.EurostarSearchType.return
14314
+ : exports.EurostarSearchType.oneWay;
14315
+ this.searchService
14316
+ .getAirportsList(fav.originAirport)
14317
+ .subscribe(function (results) {
13702
14318
  _this.departLocation = results.find(function (a) { return a.gateway == fav.originAirport; });
13703
14319
  });
13704
- this.searchService.getAirportsList(fav.destinationAirport).subscribe(function (results) {
14320
+ this.searchService
14321
+ .getAirportsList(fav.destinationAirport)
14322
+ .subscribe(function (results) {
13705
14323
  _this.arriveLocation = results.find(function (a) { return a.gateway == fav.destinationAirport; });
13706
14324
  });
13707
14325
  this._passengers = fav.passengers;
13708
- this.adults = fav.passengers.filter(function (a) { return a.type == "ADULT"; }).length;
13709
- this.children = fav.passengers.filter(function (a) { return a.type == "CHILD"; }).length;
14326
+ this.adults = fav.passengers.filter(function (a) { return a.type == 'ADULT'; }).length;
14327
+ this.children = fav.passengers.filter(function (a) { return a.type == 'CHILD'; }).length;
13710
14328
  return [2 /*return*/];
13711
14329
  });
13712
14330
  });
@@ -13798,11 +14416,10 @@
13798
14416
  var RailEnterpriseSearch = /** @class */ (function (_super) {
13799
14417
  __extends(RailEnterpriseSearch, _super);
13800
14418
  function RailEnterpriseSearch(Railfetcher, getRailStationFetcher, helpers, basketService, storageService, searchService, userService, modalService) {
13801
- var _this = _super.call(this, storageService, helpers) || this;
14419
+ var _this = _super.call(this, storageService, helpers, searchService) || this;
13802
14420
  _this.Railfetcher = Railfetcher;
13803
14421
  _this.getRailStationFetcher = getRailStationFetcher;
13804
14422
  _this.basketService = basketService;
13805
- _this.searchService = searchService;
13806
14423
  _this.userService = userService;
13807
14424
  _this.modalService = modalService;
13808
14425
  _this.resultsSessionName = RailEnterpriseSearch.STORAGE_SESSION_RESULTS;
@@ -13918,6 +14535,7 @@
13918
14535
  originalUserSearch: {}
13919
14536
  };
13920
14537
  _this.updateTempParams(_this.searchService.makeRailQuery(data.tempParams));
14538
+ data.originalUserSearch.transactionIdentifier = null;
13921
14539
  _this._originalUserSearch = data.originalUserSearch;
13922
14540
  if (searchService.shouldAddTravellerSubscription()) {
13923
14541
  searchService.travellerInformation.subscribe(function (travellers) {
@@ -13976,6 +14594,16 @@
13976
14594
  enumerable: false,
13977
14595
  configurable: true
13978
14596
  });
14597
+ Object.defineProperty(RailEnterpriseSearch.prototype, "transactionIdentifier", {
14598
+ get: function () {
14599
+ return this.tempParams.transactionIdentifier;
14600
+ },
14601
+ set: function (id) {
14602
+ this.tempParams.transactionIdentifier = id;
14603
+ },
14604
+ enumerable: false,
14605
+ configurable: true
14606
+ });
13979
14607
  Object.defineProperty(RailEnterpriseSearch.prototype, "bookRailFromLive", {
13980
14608
  get: function () {
13981
14609
  return this._bookRailFromLive;
@@ -14286,6 +14914,9 @@
14286
14914
  return this.tempParams.applyRailcards;
14287
14915
  },
14288
14916
  set: function (apCards) {
14917
+ if (!apCards) {
14918
+ this.railCards = [];
14919
+ }
14289
14920
  this.tempParams.applyRailcards = apCards;
14290
14921
  },
14291
14922
  enumerable: false,
@@ -14369,6 +15000,7 @@
14369
15000
  };
14370
15001
  RailEnterpriseSearch.prototype.processResults = function (rawResults) {
14371
15002
  var _this = this;
15003
+ this.transactionIdentifier = null;
14372
15004
  var setFares = function (fare) {
14373
15005
  var _a;
14374
15006
  return Object.assign(Object.assign({}, fare), { type: (_a = fare === null || fare === void 0 ? void 0 : fare.type) === null || _a === void 0 ? void 0 : _a.toLowerCase(), selected: false, selectable: true });
@@ -14906,7 +15538,7 @@
14906
15538
  // ! - Dual Singles
14907
15539
  _h.sent();
14908
15540
  _h.label = 7;
14909
- case 7: return [2 /*return*/, false];
15541
+ case 7: return [2 /*return*/, exports.DifferentInvokdedUserReasons.cancel];
14910
15542
  }
14911
15543
  });
14912
15544
  });
@@ -14921,7 +15553,7 @@
14921
15553
  RailEnterpriseSearch.prototype.addDualSingleToBasket = function (serviceId, searchQuery, outbound, inbound, outboundFare, inboundFare) {
14922
15554
  var _a, _b;
14923
15555
  return __awaiter(this, void 0, void 0, function () {
14924
- var railQuery, inTicketExtras, outTicketExtras, intBasket, basket, termsAndConditions, outboundLegs, inboundLegs, basketItem;
15556
+ var railQuery, inTicketExtras, outTicketExtras, intBasket, basket, termsAndConditions, outboundLegs, inboundLegs, basketItem, whatHappened;
14925
15557
  return __generator(this, function (_h) {
14926
15558
  switch (_h.label) {
14927
15559
  case 0:
@@ -14938,90 +15570,95 @@
14938
15570
  intBasket = _h.sent();
14939
15571
  basket = intBasket === null || intBasket === void 0 ? void 0 : intBasket.subject.value;
14940
15572
  termsAndConditions = this.getTermsAndCond(outboundFare, outbound, inbound);
14941
- if (basket) {
14942
- outboundLegs = this.getLegsFromRailJourneyOption(outbound);
14943
- inboundLegs = this.getLegsFromRailJourneyOption(inbound);
14944
- basketItem = {
14945
- basket: basket.id,
14946
- service: serviceId,
14947
- detail: {
14948
- ticketQueueList: (outbound.ticketQueueList || []).map(function (item) {
14949
- return {
14950
- id: item.id,
14951
- name: item.name,
14952
- type: item.type
14953
- };
14954
- }),
14955
- accountsList: (outbound.accountsList || []).map(function (item) {
14956
- return {
14957
- id: item.id,
14958
- description: item.description
14959
- };
14960
- }),
14961
- outwardDetail: {
14962
- arrivalDateTime: outbound.arriveDateTime,
14963
- arrivalStationName: outbound.to,
14964
- departureDateTime: outbound.departDateTime,
14965
- departureStationName: outbound.from,
14966
- supplierTickets: [
14967
- {
14968
- supplierName: outboundFare.providerName,
14969
- ticketDescription: outboundFare.type,
14970
- price: outboundFare.price,
14971
- legs: outboundLegs
14972
- }
14973
- ]
14974
- },
14975
- inwardDetail: {
14976
- arrivalDateTime: inbound.arriveDateTime,
14977
- arrivalStationName: inbound.to,
14978
- departureDateTime: inbound.departDateTime,
14979
- departureStationName: inbound.from,
14980
- supplierTickets: [
14981
- {
14982
- supplierName: inboundFare.providerName,
14983
- ticketDescription: inboundFare.type,
14984
- legs: inboundLegs
14985
- }
14986
- ]
14987
- },
14988
- transactionIdentifier: outboundFare.identifiers.transactionIdentifier,
14989
- outbound: {
14990
- fareIdentifiers: [outboundFare.identifiers.fareIdentifier],
14991
- journeyIdentifier: outboundFare.identifiers.journeyIdentifier,
14992
- isDualSingleReturn: true,
14993
- journeyLegs: this.removedScheduledPlatformFromCallingPoints(outbound.journeyLegs),
14994
- eTicket: !!outboundFare.eTicketAvailable
14995
- },
14996
- // ticketQueueList,
14997
- return: {
14998
- fareIdentifiers: [inboundFare.identifiers.fareIdentifier],
14999
- journeyIdentifier: inboundFare.identifiers.journeyIdentifier,
15000
- isDualSingleReturn: true,
15001
- journeyLegs: this.removedScheduledPlatformFromCallingPoints(inbound.journeyLegs),
15002
- eTicket: !!inboundFare.eTicketAvailable
15003
- },
15004
- termsAndCond: termsAndConditions
15573
+ if (!basket) return [3 /*break*/, 3];
15574
+ outboundLegs = this.getLegsFromRailJourneyOption(outbound);
15575
+ inboundLegs = this.getLegsFromRailJourneyOption(inbound);
15576
+ basketItem = {
15577
+ basket: basket.id,
15578
+ service: serviceId,
15579
+ detail: {
15580
+ ticketQueueList: (outbound.ticketQueueList || []).map(function (item) {
15581
+ return {
15582
+ id: item.id,
15583
+ name: item.name,
15584
+ type: item.type
15585
+ };
15586
+ }),
15587
+ accountsList: (outbound.accountsList || []).map(function (item) {
15588
+ return {
15589
+ id: item.id,
15590
+ description: item.description
15591
+ };
15592
+ }),
15593
+ outwardDetail: {
15594
+ arrivalDateTime: outbound.arriveDateTime,
15595
+ arrivalStationName: outbound.to,
15596
+ departureDateTime: outbound.departDateTime,
15597
+ departureStationName: outbound.from,
15598
+ supplierTickets: [
15599
+ {
15600
+ supplierName: outboundFare.providerName,
15601
+ ticketDescription: outboundFare.type,
15602
+ price: outboundFare.price,
15603
+ legs: outboundLegs
15604
+ }
15605
+ ]
15005
15606
  },
15006
- adults: railQuery.adults,
15007
- price: Number(Number(outboundFare.price + inboundFare.price).toFixed(2)),
15008
- currency: outboundFare.currency,
15009
- searchQuery: railQuery,
15010
- co2PerItem: outbound.co2PerItem,
15011
- co2PerPassenger: outbound.co2PerPassenger,
15012
- outboundDate: outbound.arriveDateTime,
15013
- inboundDate: inbound.arriveDateTime
15014
- };
15015
- // if inTicketExtras or outTicketExtras exists add the object to basketItem
15016
- if (inTicketExtras) {
15017
- basketItem.detail.return.ticketExtras = inTicketExtras;
15018
- }
15019
- if (outTicketExtras) {
15020
- basketItem.detail.outbound.ticketExtras = outTicketExtras;
15021
- }
15022
- return [2 /*return*/, this.basketService.addToBasket(basketItem, intBasket, this.searchService, this.travellers, outboundFare.requiresReason || inboundFare.requiresReason)];
15607
+ inwardDetail: {
15608
+ arrivalDateTime: inbound.arriveDateTime,
15609
+ arrivalStationName: inbound.to,
15610
+ departureDateTime: inbound.departDateTime,
15611
+ departureStationName: inbound.from,
15612
+ supplierTickets: [
15613
+ {
15614
+ supplierName: inboundFare.providerName,
15615
+ ticketDescription: inboundFare.type,
15616
+ legs: inboundLegs
15617
+ }
15618
+ ]
15619
+ },
15620
+ transactionIdentifier: outboundFare.identifiers.transactionIdentifier,
15621
+ outbound: {
15622
+ fareIdentifiers: [outboundFare.identifiers.fareIdentifier],
15623
+ journeyIdentifier: outboundFare.identifiers.journeyIdentifier,
15624
+ isDualSingleReturn: true,
15625
+ journeyLegs: this.removedScheduledPlatformFromCallingPoints(outbound.journeyLegs),
15626
+ eTicket: !!outboundFare.eTicketAvailable
15627
+ },
15628
+ // ticketQueueList,
15629
+ return: {
15630
+ fareIdentifiers: [inboundFare.identifiers.fareIdentifier],
15631
+ journeyIdentifier: inboundFare.identifiers.journeyIdentifier,
15632
+ isDualSingleReturn: true,
15633
+ journeyLegs: this.removedScheduledPlatformFromCallingPoints(inbound.journeyLegs),
15634
+ eTicket: !!inboundFare.eTicketAvailable
15635
+ },
15636
+ termsAndCond: termsAndConditions
15637
+ },
15638
+ adults: railQuery.adults,
15639
+ price: Number(Number(outboundFare.price + inboundFare.price).toFixed(2)),
15640
+ currency: outboundFare.currency,
15641
+ searchQuery: railQuery,
15642
+ co2PerItem: outbound.co2PerItem,
15643
+ co2PerPassenger: outbound.co2PerPassenger,
15644
+ outboundDate: outbound.arriveDateTime,
15645
+ inboundDate: inbound.arriveDateTime
15646
+ };
15647
+ // if inTicketExtras or outTicketExtras exists add the object to basketItem
15648
+ if (inTicketExtras) {
15649
+ basketItem.detail.return.ticketExtras = inTicketExtras;
15650
+ }
15651
+ if (outTicketExtras) {
15652
+ basketItem.detail.outbound.ticketExtras = outTicketExtras;
15653
+ }
15654
+ return [4 /*yield*/, this.basketService.addToBasket(basketItem, intBasket, this.searchService, this.travellers, outboundFare.requiresReason || inboundFare.requiresReason)];
15655
+ case 2:
15656
+ whatHappened = _h.sent();
15657
+ if (whatHappened === exports.DifferentInvokdedUserReasons.research) {
15658
+ this.performSearch();
15023
15659
  }
15024
- return [2 /*return*/, Promise.resolve()];
15660
+ return [2 /*return*/, whatHappened];
15661
+ case 3: return [2 /*return*/, exports.DifferentInvokdedUserReasons.continue];
15025
15662
  }
15026
15663
  });
15027
15664
  });
@@ -15082,6 +15719,7 @@
15082
15719
  this.results.next([]);
15083
15720
  if (this.isValid.value) {
15084
15721
  var query = this.getSearchQuery(this.tempParams);
15722
+ this.tempParams.transactionIdentifier = null;
15085
15723
  this._originalUserSearch = Object.freeze(this.helpers.clone(this.tempParams));
15086
15724
  this.storageService.setSessionItem(RailEnterpriseSearch.STORAGE_SESSION_PARAMS, {
15087
15725
  tempParams: this.tempParams,
@@ -15202,8 +15840,9 @@
15202
15840
  returnDepartureDateTime: this.helpers.formatGraphQLDateTime(tempParams.inBoundDateTime),
15203
15841
  viaLocationId: (_f = (_e = tempParams.viaLocation) === null || _e === void 0 ? void 0 : _e.railstation) === null || _f === void 0 ? void 0 : _f.id,
15204
15842
  railCardQualifiers: (_g = tempParams.railCards) === null || _g === void 0 ? void 0 : _g.map(function (railCard) {
15205
- return railCard.code;
15206
- })
15843
+ return railCard === null || railCard === void 0 ? void 0 : railCard.code;
15844
+ }),
15845
+ transactionIdentifier: tempParams.transactionIdentifier
15207
15846
  };
15208
15847
  if (tempParams.noOfChildren === 0) {
15209
15848
  query.children = null;
@@ -15256,6 +15895,88 @@
15256
15895
  }
15257
15896
  };
15258
15897
  RailEnterpriseSearch.prototype.updateFromPreviousSearches = function (previousItems) { };
15898
+ RailEnterpriseSearch.prototype.updateSearchFromExpiredBasketItem = function (basketItem) {
15899
+ var _this = this;
15900
+ var searchRailQuery = basketItem.searchQuery;
15901
+ this.chosenSearchType = searchRailQuery.journeyType;
15902
+ this.chosenSearchClass = searchRailQuery.class;
15903
+ this.extraTime = searchRailQuery.extraTimeToChange;
15904
+ // get outBoundDateTime, inBoundDateTime and outboundCriteria ,returnCriteria
15905
+ this.outBoundDateTime = searchRailQuery.outboundDepartureDateTime
15906
+ ? moment__default['default'](searchRailQuery.outboundDepartureDateTime)
15907
+ : moment__default['default'](searchRailQuery.outboundArrivalDateTime);
15908
+ this.outboundCriteria = this.getCriteria(searchRailQuery.outboundDepartureDateTime, searchRailQuery.outboundArrivalDateTime);
15909
+ if (searchRailQuery.journeyType === RailSearchJourneyType.ReturnJourney) {
15910
+ this.inBoundDateTime = searchRailQuery.returnDepartureDateTime
15911
+ ? moment__default['default'](searchRailQuery.returnDepartureDateTime)
15912
+ : moment__default['default'](searchRailQuery.returnArrivalDateTime);
15913
+ this.returnCriteria = this.getCriteria(searchRailQuery.returnDepartureDateTime, searchRailQuery.returnArrivalDateTime);
15914
+ }
15915
+ if (searchRailQuery.journeyType === RailSearchJourneyType.OpenReturnJourney) {
15916
+ this.openReturn = true;
15917
+ }
15918
+ if (searchRailQuery.departureLocationId) {
15919
+ this.searchService
15920
+ .getRailStationById(searchRailQuery.departureLocationId)
15921
+ .subscribe(function (departureStation) {
15922
+ _this.travellingFrom = {
15923
+ name: departureStation.name,
15924
+ railstation: {
15925
+ id: departureStation.id,
15926
+ name: departureStation.name,
15927
+ nlcCode: departureStation.nlcCode,
15928
+ stationCode: departureStation.stationCode,
15929
+ trainlineCode: departureStation.trainlineCode,
15930
+ trainlineUniqueCode: departureStation.trainlineUniqueCode
15931
+ }
15932
+ };
15933
+ });
15934
+ }
15935
+ if (searchRailQuery.arrivalLocationId) {
15936
+ this.searchService
15937
+ .getRailStationById(searchRailQuery.arrivalLocationId)
15938
+ .subscribe(function (arrivalStation) {
15939
+ _this.travellingTo = {
15940
+ name: arrivalStation.name,
15941
+ railstation: {
15942
+ id: arrivalStation.id,
15943
+ name: arrivalStation.name,
15944
+ nlcCode: arrivalStation.nlcCode,
15945
+ stationCode: arrivalStation.stationCode,
15946
+ trainlineCode: arrivalStation.trainlineCode,
15947
+ trainlineUniqueCode: arrivalStation.trainlineUniqueCode
15948
+ }
15949
+ };
15950
+ });
15951
+ }
15952
+ if (searchRailQuery.viaLocationId) {
15953
+ this.via = true;
15954
+ this.searchService
15955
+ .getRailStationById(searchRailQuery.viaLocationId)
15956
+ .subscribe(function (viaLocation) {
15957
+ _this.viaLocation = {
15958
+ name: viaLocation.name,
15959
+ railstation: {
15960
+ id: viaLocation.id,
15961
+ name: viaLocation.name,
15962
+ nlcCode: viaLocation.nlcCode,
15963
+ stationCode: viaLocation.stationCode,
15964
+ trainlineCode: viaLocation.trainlineCode,
15965
+ trainlineUniqueCode: viaLocation.trainlineUniqueCode
15966
+ }
15967
+ };
15968
+ });
15969
+ }
15970
+ else {
15971
+ this.viaLocation = null;
15972
+ }
15973
+ // add Travellers
15974
+ if (basketItem.users) {
15975
+ basketItem.users.forEach(function (user) {
15976
+ _this.searchService.addTraveller(user);
15977
+ });
15978
+ }
15979
+ };
15259
15980
  RailEnterpriseSearch.prototype.getRailStation = function (code, isLoading) {
15260
15981
  if (code.length === 3) {
15261
15982
  isLoading === null || isLoading === void 0 ? void 0 : isLoading.next(true);
@@ -15286,7 +16007,7 @@
15286
16007
  RailEnterpriseSearch.prototype.addSingleJourneyToBasket = function (serviceId, tempParams, railJourneyOption, railFare) {
15287
16008
  var _a;
15288
16009
  return __awaiter(this, void 0, void 0, function () {
15289
- var railQuery, outTicketExtras, intBasket, basket, termsAndConditions, legs, basketItem;
16010
+ var railQuery, outTicketExtras, intBasket, basket, termsAndConditions, legs, basketItem, whatHappened;
15290
16011
  return __generator(this, function (_h) {
15291
16012
  switch (_h.label) {
15292
16013
  case 0:
@@ -15300,64 +16021,69 @@
15300
16021
  intBasket = _h.sent();
15301
16022
  basket = intBasket === null || intBasket === void 0 ? void 0 : intBasket.subject.value;
15302
16023
  termsAndConditions = this.getTermsAndCond(railFare, railJourneyOption);
15303
- if (basket) {
15304
- legs = this.getLegsFromRailJourneyOption(railJourneyOption);
15305
- basketItem = {
15306
- basket: basket.id,
15307
- service: serviceId.toString(),
15308
- detail: {
15309
- ticketQueueList: (railJourneyOption.ticketQueueList || []).map(function (item) {
15310
- return {
15311
- id: item.id,
15312
- name: item.name,
15313
- type: item.type
15314
- };
15315
- }),
15316
- accountsList: (railJourneyOption.accountsList || []).map(function (item) {
15317
- return {
15318
- id: item.id,
15319
- description: item.description
15320
- };
15321
- }),
15322
- outwardDetail: {
15323
- arrivalDateTime: railJourneyOption.arriveDateTime,
15324
- arrivalStationName: railJourneyOption.to,
15325
- departureDateTime: railJourneyOption.departDateTime,
15326
- departureStationName: railJourneyOption.from,
15327
- supplierTickets: [
15328
- {
15329
- supplierName: railFare.providerName,
15330
- ticketDescription: railFare.type,
15331
- price: railFare.price,
15332
- legs: legs
15333
- }
15334
- ]
15335
- },
15336
- transactionIdentifier: railFare.identifiers.transactionIdentifier,
15337
- outbound: {
15338
- eTicket: !!railFare.eTicketAvailable,
15339
- fareIdentifiers: [railFare.identifiers.fareIdentifier],
15340
- journeyIdentifier: railFare.identifiers.journeyIdentifier,
15341
- journeyLegs: this.removedScheduledPlatformFromCallingPoints(railJourneyOption.journeyLegs)
15342
- },
15343
- termsAndCond: termsAndConditions
15344
- // ticketQueueList
16024
+ if (!basket) return [3 /*break*/, 3];
16025
+ legs = this.getLegsFromRailJourneyOption(railJourneyOption);
16026
+ basketItem = {
16027
+ basket: basket.id,
16028
+ service: serviceId.toString(),
16029
+ detail: {
16030
+ ticketQueueList: (railJourneyOption.ticketQueueList || []).map(function (item) {
16031
+ return {
16032
+ id: item.id,
16033
+ name: item.name,
16034
+ type: item.type
16035
+ };
16036
+ }),
16037
+ accountsList: (railJourneyOption.accountsList || []).map(function (item) {
16038
+ return {
16039
+ id: item.id,
16040
+ description: item.description
16041
+ };
16042
+ }),
16043
+ outwardDetail: {
16044
+ arrivalDateTime: railJourneyOption.arriveDateTime,
16045
+ arrivalStationName: railJourneyOption.to,
16046
+ departureDateTime: railJourneyOption.departDateTime,
16047
+ departureStationName: railJourneyOption.from,
16048
+ supplierTickets: [
16049
+ {
16050
+ supplierName: railFare.providerName,
16051
+ ticketDescription: railFare.type,
16052
+ price: railFare.price,
16053
+ legs: legs
16054
+ }
16055
+ ]
15345
16056
  },
15346
- adults: railQuery.adults,
15347
- price: railFare.price,
15348
- currency: railFare.currency,
15349
- searchQuery: railQuery,
15350
- co2PerItem: railJourneyOption.co2PerItem,
15351
- co2PerPassenger: railJourneyOption.co2PerPassenger,
15352
- outboundDate: railJourneyOption.departDateTime
15353
- };
15354
- // if ticketExtras exists add the object to basketItem
15355
- if (outTicketExtras) {
15356
- basketItem.detail.outbound.ticketExtras = outTicketExtras;
15357
- }
15358
- return [2 /*return*/, this.basketService.addToBasket(basketItem, intBasket, this.searchService, this.travellers, railFare.requiresReason)];
16057
+ transactionIdentifier: railFare.identifiers.transactionIdentifier,
16058
+ outbound: {
16059
+ eTicket: !!railFare.eTicketAvailable,
16060
+ fareIdentifiers: [railFare.identifiers.fareIdentifier],
16061
+ journeyIdentifier: railFare.identifiers.journeyIdentifier,
16062
+ journeyLegs: this.removedScheduledPlatformFromCallingPoints(railJourneyOption.journeyLegs)
16063
+ },
16064
+ termsAndCond: termsAndConditions
16065
+ // ticketQueueList
16066
+ },
16067
+ adults: railQuery.adults,
16068
+ price: railFare.price,
16069
+ currency: railFare.currency,
16070
+ searchQuery: railQuery,
16071
+ co2PerItem: railJourneyOption.co2PerItem,
16072
+ co2PerPassenger: railJourneyOption.co2PerPassenger,
16073
+ outboundDate: railJourneyOption.departDateTime
16074
+ };
16075
+ // if ticketExtras exists add the object to basketItem
16076
+ if (outTicketExtras) {
16077
+ basketItem.detail.outbound.ticketExtras = outTicketExtras;
16078
+ }
16079
+ return [4 /*yield*/, this.basketService.addToBasket(basketItem, intBasket, this.searchService, this.travellers, railFare.requiresReason)];
16080
+ case 2:
16081
+ whatHappened = _h.sent();
16082
+ if (whatHappened === exports.DifferentInvokdedUserReasons.research) {
16083
+ this.performSearch();
15359
16084
  }
15360
- return [2 /*return*/, Promise.resolve()];
16085
+ return [2 /*return*/, whatHappened];
16086
+ case 3: return [2 /*return*/, exports.DifferentInvokdedUserReasons.cancel];
15361
16087
  }
15362
16088
  });
15363
16089
  });
@@ -15365,7 +16091,7 @@
15365
16091
  RailEnterpriseSearch.prototype.addReturnJourneyToBasket = function (serviceId, tempParams, outbound, inbound, outboundFare, inboundFare) {
15366
16092
  var _a;
15367
16093
  return __awaiter(this, void 0, void 0, function () {
15368
- var railQuery, ticketExtras, intBasket, basket, termsAndConditions, outboundLegs, inboundLegs, basketItem;
16094
+ var railQuery, ticketExtras, intBasket, basket, termsAndConditions, outboundLegs, inboundLegs, basketItem, whatHappened;
15369
16095
  return __generator(this, function (_h) {
15370
16096
  switch (_h.label) {
15371
16097
  case 0:
@@ -15379,85 +16105,90 @@
15379
16105
  intBasket = _h.sent();
15380
16106
  basket = intBasket === null || intBasket === void 0 ? void 0 : intBasket.subject.value;
15381
16107
  termsAndConditions = this.getTermsAndCond(outboundFare, outbound, inbound);
15382
- if (basket) {
15383
- outboundLegs = this.getLegsFromRailJourneyOption(outbound);
15384
- inboundLegs = this.getLegsFromRailJourneyOption(inbound);
15385
- basketItem = {
15386
- basket: basket.id,
15387
- service: serviceId,
15388
- detail: {
15389
- ticketQueueList: (outbound.ticketQueueList || []).map(function (item) {
15390
- return {
15391
- id: item.id,
15392
- name: item.name,
15393
- type: item.type
15394
- };
15395
- }),
15396
- accountsList: (outbound.accountsList || []).map(function (item) {
15397
- return {
15398
- id: item.id,
15399
- description: item.description
15400
- };
15401
- }),
15402
- outwardDetail: {
15403
- arrivalDateTime: outbound.arriveDateTime,
15404
- arrivalStationName: outbound.to,
15405
- departureDateTime: outbound.departDateTime,
15406
- departureStationName: outbound.from,
15407
- supplierTickets: [
15408
- {
15409
- supplierName: outboundFare.providerName,
15410
- ticketDescription: outboundFare.type,
15411
- price: outboundFare.price,
15412
- legs: outboundLegs
15413
- }
15414
- ]
15415
- },
15416
- inwardDetail: {
15417
- arrivalDateTime: inbound.arriveDateTime,
15418
- arrivalStationName: inbound.to,
15419
- departureDateTime: inbound.departDateTime,
15420
- departureStationName: inbound.from,
15421
- supplierTickets: [
15422
- {
15423
- supplierName: inboundFare.providerName,
15424
- ticketDescription: inboundFare.type,
15425
- legs: inboundLegs
15426
- }
15427
- ]
15428
- },
15429
- transactionIdentifier: outboundFare.identifiers.transactionIdentifier,
15430
- outbound: {
15431
- eTicket: !!outboundFare.eTicketAvailable,
15432
- fareIdentifiers: [outboundFare.identifiers.fareIdentifier],
15433
- journeyIdentifier: outboundFare.identifiers.journeyIdentifier,
15434
- journeyLegs: this.removedScheduledPlatformFromCallingPoints(outbound.journeyLegs)
15435
- },
15436
- // ticketQueueList,
15437
- return: {
15438
- eTicket: !!inboundFare.eTicketAvailable,
15439
- fareIdentifiers: [inboundFare.identifiers.fareIdentifier],
15440
- journeyIdentifier: inboundFare.identifiers.journeyIdentifier,
15441
- journeyLegs: this.removedScheduledPlatformFromCallingPoints(inbound.journeyLegs)
15442
- },
15443
- termsAndCond: termsAndConditions
16108
+ if (!basket) return [3 /*break*/, 3];
16109
+ outboundLegs = this.getLegsFromRailJourneyOption(outbound);
16110
+ inboundLegs = this.getLegsFromRailJourneyOption(inbound);
16111
+ basketItem = {
16112
+ basket: basket.id,
16113
+ service: serviceId,
16114
+ detail: {
16115
+ ticketQueueList: (outbound.ticketQueueList || []).map(function (item) {
16116
+ return {
16117
+ id: item.id,
16118
+ name: item.name,
16119
+ type: item.type
16120
+ };
16121
+ }),
16122
+ accountsList: (outbound.accountsList || []).map(function (item) {
16123
+ return {
16124
+ id: item.id,
16125
+ description: item.description
16126
+ };
16127
+ }),
16128
+ outwardDetail: {
16129
+ arrivalDateTime: outbound.arriveDateTime,
16130
+ arrivalStationName: outbound.to,
16131
+ departureDateTime: outbound.departDateTime,
16132
+ departureStationName: outbound.from,
16133
+ supplierTickets: [
16134
+ {
16135
+ supplierName: outboundFare.providerName,
16136
+ ticketDescription: outboundFare.type,
16137
+ price: outboundFare.price,
16138
+ legs: outboundLegs
16139
+ }
16140
+ ]
15444
16141
  },
15445
- adults: railQuery.adults,
15446
- price: outboundFare.price,
15447
- currency: outboundFare.currency,
15448
- searchQuery: railQuery,
15449
- co2PerItem: outbound.co2PerItem,
15450
- co2PerPassenger: outbound.co2PerPassenger,
15451
- outboundDate: outbound.arriveDateTime,
15452
- inboundDate: inbound.arriveDateTime
15453
- };
15454
- // if ticketExtras exists add the object to basketItem
15455
- if (ticketExtras) {
15456
- basketItem.detail.outbound.ticketExtras = ticketExtras;
15457
- }
15458
- return [2 /*return*/, this.basketService.addToBasket(basketItem, intBasket, this.searchService, this.travellers, outboundFare.requiresReason || inboundFare.requiresReason)];
16142
+ inwardDetail: {
16143
+ arrivalDateTime: inbound.arriveDateTime,
16144
+ arrivalStationName: inbound.to,
16145
+ departureDateTime: inbound.departDateTime,
16146
+ departureStationName: inbound.from,
16147
+ supplierTickets: [
16148
+ {
16149
+ supplierName: inboundFare.providerName,
16150
+ ticketDescription: inboundFare.type,
16151
+ legs: inboundLegs
16152
+ }
16153
+ ]
16154
+ },
16155
+ transactionIdentifier: outboundFare.identifiers.transactionIdentifier,
16156
+ outbound: {
16157
+ eTicket: !!outboundFare.eTicketAvailable,
16158
+ fareIdentifiers: [outboundFare.identifiers.fareIdentifier],
16159
+ journeyIdentifier: outboundFare.identifiers.journeyIdentifier,
16160
+ journeyLegs: this.removedScheduledPlatformFromCallingPoints(outbound.journeyLegs)
16161
+ },
16162
+ // ticketQueueList,
16163
+ return: {
16164
+ eTicket: !!inboundFare.eTicketAvailable,
16165
+ fareIdentifiers: [inboundFare.identifiers.fareIdentifier],
16166
+ journeyIdentifier: inboundFare.identifiers.journeyIdentifier,
16167
+ journeyLegs: this.removedScheduledPlatformFromCallingPoints(inbound.journeyLegs)
16168
+ },
16169
+ termsAndCond: termsAndConditions
16170
+ },
16171
+ adults: railQuery.adults,
16172
+ price: outboundFare.price,
16173
+ currency: outboundFare.currency,
16174
+ searchQuery: railQuery,
16175
+ co2PerItem: outbound.co2PerItem,
16176
+ co2PerPassenger: outbound.co2PerPassenger,
16177
+ outboundDate: outbound.arriveDateTime,
16178
+ inboundDate: inbound.arriveDateTime
16179
+ };
16180
+ // if ticketExtras exists add the object to basketItem
16181
+ if (ticketExtras) {
16182
+ basketItem.detail.outbound.ticketExtras = ticketExtras;
16183
+ }
16184
+ return [4 /*yield*/, this.basketService.addToBasket(basketItem, intBasket, this.searchService, this.travellers, outboundFare.requiresReason || inboundFare.requiresReason)];
16185
+ case 2:
16186
+ whatHappened = _h.sent();
16187
+ if (whatHappened === exports.DifferentInvokdedUserReasons.research) {
16188
+ this.performSearch();
15459
16189
  }
15460
- return [2 /*return*/, Promise.resolve(false)];
16190
+ return [2 /*return*/, whatHappened];
16191
+ case 3: return [2 /*return*/, exports.DifferentInvokdedUserReasons.cancel];
15461
16192
  }
15462
16193
  });
15463
16194
  });
@@ -15551,7 +16282,7 @@
15551
16282
  .clone(this.fullResults)
15552
16283
  .reduce(function (accum, next) {
15553
16284
  var temp = Object.assign(Object.assign({}, next), { outbound: (next.outbound || []).map(function (journey) {
15554
- return Object.assign(Object.assign({}, journey), { dualSingleJourneyFares: _this.helpers.map(journey.dualSingleJourneyFares || {}, setRules('dualSingleJourneyFares', journey, exports.RailDirection.Outbound)), returnJourneyFares: _this.helpers.map(journey.returnJourneyFares || {}, setRules('returnJourneyFares', journey, exports.RailDirection.Outbound)), openReturnJourneyFares: _this.helpers.map(journey.openReturnJourneyFares || {}, setRules('openReturnJourneyFares', journey, exports.RailDirection.Outbound)) });
16285
+ return Object.assign(Object.assign({}, journey), { dualSingleJourneyFares: _this.helpers.map(journey.dualSingleJourneyFares || {}, setRules('dualSingleJourneyFares', journey, exports.RailDirection.Outbound)), singleJourneyFares: _this.helpers.map(journey.singleJourneyFares || {}, setRules('singleJourneyFares', journey, exports.RailDirection.Outbound)), returnJourneyFares: _this.helpers.map(journey.returnJourneyFares || {}, setRules('returnJourneyFares', journey, exports.RailDirection.Outbound)), openReturnJourneyFares: _this.helpers.map(journey.openReturnJourneyFares || {}, setRules('openReturnJourneyFares', journey, exports.RailDirection.Outbound)) });
15555
16286
  }), return: (next.return || []).map(function (journey) {
15556
16287
  return Object.assign(Object.assign({}, journey), { returnJourneyFares: _this.helpers.map(journey.returnJourneyFares || {}, setSelected('returnJourneyFares', journey)), dualSingleJourneyFares: _this.helpers.map(journey.dualSingleJourneyFares || {}, setSelected('dualSingleJourneyFares', journey)), singleJourneyFares: _this.helpers.map(journey.singleJourneyFares || {}, setRules('singleJourneyFares', journey, 'return')), openReturnJourneyFares: _this.helpers.map(journey.openReturnJourneyFares || {}, setRules('openReturnJourneyFares', journey, 'return')) });
15557
16288
  }) });
@@ -15655,24 +16386,30 @@
15655
16386
  this.noOfChildren = fav.children;
15656
16387
  this.chosenSearchType = fav.journeyType;
15657
16388
  switch (fav.class) {
15658
- case "First":
16389
+ case 'First':
15659
16390
  this.chosenRailClass = RailClass.First;
15660
16391
  break;
15661
- case "Any":
16392
+ case 'Any':
15662
16393
  this.chosenRailClass = RailClass.All;
15663
16394
  break;
15664
- case "Standard":
16395
+ case 'Standard':
15665
16396
  this.chosenRailClass = RailClass.Standard;
15666
16397
  break;
15667
16398
  }
15668
- this.getRailStationFetcher.fetchList({ id: fav.departureLocationId }).subscribe(function (a) {
16399
+ this.getRailStationFetcher
16400
+ .fetchList({ id: fav.departureLocationId })
16401
+ .subscribe(function (a) {
15669
16402
  _this.travellingFrom = a;
15670
16403
  });
15671
- this.getRailStationFetcher.fetchList({ id: fav.arrivalLocationId }).subscribe(function (a) {
16404
+ this.getRailStationFetcher
16405
+ .fetchList({ id: fav.arrivalLocationId })
16406
+ .subscribe(function (a) {
15672
16407
  _this.travellingTo = a;
15673
16408
  });
15674
16409
  if (fav.viaLocationId) {
15675
- this.getRailStationFetcher.fetchList({ id: fav.viaLocationId }).subscribe(function (a) {
16410
+ this.getRailStationFetcher
16411
+ .fetchList({ id: fav.viaLocationId })
16412
+ .subscribe(function (a) {
15676
16413
  _this.viaLocation = a;
15677
16414
  });
15678
16415
  this.via = true;
@@ -15754,11 +16491,10 @@
15754
16491
  var IRLEnterpriseSearch = /** @class */ (function (_super) {
15755
16492
  __extends(IRLEnterpriseSearch, _super);
15756
16493
  function IRLEnterpriseSearch(Irlfetcher, irlDiscountCardsFetcher, helpers, basketService, storageService, searchService, getIrlSupplierStationFetcher) {
15757
- var _this = _super.call(this, storageService, helpers) || this;
16494
+ var _this = _super.call(this, storageService, helpers, searchService) || this;
15758
16495
  _this.Irlfetcher = Irlfetcher;
15759
16496
  _this.irlDiscountCardsFetcher = irlDiscountCardsFetcher;
15760
16497
  _this.basketService = basketService;
15761
- _this.searchService = searchService;
15762
16498
  _this.getIrlSupplierStationFetcher = getIrlSupplierStationFetcher;
15763
16499
  _this.resultsSessionName = IRLEnterpriseSearch.STORAGE_SESSION_RESULTS;
15764
16500
  _this.multiResultsSessionName = IRLEnterpriseSearch.STORAGE_SESSION_RESULTS;
@@ -16452,6 +17188,57 @@
16452
17188
  }
16453
17189
  return this.helpers.removeNulls(query);
16454
17190
  };
17191
+ IRLEnterpriseSearch.prototype.updateSearchFromExpiredBasketItem = function (basketItem) {
17192
+ var _this = this;
17193
+ var searchIrlQuery = basketItem.searchQuery;
17194
+ this.journeyType = searchIrlQuery.journeyType;
17195
+ this.irlClass = searchIrlQuery.class;
17196
+ // get outBoundDateTime, inBoundDateTime
17197
+ this.outBoundDateTime = moment__default['default'](searchIrlQuery.outboundDepartureDateTime);
17198
+ if (searchIrlQuery.journeyType === IrlJourneyType.ReturnJourney) {
17199
+ this.inBoundDateTime = moment__default['default'](searchIrlQuery.returnDepartureDateTime);
17200
+ }
17201
+ if (searchIrlQuery.departureLocationId) {
17202
+ this.searchService
17203
+ .getRailStationById(searchIrlQuery.departureLocationId)
17204
+ .subscribe(function (departureStation) {
17205
+ _this.travellingFrom = {
17206
+ name: departureStation.name,
17207
+ railstation: {
17208
+ id: departureStation.id,
17209
+ name: departureStation.name,
17210
+ nlcCode: departureStation.nlcCode,
17211
+ stationCode: departureStation.stationCode,
17212
+ trainlineCode: departureStation.trainlineCode,
17213
+ trainlineUniqueCode: departureStation.trainlineUniqueCode
17214
+ }
17215
+ };
17216
+ });
17217
+ }
17218
+ if (searchIrlQuery.arrivalLocationId) {
17219
+ this.searchService
17220
+ .getRailStationById(searchIrlQuery.arrivalLocationId)
17221
+ .subscribe(function (arrivalStation) {
17222
+ _this.travellingTo = {
17223
+ name: arrivalStation.name,
17224
+ railstation: {
17225
+ id: arrivalStation.id,
17226
+ name: arrivalStation.name,
17227
+ nlcCode: arrivalStation.nlcCode,
17228
+ stationCode: arrivalStation.stationCode,
17229
+ trainlineCode: arrivalStation.trainlineCode,
17230
+ trainlineUniqueCode: arrivalStation.trainlineUniqueCode
17231
+ }
17232
+ };
17233
+ });
17234
+ }
17235
+ // add Travellers
17236
+ if (basketItem.users) {
17237
+ basketItem.users.forEach(function (user) {
17238
+ _this.searchService.addTraveller(user);
17239
+ });
17240
+ }
17241
+ };
16455
17242
  IRLEnterpriseSearch.prototype.updateFromPreviousSearches = function (previousItems) { };
16456
17243
  IRLEnterpriseSearch.prototype.updateCanCombine = function (tkt) {
16457
17244
  var _this = this;
@@ -16489,139 +17276,150 @@
16489
17276
  };
16490
17277
  IRLEnterpriseSearch.prototype.addSingleJourneyToBasket = function (serviceId, irlQuery, outbound, irlJourneyOption) {
16491
17278
  return __awaiter(this, void 0, void 0, function () {
16492
- var intBasket, basket, selectedIrlTicketOption, legs, termsAndConditions, basketItem;
17279
+ var intBasket, basket, selectedIrlTicketOption, legs, termsAndConditions, basketItem, whatHappened;
16493
17280
  return __generator(this, function (_e) {
16494
17281
  switch (_e.label) {
16495
17282
  case 0: return [4 /*yield*/, this.basketService.getDefaultBasket()];
16496
17283
  case 1:
16497
17284
  intBasket = _e.sent();
16498
17285
  basket = intBasket === null || intBasket === void 0 ? void 0 : intBasket.subject.value;
16499
- if (basket) {
16500
- selectedIrlTicketOption = this.getSelectedIrlTicketOption(irlJourneyOption, outbound, 0);
16501
- legs = this.getLegsFromIrlJourneyOption(irlJourneyOption);
16502
- termsAndConditions = this.getTermsAndCond(irlJourneyOption);
16503
- basketItem = {
16504
- basket: basket.id,
16505
- service: serviceId,
16506
- detail: {
16507
- outwardDetail: {
16508
- arrivalDateTime: irlJourneyOption.arriveDateTime,
16509
- arrivalStationName: irlJourneyOption.to,
16510
- arrivalStationCode: irlJourneyOption.toCode,
16511
- departureDateTime: irlJourneyOption.departDateTime,
16512
- departureStationName: irlJourneyOption.from,
16513
- departureStationCode: irlJourneyOption.fromCode,
16514
- supplierTickets: [
16515
- {
16516
- supplierName: irlJourneyOption.providers[0].name,
16517
- ticketDescription: selectedIrlTicketOption.type,
16518
- price: selectedIrlTicketOption.price,
16519
- legs: legs
16520
- }
16521
- ]
16522
- },
16523
- transactionIdentifier: irlJourneyOption.identifiers.transactionIdentifier,
16524
- outbound: {
16525
- fareIdentifiers: [
16526
- selectedIrlTicketOption.identifiers.fareIdentifier
16527
- ],
16528
- journeyIdentifier: selectedIrlTicketOption.identifiers.journeyIdentifier
16529
- },
16530
- supplier: irlJourneyOption.providers[0].providerId,
16531
- termsAndCond: termsAndConditions
17286
+ if (!basket) return [3 /*break*/, 3];
17287
+ selectedIrlTicketOption = this.getSelectedIrlTicketOption(irlJourneyOption, outbound, 0);
17288
+ legs = this.getLegsFromIrlJourneyOption(irlJourneyOption);
17289
+ termsAndConditions = this.getTermsAndCond(irlJourneyOption);
17290
+ basketItem = {
17291
+ basket: basket.id,
17292
+ service: serviceId,
17293
+ detail: {
17294
+ outwardDetail: {
17295
+ arrivalDateTime: irlJourneyOption.arriveDateTime,
17296
+ arrivalStationName: irlJourneyOption.to,
17297
+ arrivalStationCode: irlJourneyOption.toCode,
17298
+ departureDateTime: irlJourneyOption.departDateTime,
17299
+ departureStationName: irlJourneyOption.from,
17300
+ departureStationCode: irlJourneyOption.fromCode,
17301
+ supplierTickets: [
17302
+ {
17303
+ supplierName: irlJourneyOption.providers[0].name,
17304
+ ticketDescription: selectedIrlTicketOption.type,
17305
+ price: selectedIrlTicketOption.price,
17306
+ legs: legs
17307
+ }
17308
+ ]
16532
17309
  },
16533
- adults: irlQuery.adults,
16534
- price: selectedIrlTicketOption.price,
16535
- currency: selectedIrlTicketOption.currency,
16536
- searchQuery: irlQuery,
16537
- // co2PerItem: irlJourneyOption.co2PerItem,
16538
- // co2PerPassenger: irlJourneyOption.co2PerPassenger,
16539
- outboundDate: irlJourneyOption.departDateTime
16540
- };
16541
- return [2 /*return*/, this.basketService.addToBasket(basketItem, intBasket, this.searchService, this.travellers, false // TODO
16542
- )];
17310
+ transactionIdentifier: irlJourneyOption.identifiers.transactionIdentifier,
17311
+ outbound: {
17312
+ fareIdentifiers: [
17313
+ selectedIrlTicketOption.identifiers.fareIdentifier
17314
+ ],
17315
+ journeyIdentifier: selectedIrlTicketOption.identifiers.journeyIdentifier
17316
+ },
17317
+ supplier: irlJourneyOption.providers[0].providerId,
17318
+ termsAndCond: termsAndConditions
17319
+ },
17320
+ adults: irlQuery.adults,
17321
+ price: selectedIrlTicketOption.price,
17322
+ currency: selectedIrlTicketOption.currency,
17323
+ searchQuery: irlQuery,
17324
+ // co2PerItem: irlJourneyOption.co2PerItem,
17325
+ // co2PerPassenger: irlJourneyOption.co2PerPassenger,
17326
+ outboundDate: irlJourneyOption.departDateTime
17327
+ };
17328
+ return [4 /*yield*/, this.basketService.addToBasket(basketItem, intBasket, this.searchService, this.travellers, false // TODO
17329
+ )];
17330
+ case 2:
17331
+ whatHappened = _e.sent();
17332
+ if (whatHappened === exports.DifferentInvokdedUserReasons.research) {
17333
+ this.performSearch();
16543
17334
  }
16544
- return [2 /*return*/, Promise.resolve(false)];
17335
+ return [2 /*return*/, whatHappened];
17336
+ case 3: return [2 /*return*/, exports.DifferentInvokdedUserReasons.cancel];
16545
17337
  }
16546
17338
  });
16547
17339
  });
16548
17340
  };
16549
17341
  IRLEnterpriseSearch.prototype.addReturnJourneyToBasket = function (serviceId, irlQuery, inbound, inJourneyOption, outboundTicket, outboundJourney) {
16550
17342
  return __awaiter(this, void 0, void 0, function () {
16551
- var outbound, outJourneyOption, intBasket, basket, selectedIrlTicketOption, outboundLegs, inboundLegs, termsAndConditions, basketItem;
17343
+ var outbound, outJourneyOption, intBasket, basket, selectedIrlTicketOption, outboundLegs, inboundLegs, termsAndConditions, basketItem, whatHappened;
16552
17344
  return __generator(this, function (_e) {
16553
17345
  switch (_e.label) {
16554
17346
  case 0:
16555
17347
  outbound = outboundTicket ? outboundTicket : this.outboundTicket;
16556
- outJourneyOption = outboundJourney ? outboundJourney : this.outboundJourneyOptions;
17348
+ outJourneyOption = outboundJourney
17349
+ ? outboundJourney
17350
+ : this.outboundJourneyOptions;
16557
17351
  return [4 /*yield*/, this.basketService.getDefaultBasket()];
16558
17352
  case 1:
16559
17353
  intBasket = _e.sent();
16560
17354
  basket = intBasket === null || intBasket === void 0 ? void 0 : intBasket.subject.value;
16561
- if (basket) {
16562
- selectedIrlTicketOption = this.getSelectedIrlTicketOption(outJourneyOption, outbound, 0);
16563
- outboundLegs = this.getLegsFromIrlJourneyOption(outJourneyOption);
16564
- inboundLegs = this.getLegsFromIrlJourneyOption(inJourneyOption);
16565
- termsAndConditions = this.getTermsAndCond(outJourneyOption);
16566
- basketItem = {
16567
- basket: basket.id,
16568
- service: serviceId,
16569
- detail: {
16570
- outwardDetail: {
16571
- arrivalDateTime: outJourneyOption.arriveDateTime,
16572
- arrivalStationName: outJourneyOption.to,
16573
- arrivalStationCode: outJourneyOption.toCode,
16574
- departureStationCode: outJourneyOption.fromCode,
16575
- departureDateTime: outJourneyOption.departDateTime,
16576
- departureStationName: outJourneyOption.from,
16577
- supplierTickets: [
16578
- {
16579
- supplierName: outJourneyOption.providers[0].name,
16580
- ticketDescription: selectedIrlTicketOption.type,
16581
- price: selectedIrlTicketOption.price,
16582
- legs: outboundLegs
16583
- }
16584
- ]
16585
- },
16586
- inwardDetail: {
16587
- arrivalDateTime: inJourneyOption.arriveDateTime,
16588
- arrivalStationName: inJourneyOption.to,
16589
- arrivalStationCode: inJourneyOption.toCode,
16590
- departureStationCode: inJourneyOption.fromCode,
16591
- departureDateTime: inJourneyOption.departDateTime,
16592
- departureStationName: inJourneyOption.from,
16593
- supplierTickets: [
16594
- {
16595
- supplierName: inJourneyOption.providers[0].name,
16596
- ticketDescription: inbound.type,
16597
- legs: inboundLegs
16598
- }
16599
- ]
16600
- },
16601
- transactionIdentifier: outbound.identifiers.transactionIdentifier,
16602
- outbound: {
16603
- fareIdentifiers: [
16604
- selectedIrlTicketOption.identifiers.fareIdentifier
16605
- ],
16606
- journeyIdentifier: selectedIrlTicketOption.identifiers.journeyIdentifier
16607
- },
16608
- supplier: outJourneyOption.providers[0].providerId,
16609
- termsAndCond: termsAndConditions
17355
+ if (!basket) return [3 /*break*/, 3];
17356
+ selectedIrlTicketOption = this.getSelectedIrlTicketOption(outJourneyOption, outbound, 0);
17357
+ outboundLegs = this.getLegsFromIrlJourneyOption(outJourneyOption);
17358
+ inboundLegs = this.getLegsFromIrlJourneyOption(inJourneyOption);
17359
+ termsAndConditions = this.getTermsAndCond(outJourneyOption);
17360
+ basketItem = {
17361
+ basket: basket.id,
17362
+ service: serviceId,
17363
+ detail: {
17364
+ outwardDetail: {
17365
+ arrivalDateTime: outJourneyOption.arriveDateTime,
17366
+ arrivalStationName: outJourneyOption.to,
17367
+ arrivalStationCode: outJourneyOption.toCode,
17368
+ departureStationCode: outJourneyOption.fromCode,
17369
+ departureDateTime: outJourneyOption.departDateTime,
17370
+ departureStationName: outJourneyOption.from,
17371
+ supplierTickets: [
17372
+ {
17373
+ supplierName: outJourneyOption.providers[0].name,
17374
+ ticketDescription: selectedIrlTicketOption.type,
17375
+ price: selectedIrlTicketOption.price,
17376
+ legs: outboundLegs
17377
+ }
17378
+ ]
16610
17379
  },
16611
- adults: irlQuery.adults,
16612
- price: Number((Number(selectedIrlTicketOption.price) + Number(inbound.price)).toFixed(2)),
16613
- currency: selectedIrlTicketOption.currency,
16614
- searchQuery: irlQuery,
16615
- outboundDate: outJourneyOption.departDateTime
16616
- // co2PerItem: outbound.co2PerItem,
16617
- // co2PerPassenger: outbound.co2PerPassenger
16618
- };
16619
- this.filterSelected();
16620
- console.log(basketItem);
16621
- return [2 /*return*/, this.basketService.addToBasket(basketItem, intBasket, this.searchService, this.travellers, false // TODO
16622
- )];
17380
+ inwardDetail: {
17381
+ arrivalDateTime: inJourneyOption.arriveDateTime,
17382
+ arrivalStationName: inJourneyOption.to,
17383
+ arrivalStationCode: inJourneyOption.toCode,
17384
+ departureStationCode: inJourneyOption.fromCode,
17385
+ departureDateTime: inJourneyOption.departDateTime,
17386
+ departureStationName: inJourneyOption.from,
17387
+ supplierTickets: [
17388
+ {
17389
+ supplierName: inJourneyOption.providers[0].name,
17390
+ ticketDescription: inbound.type,
17391
+ legs: inboundLegs
17392
+ }
17393
+ ]
17394
+ },
17395
+ transactionIdentifier: outbound.identifiers.transactionIdentifier,
17396
+ outbound: {
17397
+ fareIdentifiers: [
17398
+ selectedIrlTicketOption.identifiers.fareIdentifier
17399
+ ],
17400
+ journeyIdentifier: selectedIrlTicketOption.identifiers.journeyIdentifier
17401
+ },
17402
+ supplier: outJourneyOption.providers[0].providerId,
17403
+ termsAndCond: termsAndConditions
17404
+ },
17405
+ adults: irlQuery.adults,
17406
+ price: Number((Number(selectedIrlTicketOption.price) + Number(inbound.price)).toFixed(2)),
17407
+ currency: selectedIrlTicketOption.currency,
17408
+ searchQuery: irlQuery,
17409
+ outboundDate: outJourneyOption.departDateTime
17410
+ // co2PerItem: outbound.co2PerItem,
17411
+ // co2PerPassenger: outbound.co2PerPassenger
17412
+ };
17413
+ this.filterSelected();
17414
+ return [4 /*yield*/, this.basketService.addToBasket(basketItem, intBasket, this.searchService, this.travellers, false // TODO
17415
+ )];
17416
+ case 2:
17417
+ whatHappened = _e.sent();
17418
+ if (whatHappened === exports.DifferentInvokdedUserReasons.research) {
17419
+ this.performSearch();
16623
17420
  }
16624
- return [2 /*return*/, Promise.resolve(false)];
17421
+ return [2 /*return*/, whatHappened];
17422
+ case 3: return [2 /*return*/, exports.DifferentInvokdedUserReasons.cancel];
16625
17423
  }
16626
17424
  });
16627
17425
  });
@@ -16812,16 +17610,20 @@
16812
17610
  if (!priceMin || priceMin > result.providers[0].cheapestTicket.price) {
16813
17611
  priceMin = Math.floor(result.providers[0].cheapestTicket.price);
16814
17612
  }
16815
- if (!dateDepMin || moment__default['default'](result.departDateTime).isBefore(moment__default['default'](dateDepMin))) {
17613
+ if (!dateDepMin ||
17614
+ moment__default['default'](result.departDateTime).isBefore(moment__default['default'](dateDepMin))) {
16816
17615
  dateDepMin = Number(moment__default['default'](result.departDateTime).format('HHmm'));
16817
17616
  }
16818
- if (!dateDepMax || moment__default['default'](result.departDateTime).isAfter(moment__default['default'](dateDepMax))) {
17617
+ if (!dateDepMax ||
17618
+ moment__default['default'](result.departDateTime).isAfter(moment__default['default'](dateDepMax))) {
16819
17619
  dateDepMax = Number(moment__default['default'](result.departDateTime).format('HHmm'));
16820
17620
  }
16821
- if (!dateArrMin || moment__default['default'](result.arriveDateTime).isBefore(moment__default['default'](dateArrMin))) {
17621
+ if (!dateArrMin ||
17622
+ moment__default['default'](result.arriveDateTime).isBefore(moment__default['default'](dateArrMin))) {
16822
17623
  dateArrMin = Number(moment__default['default'](result.arriveDateTime).format('HHmm'));
16823
17624
  }
16824
- if (!dateArrMax || moment__default['default'](result.arriveDateTime).isAfter(moment__default['default'](dateArrMax))) {
17625
+ if (!dateArrMax ||
17626
+ moment__default['default'](result.arriveDateTime).isAfter(moment__default['default'](dateArrMax))) {
16825
17627
  dateArrMax = Number(moment__default['default'](result.arriveDateTime).format('HHmm'));
16826
17628
  }
16827
17629
  changesObject[result.segments.length - 1] = {
@@ -16874,7 +17676,7 @@
16874
17676
  // now first of all - apply the price filters
16875
17677
  dirResults = dirResults.filter(function (result) {
16876
17678
  var tickets = result.providers[0].ticketOptions.filter(function (ticket) {
16877
- return ticket.price >= filters.priceMin && ticket.price <= filters.priceMax;
17679
+ return (ticket.price >= filters.priceMin && ticket.price <= filters.priceMax);
16878
17680
  });
16879
17681
  result.providers[0].ticketOptions = tickets;
16880
17682
  return tickets.length;
@@ -16939,17 +17741,24 @@
16939
17741
  return __awaiter(this, void 0, void 0, function () {
16940
17742
  var _this = this;
16941
17743
  return __generator(this, function (_e) {
16942
- this.getIrlSupplierStationFetcher.fetchList({ id: fav.departureLocationId }).subscribe(function (a) {
17744
+ this.getIrlSupplierStationFetcher
17745
+ .fetchList({ id: fav.departureLocationId })
17746
+ .subscribe(function (a) {
16943
17747
  _this.travellingFrom = a;
16944
17748
  });
16945
- this.getIrlSupplierStationFetcher.fetchList({ id: fav.arrivalLocationId }).subscribe(function (a) {
17749
+ this.getIrlSupplierStationFetcher
17750
+ .fetchList({ id: fav.arrivalLocationId })
17751
+ .subscribe(function (a) {
16946
17752
  _this.travellingTo = a;
16947
17753
  });
16948
17754
  this.adults = fav.adults;
16949
17755
  this.children = fav.children;
16950
17756
  this.class = fav.class;
16951
17757
  this.countryCode = fav.countryCode;
16952
- this.journeyType = fav.journeyType === "ReturnJourney" ? IrlJourneyType.ReturnJourney : IrlJourneyType.SingleJourney;
17758
+ this.journeyType =
17759
+ fav.journeyType === 'ReturnJourney'
17760
+ ? IrlJourneyType.ReturnJourney
17761
+ : IrlJourneyType.SingleJourney;
16953
17762
  this.supplier = fav.supplier;
16954
17763
  return [2 /*return*/];
16955
17764
  });
@@ -17093,7 +17902,7 @@
17093
17902
  this.userInfo.phoneNumber = new PhoneNumberImpl(this.helpers);
17094
17903
  this.userInfo.supplementaryInfo =
17095
17904
  this.perPassengerSupplementaryBookingInfoSchema;
17096
- if (this.user.id) {
17905
+ if (this.user.id && this.user.__typename === 'User') {
17097
17906
  this.getUserFetcher
17098
17907
  .fetchOne({ id: this.user.id })
17099
17908
  .pipe(operators.take(1))
@@ -17114,6 +17923,7 @@
17114
17923
  this.basketItem = basketItem;
17115
17924
  this.helpers = helpers;
17116
17925
  this.hasDetails = false;
17926
+ this.noCovertSelectSchemas = [exports.SchemaFormat.railSeating, exports.SchemaFormat.passport, exports.SchemaFormat.selectQueue];
17117
17927
  this.basketItem.perPassengerSupplementaryBookingInfoSchema =
17118
17928
  basketItem.perPassengerSupplementaryBookingInfoSchema
17119
17929
  ? this.processSchema(this.basketItem.perPassengerSupplementaryBookingInfoSchema)
@@ -17121,6 +17931,9 @@
17121
17931
  this.userInfo = this.basketItem.users.map(function (user) {
17122
17932
  return new UserInfoImpl(user, getUserFetcher, helpers, _this.basketItem.perPassengerPhoneNumber, _this.basketItem.perPassengerAddress, _this.basketItem.perPassengerSupplementaryBookingInfoSchema);
17123
17933
  });
17934
+ this.guestInfo = this.basketItem.guests.map(function (guest) {
17935
+ return new UserInfoImpl(guest, getUserFetcher, helpers, _this.basketItem.perPassengerPhoneNumber, _this.basketItem.perPassengerAddress, _this.basketItem.perPassengerSupplementaryBookingInfoSchema);
17936
+ });
17124
17937
  this.address = new AddressImpl(this.helpers);
17125
17938
  this.phoneNumber = new PhoneNumberImpl(this.helpers);
17126
17939
  this.basketItem.perItemSupplementaryBookingInfoSchema = this.basketItem
@@ -17192,7 +18005,7 @@
17192
18005
  item.format ||
17193
18006
  _this.schemaWidgetToFormat(item.widget) ||
17194
18007
  _this.schemaTypeToFormat(item.type);
17195
- if (item.oneOf && item.oneOf.length > 0 && item.format !== 'railSeating' && item.format !== exports.SchemaFormat.selectQueue) {
18008
+ if (item.oneOf && item.oneOf.length > 0 && !_this.noCovertSelectSchemas.includes(item.format)) {
17196
18009
  item.format = exports.SchemaFormat.select;
17197
18010
  }
17198
18011
  });
@@ -17239,7 +18052,8 @@
17239
18052
  basketItem: this.basketItem.id,
17240
18053
  userInfo: [],
17241
18054
  supplementaryInfo: {},
17242
- paymentMethodDetails: {}
18055
+ paymentMethodDetails: {},
18056
+ guestInfo: []
17243
18057
  };
17244
18058
  if (values.perItemAddress !== undefined) {
17245
18059
  newValue.address = this.helpers.toStrings(values.perItemAddress, AddressSchema);
@@ -17251,6 +18065,7 @@
17251
18065
  newValue.supplementaryInfo = this.helpers.toStrings(values.perItemSupplementarySchema, this.perItemSupplementarySchema);
17252
18066
  }
17253
18067
  newValue.userInfo = this.userInfo.map(function (userInfo, index) {
18068
+ var _a, _b;
17254
18069
  var userValue = { id: userInfo.id, supplementaryInfo: {} };
17255
18070
  var thisUserSupplemental = values['user_' + index] || {};
17256
18071
  if (thisUserSupplemental.perPassengerAddress !== undefined) {
@@ -17263,6 +18078,38 @@
17263
18078
  undefined) {
17264
18079
  userValue.supplementaryInfo = _this.helpers.toStrings(thisUserSupplemental.perPassengerSupplementaryBookingInfoSchema, _this.perPassengerSupplementaryBookingInfoSchema);
17265
18080
  }
18081
+ if (userValue.supplementaryInfo.passport) {
18082
+ if ((_a = userValue.supplementaryInfo.passport.dateOfExpiry) === null || _a === void 0 ? void 0 : _a.year) {
18083
+ userValue.supplementaryInfo.passport.dateOfExpiry = _this.helpers.formatIsoDate(_this.helpers.ngDateToMoment(userValue.supplementaryInfo.passport.dateOfExpiry));
18084
+ }
18085
+ if ((_b = userValue.supplementaryInfo.passport.dateOfIssue) === null || _b === void 0 ? void 0 : _b.year) {
18086
+ userValue.supplementaryInfo.passport.dateOfIssue = _this.helpers.formatIsoDate(_this.helpers.ngDateToMoment(userValue.supplementaryInfo.passport.dateOfIssue));
18087
+ }
18088
+ }
18089
+ return userValue;
18090
+ });
18091
+ newValue.guestInfo = this.guestInfo.map(function (guestInfo, index) {
18092
+ var _a, _b;
18093
+ var userValue = { id: guestInfo.id, supplementaryInfo: {} };
18094
+ var thisUserSupplemental = values['guest_' + index] || {};
18095
+ if (thisUserSupplemental.perPassengerAddress !== undefined) {
18096
+ userValue.address = _this.helpers.toStrings(thisUserSupplemental.perPassengerAddress, AddressSchema);
18097
+ }
18098
+ if (thisUserSupplemental.perPassengerPhoneNumber !== undefined) {
18099
+ userValue.phoneNumber = _this.helpers.toStrings(thisUserSupplemental.perPassengerPhoneNumber, PhoneNumberSchema);
18100
+ }
18101
+ if (thisUserSupplemental.perPassengerSupplementaryBookingInfoSchema !==
18102
+ undefined) {
18103
+ userValue.supplementaryInfo = _this.helpers.toStrings(thisUserSupplemental.perPassengerSupplementaryBookingInfoSchema, _this.perPassengerSupplementaryBookingInfoSchema);
18104
+ }
18105
+ if (userValue.supplementaryInfo.passport) {
18106
+ if ((_a = userValue.supplementaryInfo.passport.dateOfExpiry) === null || _a === void 0 ? void 0 : _a.year) {
18107
+ userValue.supplementaryInfo.passport.dateOfExpiry = _this.helpers.formatIsoDate(_this.helpers.ngDateToMoment(userValue.supplementaryInfo.passport.dateOfExpiry));
18108
+ }
18109
+ if ((_b = userValue.supplementaryInfo.passport.dateOfIssue) === null || _b === void 0 ? void 0 : _b.year) {
18110
+ userValue.supplementaryInfo.passport.dateOfIssue = _this.helpers.formatIsoDate(_this.helpers.ngDateToMoment(userValue.supplementaryInfo.passport.dateOfIssue));
18111
+ }
18112
+ }
17266
18113
  return userValue;
17267
18114
  });
17268
18115
  return newValue;
@@ -17923,6 +18770,30 @@
17923
18770
  return BaseGetConfermaRoomImagesFetcher;
17924
18771
  }(FetchableList));
17925
18772
 
18773
+ var BaseGetCompaniesFetcher = /** @class */ (function (_super) {
18774
+ __extends(BaseGetCompaniesFetcher, _super);
18775
+ function BaseGetCompaniesFetcher(getCompaniesGQL, helpers, modalService) {
18776
+ return _super.call(this, getCompaniesGQL, helpers, modalService) || this;
18777
+ }
18778
+ BaseGetCompaniesFetcher.prototype.getDataFromResult = function (results) {
18779
+ var _a;
18780
+ return (_a = results === null || results === void 0 ? void 0 : results.data) === null || _a === void 0 ? void 0 : _a.getCompanies;
18781
+ };
18782
+ return BaseGetCompaniesFetcher;
18783
+ }(FetchableList));
18784
+
18785
+ var BaseGetCompanyFetcher = /** @class */ (function (_super) {
18786
+ __extends(BaseGetCompanyFetcher, _super);
18787
+ function BaseGetCompanyFetcher(getCompanyGQL, helpers, modalService) {
18788
+ return _super.call(this, getCompanyGQL, modalService, helpers) || this;
18789
+ }
18790
+ BaseGetCompanyFetcher.prototype.getDataFromResult = function (results) {
18791
+ var _a;
18792
+ return (_a = results === null || results === void 0 ? void 0 : results.data) === null || _a === void 0 ? void 0 : _a.getCompany;
18793
+ };
18794
+ return BaseGetCompanyFetcher;
18795
+ }(FetchableObject));
18796
+
17926
18797
  var BaseEmailBasketFetcher = /** @class */ (function (_super) {
17927
18798
  __extends(BaseEmailBasketFetcher, _super);
17928
18799
  function BaseEmailBasketFetcher(gql, helpers, modalService) {
@@ -18018,6 +18889,18 @@
18018
18889
  return BaseGetCancellationInfoFetcher;
18019
18890
  }(FetchableObject));
18020
18891
 
18892
+ var BaseGetUserGuestsFetcher = /** @class */ (function (_super) {
18893
+ __extends(BaseGetUserGuestsFetcher, _super);
18894
+ function BaseGetUserGuestsFetcher(queryGQL, helpers, modalService) {
18895
+ return _super.call(this, queryGQL, helpers, modalService) || this;
18896
+ }
18897
+ BaseGetUserGuestsFetcher.prototype.getDataFromResult = function (results) {
18898
+ var _a;
18899
+ return (_a = results.data) === null || _a === void 0 ? void 0 : _a.getUserGuests;
18900
+ };
18901
+ return BaseGetUserGuestsFetcher;
18902
+ }(FetchableList));
18903
+
18021
18904
  // | 'fareTypes';
18022
18905
 
18023
18906
  ;
@@ -18125,7 +19008,7 @@
18125
19008
  return mi.reason && mi.selectedValues.length === 0;
18126
19009
  }).length !== 0);
18127
19010
  });
18128
- if (!(basketItems.length > 0)) return [3 /*break*/, 2];
19011
+ if (!(basketItems.length > 0)) return [3 /*break*/, 5];
18129
19012
  this.workingOn = {
18130
19013
  basket: basket,
18131
19014
  required: basketItems.reduce(function (required, bi) {
@@ -18138,24 +19021,30 @@
18138
19021
  return [4 /*yield*/, this.modalService.open(ModalTypes.RequiresReasonDialogComponent, { backdrop: 'static' }, this.workingOn)];
18139
19022
  case 1:
18140
19023
  results_1 = _a.sent();
18141
- if (results_1) {
18142
- this.workingOn.basket.basketItems.forEach(function (bi) {
18143
- (bi.managementInfo || []).forEach(function (mi) {
19024
+ if (!results_1) return [3 /*break*/, 3];
19025
+ return [4 /*yield*/, Promise.all(this.workingOn.basket.basketItems.map(function (bi) {
19026
+ return Promise.all((bi.managementInfo || []).map(function (mi) {
18144
19027
  if (results_1[mi.id]) {
18145
- _this.basketService.setMiSelectedValue(_this.workingOn.basket.id, mi, results_1[mi.id], null);
19028
+ return _this.basketService.setMiSelectedValue(_this.workingOn.basket.id, mi, results_1[mi.id], null);
18146
19029
  }
18147
- });
18148
- });
18149
- }
18150
- else {
18151
- Object.entries(this.workingOn.required).forEach(function (_a) {
18152
- var _b = __read(_a, 2), biId = _b[0], mis = _b[1];
18153
- _this.basketService.removeBasketItem(_this.workingOn.basket.id, _this.workingOn.basket.basketItems.find(function (bi) { return bi.id === biId; }));
18154
- });
18155
- }
19030
+ else {
19031
+ return Promise.resolve();
19032
+ }
19033
+ }));
19034
+ }))];
19035
+ case 2:
19036
+ _a.sent();
18156
19037
  this.workingOn = null;
18157
- _a.label = 2;
18158
- case 2: return [2 /*return*/];
19038
+ return [3 /*break*/, 5];
19039
+ case 3: return [4 /*yield*/, Promise.all(Object.entries(this.workingOn.required).map(function (_a) {
19040
+ var _b = __read(_a, 2), biId = _b[0], mis = _b[1];
19041
+ return _this.basketService.removeBasketItem(_this.workingOn.basket.id, _this.workingOn.basket.basketItems.find(function (bi) { return bi.id === biId; }));
19042
+ }))];
19043
+ case 4:
19044
+ _a.sent();
19045
+ this.workingOn = null;
19046
+ _a.label = 5;
19047
+ case 5: return [2 /*return*/];
18159
19048
  }
18160
19049
  });
18161
19050
  });
@@ -18208,7 +19097,7 @@
18208
19097
  this.id = basket.id;
18209
19098
  this.title = basket.title;
18210
19099
  var toSend = Object.assign(Object.assign({}, basket), (basket.basketItems || []).reduce(function (accum, item, index) {
18211
- var _a, _b;
19100
+ var _a, _b, _c;
18212
19101
  if (!accum.prices[item.currency]) {
18213
19102
  accum.prices[item.currency] = 0;
18214
19103
  }
@@ -18222,7 +19111,8 @@
18222
19111
  value: item.miGroupSelected || ''
18223
19112
  });
18224
19113
  }
18225
- if (((_a = item.managementInfo) === null || _a === void 0 ? void 0 : _a.length) > 0 && ((_b = item.users) === null || _b === void 0 ? void 0 : _b.length) > 0) {
19114
+ if (((_a = item.managementInfo) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
19115
+ (((_b = item.users) === null || _b === void 0 ? void 0 : _b.length) > 0 || ((_c = item.guests) === null || _c === void 0 ? void 0 : _c.length))) {
18226
19116
  accum.basketInfoMiDetails.push(new BasketInfoMiDetailsImpl(item, _this.basketService, _this.helpers));
18227
19117
  }
18228
19118
  return accum;
@@ -18241,7 +19131,7 @@
18241
19131
  return InternalBasket;
18242
19132
  }());
18243
19133
  var BaseEnterpriseBasketService = /** @class */ (function () {
18244
- function BaseEnterpriseBasketService(acceptNewPriceUpdater, addItemToBasketUpdater, addUserToBasketItem, basketCreator, basketFetcher, bookBasketUpdater, deleteBasketUpdater, getMiAutoSugestionFetcher, helpers, removeItemFromBasketUpdater, revalidateBasketUpdater, setBasketItemMiGroupUpdater, setBasketItemMiValueUpdater, validateMiFreeValue, sendBasketForApprovalUpdater, getUserFetcher, getUserBasketsFetcher, SetBasketItemLeadPassenger, moveItemToADifferentBasket, updateBasketNotesUpdater, updateBasketTitleUpdater, setPaymentMethodUpdater, getCancellationInfoFetcher, userService, modalService) {
19134
+ function BaseEnterpriseBasketService(acceptNewPriceUpdater, addItemToBasketUpdater, addUserToBasketItem, basketCreator, basketFetcher, bookBasketUpdater, deleteBasketUpdater, getMiAutoSugestionFetcher, helpers, removeItemFromBasketUpdater, revalidateBasketUpdater, setBasketItemMiGroupUpdater, setBasketItemMiValueUpdater, validateMiFreeValue, sendBasketForApprovalUpdater, getUserFetcher, getUserBasketsFetcher, SetBasketItemLeadPassenger, moveItemToADifferentBasket, updateBasketNotesUpdater, updateBasketTitleUpdater, setPaymentMethodUpdater, getCancellationInfoFetcher, userService, modalService, webTokenService) {
18245
19135
  var _this = this;
18246
19136
  this.acceptNewPriceUpdater = acceptNewPriceUpdater;
18247
19137
  this.addItemToBasketUpdater = addItemToBasketUpdater;
@@ -18268,6 +19158,7 @@
18268
19158
  this.getCancellationInfoFetcher = getCancellationInfoFetcher;
18269
19159
  this.userService = userService;
18270
19160
  this.modalService = modalService;
19161
+ this.webTokenService = webTokenService;
18271
19162
  this.currentBaskets = [];
18272
19163
  this.highlightBasketItemsEmitter = new rxjs.Subject();
18273
19164
  this.basketChangeEmitter = new rxjs.BehaviorSubject('');
@@ -18329,7 +19220,10 @@
18329
19220
  price: 0
18330
19221
  }
18331
19222
  ];
18332
- this.basketPrices = new rxjs.BehaviorSubject({ total: null, list: this.basketList });
19223
+ this.basketPrices = new rxjs.BehaviorSubject({
19224
+ total: null,
19225
+ list: this.basketList
19226
+ });
18333
19227
  this.menuState = exports.MenuSlideEnum.OUT;
18334
19228
  this.requiresService = new BaseRequiresReasonService(modalService, this);
18335
19229
  this.userService.changeUser.subscribe({
@@ -18383,7 +19277,6 @@
18383
19277
  else {
18384
19278
  _this.currentBasketID = null;
18385
19279
  }
18386
- _this.basketChangeEmitter.next(_this.currentBasketID);
18387
19280
  }, function (error) {
18388
19281
  console.error(error);
18389
19282
  });
@@ -18393,7 +19286,6 @@
18393
19286
  this.currentBaskets = [];
18394
19287
  this.currentBasketID = null;
18395
19288
  this.baskets.next(this.currentBaskets);
18396
- this.basketChangeEmitter.next(this.currentBasketID);
18397
19289
  }
18398
19290
  };
18399
19291
  BaseEnterpriseBasketService.prototype.getAllOpenBaskets = function (user_id) {
@@ -18420,42 +19312,81 @@
18420
19312
  BaseEnterpriseBasketService.prototype.addToBasket = function (item, intBasket, searchService, travellers, requiresReason) {
18421
19313
  if (travellers === void 0) { travellers = []; }
18422
19314
  return __awaiter(this, void 0, void 0, function () {
19315
+ var _d;
18423
19316
  var _this = this;
18424
- return __generator(this, function (_d) {
18425
- item.convertCurrencyTo = 'GBP';
18426
- if ((travellers === null || travellers === void 0 ? void 0 : travellers.length) > 0) {
18427
- item.users = this.helpers.makeUsers(travellers);
18428
- item.leadPassenger = item.users[0].id;
18429
- }
18430
- item.outboundDate = item.outboundDate
18431
- ? new Date(this.helpers.formatIsoDateTime(item.outboundDate))
18432
- : item.outboundDate;
18433
- item.inboundDate = item.inboundDate
18434
- ? new Date(this.helpers.formatIsoDateTime(item.inboundDate))
18435
- : item.inboundDate;
18436
- item.requiresReason = requiresReason;
18437
- item = this.checkDetails(item);
18438
- if (item && intBasket) {
18439
- this.addItemToBasketUpdater
18440
- .updateOne(item)
18441
- .pipe(operators.take(1))
18442
- .subscribe(function (newBasket) {
18443
- intBasket.next(Object.assign(Object.assign({}, intBasket.subject.value), newBasket));
18444
- var service = _this.userService.findService(item.service).type;
18445
- searchService.search_objects[service].booking_chosen = true;
18446
- searchService.search_objects[service].chosen = false;
18447
- var bi = newBasket.basketItems;
18448
- _this.highlightBasketItemsEmitter.next(bi);
18449
- _this.basketChangeEmitter.next(_this.currentBasketID);
18450
- }, function (error) {
18451
- console.error(error);
18452
- intBasket.subject.next(intBasket.subject.value);
18453
- });
19317
+ return __generator(this, function (_e) {
19318
+ switch (_e.label) {
19319
+ case 0: return [4 /*yield*/, this.checkBasketForInvoked(intBasket, this.webTokenService.bobo)];
19320
+ case 1:
19321
+ _d = _e.sent();
19322
+ switch (_d) {
19323
+ case exports.DifferentInvokdedUserReasons.continue: return [3 /*break*/, 2];
19324
+ case exports.DifferentInvokdedUserReasons.cancel: return [3 /*break*/, 3];
19325
+ case exports.DifferentInvokdedUserReasons.newBasket: return [3 /*break*/, 4];
19326
+ case exports.DifferentInvokdedUserReasons.research: return [3 /*break*/, 6];
19327
+ }
19328
+ return [3 /*break*/, 7];
19329
+ case 2: return [3 /*break*/, 7];
19330
+ case 3: return [2 /*return*/, exports.DifferentInvokdedUserReasons.cancel];
19331
+ case 4: return [4 /*yield*/, this.createBasket()];
19332
+ case 5:
19333
+ intBasket = _e.sent();
19334
+ this.currentBasketID = intBasket.id;
19335
+ return [3 /*break*/, 7];
19336
+ case 6:
19337
+ this.webTokenService.bobo = intBasket.subject.value.invokedUser;
19338
+ return [2 /*return*/, exports.DifferentInvokdedUserReasons.research];
19339
+ case 7:
19340
+ item.basket = intBasket.id;
19341
+ item.convertCurrencyTo = 'GBP';
19342
+ if ((travellers === null || travellers === void 0 ? void 0 : travellers.length) > 0) {
19343
+ item.users = this.helpers.makeUsers(travellers.filter(function (trav) { return !trav.guest; }));
19344
+ item.guests = this.helpers.makeUsers(travellers.filter(function (trav) { return trav.guest; }));
19345
+ item.leadPassenger = travellers[0].id;
19346
+ item.leadPassengerType = travellers[0].guest
19347
+ ? LeadPassengerType.Guest
19348
+ : LeadPassengerType.User;
19349
+ }
19350
+ item.outboundDate = item.outboundDate
19351
+ ? new Date(this.helpers.formatIsoDateTime(item.outboundDate))
19352
+ : item.outboundDate;
19353
+ item.inboundDate = item.inboundDate
19354
+ ? new Date(this.helpers.formatIsoDateTime(item.inboundDate))
19355
+ : item.inboundDate;
19356
+ item.requiresReason = requiresReason;
19357
+ item = this.checkDetails(item);
19358
+ this.removeBookedBasket();
19359
+ if (item && intBasket) {
19360
+ this.addItemToBasketUpdater
19361
+ .updateOne(item)
19362
+ .pipe(operators.take(1))
19363
+ .subscribe(function (newBasket) {
19364
+ intBasket.next(Object.assign(Object.assign({}, intBasket.subject.value), newBasket));
19365
+ var service = _this.userService.findService(item.service).type;
19366
+ searchService.search_objects[service].booking_chosen = true;
19367
+ searchService.search_objects[service].chosen = false;
19368
+ var bi = newBasket.basketItems;
19369
+ _this.highlightBasketItemsEmitter.next(bi);
19370
+ }, function (error) {
19371
+ console.error(error);
19372
+ intBasket.subject.next(intBasket.subject.value);
19373
+ });
19374
+ }
19375
+ return [2 /*return*/, exports.DifferentInvokdedUserReasons.continue];
18454
19376
  }
18455
- return [2 /*return*/, false];
18456
19377
  });
18457
19378
  });
18458
19379
  };
19380
+ BaseEnterpriseBasketService.prototype.checkBasketForInvoked = function (intBasket, bobo) {
19381
+ var _a;
19382
+ if (((_a = intBasket.subject.value.invokedUser) === null || _a === void 0 ? void 0 : _a.id) !== (bobo === null || bobo === void 0 ? void 0 : bobo.id)) {
19383
+ return this.modalService.open(ModalTypes.DifferentInvokdedUserComponent, {}, {
19384
+ basketBobo: intBasket.subject.value.invokedUser,
19385
+ currentBobo: bobo
19386
+ });
19387
+ }
19388
+ return Promise.resolve(exports.DifferentInvokdedUserReasons.continue);
19389
+ };
18459
19390
  BaseEnterpriseBasketService.prototype.loadBasket = function (id) {
18460
19391
  var intBasket = this.findBasket(id);
18461
19392
  if (!intBasket) {
@@ -18639,9 +19570,12 @@
18639
19570
  };
18640
19571
  BaseEnterpriseBasketService.prototype.createBasketOnDB = function (intBasket) {
18641
19572
  var _this = this;
19573
+ var _a, _b;
19574
+ var mutation = ((_a = this.webTokenService.bobo) === null || _a === void 0 ? void 0 : _a.id) ? { invokedUser: (_b = this.webTokenService.bobo) === null || _b === void 0 ? void 0 : _b.id }
19575
+ : {};
18642
19576
  return new Promise(function (resolve, reject) {
18643
19577
  _this.basketCreator
18644
- .updateOne({})
19578
+ .updateOne(mutation)
18645
19579
  .pipe(operators.take(1))
18646
19580
  .subscribe(function (basket) {
18647
19581
  intBasket.id = basket.id;
@@ -18733,7 +19667,6 @@
18733
19667
  _this.baskets.next(_this.currentBaskets);
18734
19668
  if (basketid === _this.currentBasketID) {
18735
19669
  _this.currentBasketID = ((_b = _this.currentBaskets[0]) === null || _b === void 0 ? void 0 : _b.id) || null;
18736
- _this.basketChangeEmitter.next(_this.currentBasketID);
18737
19670
  }
18738
19671
  return rxjs.of(data);
18739
19672
  }));
@@ -18787,16 +19720,18 @@
18787
19720
  });
18788
19721
  }
18789
19722
  };
18790
- BaseEnterpriseBasketService.prototype.setLeadPassenger = function (basketid, basketItem, travellers, index) {
19723
+ BaseEnterpriseBasketService.prototype.setLeadPassenger = function (basketid, basketItem, travellers, index, leadPassengerType) {
18791
19724
  var _this = this;
18792
19725
  if (index === void 0) { index = 0; }
19726
+ if (leadPassengerType === void 0) { leadPassengerType = LeadPassengerType.User; }
18793
19727
  var basket = this.findBasket(basketid);
18794
19728
  if (index < 1) {
18795
19729
  this.SetBasketItemLeadPassenger.updateOne({
18796
19730
  convertCurrencyTo: 'GBP',
18797
19731
  id: basketItem.id,
18798
- user: travellers.id,
18799
- withSupplemental: false
19732
+ userOrGuest: travellers.id,
19733
+ withSupplemental: false,
19734
+ leadPassengerType: leadPassengerType
18800
19735
  }).subscribe(function () { }, function () { }, function () {
18801
19736
  _this.setLeadPassenger(basket.id, basketItem, travellers, index + 1);
18802
19737
  });
@@ -18853,7 +19788,8 @@
18853
19788
  .subscribe(resolve, reject);
18854
19789
  });
18855
19790
  };
18856
- BaseEnterpriseBasketService.prototype.setMiFreeValue = function (basketid, miItem, freeValue, userId) {
19791
+ BaseEnterpriseBasketService.prototype.setMiFreeValue = function (basketid, miItem, freeValue, userId, guest) {
19792
+ var _this = this;
18857
19793
  if (userId === void 0) { userId = null; }
18858
19794
  var intBasket = this.findBasket(basketid);
18859
19795
  var args = {
@@ -18862,18 +19798,28 @@
18862
19798
  miFreeValue: freeValue
18863
19799
  };
18864
19800
  if (!!userId) {
18865
- args.user = userId;
19801
+ if (guest) {
19802
+ args.guest = userId;
19803
+ }
19804
+ else {
19805
+ args.user = userId;
19806
+ }
18866
19807
  }
18867
- this.setBasketItemMiValueUpdater
18868
- .updateOne(args)
18869
- .pipe(operators.take(1))
18870
- .subscribe(function (basket) {
18871
- intBasket.next(basket);
18872
- }, function (_) { }, function () {
18873
- intBasket.next(intBasket.subject.value);
19808
+ return new Promise(function (resolve, reject) {
19809
+ _this.setBasketItemMiValueUpdater
19810
+ .updateOne(args)
19811
+ .pipe(operators.take(1))
19812
+ .subscribe(function (basket) {
19813
+ intBasket.next(basket);
19814
+ }, function (error) {
19815
+ reject(error);
19816
+ }, function () {
19817
+ intBasket.next(intBasket.subject.value);
19818
+ resolve();
19819
+ });
18874
19820
  });
18875
19821
  };
18876
- BaseEnterpriseBasketService.prototype.setMiSelectedValue = function (basketid, miItem, selectedValue, userId) {
19822
+ BaseEnterpriseBasketService.prototype.setMiSelectedValue = function (basketid, miItem, selectedValue, userId, guest) {
18877
19823
  if (userId === void 0) { userId = null; }
18878
19824
  var args = {
18879
19825
  convertCurrencyTo: 'GBP',
@@ -18881,9 +19827,14 @@
18881
19827
  miValue: selectedValue
18882
19828
  };
18883
19829
  if (!!userId) {
18884
- args.user = userId;
19830
+ if (guest) {
19831
+ args.guest = userId;
19832
+ }
19833
+ else {
19834
+ args.user = userId;
19835
+ }
18885
19836
  }
18886
- this.updateBasket(basketid, this.setBasketItemMiValueUpdater.updateOne(args));
19837
+ return this.updateBasket(basketid, this.setBasketItemMiValueUpdater.updateOne(args));
18887
19838
  };
18888
19839
  BaseEnterpriseBasketService.prototype.getMiAutoSugestions = function (miId, partialLabel, isLoading) {
18889
19840
  isLoading === null || isLoading === void 0 ? void 0 : isLoading.next(true);
@@ -18903,6 +19854,11 @@
18903
19854
  item.save(basketId, user);
18904
19855
  });
18905
19856
  });
19857
+ bmi.guests.forEach(function (user) {
19858
+ bmi.miPerGuest[user].managementInfo.forEach(function (item) {
19859
+ item.save(basketId, user, true);
19860
+ });
19861
+ });
18906
19862
  });
18907
19863
  };
18908
19864
  BaseEnterpriseBasketService.prototype.sendBasketForApproval = function (basketid) {
@@ -18982,6 +19938,15 @@
18982
19938
  basketItem: basketItem.id
18983
19939
  });
18984
19940
  };
19941
+ BaseEnterpriseBasketService.prototype.removeBookedBasket = function () {
19942
+ this.currentBaskets = this.currentBaskets.reduce(function (acc, basket) {
19943
+ if (basket.subject.value.status !== BasketStatus.Booked) {
19944
+ acc.push(basket);
19945
+ }
19946
+ return acc;
19947
+ }, []);
19948
+ this.baskets.next(this.currentBaskets);
19949
+ };
18985
19950
  return BaseEnterpriseBasketService;
18986
19951
  }());
18987
19952
 
@@ -19228,14 +20193,18 @@
19228
20193
  var USER_SIGNEDOUT = 'USER_SIGNEDOUT';
19229
20194
  var USER_SIGNEDIN = 'USER_SIGNEDIN';
19230
20195
  var BaseUserService = /** @class */ (function () {
19231
- function BaseUserService(getUserFetcher, userUiConfigsFetcher, userProductsFetcher, userMessagesFetcher, baseConfirmMessagesUpdater, setUserLanguageUpdater, editUserUpdater, storageService, helpers) {
20196
+ function BaseUserService(getUserFetcher, userUiConfigsFetcher, userProductsFetcher, userMessagesFetcher, baseConfirmMessagesUpdater, getCompaniesFetcher, getCompanyFetcher, setUserLanguageUpdater, editUserUpdater, createGuestUpdater, getUserGuestsFetcher, storageService, helpers) {
19232
20197
  this.getUserFetcher = getUserFetcher;
19233
20198
  this.userUiConfigsFetcher = userUiConfigsFetcher;
19234
20199
  this.userProductsFetcher = userProductsFetcher;
19235
20200
  this.userMessagesFetcher = userMessagesFetcher;
19236
20201
  this.baseConfirmMessagesUpdater = baseConfirmMessagesUpdater;
20202
+ this.getCompaniesFetcher = getCompaniesFetcher;
20203
+ this.getCompanyFetcher = getCompanyFetcher;
19237
20204
  this.setUserLanguageUpdater = setUserLanguageUpdater;
19238
20205
  this.editUserUpdater = editUserUpdater;
20206
+ this.createGuestUpdater = createGuestUpdater;
20207
+ this.getUserGuestsFetcher = getUserGuestsFetcher;
19239
20208
  this.storageService = storageService;
19240
20209
  this.helpers = helpers;
19241
20210
  this.fullUserDetails = {
@@ -19253,9 +20222,10 @@
19253
20222
  var _this = this;
19254
20223
  var userdata = this.fullUserDetails.userData.value;
19255
20224
  if (!userdata || userdata.username !== user_data.username) {
19256
- if (userdata === null || userdata === void 0 ? void 0 : userdata.user_id) {
19257
- this.getUserFetcher.fetchOne({
19258
- id: userdata.user_id.toString()
20225
+ if (user_data === null || user_data === void 0 ? void 0 : user_data.user_id) {
20226
+ this.getUserFetcher
20227
+ .fetchOne({
20228
+ id: user_data.user_id.toString()
19259
20229
  })
19260
20230
  .pipe(operators.take(1))
19261
20231
  .subscribe(function (user) {
@@ -19284,7 +20254,8 @@
19284
20254
  this.fullUserDetails.travllerObject.next(TravellerObject.makeTravellerObjectFromUser(user_data));
19285
20255
  }
19286
20256
  if (user_data === null || user_data === void 0 ? void 0 : user_data.user_id) {
19287
- this.getUserFetcher.fetchOne({
20257
+ this.getUserFetcher
20258
+ .fetchOne({
19288
20259
  id: user_data === null || user_data === void 0 ? void 0 : user_data.user_id.toString()
19289
20260
  })
19290
20261
  .pipe(operators.take(1))
@@ -19296,6 +20267,9 @@
19296
20267
  this.fullUserDetails.userData.next(user_data);
19297
20268
  this.storageService.setSessionItem('lightning_user_data', user_data);
19298
20269
  };
20270
+ BaseUserService.prototype.canBookGuest = function () {
20271
+ return this.fullUserDetails.allDetails.value.canBookGuest;
20272
+ };
19299
20273
  BaseUserService.prototype.checkEmitUser = function () {
19300
20274
  if (!!this.fullUserDetails.userConfigs.value &&
19301
20275
  !!this.fullUserDetails.userData.value &&
@@ -19492,17 +20466,33 @@
19492
20466
  BaseUserService.prototype.confirmMessages = function (id) {
19493
20467
  return this.baseConfirmMessagesUpdater.updateOne({ messages: id });
19494
20468
  };
19495
- BaseUserService.prototype.getUser = function () {
20469
+ BaseUserService.prototype.userIsRoot = function () {
20470
+ return this.fullUserDetails.userData.value.booker_type === BookerType.Root;
20471
+ };
20472
+ BaseUserService.prototype.userIsSupportAgent = function () {
20473
+ return !!this.fullUserDetails.userData.value.support_agent;
20474
+ };
20475
+ BaseUserService.prototype.getUserCompanies = function (query) {
20476
+ if (query === void 0) { query = null; }
20477
+ return query
20478
+ ? this.getCompaniesFetcher.fetchList({ query: query }).pipe(operators.take(1))
20479
+ : this.getCompaniesFetcher.fetchList().pipe(operators.take(1));
20480
+ };
20481
+ BaseUserService.prototype.getCompanyById = function (id, withUsers) {
20482
+ if (withUsers === void 0) { withUsers = false; }
20483
+ return this.getCompanyFetcher.fetchOne({ id: id }).pipe(operators.take(1));
20484
+ };
20485
+ BaseUserService.prototype.getUser = function (userId) {
19496
20486
  var user = this.getfullUserDetails();
19497
20487
  return this.getUserFetcher.fetchOne({
19498
- id: user.userData.value.user_id.toString()
20488
+ id: userId ? userId : user.userData.value.user_id.toString()
19499
20489
  });
19500
20490
  };
19501
20491
  BaseUserService.prototype.setUserLanguage = function (id) {
19502
20492
  return this.setUserLanguageUpdater.updateOne({ language: id });
19503
20493
  };
19504
- BaseUserService.prototype.getDocuments = function (type) {
19505
- return this.getUser().pipe(operators.map(function (user) { return user.documents || []; }), operators.map(function (docs) {
20494
+ BaseUserService.prototype.getDocuments = function (type, userId) {
20495
+ return this.getUser(userId).pipe(operators.map(function (user) { return user.documents || []; }), operators.map(function (docs) {
19506
20496
  return type
19507
20497
  ? docs.filter(function (doc) { return doc.docType === type; })
19508
20498
  : docs;
@@ -19510,13 +20500,24 @@
19510
20500
  };
19511
20501
  BaseUserService.prototype.editUser = function (user) {
19512
20502
  var _this = this;
19513
- return this.editUserUpdater.updateOne(user).pipe(operators.tap(function (user) { return _this.fullUserDetails.allDetails.next(user); }));
20503
+ return this.editUserUpdater
20504
+ .updateOne(user)
20505
+ .pipe(operators.tap(function (user) { return _this.fullUserDetails.allDetails.next(user); }));
20506
+ };
20507
+ BaseUserService.prototype.createGuest = function (newGuest) {
20508
+ return this.createGuestUpdater.updateOne(newGuest).pipe(operators.take(1));
20509
+ };
20510
+ BaseUserService.prototype.getUserGuests = function () {
20511
+ return this.getUserGuestsFetcher.fetchList();
20512
+ };
20513
+ BaseUserService.prototype.canInvokeUser = function () {
20514
+ return this.fullUserDetails.allDetails.value.canInvokeUser;
19514
20515
  };
19515
20516
  return BaseUserService;
19516
20517
  }());
19517
20518
 
19518
20519
  var BaseLogonService = /** @class */ (function () {
19519
- function BaseLogonService(userService, modalService, http, router, eventMessenager, storageService, environment) {
20520
+ function BaseLogonService(userService, modalService, http, router, eventMessenager, storageService, environment, webTokenService) {
19520
20521
  this.userService = userService;
19521
20522
  this.modalService = modalService;
19522
20523
  this.http = http;
@@ -19524,6 +20525,7 @@
19524
20525
  this.eventMessenager = eventMessenager;
19525
20526
  this.storageService = storageService;
19526
20527
  this.environment = environment;
20528
+ this.webTokenService = webTokenService;
19527
20529
  this.loading = false;
19528
20530
  this.isLoggedIn = false;
19529
20531
  this.redirectUrl = '';
@@ -19591,6 +20593,39 @@
19591
20593
  BaseLogonService.prototype.setRefresh = function () {
19592
20594
  this.timeoutSubscription = window.setTimeout(this.refreshToken.bind(this), this.environment.authRefreshTimeout * 1000);
19593
20595
  };
20596
+ BaseLogonService.prototype.becomeUser = function (username) {
20597
+ var _this = this;
20598
+ return new Promise(function (resolve, reject) {
20599
+ _this.clearRefresh();
20600
+ _this.http
20601
+ .post(exports.URLS.BECOME_USER, { username: username })
20602
+ .pipe(operators.take(1))
20603
+ .subscribe(function (data) {
20604
+ console.log(data);
20605
+ _this.userService.setUser(data.jwtObject);
20606
+ _this.router.navigate(['main']);
20607
+ resolve(true);
20608
+ }, function (error) {
20609
+ reject(error);
20610
+ });
20611
+ });
20612
+ };
20613
+ BaseLogonService.prototype.endBecomeUserSession = function () {
20614
+ var _this = this;
20615
+ return new Promise(function (resolve, reject) {
20616
+ _this.clearRefresh();
20617
+ _this.http
20618
+ .post(exports.URLS.END_BECOME_USER, {})
20619
+ .pipe(operators.take(1))
20620
+ .subscribe(function (data) {
20621
+ console.log(data);
20622
+ _this.userService.setUser(data.jwtObject);
20623
+ resolve(true);
20624
+ }, function (error) {
20625
+ reject(error);
20626
+ });
20627
+ });
20628
+ };
19594
20629
  BaseLogonService.prototype.login = function (username, password, again) {
19595
20630
  var _this = this;
19596
20631
  this.userService.emptyUserData();
@@ -19602,6 +20637,7 @@
19602
20637
  password: password
19603
20638
  })
19604
20639
  .pipe(operators.take(1), operators.map(function (value, index) {
20640
+ _this.webTokenService.bobo = null;
19605
20641
  _this.setRefresh();
19606
20642
  return _this.handleResponse(value);
19607
20643
  }));
@@ -19632,6 +20668,7 @@
19632
20668
  var isSSO = this.userService.isUserFavoriteSet(UserFavorurite.SSO_no_password);
19633
20669
  this.clearRefresh();
19634
20670
  this.isLoggedIn = false;
20671
+ this.webTokenService.bobo = null;
19635
20672
  this.userService.emptyUserData();
19636
20673
  this.storageService.clearSessionData();
19637
20674
  this.http.post(exports.URLS.LOGOUT_URL).subscribe(function (data) {
@@ -19674,7 +20711,7 @@
19674
20711
  **/
19675
20712
  BaseLogonService.prototype.recoverPassword = function (username) {
19676
20713
  return this.http.formEncodedPost(exports.URLS.RECOVER_PASSWORD_URL, {
19677
- username: "" + username,
20714
+ username: "" + username
19678
20715
  }, 'text');
19679
20716
  };
19680
20717
  /*
@@ -21107,10 +22144,9 @@
21107
22144
  var FastTrackEnterpriseSearch = /** @class */ (function (_super) {
21108
22145
  __extends(FastTrackEnterpriseSearch, _super);
21109
22146
  function FastTrackEnterpriseSearch(fasttrackFetcher, helpers, basketService, storageService, searchService) {
21110
- var _this = _super.call(this, storageService, helpers) || this;
22147
+ var _this = _super.call(this, storageService, helpers, searchService) || this;
21111
22148
  _this.fasttrackFetcher = fasttrackFetcher;
21112
22149
  _this.basketService = basketService;
21113
- _this.searchService = searchService;
21114
22150
  _this.type = ServiceType.FastTrack;
21115
22151
  _this._date = null;
21116
22152
  _this._time = null;
@@ -21269,7 +22305,7 @@
21269
22305
  FastTrackEnterpriseSearch.prototype.getSearchQuery = function () {
21270
22306
  var query = {
21271
22307
  adults: this.tempParams.adults,
21272
- children: this.tempParams.children,
22308
+ children: this.tempParams.children ? this.tempParams.children : null,
21273
22309
  locationCode: this._locationCode,
21274
22310
  arrivalDatetime: this.tempParams.arrivalDatetime
21275
22311
  };
@@ -21304,6 +22340,26 @@
21304
22340
  });
21305
22341
  this.searchService.startSearches();
21306
22342
  };
22343
+ FastTrackEnterpriseSearch.prototype.updateSearchFromExpiredBasketItem = function (basketItem) {
22344
+ var _this = this;
22345
+ var searchFastTrackQuery = basketItem.searchQuery;
22346
+ this.arrivalDatetime = moment__default['default'](searchFastTrackQuery.arrivalDatetime);
22347
+ this.searchService
22348
+ .getAirportByCode(searchFastTrackQuery.locationCode)
22349
+ .subscribe(function (airport) {
22350
+ var _a, _b, _c, _d, _e, _f;
22351
+ if (airport) {
22352
+ _this.locationCode = {
22353
+ country: (_b = (_a = airport.iataMatch) === null || _a === void 0 ? void 0 : _a.locationDetails) === null || _b === void 0 ? void 0 : _b.country,
22354
+ countryCode: (_d = (_c = airport.iataMatch) === null || _c === void 0 ? void 0 : _c.locationDetails) === null || _d === void 0 ? void 0 : _d.countryCode,
22355
+ destination: airport.iataMatch.name,
22356
+ gateway: airport.iataMatch.iata,
22357
+ postcode: (_f = (_e = airport.iataMatch) === null || _e === void 0 ? void 0 : _e.locationDetails) === null || _f === void 0 ? void 0 : _f.postcode,
22358
+ terminals: _this.searchService.processTerminals(airport.iataMatch.terminals)
22359
+ };
22360
+ }
22361
+ });
22362
+ };
21307
22363
  FastTrackEnterpriseSearch.prototype.updateFromPreviousSearches = function (previousItems) {
21308
22364
  var _a;
21309
22365
  console.log('PREPOPULATING LOUNGE FORM');
@@ -21338,40 +22394,43 @@
21338
22394
  FastTrackEnterpriseSearch.prototype.addFastTrackToBasket = function (fasttrackQuote, fasttrackQuery) {
21339
22395
  var _a;
21340
22396
  return __awaiter(this, void 0, void 0, function () {
21341
- var intBasket, basket, termsAndConditions;
22397
+ var intBasket, basket, termsAndConditions, whatHappened;
21342
22398
  return __generator(this, function (_g) {
21343
22399
  switch (_g.label) {
21344
22400
  case 0:
21345
22401
  if (fasttrackQuote.unavailable) {
21346
- return [2 /*return*/, Promise.resolve(false)];
22402
+ return [2 /*return*/, Promise.resolve(exports.DifferentInvokdedUserReasons.cancel)];
21347
22403
  }
21348
22404
  return [4 /*yield*/, this.basketService.getDefaultBasket()];
21349
22405
  case 1:
21350
22406
  intBasket = _g.sent();
21351
22407
  basket = intBasket === null || intBasket === void 0 ? void 0 : intBasket.subject.value;
21352
22408
  termsAndConditions = this.getTermsAndCond(fasttrackQuote);
21353
- if (basket) {
21354
- return [2 /*return*/, this.basketService.addToBasket({
21355
- adults: fasttrackQuery.adults,
21356
- children: fasttrackQuery.children,
21357
- basket: basket.id,
21358
- service: fasttrackQuote.sourceId.toString(),
21359
- detail: {
21360
- arrivalDatetime: fasttrackQuery.arrivalDatetime.format(),
21361
- locationCode: fasttrackQuote.code,
21362
- name: fasttrackQuote.name,
21363
- airportIata: fasttrackQuery === null || fasttrackQuery === void 0 ? void 0 : fasttrackQuery.locationCode,
21364
- logo: fasttrackQuote.logo,
21365
- terminal: (_a = fasttrackQuote.terminal) === null || _a === void 0 ? void 0 : _a.toString(),
21366
- termsAndCond: termsAndConditions
21367
- },
21368
- price: fasttrackQuote.price,
21369
- currency: fasttrackQuote.currency,
21370
- searchQuery: fasttrackQuery,
21371
- outboundDate: fasttrackQuery.arrivalDatetime.format()
21372
- }, intBasket, this.searchService, this.travellers, fasttrackQuote.requiresReason)];
22409
+ if (!basket) return [3 /*break*/, 3];
22410
+ return [4 /*yield*/, this.basketService.addToBasket({
22411
+ adults: fasttrackQuery.adults,
22412
+ children: fasttrackQuery.children,
22413
+ basket: basket.id,
22414
+ service: fasttrackQuote.sourceId.toString(),
22415
+ detail: {
22416
+ arrivalDatetime: fasttrackQuery.arrivalDatetime.format(),
22417
+ locationCode: fasttrackQuote.code,
22418
+ name: fasttrackQuote.name,
22419
+ airportIata: fasttrackQuery === null || fasttrackQuery === void 0 ? void 0 : fasttrackQuery.locationCode,
22420
+ terminal: (_a = fasttrackQuote.terminal) === null || _a === void 0 ? void 0 : _a.toString()
22421
+ },
22422
+ price: fasttrackQuote.price,
22423
+ currency: fasttrackQuote.currency,
22424
+ searchQuery: fasttrackQuery,
22425
+ outboundDate: fasttrackQuery.arrivalDatetime.format()
22426
+ }, intBasket, this.searchService, this.travellers, fasttrackQuote.requiresReason)];
22427
+ case 2:
22428
+ whatHappened = _g.sent();
22429
+ if (whatHappened === exports.DifferentInvokdedUserReasons.research) {
22430
+ this.performSearch();
21373
22431
  }
21374
- return [2 /*return*/, Promise.resolve(false)]; // TODO should this throw an error?
22432
+ return [2 /*return*/, whatHappened];
22433
+ case 3: return [2 /*return*/, exports.DifferentInvokdedUserReasons.cancel];
21375
22434
  }
21376
22435
  });
21377
22436
  });
@@ -21471,6 +22530,7 @@
21471
22530
  this.baseSaveFavouriteSearchUpdater = baseSaveFavouriteSearchUpdater;
21472
22531
  this.getRailStationFetcher = getRailStationFetcher;
21473
22532
  this.getIrlSupplierStationFetcher = getIrlSupplierStationFetcher;
22533
+ this.baseWebTokenService = baseWebTokenService;
21474
22534
  this.riskAlertsFetcher = riskAlertsFetcher;
21475
22535
  this.getUserRecentSearchesFetcher = getUserRecentSearchesFetcher;
21476
22536
  this.getRailCardsFetcher = getRailCardsFetcher;
@@ -21852,6 +22912,14 @@
21852
22912
  return rxjs.of([]);
21853
22913
  }
21854
22914
  };
22915
+ BaseEnterpriseSearchService.prototype.getRailStationById = function (id) {
22916
+ if (id) {
22917
+ return this.getRailStationFetcher.fetchList({ id: id }).pipe(operators.take(1));
22918
+ }
22919
+ else {
22920
+ return rxjs.of();
22921
+ }
22922
+ };
21855
22923
  /**
21856
22924
  * @description - get irl station locations
21857
22925
  * @param term - the term to search
@@ -22010,6 +23078,9 @@
22010
23078
  BaseEnterpriseSearchService.prototype.updateTravellerInformation = function () {
22011
23079
  this.storageService.setSessionItem(BaseEnterpriseSearchService.SESSION_TRAVELLER, this.selectedTravellers);
22012
23080
  this.travellerInformation.next(__spread(this.selectedTravellers));
23081
+ if (this.searches[ServiceType.Rail]) {
23082
+ this.searches[ServiceType.Rail].railCards = new Array(this.selectedTravellers.length).fill({ name: '', code: '' }, 0, this.selectedTravellers.length);
23083
+ }
22013
23084
  };
22014
23085
  /*
22015
23086
  * @desc - determine and return the highest priority value,
@@ -22041,7 +23112,8 @@
22041
23112
  BaseEnterpriseSearchService.prototype.getSelectedOptions = function () {
22042
23113
  var _this = this;
22043
23114
  return Object.keys(this.search_objects).reduce(function (cv, itemIndex) {
22044
- if (_this.search_objects[itemIndex].chosen) {
23115
+ var _a;
23116
+ if ((_a = _this.search_objects[itemIndex]) === null || _a === void 0 ? void 0 : _a.chosen) {
22045
23117
  cv.push(itemIndex);
22046
23118
  }
22047
23119
  return cv;
@@ -22073,13 +23145,14 @@
22073
23145
  };
22074
23146
  BaseEnterpriseSearchService.prototype.canSearch = function (type) {
22075
23147
  // check that the selected type is chosen, has highest priority and has not already had a booking chosen
23148
+ var _a, _b;
22076
23149
  this.determineHighestSearchPriority();
22077
23150
  // firstly check that the type of search exists
22078
23151
  if (this.search_objects[type]) {
22079
23152
  console.log('can search here');
22080
23153
  // now check that the type is chosen has highest priority
22081
- if (this.search_objects[type].chosen &&
22082
- this.hasHighestSearchPriority(this.search_objects[type].priority)) {
23154
+ if (((_a = this.search_objects[type]) === null || _a === void 0 ? void 0 : _a.chosen) &&
23155
+ this.hasHighestSearchPriority((_b = this.search_objects[type]) === null || _b === void 0 ? void 0 : _b.priority)) {
22083
23156
  console.log(type + ' can be searched');
22084
23157
  return true;
22085
23158
  }
@@ -22095,61 +23168,15 @@
22095
23168
  * travellers (or will do when it's complete) TODO - add Flight, Rail Car
22096
23169
  **/
22097
23170
  BaseEnterpriseSearchService.prototype.getAllErrorMessages = function () {
22098
- var concattedErrors = this.travellerValidationMessages;
22099
- if (this.search_objects[ServiceType.Lounge].chosen &&
22100
- this.canSearch(ServiceType.Lounge)) {
22101
- concattedErrors.push.apply(concattedErrors, __spread(this.searches[ServiceType.Lounge].validationMessages));
22102
- }
22103
- if (this.search_objects[ServiceType.Car].chosen &&
22104
- this.canSearch(ServiceType.Car)) {
22105
- concattedErrors.push.apply(concattedErrors, __spread(this.searches[ServiceType.Car].validationMessages));
22106
- }
22107
- if (this.search_objects[ServiceType.Rail].chosen &&
22108
- this.canSearch(ServiceType.Rail)) {
22109
- concattedErrors.push.apply(concattedErrors, __spread(this.searches[ServiceType.Rail].validationMessages));
22110
- }
22111
- if (this.search_objects[ServiceType.Parking].chosen &&
22112
- this.canSearch(ServiceType.Parking)) {
22113
- concattedErrors.push.apply(concattedErrors, __spread(this.searches[ServiceType.Parking].validationMessages));
22114
- }
22115
- if (this.search_objects[ServiceType.Cab].chosen &&
22116
- this.canSearch(ServiceType.Cab)) {
22117
- concattedErrors.push.apply(concattedErrors, __spread(this.searches[ServiceType.Cab].validationMessages));
22118
- }
22119
- if (this.search_objects[ServiceType.Hotel].chosen &&
22120
- this.canSearch(ServiceType.Hotel)) {
22121
- concattedErrors.push.apply(concattedErrors, __spread(this.searches[ServiceType.Hotel].validationMessages));
22122
- }
22123
- if (this.search_objects[ServiceType.FastTrack].chosen &&
22124
- this.canSearch(ServiceType.FastTrack)) {
22125
- concattedErrors.push.apply(concattedErrors, __spread(this.searches[ServiceType.FastTrack].validationMessages));
22126
- }
22127
- /*
22128
- if (this.search_objects.hotel.chosen && this.canSearch(TravelTypeEnum.HOTEL)) {
22129
- concattedErrors = concattedErrors.concat(this.hotel.validationMessages);
22130
- }
22131
-
22132
-
22133
-
22134
- if (this.search_objects.flight.chosen && this.canSearch(TravelTypeEnum.FLIGHT)) {
22135
- concattedErrors = concattedErrors.concat(this.flight.validationMessages);
22136
- }
22137
-
22138
- if (this.search_objects.parking.chosen && this.canSearch(TravelTypeEnum.AIR_PARKING)) {
22139
- concattedErrors.push(...this.parking.validationMessages);
22140
- }
22141
-
22142
- if (this.search_objects.taxi.chosen && this.canSearch(TravelTypeEnum.TAXI)) {
22143
- concattedErrors.push(...this.taxi.validationMessages);
22144
- }
22145
-
22146
- if (this.search_objects.eurostar.chosen && this.canSearch(TravelTypeEnum.EUROSTAR)) {
22147
- concattedErrors.push(...this.eurostar.validationMessages);
22148
- }
22149
-
22150
- if (this.search_objects.coach.chosen && this.canSearch(TravelTypeEnum.COACH)) {
22151
- concattedErrors.push(...this.coach.validationMessages);
22152
- }*/
23171
+ var _this = this;
23172
+ var concattedErrors = Object.entries(this.search_objects).reduce(function (accum, _d) {
23173
+ var _e = __read(_d, 2), type = _e[0], searchObject = _e[1];
23174
+ if ((searchObject === null || searchObject === void 0 ? void 0 : searchObject.chosen) && _this.canSearch(type)) {
23175
+ accum.push.apply(accum, __spread(_this.searches[type]
23176
+ .validationMessages));
23177
+ }
23178
+ return accum;
23179
+ }, this.travellerValidationMessages);
22153
23180
  this.errors.next(concattedErrors);
22154
23181
  return concattedErrors;
22155
23182
  };
@@ -22246,9 +23273,9 @@
22246
23273
  // }, this.environment.searchTimeout);
22247
23274
  try {
22248
23275
  Promise.all(Object.values(this.searches).map(function (search) {
23276
+ var _a;
22249
23277
  return !!search &&
22250
- _this.search_objects[search.type] &&
22251
- _this.search_objects[search.type].chosen
23278
+ _this.search_objects[search.type] && ((_a = _this.search_objects[search.type]) === null || _a === void 0 ? void 0 : _a.chosen)
22252
23279
  ? search.startSearch()
22253
23280
  : Promise.resolve(false);
22254
23281
  })).finally(function () {
@@ -22725,7 +23752,8 @@
22725
23752
  travellingTo: null,
22726
23753
  via: false,
22727
23754
  viaLocation: null,
22728
- railCards: null
23755
+ railCards: [],
23756
+ transactionIdentifier: null
22729
23757
  };
22730
23758
  return this.helpers.sanatizeReturns(defaultVal, Object.assign.apply(Object, __spread([{}], args)), ['inBoundDateTime', 'outBoundDateTime']);
22731
23759
  };
@@ -22871,7 +23899,9 @@
22871
23899
  return this.deleteFavouriteSearchUpdater.updateOne({ id: id });
22872
23900
  };
22873
23901
  BaseEnterpriseSearchService.prototype.saveRecentSearch = function (query) {
22874
- if (query) {
23902
+ if (query &&
23903
+ !this.selectedTravellers.find(function (traveller) { return traveller.guest; })) {
23904
+ // prevent it saving recent searches with guests - atm it's erroring
22875
23905
  this.baseSaveRecentSearchUpdater
22876
23906
  .updateOne(query)
22877
23907
  .pipe(operators.take(1))
@@ -22971,7 +24001,7 @@
22971
24001
  var age;
22972
24002
  if (traveller.dob) {
22973
24003
  var timeDiff = Math.abs(new Date().getTime() - new Date(traveller.dob).getTime());
22974
- age = Math.floor((timeDiff / (1000 * 3600 * 24)) / 365);
24004
+ age = Math.floor(timeDiff / (1000 * 3600 * 24) / 365);
22975
24005
  }
22976
24006
  return {
22977
24007
  name: traveller.name,
@@ -22980,7 +24010,9 @@
22980
24010
  loyaltyCard: "Loyalty Card " + (index + 1)
22981
24011
  };
22982
24012
  });
22983
- onBehalfOf = travellers[0].email ? travellers[0].email : currentUserEmail;
24013
+ onBehalfOf = travellers[0].email
24014
+ ? travellers[0].email
24015
+ : currentUserEmail;
22984
24016
  }));
22985
24017
  // get jrfreference
22986
24018
  this.allSubscription.add(searchParams.results.subscribe(function (irlJourney) {
@@ -23017,6 +24049,9 @@
23017
24049
  BaseEnterpriseSearchService.prototype.sendOfflineNotification = function (jrfReference) {
23018
24050
  return this.sendOfflineNotificationFetcher.fetchOne(jrfReference);
23019
24051
  };
24052
+ BaseEnterpriseSearchService.prototype.getCountries = function () {
24053
+ return this.countries;
24054
+ };
23020
24055
  return BaseEnterpriseSearchService;
23021
24056
  }());
23022
24057
  BaseEnterpriseSearchService.SESSION_TRAVELLER = 'search_travellers';
@@ -23035,6 +24070,7 @@
23035
24070
  this.timer = null;
23036
24071
  this.timeoutDuration = 60 * 60;
23037
24072
  this.autoLogoutConfig = {};
24073
+ this._bobo = null;
23038
24074
  this.timeOutDuration = environment.autoLogoutTime;
23039
24075
  }
23040
24076
  Object.defineProperty(BaseWebTokenService.prototype, "timeOutDuration", {
@@ -23059,6 +24095,16 @@
23059
24095
  enumerable: false,
23060
24096
  configurable: true
23061
24097
  });
24098
+ Object.defineProperty(BaseWebTokenService.prototype, "bobo", {
24099
+ get: function () {
24100
+ return this._bobo;
24101
+ },
24102
+ set: function (value) {
24103
+ this._bobo = value || null;
24104
+ },
24105
+ enumerable: false,
24106
+ configurable: true
24107
+ });
23062
24108
  BaseWebTokenService.prototype._updateTimer = function () {
23063
24109
  var _this = this;
23064
24110
  window.clearTimeout(this.timer);
@@ -23640,6 +24686,18 @@
23640
24686
  return BaseEditUserUpdater;
23641
24687
  }(UpdateableObject));
23642
24688
 
24689
+ var BaseCreateGuestUpdater = /** @class */ (function (_super) {
24690
+ __extends(BaseCreateGuestUpdater, _super);
24691
+ function BaseCreateGuestUpdater(createBasketGQL, modalService) {
24692
+ return _super.call(this, createBasketGQL, modalService) || this;
24693
+ }
24694
+ BaseCreateGuestUpdater.prototype.getDataFromResult = function (results) {
24695
+ var _a;
24696
+ return (_a = results === null || results === void 0 ? void 0 : results.data) === null || _a === void 0 ? void 0 : _a.createGuest;
24697
+ };
24698
+ return BaseCreateGuestUpdater;
24699
+ }(UpdateableObject));
24700
+
23643
24701
  /**
23644
24702
  * Generated bundle index. Do not edit.
23645
24703
  */
@@ -23661,6 +24719,7 @@
23661
24719
  exports.BaseConfermaOfficeNamesFetcher = BaseConfermaOfficeNamesFetcher;
23662
24720
  exports.BaseConfirmMessagesUpdater = BaseConfirmMessagesUpdater;
23663
24721
  exports.BaseCreateBasketUpdater = BaseCreateBasketUpdater;
24722
+ exports.BaseCreateGuestUpdater = BaseCreateGuestUpdater;
23664
24723
  exports.BaseDeleteBasketUpdater = BaseDeleteBasketUpdater;
23665
24724
  exports.BaseDeleteFavouriteSearchUpdater = BaseDeleteFavouriteSearchUpdater;
23666
24725
  exports.BaseDeleteRecentSearchUpdater = BaseDeleteRecentSearchUpdater;
@@ -23680,6 +24739,8 @@
23680
24739
  exports.BaseGetBasketFetcher = BaseGetBasketFetcher;
23681
24740
  exports.BaseGetCancellationInfoFetcher = BaseGetCancellationInfoFetcher;
23682
24741
  exports.BaseGetCarHireProvidersFetcher = BaseGetCarHireProvidersFetcher;
24742
+ exports.BaseGetCompaniesFetcher = BaseGetCompaniesFetcher;
24743
+ exports.BaseGetCompanyFetcher = BaseGetCompanyFetcher;
23683
24744
  exports.BaseGetConfermaRoomImagesFetcher = BaseGetConfermaRoomImagesFetcher;
23684
24745
  exports.BaseGetCovidMicrositeTokenFetcher = BaseGetCovidMicrositeTokenFetcher;
23685
24746
  exports.BaseGetFlightFareRulesFetcher = BaseGetFlightFareRulesFetcher;
@@ -23697,6 +24758,7 @@
23697
24758
  exports.BaseGetUserCurrentCarbonAllowanceFetcher = BaseGetUserCurrentCarbonAllowanceFetcher;
23698
24759
  exports.BaseGetUserFavouriteSearchesFetcher = BaseGetUserFavouriteSearchesFetcher;
23699
24760
  exports.BaseGetUserFetcher = BaseGetUserFetcher;
24761
+ exports.BaseGetUserGuestsFetcher = BaseGetUserGuestsFetcher;
23700
24762
  exports.BaseGetUserRecentSearchesFetcher = BaseGetUserRecentSearchesFetcher;
23701
24763
  exports.BaseHelperRoutines = BaseHelperRoutines;
23702
24764
  exports.BaseHotelAvalibilityQuoteFetcher = BaseHotelAvalibilityQuoteFetcher;
@@ -23789,6 +24851,7 @@
23789
24851
  exports.defaultValidations = defaultValidations;
23790
24852
  exports.excludedExpression = excludedExpression;
23791
24853
  exports.filtersKeys = filtersKeys;
24854
+ exports.includedAccessibilityExpression = includedAccessibilityExpression;
23792
24855
  exports.includedExpression = includedExpression;
23793
24856
  exports.makeManagamentInfo = makeManagamentInfo;
23794
24857
  exports.maxTravellerWellbeing = maxTravellerWellbeing;