@sabstravtech/obtservices 0.2.2504251220 → 0.2.2505201645

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.
@@ -1,5 +1,5 @@
1
1
  import { __awaiter, __decorate, __metadata } from 'tslib';
2
- import { BehaviorSubject, of, combineLatest, Subject, firstValueFrom, forkJoin, lastValueFrom, Subscription } from 'rxjs';
2
+ import { BehaviorSubject, of, combineLatest, Subject, forkJoin, Subscription } from 'rxjs';
3
3
  import { take, map, catchError, debounceTime, distinctUntilChanged, switchMap, tap, takeUntil } from 'rxjs/operators';
4
4
  import moment from 'moment';
5
5
  import _, { uniq } from 'lodash';
@@ -8373,7 +8373,7 @@ class CabHireEnterpriseSearch extends BaseEnterpriseSearch {
8373
8373
  const term = location.buildingName.replace(/^[^,]+,\s*/, "");
8374
8374
  const isTrueSubject = new BehaviorSubject(true);
8375
8375
  if (location.terminal) { // airport type
8376
- const locations = yield firstValueFrom(this.searchService.getAirportLocations(term, location.countryCode, isTrueSubject));
8376
+ const locations = yield this.searchService.getAirportLocations(term, location.countryCode, isTrueSubject).toPromise();
8377
8377
  if (locations === null || locations === void 0 ? void 0 : locations.length) {
8378
8378
  const { airport, name, type } = locations[0];
8379
8379
  return {
@@ -8388,7 +8388,7 @@ class CabHireEnterpriseSearch extends BaseEnterpriseSearch {
8388
8388
  }
8389
8389
  }
8390
8390
  else if (location.buildingName === location.streetAndNumber) { // Train St. type
8391
- const locations = yield firstValueFrom(this.searchService.getStationLocations(term, isTrueSubject));
8391
+ const locations = yield this.searchService.getStationLocations(term, isTrueSubject).toPromise();
8392
8392
  if (locations === null || locations === void 0 ? void 0 : locations.length) {
8393
8393
  const { name, railstation, type } = locations[0];
8394
8394
  return {
@@ -24434,8 +24434,12 @@ class RailEnterpriseSearch extends BaseEnterpriseSearch {
24434
24434
  if (this.applyRailcards) {
24435
24435
  this.railCards = query.railCardQualifiers;
24436
24436
  }
24437
+ // const fetchRailStation = async (locationId: string): Promise<{ name: string; railstation: RailStation }> => {
24438
+ // const station = await firstValueFrom(this.searchService.getRailStationById(locationId));
24439
+ // return { name: station.name, railstation: station };
24440
+ // };
24437
24441
  const fetchRailStation = (locationId) => __awaiter(this, void 0, void 0, function* () {
24438
- const station = yield firstValueFrom(this.searchService.getRailStationById(locationId));
24442
+ const station = yield this.searchService.getRailStationById(locationId).toPromise();
24439
24443
  return { name: station.name, railstation: station };
24440
24444
  });
24441
24445
  const resiN = yield fetchRailStation(query.arrivalLocationId);
@@ -28778,7 +28782,7 @@ class BaseEnterpriseBasketService {
28778
28782
  for (const basket of this.currentBaskets) {
28779
28783
  const basketValue = basket.subject.value;
28780
28784
  if (basketValue.invokedUser) {
28781
- yield firstValueFrom(this.removeBasket(basketValue.id));
28785
+ yield this.removeBasket(basketValue.id).toPromise();
28782
28786
  }
28783
28787
  }
28784
28788
  });
@@ -29090,7 +29094,6 @@ class BaseEnterpriseBasketService {
29090
29094
  return __awaiter(this, void 0, void 0, function* () {
29091
29095
  this.removingFromBasket.next(true);
29092
29096
  let intBasket = this.findBasket(basketId);
29093
- // if it's a hotel remove all linked items
29094
29097
  if (((_a = item === null || item === void 0 ? void 0 : item.service) === null || _a === void 0 ? void 0 : _a.type) === ServiceType.Hotel) {
29095
29098
  const hotelItems = intBasket === null || intBasket === void 0 ? void 0 : intBasket.subject.value.basketItems.filter((basketItem) => {
29096
29099
  return (item.detail.hotelId === basketItem.detail.hotelId &&
@@ -29099,15 +29102,17 @@ class BaseEnterpriseBasketService {
29099
29102
  item.detail.rooms[0].checkOut === basketItem.detail.rooms[0].checkOut);
29100
29103
  });
29101
29104
  if ((hotelItems === null || hotelItems === void 0 ? void 0 : hotelItems.length) > 1) {
29102
- // ENT-2447 new modal made in LU, needs to be made in all obts and app or will get error
29103
29105
  yield this.modalService.open(ModalTypes.WarningRemoveModalComponent, {
29104
29106
  backdrop: 'static'
29105
29107
  });
29106
29108
  for (const item of hotelItems) {
29107
- const newBasket = yield lastValueFrom(this.removeItemFromBasketUpdater.updateOne({
29109
+ const newBasket = yield this.removeItemFromBasketUpdater
29110
+ .updateOne({
29108
29111
  convertCurrencyTo: this.userCurrency,
29109
29112
  basketItem: item.id
29110
- }));
29113
+ })
29114
+ .pipe(take(1))
29115
+ .toPromise();
29111
29116
  if (newBasket) {
29112
29117
  this.miViewed = false;
29113
29118
  intBasket === null || intBasket === void 0 ? void 0 : intBasket.next(Object.assign(Object.assign({}, intBasket.subject.value), newBasket));
@@ -29117,10 +29122,13 @@ class BaseEnterpriseBasketService {
29117
29122
  }
29118
29123
  }
29119
29124
  else {
29120
- const newBasket = yield lastValueFrom(this.removeItemFromBasketUpdater.updateOne({
29125
+ const newBasket = yield this.removeItemFromBasketUpdater
29126
+ .updateOne({
29121
29127
  convertCurrencyTo: this.userCurrency,
29122
29128
  basketItem: item.id
29123
- }));
29129
+ })
29130
+ .pipe(take(1))
29131
+ .toPromise();
29124
29132
  if (newBasket) {
29125
29133
  this.miViewed = false;
29126
29134
  intBasket === null || intBasket === void 0 ? void 0 : intBasket.next(Object.assign(Object.assign({}, intBasket.subject.value), newBasket));
@@ -29130,10 +29138,13 @@ class BaseEnterpriseBasketService {
29130
29138
  }
29131
29139
  }
29132
29140
  else {
29133
- const newBasket = yield lastValueFrom(this.removeItemFromBasketUpdater.updateOne({
29141
+ const newBasket = yield this.removeItemFromBasketUpdater
29142
+ .updateOne({
29134
29143
  convertCurrencyTo: this.userCurrency,
29135
29144
  basketItem: item.id
29136
- }));
29145
+ })
29146
+ .pipe(take(1))
29147
+ .toPromise();
29137
29148
  if (newBasket) {
29138
29149
  this.miViewed = false;
29139
29150
  intBasket === null || intBasket === void 0 ? void 0 : intBasket.next(Object.assign(Object.assign({}, intBasket.subject.value), newBasket));
@@ -29527,10 +29538,19 @@ class BaseEnterpriseBasketService {
29527
29538
  this.validateBasketItemMiFetcher.fetchOne(query);
29528
29539
  });
29529
29540
  }
29541
+ // async validateMiBasket(basketId: string): Promise<void> {
29542
+ // const query = { basketId };
29543
+ // return firstValueFrom(this.validateBasketMiFetcher.fetchOne(query)).then(data => {
29544
+ // this.miViewed = true;
29545
+ // this.missingMIs = data;
29546
+ // });
29547
+ // }
29530
29548
  validateMiBasket(basketId) {
29531
29549
  return __awaiter(this, void 0, void 0, function* () {
29532
- const query = { basketId };
29533
- return firstValueFrom(this.validateBasketMiFetcher.fetchOne(query)).then(data => {
29550
+ const query = {
29551
+ basketId
29552
+ };
29553
+ this.validateBasketMiFetcher.fetchOne(query).subscribe(data => {
29534
29554
  this.miViewed = true;
29535
29555
  this.missingMIs = data;
29536
29556
  });