@sabstravtech/obtservices 0.0.3 → 0.0.19020100
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.
- package/angular/fetchers.d.ts +1 -0
- package/angular/lib/vendor/classes/helpers.d.ts +6 -3
- package/angular/lib/vendor/fetchers/conferma-office.fetcher.d.ts +6 -0
- package/angular/lib/vendor/fetchers/search-irl-stations.fetcher.d.ts +7 -0
- package/angular/lib/vendor/services/search.service.d.ts +5 -3
- package/angular/lib/vendor/types/graphql.angular.types.d.ts +268 -6
- package/angular/obtservices.module.d.ts +1 -1
- package/angular/sabstravtech-obtservices-angular.d.ts +6 -5
- package/angular/sabstravtech-obtservices-angular.metadata.json +1 -1
- package/base/fetchers.d.ts +2 -0
- package/base/lib/vendor/classes/base-enterprise.d.ts +4 -0
- package/base/lib/vendor/classes/bookable-basket.d.ts +1 -1
- package/base/lib/vendor/classes/cabhire-enterprise-search.d.ts +6 -1
- package/base/lib/vendor/classes/carhire-enterprise-search.d.ts +2 -1
- package/base/lib/vendor/classes/eurostar-enterprise-search.d.ts +21 -5
- package/base/lib/vendor/classes/flight-enterprise-search.d.ts +22 -75
- package/base/lib/vendor/classes/helpers.d.ts +3 -0
- package/base/lib/vendor/classes/hotel-enterprise-search.d.ts +1 -0
- package/base/lib/vendor/classes/irl-enterprise-search.d.ts +21 -10
- package/base/lib/vendor/classes/lounges-enterprise-search.d.ts +1 -0
- package/base/lib/vendor/classes/parking-enterprise-search.d.ts +1 -0
- package/base/lib/vendor/classes/rail-enterprise-search.d.ts +1 -0
- package/base/lib/vendor/fetchers/conferma-office.fetcher.d.ts +20 -0
- package/base/lib/vendor/fetchers/irl-quote-fetcher.d.ts +1 -1
- package/base/lib/vendor/fetchers/search-irl-stations.fetcher.d.ts +20 -0
- package/base/lib/vendor/interfaces/Icabhire-enterprise-search.d.ts +1 -0
- package/base/lib/vendor/interfaces/Ienterprise-basket.service.d.ts +1 -1
- package/base/lib/vendor/interfaces/Ieurostar-enterprise-search.d.ts +4 -35
- package/base/lib/vendor/interfaces/Iflight-enterprise-search.d.ts +4 -40
- package/base/lib/vendor/interfaces/Iirl-enterprise-search.d.ts +9 -2
- package/base/lib/vendor/interfaces/Isearch.service.d.ts +3 -1
- package/base/lib/vendor/interfaces/flight-filters.interface.d.ts +21 -25
- package/base/lib/vendor/interfaces/hotel-recent-search-args.interface.d.ts +23 -0
- package/base/lib/vendor/interfaces/value-display.d.ts +2 -2
- package/base/lib/vendor/models/traveller.object.d.ts +7 -0
- package/base/lib/vendor/services/enterprise-basket.service.d.ts +1 -1
- package/base/lib/vendor/services/search.service.d.ts +10 -3
- package/base/lib/vendor/types/graphql.types.d.ts +253 -6
- package/base/lib/vendor/types/types.d.ts +11 -2
- package/base/sabstravtech-obtservices-base.metadata.json +1 -1
- package/bundles/sabstravtech-obtservices-angular.umd.js +200 -64
- package/bundles/sabstravtech-obtservices-angular.umd.js.map +1 -1
- package/bundles/sabstravtech-obtservices-angular.umd.min.js +1 -1
- package/bundles/sabstravtech-obtservices-angular.umd.min.js.map +1 -1
- package/bundles/sabstravtech-obtservices-base.umd.js +1632 -1085
- package/bundles/sabstravtech-obtservices-base.umd.js.map +1 -1
- package/bundles/sabstravtech-obtservices-base.umd.min.js +2 -2
- package/bundles/sabstravtech-obtservices-base.umd.min.js.map +1 -1
- package/esm2015/angular/fetchers.js +2 -1
- package/esm2015/angular/lib/vendor/classes/helpers.js +25 -4
- package/esm2015/angular/lib/vendor/fetchers/conferma-office.fetcher.js +22 -0
- package/esm2015/angular/lib/vendor/fetchers/search-irl-stations.fetcher.js +25 -0
- package/esm2015/angular/lib/vendor/services/search.service.js +35 -29
- package/esm2015/angular/lib/vendor/types/graphql.angular.types.js +174 -6
- package/esm2015/angular/obtservices.module.js +3 -3
- package/esm2015/angular/sabstravtech-obtservices-angular.js +7 -6
- package/esm2015/base/fetchers.js +3 -1
- package/esm2015/base/lib/vendor/classes/base-enterprise.js +49 -2
- package/esm2015/base/lib/vendor/classes/bookable-basket.js +2 -2
- package/esm2015/base/lib/vendor/classes/cabhire-enterprise-search.js +95 -15
- package/esm2015/base/lib/vendor/classes/carhire-enterprise-search.js +2 -1
- package/esm2015/base/lib/vendor/classes/eurostar-enterprise-search.js +262 -52
- package/esm2015/base/lib/vendor/classes/flight-enterprise-search.js +439 -713
- package/esm2015/base/lib/vendor/classes/helpers.js +239 -24
- package/esm2015/base/lib/vendor/classes/hotel-enterprise-search.js +74 -70
- package/esm2015/base/lib/vendor/classes/irl-enterprise-search.js +153 -118
- package/esm2015/base/lib/vendor/classes/lounges-enterprise-search.js +2 -1
- package/esm2015/base/lib/vendor/classes/management-info-and-valid.js +58 -1
- package/esm2015/base/lib/vendor/classes/parking-enterprise-search.js +6 -3
- package/esm2015/base/lib/vendor/classes/rail-enterprise-search.js +2 -1
- package/esm2015/base/lib/vendor/fetchers/conferma-office.fetcher.js +11 -0
- package/esm2015/base/lib/vendor/fetchers/irl-quote-fetcher.js +2 -2
- package/esm2015/base/lib/vendor/fetchers/search-irl-stations.fetcher.js +11 -0
- package/esm2015/base/lib/vendor/interfaces/Icabhire-enterprise-search.js +1 -1
- package/esm2015/base/lib/vendor/interfaces/Ienterprise-basket.service.js +1 -1
- package/esm2015/base/lib/vendor/interfaces/Ieurostar-enterprise-search.js +1 -1
- package/esm2015/base/lib/vendor/interfaces/Iflight-enterprise-search.js +43 -2
- package/esm2015/base/lib/vendor/interfaces/Iirl-enterprise-search.js +1 -1
- package/esm2015/base/lib/vendor/interfaces/Isearch.service.js +1 -1
- package/esm2015/base/lib/vendor/interfaces/flight-filters.interface.js +2 -1
- package/esm2015/base/lib/vendor/interfaces/hotel-recent-search-args.interface.js +2 -0
- package/esm2015/base/lib/vendor/interfaces/value-display.js +1 -1
- package/esm2015/base/lib/vendor/models/traveller.object.js +8 -1
- package/esm2015/base/lib/vendor/services/enterprise-basket.service.js +3 -2
- package/esm2015/base/lib/vendor/services/search.service.js +67 -12
- package/esm2015/base/lib/vendor/types/graphql.types.js +13 -2
- package/esm2015/base/lib/vendor/types/types.js +1 -1
- package/fesm2015/sabstravtech-obtservices-angular.js +238 -16
- package/fesm2015/sabstravtech-obtservices-angular.js.map +1 -1
- package/fesm2015/sabstravtech-obtservices-base.js +1561 -1045
- package/fesm2015/sabstravtech-obtservices-base.js.map +1 -1
- package/package.json +4 -4
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
};
|
|
21
21
|
this.isValid = new rxjs.BehaviorSubject(false);
|
|
22
22
|
this.results = new rxjs.BehaviorSubject([]);
|
|
23
|
+
this.multiResults = new rxjs.BehaviorSubject([]);
|
|
23
24
|
this.messages = new rxjs.BehaviorSubject([]);
|
|
24
25
|
this.messagesInfo = new rxjs.BehaviorSubject([]);
|
|
25
26
|
this.validationMessages = [];
|
|
@@ -28,6 +29,7 @@
|
|
|
28
29
|
this.tempParams = {};
|
|
29
30
|
this.doChecks = true;
|
|
30
31
|
this.fullResults = []; // should be an array of type specified by O
|
|
32
|
+
this.fullMultiResults = []; // an array of arrays of type specified by O
|
|
31
33
|
this.mapper = function (results) {
|
|
32
34
|
return results;
|
|
33
35
|
};
|
|
@@ -63,7 +65,7 @@
|
|
|
63
65
|
try {
|
|
64
66
|
results.pipe(operators.take(1)).subscribe(function (results1) {
|
|
65
67
|
console.log('Got results', _.cloneDeep(results1));
|
|
66
|
-
_this.fullResults = _this.mapper(results1);
|
|
68
|
+
_this.fullResults = Object.freeze(_this.mapper(results1));
|
|
67
69
|
_this._cheapestResultPrice = _this.updateLowestPrice(_this.fullResults);
|
|
68
70
|
_this.storageService.setSessionItem(_this.resultsSessionName, _this.makeSessionResults(_this.fullResults));
|
|
69
71
|
_this.results.next(_this.fullResults);
|
|
@@ -84,10 +86,56 @@
|
|
|
84
86
|
}
|
|
85
87
|
});
|
|
86
88
|
};
|
|
89
|
+
BaseEnterpriseSearch.prototype._startMultiSearch = function (resultsArray) {
|
|
90
|
+
var _this = this;
|
|
91
|
+
this.isLoading.next(true);
|
|
92
|
+
this.fullMultiResults = [];
|
|
93
|
+
var allQueries = [];
|
|
94
|
+
resultsArray.forEach(function (results, index) {
|
|
95
|
+
allQueries.push(new Promise(function (resolve, reject) {
|
|
96
|
+
try {
|
|
97
|
+
results.pipe(operators.take(1)).subscribe(function (results1) {
|
|
98
|
+
console.log('Got results', _.cloneDeep(results1));
|
|
99
|
+
var mappedResults = _this.mapper(results1);
|
|
100
|
+
_this.fullMultiResults[index] = mappedResults;
|
|
101
|
+
// this._cheapestResultPrice = this.updateLowestPrice( // perform these after all searches complete
|
|
102
|
+
// this.fullResults
|
|
103
|
+
// );
|
|
104
|
+
// this.results.next(this.fullResults);
|
|
105
|
+
resolve(mappedResults.length !== 0);
|
|
106
|
+
}, function (error) {
|
|
107
|
+
_this.multiResults.next([]);
|
|
108
|
+
resolve(false);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
_this.storageService.setSessionItem(_this.resultsSessionName, []);
|
|
113
|
+
_this.multiResults.next([]);
|
|
114
|
+
reject(err);
|
|
115
|
+
}
|
|
116
|
+
}));
|
|
117
|
+
});
|
|
118
|
+
return Promise.all(allQueries).then(function (value) {
|
|
119
|
+
_this.isLoading.next(false);
|
|
120
|
+
console.log('+++ Multiloading Complete +++');
|
|
121
|
+
console.log('+++ Multi Results: ', _this.fullMultiResults, ' +++');
|
|
122
|
+
// store the full results
|
|
123
|
+
_this.storageService.setSessionItem(_this.multiResultsSessionName, _this.fullMultiResults);
|
|
124
|
+
_this.multiResults.next(_this.fullMultiResults);
|
|
125
|
+
return true;
|
|
126
|
+
});
|
|
127
|
+
};
|
|
87
128
|
BaseEnterpriseSearch.prototype.reset = function () {
|
|
88
129
|
this.storageService.removeSessionItem(this.resultsSessionName);
|
|
130
|
+
try {
|
|
131
|
+
this.storageService.removeSessionItem(this.multiResultsSessionName);
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
}
|
|
89
135
|
this.fullResults = [];
|
|
136
|
+
this.fullMultiResults = [];
|
|
90
137
|
this.results.next([]);
|
|
138
|
+
this.multiResults.next([]);
|
|
91
139
|
this.resetQuery();
|
|
92
140
|
};
|
|
93
141
|
BaseEnterpriseSearch.prototype.makeSessionResults = function (data) {
|
|
@@ -800,9 +848,10 @@
|
|
|
800
848
|
(function (FlightCabinClass) {
|
|
801
849
|
FlightCabinClass["Any"] = "Any";
|
|
802
850
|
FlightCabinClass["LiteEconomy"] = "LiteEconomy";
|
|
851
|
+
FlightCabinClass["Economy"] = "Economy";
|
|
803
852
|
FlightCabinClass["EconomyRestricted"] = "EconomyRestricted";
|
|
804
853
|
FlightCabinClass["EconomyNoBags"] = "EconomyNoBags";
|
|
805
|
-
FlightCabinClass["
|
|
854
|
+
FlightCabinClass["EconomyFlexi"] = "EconomyFlexi";
|
|
806
855
|
FlightCabinClass["PremiumEconomy"] = "PremiumEconomy";
|
|
807
856
|
FlightCabinClass["Business"] = "Business";
|
|
808
857
|
FlightCabinClass["PremiumBusiness"] = "PremiumBusiness";
|
|
@@ -838,6 +887,15 @@
|
|
|
838
887
|
IrlTravellerStatus["Placeholder"] = "placeholder";
|
|
839
888
|
IrlTravellerStatus["Complete"] = "complete";
|
|
840
889
|
})(IrlTravellerStatus || (IrlTravellerStatus = {}));
|
|
890
|
+
var MessageTarget;
|
|
891
|
+
(function (MessageTarget) {
|
|
892
|
+
MessageTarget["Login"] = "LOGIN";
|
|
893
|
+
MessageTarget["SearchForm"] = "SEARCH_FORM";
|
|
894
|
+
MessageTarget["Results"] = "RESULTS";
|
|
895
|
+
MessageTarget["MiForm"] = "MI_FORM";
|
|
896
|
+
MessageTarget["BasketBeforeConfirm"] = "BASKET_BEFORE_CONFIRM";
|
|
897
|
+
MessageTarget["Dashboard"] = "DASHBOARD";
|
|
898
|
+
})(MessageTarget || (MessageTarget = {}));
|
|
841
899
|
var PassengerType;
|
|
842
900
|
(function (PassengerType) {
|
|
843
901
|
PassengerType["Adult"] = "ADULT";
|
|
@@ -923,6 +981,7 @@
|
|
|
923
981
|
(function (UiPresentation) {
|
|
924
982
|
UiPresentation["FreeText"] = "FREE_TEXT";
|
|
925
983
|
UiPresentation["AutoSuggest"] = "AUTO_SUGGEST";
|
|
984
|
+
UiPresentation["Dropdown"] = "DROPDOWN";
|
|
926
985
|
UiPresentation["Hidden"] = "HIDDEN";
|
|
927
986
|
})(UiPresentation || (UiPresentation = {}));
|
|
928
987
|
|
|
@@ -1108,6 +1167,64 @@
|
|
|
1108
1167
|
HiddenManagementInfo.prototype.save = function (basketid, userId) { };
|
|
1109
1168
|
return HiddenManagementInfo;
|
|
1110
1169
|
}(ManagementInfoAndIsValid));
|
|
1170
|
+
var DropdownManagementInfo = /** @class */ (function (_super) {
|
|
1171
|
+
__extends(DropdownManagementInfo, _super);
|
|
1172
|
+
function DropdownManagementInfo(managementInfo, basketService) {
|
|
1173
|
+
var _this = this;
|
|
1174
|
+
var _a;
|
|
1175
|
+
_this = _super.call(this, managementInfo) || this;
|
|
1176
|
+
_this.basketService = basketService;
|
|
1177
|
+
if (((_a = _this.values) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
1178
|
+
_this.avaliableItems = _this.values;
|
|
1179
|
+
}
|
|
1180
|
+
else {
|
|
1181
|
+
console.error('No values for Dropdown MI field ');
|
|
1182
|
+
}
|
|
1183
|
+
return _this;
|
|
1184
|
+
}
|
|
1185
|
+
DropdownManagementInfo.prototype.getValue = function () {
|
|
1186
|
+
return this.selectedValues[0] ? this.selectedValues[0].value.id : '__NONE';
|
|
1187
|
+
};
|
|
1188
|
+
DropdownManagementInfo.prototype.hasErrors = function (id) {
|
|
1189
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1190
|
+
return __generator(this, function (_b) {
|
|
1191
|
+
return [2 /*return*/, !this.avaliableItems.find(function (value1) {
|
|
1192
|
+
return value1.id === id;
|
|
1193
|
+
})
|
|
1194
|
+
? { hasErrors: true }
|
|
1195
|
+
: null];
|
|
1196
|
+
});
|
|
1197
|
+
});
|
|
1198
|
+
};
|
|
1199
|
+
DropdownManagementInfo.prototype.setValue = function (id) {
|
|
1200
|
+
var value = this.avaliableItems.find(function (value1) {
|
|
1201
|
+
return value1.id === id;
|
|
1202
|
+
});
|
|
1203
|
+
if (!!value) {
|
|
1204
|
+
this.selectedValues = [
|
|
1205
|
+
{
|
|
1206
|
+
value: {
|
|
1207
|
+
id: value.id,
|
|
1208
|
+
label: value.label,
|
|
1209
|
+
value: value.value,
|
|
1210
|
+
default: value.default,
|
|
1211
|
+
fixed: value.fixed,
|
|
1212
|
+
agentOnly: value.agentOnly
|
|
1213
|
+
},
|
|
1214
|
+
basketLevelValue: this.perBooking,
|
|
1215
|
+
userLevelValue: this.perPassenger
|
|
1216
|
+
}
|
|
1217
|
+
];
|
|
1218
|
+
}
|
|
1219
|
+
else {
|
|
1220
|
+
this.selectedValues = [];
|
|
1221
|
+
}
|
|
1222
|
+
};
|
|
1223
|
+
DropdownManagementInfo.prototype.save = function (basketid, userid) {
|
|
1224
|
+
this.basketService.setMiSelectedValue(basketid, this, this.selectedValues[0].value.id, userid);
|
|
1225
|
+
};
|
|
1226
|
+
return DropdownManagementInfo;
|
|
1227
|
+
}(ManagementInfoAndIsValid));
|
|
1111
1228
|
var makeManagamentInfo = function (managementInfo, basketService) {
|
|
1112
1229
|
switch (managementInfo.uiPresentation) {
|
|
1113
1230
|
case UiPresentation.FreeText:
|
|
@@ -1116,6 +1233,11 @@
|
|
|
1116
1233
|
return new AutoSugestManagementInfo(managementInfo, basketService);
|
|
1117
1234
|
case UiPresentation.Hidden:
|
|
1118
1235
|
return new HiddenManagementInfo(managementInfo);
|
|
1236
|
+
case UiPresentation.Dropdown:
|
|
1237
|
+
return new DropdownManagementInfo(managementInfo, basketService);
|
|
1238
|
+
default:
|
|
1239
|
+
var tmp = managementInfo.uiPresentation;
|
|
1240
|
+
console.log(tmp);
|
|
1119
1241
|
}
|
|
1120
1242
|
return null;
|
|
1121
1243
|
};
|
|
@@ -1379,7 +1501,7 @@
|
|
|
1379
1501
|
}
|
|
1380
1502
|
};
|
|
1381
1503
|
BookableBasket.prototype.sendBasketForApproval = function () {
|
|
1382
|
-
this.basketService.sendBasketForApproval(this.id);
|
|
1504
|
+
return this.basketService.sendBasketForApproval(this.id);
|
|
1383
1505
|
};
|
|
1384
1506
|
BookableBasket.prototype.workoutApprovedState = function (basket) {
|
|
1385
1507
|
var status = exports.BookingStatus.ApprovedBook;
|
|
@@ -1601,13 +1723,17 @@
|
|
|
1601
1723
|
{ enabled: false, key: 'wait_and_return', value: 'Wait And Return' }
|
|
1602
1724
|
];
|
|
1603
1725
|
_this.searchTypes = [
|
|
1604
|
-
'One-way'
|
|
1605
|
-
// , 'Return'
|
|
1726
|
+
'One-way', 'Return'
|
|
1606
1727
|
];
|
|
1607
1728
|
_this.airportSearchTypes = ['Airport drop off', 'Airport Pick Up'];
|
|
1608
1729
|
_this.criteria = ['Pick Up Time'];
|
|
1609
1730
|
_this.mode = exports.TaxiFormMode.ADDRESS;
|
|
1610
1731
|
_this.minSelectDate = moment__default['default']();
|
|
1732
|
+
_this.minReturnSelectDate = {
|
|
1733
|
+
day: moment__default['default']().date(),
|
|
1734
|
+
month: moment__default['default']().month() + 1,
|
|
1735
|
+
year: moment__default['default']().year()
|
|
1736
|
+
};
|
|
1611
1737
|
// getters and setters
|
|
1612
1738
|
_this._date = null;
|
|
1613
1739
|
_this.selectedPlaces = [];
|
|
@@ -1642,6 +1768,7 @@
|
|
|
1642
1768
|
_this._terminal = null;
|
|
1643
1769
|
_this._time = null;
|
|
1644
1770
|
_this.resultsSessionName = CabHireEnterpriseSearch.STORAGE_SESSION_RESULTS;
|
|
1771
|
+
_this.multiResultsSessionName = CabHireEnterpriseSearch.MULTI_STORAGE_SESSION_RESULTS;
|
|
1645
1772
|
_this.getPassengers = function () {
|
|
1646
1773
|
var adults = _this.adults;
|
|
1647
1774
|
var children = _this.children;
|
|
@@ -1661,10 +1788,17 @@
|
|
|
1661
1788
|
var data = storageService.getSessionItem(CabHireEnterpriseSearch.STORAGE_SESSION_PARAMS) || {
|
|
1662
1789
|
tempParams: {}
|
|
1663
1790
|
};
|
|
1664
|
-
// const momentDateTime = data.query.departs
|
|
1665
|
-
// ? moment(data.query.departs)
|
|
1666
|
-
// : moment();
|
|
1667
1791
|
_this.updateTempParams(searchService.makeCabHireQuery(data.tempParams));
|
|
1792
|
+
try {
|
|
1793
|
+
var returnData = storageService.getSessionItem(CabHireEnterpriseSearch.SECONDARY_STORAGE_SESSION_PARAMS);
|
|
1794
|
+
if (returnData) {
|
|
1795
|
+
_this.returnDateTime = moment__default['default'](returnData.tempParams.departs);
|
|
1796
|
+
_this.searchType = _this.searchTypes[1];
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
catch (error) {
|
|
1800
|
+
console.error('+++ Error recovering return data: ', error, ' +++');
|
|
1801
|
+
}
|
|
1668
1802
|
if (data.tempParams.fromAddress) {
|
|
1669
1803
|
_this.fromAddress = data.tempParams.fromAddress;
|
|
1670
1804
|
}
|
|
@@ -1684,6 +1818,9 @@
|
|
|
1684
1818
|
_this.fullResults = results;
|
|
1685
1819
|
_this._cheapestResultPrice = _this.updateLowestPrice(results);
|
|
1686
1820
|
_this.results.next(results || []);
|
|
1821
|
+
var secondaryResults = storageService.getSessionItemAsList(_this.multiResultsSessionName) || [];
|
|
1822
|
+
_this.fullMultiResults = secondaryResults;
|
|
1823
|
+
_this.multiResults.next(secondaryResults);
|
|
1687
1824
|
_this._isValid();
|
|
1688
1825
|
_this.outboundVisibility = new rxjs.BehaviorSubject(false);
|
|
1689
1826
|
_this.inboundVisibility = new rxjs.BehaviorSubject(false);
|
|
@@ -1720,6 +1857,7 @@
|
|
|
1720
1857
|
},
|
|
1721
1858
|
set: function (value) {
|
|
1722
1859
|
this._searchType = value;
|
|
1860
|
+
this._isValid();
|
|
1723
1861
|
},
|
|
1724
1862
|
enumerable: false,
|
|
1725
1863
|
configurable: true
|
|
@@ -1786,6 +1924,7 @@
|
|
|
1786
1924
|
},
|
|
1787
1925
|
set: function (value) {
|
|
1788
1926
|
this._returnDateTime = value;
|
|
1927
|
+
this._isValid();
|
|
1789
1928
|
},
|
|
1790
1929
|
enumerable: false,
|
|
1791
1930
|
configurable: true
|
|
@@ -1844,6 +1983,14 @@
|
|
|
1844
1983
|
this._date = this.helpers.momentToNgDate(value);
|
|
1845
1984
|
this._time = this.helpers.formatTimeColon(value);
|
|
1846
1985
|
}
|
|
1986
|
+
this.minReturnSelectDate = {
|
|
1987
|
+
day: moment__default['default'](value).date(),
|
|
1988
|
+
month: moment__default['default'](value).month() + 1,
|
|
1989
|
+
year: moment__default['default'](value).year(),
|
|
1990
|
+
};
|
|
1991
|
+
if (value.isAfter(this.returnDateTime)) {
|
|
1992
|
+
this.returnDateTime.set('date', value.date());
|
|
1993
|
+
}
|
|
1847
1994
|
this._isValid();
|
|
1848
1995
|
},
|
|
1849
1996
|
enumerable: false,
|
|
@@ -2013,12 +2160,19 @@
|
|
|
2013
2160
|
});
|
|
2014
2161
|
CabHireEnterpriseSearch.prototype.resetQuery = function () {
|
|
2015
2162
|
this.updateTempParams(this.searchService.makeCabHireQuery());
|
|
2163
|
+
try {
|
|
2164
|
+
this.storageService.removeSessionItem(CabHireEnterpriseSearch.SECONDARY_STORAGE_SESSION_PARAMS);
|
|
2165
|
+
}
|
|
2166
|
+
catch (error) {
|
|
2167
|
+
}
|
|
2168
|
+
this._searchType = this.searchTypes[0]; // reset to one-way
|
|
2016
2169
|
this._isValid();
|
|
2017
2170
|
};
|
|
2018
2171
|
CabHireEnterpriseSearch.prototype.resetParams = function () {
|
|
2019
2172
|
this.reset();
|
|
2020
2173
|
this.resetQuery();
|
|
2021
2174
|
this.results.next([]);
|
|
2175
|
+
this.multiResults.next([]);
|
|
2022
2176
|
};
|
|
2023
2177
|
CabHireEnterpriseSearch.prototype._isValid = function () {
|
|
2024
2178
|
if (!this.doChecks) {
|
|
@@ -2040,6 +2194,9 @@
|
|
|
2040
2194
|
if (this.tempParams.adults + this.tempParams.children < 1) {
|
|
2041
2195
|
this.validationMessages.push('There must be at least 1 traveller');
|
|
2042
2196
|
}
|
|
2197
|
+
if (this.searchType === this.searchTypes[1] && this.returnDateTime.isSameOrBefore(this.departs)) {
|
|
2198
|
+
this.validationMessages.push('Return Date/Time must be after outbound date/time');
|
|
2199
|
+
}
|
|
2043
2200
|
this.isValid.next(this.validationMessages.length === 0);
|
|
2044
2201
|
this.messages.next(this.validationMessages);
|
|
2045
2202
|
};
|
|
@@ -2050,10 +2207,26 @@
|
|
|
2050
2207
|
};
|
|
2051
2208
|
CabHireEnterpriseSearch.prototype.startSearch = function () {
|
|
2052
2209
|
this.results.next([]);
|
|
2210
|
+
this.multiResults.next([]);
|
|
2053
2211
|
if (this.isValid.value) {
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2212
|
+
if (this.searchType === this.searchTypes[1]) { // return - kick off two searches
|
|
2213
|
+
var query = this.getSearchQuery();
|
|
2214
|
+
var returnQuery = this.getReturnSearchQuery();
|
|
2215
|
+
console.log('+++ Search Query: ', query, ' +++');
|
|
2216
|
+
console.log('+++ Search Return Query: ', returnQuery, ' +++');
|
|
2217
|
+
this.storageService.setSessionItem(CabHireEnterpriseSearch.SECONDARY_STORAGE_SESSION_PARAMS, {
|
|
2218
|
+
tempParams: returnQuery
|
|
2219
|
+
});
|
|
2220
|
+
return this._startMultiSearch([
|
|
2221
|
+
this.cabfetcher.fetchList(this.helpers.removeNulls(query)),
|
|
2222
|
+
this.cabfetcher.fetchList(this.helpers.removeNulls(returnQuery))
|
|
2223
|
+
]);
|
|
2224
|
+
}
|
|
2225
|
+
else {
|
|
2226
|
+
var query = this.getSearchQuery();
|
|
2227
|
+
this.searchService.saveRecentSearch(this.getRecentSearchQuery(query));
|
|
2228
|
+
return this._startSearch(this.cabfetcher.fetchList(this.helpers.removeNulls(query)));
|
|
2229
|
+
}
|
|
2057
2230
|
}
|
|
2058
2231
|
else {
|
|
2059
2232
|
return Promise.resolve(false);
|
|
@@ -2128,6 +2301,19 @@
|
|
|
2128
2301
|
};
|
|
2129
2302
|
return this.helpers.removeNulls(query);
|
|
2130
2303
|
};
|
|
2304
|
+
CabHireEnterpriseSearch.prototype.getReturnSearchQuery = function () {
|
|
2305
|
+
var query = {
|
|
2306
|
+
adults: this.tempParams.adults,
|
|
2307
|
+
children: this.tempParams.children,
|
|
2308
|
+
departs: this._returnDateTime,
|
|
2309
|
+
fromLocation: this.createCabHireLocation(this.tempParams.toAddress),
|
|
2310
|
+
toLocation: this.createCabHireLocation(this.tempParams.fromAddress),
|
|
2311
|
+
infants: 0,
|
|
2312
|
+
vehicleType: this.vehicleType,
|
|
2313
|
+
vias: this._vias,
|
|
2314
|
+
};
|
|
2315
|
+
return this.helpers.removeNulls(query);
|
|
2316
|
+
};
|
|
2131
2317
|
CabHireEnterpriseSearch.prototype.updateOutboundAddress = function (location, placeDescription) {
|
|
2132
2318
|
this.tempParams.fromAddress = this.getAddressFormat(location, placeDescription);
|
|
2133
2319
|
};
|
|
@@ -2153,15 +2339,29 @@
|
|
|
2153
2339
|
this._fromLocation = this.createCabHireLocation(this.tempParams.fromAddress);
|
|
2154
2340
|
this._isValid();
|
|
2155
2341
|
};
|
|
2156
|
-
CabHireEnterpriseSearch.prototype.sortBy = function (asc) {
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
results =
|
|
2342
|
+
CabHireEnterpriseSearch.prototype.sortBy = function (asc, returnIndex) {
|
|
2343
|
+
if (returnIndex >= 0) {
|
|
2344
|
+
console.log('here');
|
|
2345
|
+
var results = this.helpers.clone(this.fullMultiResults[returnIndex]);
|
|
2346
|
+
if (asc) {
|
|
2347
|
+
results = results.sort(function (a, b) { return b.price - a.price; });
|
|
2348
|
+
}
|
|
2349
|
+
else {
|
|
2350
|
+
results = results.sort(function (a, b) { return a.price - b.price; });
|
|
2351
|
+
}
|
|
2352
|
+
this.fullMultiResults[returnIndex] = results;
|
|
2353
|
+
this.multiResults.next(this.fullMultiResults);
|
|
2160
2354
|
}
|
|
2161
2355
|
else {
|
|
2162
|
-
results =
|
|
2356
|
+
var results = this.helpers.clone(this.fullResults);
|
|
2357
|
+
if (asc) {
|
|
2358
|
+
results = results.sort(function (a, b) { return b.price - a.price; });
|
|
2359
|
+
}
|
|
2360
|
+
else {
|
|
2361
|
+
results = results.sort(function (a, b) { return a.price - b.price; });
|
|
2362
|
+
}
|
|
2363
|
+
this.results.next(results);
|
|
2163
2364
|
}
|
|
2164
|
-
this.results.next(results);
|
|
2165
2365
|
};
|
|
2166
2366
|
// ! stuff to go in a postcode servie
|
|
2167
2367
|
CabHireEnterpriseSearch.prototype.getAddressFormat = function (location, placeDescription) {
|
|
@@ -2375,7 +2575,9 @@
|
|
|
2375
2575
|
return CabHireEnterpriseSearch;
|
|
2376
2576
|
}(BaseEnterpriseSearch));
|
|
2377
2577
|
CabHireEnterpriseSearch.STORAGE_SESSION_PARAMS = 'search_cab';
|
|
2378
|
-
CabHireEnterpriseSearch.
|
|
2578
|
+
CabHireEnterpriseSearch.SECONDARY_STORAGE_SESSION_PARAMS = 'secondary_search_cab';
|
|
2579
|
+
CabHireEnterpriseSearch.STORAGE_SESSION_RESULTS = 'results_cab';
|
|
2580
|
+
CabHireEnterpriseSearch.MULTI_STORAGE_SESSION_RESULTS = 'multi_results_cab';
|
|
2379
2581
|
|
|
2380
2582
|
(function (SortTypesCar) {
|
|
2381
2583
|
SortTypesCar["price"] = "price";
|
|
@@ -2588,6 +2790,7 @@
|
|
|
2588
2790
|
_this._dropoff_date = null;
|
|
2589
2791
|
_this._dropoff_time = null;
|
|
2590
2792
|
_this.resultsSessionName = CarhireEnterpriseSearch.STORAGE_SESSION_RESULTS;
|
|
2793
|
+
_this.multiResultsSessionName = CarhireEnterpriseSearch.STORAGE_SESSION_RESULTS;
|
|
2591
2794
|
var data = storageService.getSessionItem(CarhireEnterpriseSearch.STORAGE_SESSION_PARAMS) || {
|
|
2592
2795
|
tempParams: {}
|
|
2593
2796
|
};
|
|
@@ -3782,6 +3985,49 @@
|
|
|
3782
3985
|
return BaseEventMessenager;
|
|
3783
3986
|
}());
|
|
3784
3987
|
|
|
3988
|
+
var DEFAULT_FLIGHT_FILTERS = Object.freeze({
|
|
3989
|
+
stops: {},
|
|
3990
|
+
mustInclude: {},
|
|
3991
|
+
classes: {},
|
|
3992
|
+
airlines: {},
|
|
3993
|
+
travelPolicy: {},
|
|
3994
|
+
depatureAirport: {},
|
|
3995
|
+
depatureReturnAirport: {},
|
|
3996
|
+
arrivalAirport: {},
|
|
3997
|
+
arrivalReturnAirport: {},
|
|
3998
|
+
baggage: {},
|
|
3999
|
+
fareTypes: {},
|
|
4000
|
+
price: {
|
|
4001
|
+
min: Number.MAX_SAFE_INTEGER,
|
|
4002
|
+
max: Number.MIN_SAFE_INTEGER
|
|
4003
|
+
},
|
|
4004
|
+
duration: {
|
|
4005
|
+
min: Number.MAX_SAFE_INTEGER,
|
|
4006
|
+
max: Number.MIN_SAFE_INTEGER
|
|
4007
|
+
},
|
|
4008
|
+
returnDuration: {
|
|
4009
|
+
min: Number.MAX_SAFE_INTEGER,
|
|
4010
|
+
max: Number.MIN_SAFE_INTEGER
|
|
4011
|
+
},
|
|
4012
|
+
departureTime: {
|
|
4013
|
+
min: 0,
|
|
4014
|
+
max: 24
|
|
4015
|
+
},
|
|
4016
|
+
arrivalTime: {
|
|
4017
|
+
min: 0,
|
|
4018
|
+
max: 24
|
|
4019
|
+
},
|
|
4020
|
+
returnDepartureTime: {
|
|
4021
|
+
min: 0,
|
|
4022
|
+
max: 24
|
|
4023
|
+
},
|
|
4024
|
+
returnArrivalTime: {
|
|
4025
|
+
min: 0,
|
|
4026
|
+
max: 24
|
|
4027
|
+
},
|
|
4028
|
+
flightNumber: ''
|
|
4029
|
+
});
|
|
4030
|
+
|
|
3785
4031
|
(function (FlightSearchType) {
|
|
3786
4032
|
FlightSearchType["return"] = "return";
|
|
3787
4033
|
FlightSearchType["oneWay"] = "oneWay";
|
|
@@ -3793,23 +4039,29 @@
|
|
|
3793
4039
|
TimeWindow["Depart"] = "Depart By";
|
|
3794
4040
|
TimeWindow["Arrive"] = "Arrive By";
|
|
3795
4041
|
})(exports.TimeWindow || (exports.TimeWindow = {}));
|
|
3796
|
-
(function (
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
4042
|
+
(function (FlightSortTypes) {
|
|
4043
|
+
FlightSortTypes["Cheapest"] = "Cheapest";
|
|
4044
|
+
FlightSortTypes["MostExpensive"] = "Most Expensive";
|
|
4045
|
+
FlightSortTypes["Fastest"] = "Fastest";
|
|
4046
|
+
FlightSortTypes["Preferred"] = "Preferred";
|
|
4047
|
+
FlightSortTypes["LowestEmissions"] = "Lowest Emissions";
|
|
4048
|
+
FlightSortTypes["DepartureTime"] = "Departure Time";
|
|
4049
|
+
FlightSortTypes["ArrivalTime"] = "Arrival Time";
|
|
4050
|
+
FlightSortTypes["Quickest"] = "Quickest";
|
|
4051
|
+
FlightSortTypes["MostDirect"] = "Most Direct";
|
|
4052
|
+
})(exports.FlightSortTypes || (exports.FlightSortTypes = {}));
|
|
3803
4053
|
var FlightEnterpriseSearch = /** @class */ (function (_super) {
|
|
3804
4054
|
__extends(FlightEnterpriseSearch, _super);
|
|
3805
4055
|
function FlightEnterpriseSearch(flightfetcher, helpers, userService, basketService, storageService, searchService) {
|
|
4056
|
+
var _o, _p;
|
|
3806
4057
|
var _this = _super.call(this, storageService, function (results) {
|
|
3807
4058
|
_this.flightsToGroup = {};
|
|
3808
4059
|
_this.grouped = results.grouped || [];
|
|
3809
4060
|
_this.resultQuery = _this.getSearchQuery();
|
|
4061
|
+
_this.filters.next(_this.helpers.createFlightFilters(results.journeys, DEFAULT_FLIGHT_FILTERS));
|
|
3810
4062
|
delete _this.resultQuery.withGrouped;
|
|
3811
4063
|
if (results && _this.searchService.isFlightsGrouped()) {
|
|
3812
|
-
_this.groupedObject =
|
|
4064
|
+
_this.groupedObject = []
|
|
3813
4065
|
.reduce(function (previousItems, nextItem) {
|
|
3814
4066
|
return previousItems.concat(nextItem.results);
|
|
3815
4067
|
}, results.journeys)
|
|
@@ -3820,11 +4072,12 @@
|
|
|
3820
4072
|
var _o;
|
|
3821
4073
|
var isOutBound = item.boundIndicator === exports.FlightDirectionEnum.Outbound;
|
|
3822
4074
|
var returnObject = {
|
|
4075
|
+
type: 'FlightGroupedQuoteResult',
|
|
3823
4076
|
direction: item.boundIndicator,
|
|
3824
4077
|
classes: (_o = {},
|
|
3825
4078
|
_o[FlightCabinClass.EconomyNoBags] = null,
|
|
3826
4079
|
_o[FlightCabinClass.EconomyRestricted] = null,
|
|
3827
|
-
_o[FlightCabinClass.
|
|
4080
|
+
_o[FlightCabinClass.EconomyFlexi] = null,
|
|
3828
4081
|
_o[FlightCabinClass.Business] = null,
|
|
3829
4082
|
_o[FlightCabinClass.First] = null,
|
|
3830
4083
|
_o[FlightCabinClass.PremiumEconomy] = null,
|
|
@@ -3847,7 +4100,11 @@
|
|
|
3847
4100
|
operator: '',
|
|
3848
4101
|
operatorFull: '',
|
|
3849
4102
|
inboundFlightNumber: '',
|
|
3850
|
-
isReturn: false
|
|
4103
|
+
isReturn: false,
|
|
4104
|
+
minPrice: Number.MAX_SAFE_INTEGER,
|
|
4105
|
+
maxPrice: Number.MAX_SAFE_INTEGER,
|
|
4106
|
+
co2PerItem: 0,
|
|
4107
|
+
co2PerPassenger: 0
|
|
3851
4108
|
};
|
|
3852
4109
|
var brands = item.flights;
|
|
3853
4110
|
Object.keys(brands)
|
|
@@ -3862,62 +4119,78 @@
|
|
|
3862
4119
|
(_this.flightsToGroup[flightNum] =
|
|
3863
4120
|
_this.flightsToGroup[flightNum] || []).push(groupNumber);
|
|
3864
4121
|
var flight = _this.groupedObject[flightNum];
|
|
3865
|
-
if (isOutBound) {
|
|
3866
|
-
_this.createGroupedItem(returnObject, flight.source, flight.outboundFlights, flight.outboundTotalDuration, flight.inboundFlights, flight.inboundTotalDuration);
|
|
3867
|
-
}
|
|
3868
|
-
else {
|
|
3869
|
-
_this.createGroupedItem(returnObject, flight.source, flight.inboundFlights, flight.inboundTotalDuration, flight.outboundFlights, flight.outboundTotalDuration);
|
|
3870
|
-
}
|
|
3871
4122
|
if (flight) {
|
|
4123
|
+
if (isOutBound) {
|
|
4124
|
+
_this.createGroupedItem(returnObject, flight.source, flight.outboundFlights, flight.outboundTotalDuration, flight.inboundFlights, flight.inboundTotalDuration, flight.co2PerItem, flight.co2PerPassenger);
|
|
4125
|
+
}
|
|
4126
|
+
else {
|
|
4127
|
+
_this.createGroupedItem(returnObject, flight.source, flight.inboundFlights, flight.inboundTotalDuration, flight.outboundFlights, flight.outboundTotalDuration, flight.co2PerItem, flight.co2PerPassenger);
|
|
4128
|
+
}
|
|
3872
4129
|
acc1.push(flight);
|
|
3873
4130
|
}
|
|
4131
|
+
else {
|
|
4132
|
+
// console.error(
|
|
4133
|
+
// 'Unable to find flight with uid ' + flightNum
|
|
4134
|
+
// );
|
|
4135
|
+
}
|
|
3874
4136
|
return acc1;
|
|
3875
4137
|
}, []);
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
returnObject.
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
returnObject.classes[correctBrand]
|
|
3912
|
-
flights
|
|
3913
|
-
minprice
|
|
3914
|
-
maxprice
|
|
3915
|
-
|
|
3916
|
-
|
|
4138
|
+
if (matchingBrandFlights.length > 0) {
|
|
4139
|
+
var correctBrand = void 0;
|
|
4140
|
+
switch (brand) {
|
|
4141
|
+
case FlightCabinClass.EconomyNoBags:
|
|
4142
|
+
correctBrand = FlightCabinClass.EconomyNoBags;
|
|
4143
|
+
break;
|
|
4144
|
+
case FlightCabinClass.EconomyRestricted:
|
|
4145
|
+
correctBrand = FlightCabinClass.EconomyRestricted;
|
|
4146
|
+
break;
|
|
4147
|
+
case FlightCabinClass.EconomyFlexi:
|
|
4148
|
+
correctBrand = FlightCabinClass.EconomyFlexi;
|
|
4149
|
+
break;
|
|
4150
|
+
case FlightCabinClass.Business:
|
|
4151
|
+
correctBrand = FlightCabinClass.Business;
|
|
4152
|
+
break;
|
|
4153
|
+
case FlightCabinClass.First:
|
|
4154
|
+
correctBrand = FlightCabinClass.First;
|
|
4155
|
+
break;
|
|
4156
|
+
case FlightCabinClass.PremiumEconomy:
|
|
4157
|
+
correctBrand = FlightCabinClass.PremiumEconomy;
|
|
4158
|
+
break;
|
|
4159
|
+
default:
|
|
4160
|
+
console.log('something went wrong');
|
|
4161
|
+
break;
|
|
4162
|
+
}
|
|
4163
|
+
var minprice = _this.getMinFlightPriceForBrand(matchingBrandFlights);
|
|
4164
|
+
var maxprice = _this.getMaxFlightPriceForBrand(matchingBrandFlights);
|
|
4165
|
+
returnObject.minPrice =
|
|
4166
|
+
returnObject.minPrice < minprice
|
|
4167
|
+
? returnObject.minPrice
|
|
4168
|
+
: minprice;
|
|
4169
|
+
returnObject.maxPrice =
|
|
4170
|
+
returnObject.maxPrice < maxprice
|
|
4171
|
+
? returnObject.maxPrice
|
|
4172
|
+
: maxprice;
|
|
4173
|
+
if ((_b = (_a = returnObject.classes[correctBrand]) === null || _a === void 0 ? void 0 : _a.flights) === null || _b === void 0 ? void 0 : _b.length) {
|
|
4174
|
+
returnObject.classes[correctBrand].flights.concat(matchingBrandFlights);
|
|
4175
|
+
returnObject.classes[correctBrand].minprice = Math.min(returnObject.classes[correctBrand].minprice, minprice);
|
|
4176
|
+
returnObject.classes[correctBrand].maxprice = Math.max(returnObject.classes[correctBrand].maxprice, maxprice);
|
|
4177
|
+
}
|
|
4178
|
+
else {
|
|
4179
|
+
returnObject.classes[correctBrand] = {
|
|
4180
|
+
flights: matchingBrandFlights,
|
|
4181
|
+
minprice: minprice,
|
|
4182
|
+
maxprice: maxprice,
|
|
4183
|
+
currency: matchingBrandFlights[0].total.currency
|
|
4184
|
+
};
|
|
4185
|
+
}
|
|
3917
4186
|
}
|
|
3918
4187
|
});
|
|
3919
|
-
if (returnObject
|
|
3920
|
-
|
|
4188
|
+
if (returnObject &&
|
|
4189
|
+
!!Object.values(returnObject.classes).find(function (clas) {
|
|
4190
|
+
var _a;
|
|
4191
|
+
return ((_a = clas === null || clas === void 0 ? void 0 : clas.flights) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
4192
|
+
})) {
|
|
4193
|
+
acc[groupNumber] = returnObject;
|
|
3921
4194
|
}
|
|
3922
4195
|
return acc;
|
|
3923
4196
|
}, []);
|
|
@@ -3939,12 +4212,139 @@
|
|
|
3939
4212
|
_this._negotiated = false;
|
|
3940
4213
|
_this._nearby_airports = false;
|
|
3941
4214
|
_this._sortArray = [
|
|
3942
|
-
{ display: 'Cheapest First', value: exports.
|
|
3943
|
-
{
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
4215
|
+
{ display: 'Cheapest First', value: exports.FlightSortTypes.Cheapest },
|
|
4216
|
+
{
|
|
4217
|
+
display: 'Most Expensive First',
|
|
4218
|
+
value: exports.FlightSortTypes.MostExpensive
|
|
4219
|
+
},
|
|
4220
|
+
{ display: 'Fastest First', value: exports.FlightSortTypes.Fastest },
|
|
4221
|
+
{ display: 'Preferred Fares First', value: exports.FlightSortTypes.Preferred },
|
|
4222
|
+
{
|
|
4223
|
+
display: 'Lowest Co2 Emissions First',
|
|
4224
|
+
value: exports.FlightSortTypes.LowestEmissions
|
|
4225
|
+
}
|
|
3947
4226
|
];
|
|
4227
|
+
_this._sortItinaryRoutines = (_o = {},
|
|
4228
|
+
_o[exports.FlightSortTypes.Cheapest] = function (a, b) {
|
|
4229
|
+
return a.total.price - b.total.price;
|
|
4230
|
+
},
|
|
4231
|
+
_o[exports.FlightSortTypes.MostExpensive] = function (a, b) {
|
|
4232
|
+
return b.total.price - a.total.price;
|
|
4233
|
+
},
|
|
4234
|
+
_o[exports.FlightSortTypes.Fastest] = function (a, b) {
|
|
4235
|
+
return (a.outboundTotalDuration +
|
|
4236
|
+
(a.inboundTotalDuration ? a.inboundTotalDuration : 0) -
|
|
4237
|
+
(b.outboundTotalDuration +
|
|
4238
|
+
(b.inboundTotalDuration ? b.inboundTotalDuration : 0)));
|
|
4239
|
+
},
|
|
4240
|
+
_o[exports.FlightSortTypes.Preferred] = function (a, b) {
|
|
4241
|
+
return (a.tmcPreferred ? 1 : 0) - (b.tmcPreferred ? 1 : 0);
|
|
4242
|
+
},
|
|
4243
|
+
_o[exports.FlightSortTypes.LowestEmissions] = function (a, b) {
|
|
4244
|
+
return a.co2PerItem - b.co2PerItem;
|
|
4245
|
+
},
|
|
4246
|
+
_o[exports.FlightSortTypes.DepartureTime] = function (a, b) {
|
|
4247
|
+
var aTime = moment__default['default'](a.outboundFlights[0].dateTimeDeparting);
|
|
4248
|
+
var bTime = moment__default['default'](b.outboundFlights[0].dateTimeDeparting);
|
|
4249
|
+
if (aTime.isBefore(bTime)) {
|
|
4250
|
+
return -1;
|
|
4251
|
+
}
|
|
4252
|
+
return aTime.isSame(bTime) ? 0 : 1;
|
|
4253
|
+
},
|
|
4254
|
+
_o[exports.FlightSortTypes.ArrivalTime] = function (a, b) {
|
|
4255
|
+
var aTime = moment__default['default'](a.outboundFlights[0].dateTimeArriving);
|
|
4256
|
+
var bTime = moment__default['default'](b.outboundFlights[0].dateTimeArriving);
|
|
4257
|
+
if (aTime.isBefore(bTime)) {
|
|
4258
|
+
return -1;
|
|
4259
|
+
}
|
|
4260
|
+
return aTime.isSame(bTime) ? 0 : 1;
|
|
4261
|
+
},
|
|
4262
|
+
_o[exports.FlightSortTypes.Quickest] = function (a, b) {
|
|
4263
|
+
return (a.outboundTotalDuration +
|
|
4264
|
+
(a.inboundTotalDuration ? a.inboundTotalDuration : 0) -
|
|
4265
|
+
(b.outboundTotalDuration +
|
|
4266
|
+
(b.inboundTotalDuration ? b.inboundTotalDuration : 0)));
|
|
4267
|
+
},
|
|
4268
|
+
_o[exports.FlightSortTypes.MostDirect] = function (a, b) {
|
|
4269
|
+
return (a.outboundFlights.length +
|
|
4270
|
+
(a.outboundFlights ? a.outboundFlights.length : 0) -
|
|
4271
|
+
(b.outboundFlights.length +
|
|
4272
|
+
(b.outboundFlights ? b.outboundFlights.length : 0)));
|
|
4273
|
+
},
|
|
4274
|
+
_o);
|
|
4275
|
+
_this._sortGroupedRoutines = (_p = {},
|
|
4276
|
+
_p[exports.FlightSortTypes.Cheapest] = function (a, b) {
|
|
4277
|
+
if (a.direction !== b.direction) {
|
|
4278
|
+
return a.direction - b.direction;
|
|
4279
|
+
}
|
|
4280
|
+
return a.minPrice - b.minPrice;
|
|
4281
|
+
},
|
|
4282
|
+
_p[exports.FlightSortTypes.MostExpensive] = function (a, b) {
|
|
4283
|
+
if (a.direction !== b.direction) {
|
|
4284
|
+
return a.direction - b.direction;
|
|
4285
|
+
}
|
|
4286
|
+
return b.minPrice - a.maxPrice;
|
|
4287
|
+
},
|
|
4288
|
+
_p[exports.FlightSortTypes.Fastest] = function (a, b) {
|
|
4289
|
+
if (a.direction !== b.direction) {
|
|
4290
|
+
return a.direction - b.direction;
|
|
4291
|
+
}
|
|
4292
|
+
return a.direction === exports.FlightDirectionEnum.Outbound
|
|
4293
|
+
? a.outboundTotalDuration - b.outboundTotalDuration
|
|
4294
|
+
: a.inboundTotalDuration - b.inboundTotalDuration;
|
|
4295
|
+
},
|
|
4296
|
+
_p[exports.FlightSortTypes.Preferred] = function (a, b) {
|
|
4297
|
+
if (a.direction !== b.direction) {
|
|
4298
|
+
return a.direction - b.direction;
|
|
4299
|
+
}
|
|
4300
|
+
return (a.preferred ? 1 : 0) - (b.preferred ? 1 : 0);
|
|
4301
|
+
},
|
|
4302
|
+
_p[exports.FlightSortTypes.LowestEmissions] = function (a, b) {
|
|
4303
|
+
if (a.direction !== b.direction) {
|
|
4304
|
+
return a.direction - b.direction;
|
|
4305
|
+
}
|
|
4306
|
+
return a.co2PerItem - b.co2PerItem;
|
|
4307
|
+
},
|
|
4308
|
+
_p[exports.FlightSortTypes.DepartureTime] = function (a, b) {
|
|
4309
|
+
if (a.direction !== b.direction) {
|
|
4310
|
+
return a.direction - b.direction;
|
|
4311
|
+
}
|
|
4312
|
+
var aTime = moment__default['default'](a.departDateTime);
|
|
4313
|
+
var bTime = moment__default['default'](b.departDateTime);
|
|
4314
|
+
if (aTime.isBefore(bTime)) {
|
|
4315
|
+
return -1;
|
|
4316
|
+
}
|
|
4317
|
+
return aTime.isSame(bTime) ? 0 : 1;
|
|
4318
|
+
},
|
|
4319
|
+
_p[exports.FlightSortTypes.ArrivalTime] = function (a, b) {
|
|
4320
|
+
if (a.direction !== b.direction) {
|
|
4321
|
+
return a.direction - b.direction;
|
|
4322
|
+
}
|
|
4323
|
+
var aTime = moment__default['default'](a.arrivalDateTime);
|
|
4324
|
+
var bTime = moment__default['default'](b.arrivalDateTime);
|
|
4325
|
+
if (aTime.isBefore(bTime)) {
|
|
4326
|
+
return -1;
|
|
4327
|
+
}
|
|
4328
|
+
return aTime.isSame(bTime) ? 0 : 1;
|
|
4329
|
+
},
|
|
4330
|
+
_p[exports.FlightSortTypes.Quickest] = function (a, b) {
|
|
4331
|
+
if (a.direction !== b.direction) {
|
|
4332
|
+
return a.direction - b.direction;
|
|
4333
|
+
}
|
|
4334
|
+
return a.direction === exports.FlightDirectionEnum.Outbound
|
|
4335
|
+
? a.outboundTotalDuration - b.outboundTotalDuration
|
|
4336
|
+
: (a.inboundTotalDuration ? a.inboundTotalDuration : 0) -
|
|
4337
|
+
(b.inboundTotalDuration ? b.inboundTotalDuration : 0);
|
|
4338
|
+
},
|
|
4339
|
+
_p[exports.FlightSortTypes.MostDirect] = function (a, b) {
|
|
4340
|
+
if (a.direction !== b.direction) {
|
|
4341
|
+
return a.direction - b.direction;
|
|
4342
|
+
}
|
|
4343
|
+
return a.direction === exports.FlightDirectionEnum.Outbound
|
|
4344
|
+
? a.outlegs.length - b.outlegs.length
|
|
4345
|
+
: (a.inlegs || []).length - (b.inlegs || []).length;
|
|
4346
|
+
},
|
|
4347
|
+
_p);
|
|
3948
4348
|
_this._fareTypeArray = [
|
|
3949
4349
|
{ value: FareType.Flexible, display: 'Flexible' },
|
|
3950
4350
|
{ value: FareType.Leisure, display: 'Leisure' },
|
|
@@ -3968,8 +4368,10 @@
|
|
|
3968
4368
|
_this.grouped = null;
|
|
3969
4369
|
_this.travellers = null;
|
|
3970
4370
|
_this.resultsSessionName = FlightEnterpriseSearch.STORAGE_SESSION_RESULTS;
|
|
4371
|
+
_this.multiResultsSessionName = FlightEnterpriseSearch.STORAGE_SESSION_RESULTS;
|
|
3971
4372
|
_this._showHotelForm = false;
|
|
3972
4373
|
_this._hotelSearchRequested = false;
|
|
4374
|
+
_this.filters = new rxjs.BehaviorSubject(DEFAULT_FLIGHT_FILTERS);
|
|
3973
4375
|
_this._multiDestination = [];
|
|
3974
4376
|
var data = storageService.getSessionItem(FlightEnterpriseSearch.STORAGE_SESSION_PARAMS) || {
|
|
3975
4377
|
tempParams: {},
|
|
@@ -4001,22 +4403,28 @@
|
|
|
4001
4403
|
_this.updateAvaliableClasses();
|
|
4002
4404
|
});
|
|
4003
4405
|
_this.updateTravellers();
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
}
|
|
4406
|
+
// Removing results from storage, as the results are nearly always too big to be stored.
|
|
4407
|
+
// if (this.isValid.value) {
|
|
4408
|
+
// const results: FlightSessionType = storageService.getSessionItem(
|
|
4409
|
+
// this.resultsSessionName
|
|
4410
|
+
// ) || {
|
|
4411
|
+
// results: [],
|
|
4412
|
+
// groupData: {},
|
|
4413
|
+
// grouped: [],
|
|
4414
|
+
// query: {} as SearchFlightsV2QueryVariables
|
|
4415
|
+
// };
|
|
4416
|
+
// this.fullResults = this.helpers.clone(results.results);
|
|
4417
|
+
// this.flightsToGroup = results.groupData || {};
|
|
4418
|
+
// this.resultQuery = results.query;
|
|
4419
|
+
// // if (results == null && this.isValid) {
|
|
4420
|
+
// // searchService.startSearches();
|
|
4421
|
+
// // }
|
|
4422
|
+
// const isFlightsGrouped = this.searchService.isFlightsGrouped();
|
|
4423
|
+
// if (!isFlightsGrouped) {
|
|
4424
|
+
// this._cheapestResultPrice = this.updateLowestPrice(results.results);
|
|
4425
|
+
// }
|
|
4426
|
+
// this.results.next(results.results || ([] as FlightQuoteResultArray));
|
|
4427
|
+
// }
|
|
4020
4428
|
_this.negotiated =
|
|
4021
4429
|
_this.tempParams.fareType === FareType.Negotiated ? true : false;
|
|
4022
4430
|
return _this;
|
|
@@ -4425,7 +4833,7 @@
|
|
|
4425
4833
|
enumerable: false,
|
|
4426
4834
|
configurable: true
|
|
4427
4835
|
});
|
|
4428
|
-
FlightEnterpriseSearch.prototype.createGroupedItem = function (returnObject, source, outboundFlights, outboundTotalDuration, inboundFlights, inboundTotalDuration) {
|
|
4836
|
+
FlightEnterpriseSearch.prototype.createGroupedItem = function (returnObject, source, outboundFlights, outboundTotalDuration, inboundFlights, inboundTotalDuration, co2PerItem, co2PerPassenger) {
|
|
4429
4837
|
if ((outboundFlights === null || outboundFlights === void 0 ? void 0 : outboundFlights.length) && !returnObject.departDateTime) {
|
|
4430
4838
|
var first = outboundFlights[0];
|
|
4431
4839
|
var last = outboundFlights[outboundFlights.length - 1];
|
|
@@ -4444,6 +4852,8 @@
|
|
|
4444
4852
|
returnObject.outboundFlightNumber =
|
|
4445
4853
|
this.helpers.joinFromAttribute('-', 'marketingFlightNumber', outboundFlights);
|
|
4446
4854
|
returnObject.isReturn = false;
|
|
4855
|
+
returnObject.co2PerItem = co2PerItem;
|
|
4856
|
+
returnObject.co2PerPassenger = co2PerPassenger;
|
|
4447
4857
|
}
|
|
4448
4858
|
if ((inboundFlights === null || inboundFlights === void 0 ? void 0 : inboundFlights.length) && !returnObject.inboundTotalDuration) {
|
|
4449
4859
|
returnObject.inboundTotalDuration = inboundTotalDuration;
|
|
@@ -4751,43 +5161,6 @@
|
|
|
4751
5161
|
{ name: 'First', type: FlightCabinClass.First }
|
|
4752
5162
|
]);
|
|
4753
5163
|
};
|
|
4754
|
-
/**
|
|
4755
|
-
* @description - sort the flight results
|
|
4756
|
-
* @todo - Fill out Preferred and Co2 sorting when we have that data
|
|
4757
|
-
*/
|
|
4758
|
-
FlightEnterpriseSearch.prototype.sortResults = function (sortMethodValue, givenResults) {
|
|
4759
|
-
var results = this.helpers.clone(givenResults
|
|
4760
|
-
? givenResults
|
|
4761
|
-
: this.fullResults);
|
|
4762
|
-
switch (sortMethodValue) {
|
|
4763
|
-
case exports.SortTypes.CheapestFirst:
|
|
4764
|
-
results = results.sort(function (a, b) {
|
|
4765
|
-
return a.total.price - b.total.price;
|
|
4766
|
-
});
|
|
4767
|
-
break;
|
|
4768
|
-
case exports.SortTypes.MostExpensiveFirst:
|
|
4769
|
-
results = results.sort(function (a, b) {
|
|
4770
|
-
return b.total.price - a.total.price;
|
|
4771
|
-
});
|
|
4772
|
-
break;
|
|
4773
|
-
case exports.SortTypes.FastestFirst:
|
|
4774
|
-
results = results.sort(function (a, b) {
|
|
4775
|
-
return (a.outboundTotalDuration +
|
|
4776
|
-
(a.inboundTotalDuration ? a.inboundTotalDuration : 0) -
|
|
4777
|
-
(b.outboundTotalDuration +
|
|
4778
|
-
(b.inboundTotalDuration ? b.inboundTotalDuration : 0)));
|
|
4779
|
-
});
|
|
4780
|
-
break;
|
|
4781
|
-
case exports.SortTypes.LowestEmissions:
|
|
4782
|
-
results = results.sort(function (a, b) {
|
|
4783
|
-
return a.co2PerItem - b.co2PerItem;
|
|
4784
|
-
});
|
|
4785
|
-
break;
|
|
4786
|
-
default:
|
|
4787
|
-
console.error("+++ Unknown sorting method: " + sortMethodValue + " +++");
|
|
4788
|
-
}
|
|
4789
|
-
return results;
|
|
4790
|
-
};
|
|
4791
5164
|
FlightEnterpriseSearch.prototype.updateFromPreviousSearches = function (previousItems) {
|
|
4792
5165
|
// Flights can not be search after other products so no defaults can be set.
|
|
4793
5166
|
};
|
|
@@ -4813,621 +5186,214 @@
|
|
|
4813
5186
|
}
|
|
4814
5187
|
return total;
|
|
4815
5188
|
};
|
|
5189
|
+
FlightEnterpriseSearch.prototype.isGroupedFlights = function (toTest) {
|
|
5190
|
+
var _a;
|
|
5191
|
+
return ((_a = toTest[0]) === null || _a === void 0 ? void 0 : _a.type) === 'FlightGroupedQuoteResult';
|
|
5192
|
+
};
|
|
4816
5193
|
/**
|
|
4817
5194
|
* @description - filter the results, then sort the remainder
|
|
4818
5195
|
* @todo - Add filters for travel policy, fare types and ancilliaries
|
|
4819
5196
|
*/
|
|
4820
|
-
FlightEnterpriseSearch.prototype.
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
if (this.
|
|
4824
|
-
results
|
|
4825
|
-
}
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
results = this.filterByArrivalReturnAirport(filters.arrivalReturnAirport, results);
|
|
4835
|
-
results = this.filterByPrice(filters.minPrice, filters.maxPrice, results);
|
|
4836
|
-
results = this.filterByFlightNumber(filters.flightNumber, results);
|
|
4837
|
-
results = this.filterByBaggage(filters.baggage, results);
|
|
4838
|
-
results = this.filterByDepartureTime(filters.minDepartureTime, filters.maxDepartureTime, results);
|
|
4839
|
-
results = this.filterByReturnDepartureTime(filters.minReturnDepartureTime, filters.maxReturnDepartureTime, results);
|
|
4840
|
-
results = this.filterByArrivalTime(filters.minArrivalTime, filters.maxArrivalTime, results);
|
|
4841
|
-
results = this.filterByReturnArrivalTime(filters.minReturnArrivalTime, filters.maxReturnArrivalTime, results);
|
|
4842
|
-
results = this.filterByDuration(filters.minDuration, filters.maxDuration, results);
|
|
4843
|
-
results = this.filterByDuration(filters.minReturnDuration, filters.maxReturnDuration, results, true); // return duration
|
|
4844
|
-
results = this.sortResults(sortValue, results);
|
|
4845
|
-
return results;
|
|
4846
|
-
};
|
|
4847
|
-
/**
|
|
4848
|
-
* @description - give the correct format for transfering minuetes on the sliders
|
|
4849
|
-
* @param min - the min in 100th's to transform onto 60th's
|
|
4850
|
-
*/
|
|
4851
|
-
FlightEnterpriseSearch.prototype.transformMin = function (min) {
|
|
4852
|
-
var num = (Number(min) * 60) / 100;
|
|
4853
|
-
// console.log('+++ Num Copy: ', _.clone(num), ' +++');
|
|
4854
|
-
if (num % 1 < 0.5) {
|
|
4855
|
-
num = Math.floor(num);
|
|
4856
|
-
}
|
|
4857
|
-
else {
|
|
4858
|
-
num = Math.ceil(num);
|
|
4859
|
-
}
|
|
4860
|
-
return num.toString().padStart(2, '0');
|
|
4861
|
-
};
|
|
4862
|
-
FlightEnterpriseSearch.prototype.filterByDuration = function (minDuration, maxDuration, results, isReturn) {
|
|
4863
|
-
if (isReturn === void 0) { isReturn = false; }
|
|
4864
|
-
results = results.filter(function (result) {
|
|
4865
|
-
var _a;
|
|
4866
|
-
var dur = 0;
|
|
4867
|
-
if (!isReturn) {
|
|
4868
|
-
result.outboundFlights.forEach(function (out) {
|
|
4869
|
-
dur += out.totalDuration;
|
|
4870
|
-
});
|
|
5197
|
+
FlightEnterpriseSearch.prototype.applyFilters = function (filters, sortValue) {
|
|
5198
|
+
var _this = this;
|
|
5199
|
+
// console.log('+++ Applying Filters to flights: ', filters, ' +++');
|
|
5200
|
+
if (this.fullResults.length === 0) {
|
|
5201
|
+
this.results.next([]);
|
|
5202
|
+
}
|
|
5203
|
+
var tester = function (filtersTotest, testFunction) {
|
|
5204
|
+
var selected = Object.values(filtersTotest).filter(function (filter) { return filter.selected; });
|
|
5205
|
+
if (selected.length) {
|
|
5206
|
+
return function (flightItinerary) {
|
|
5207
|
+
return !!selected.find(function (filter) {
|
|
5208
|
+
return testFunction(flightItinerary, filter.value);
|
|
5209
|
+
});
|
|
5210
|
+
};
|
|
4871
5211
|
}
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
}
|
|
5212
|
+
else {
|
|
5213
|
+
return function (flightItinerary) {
|
|
5214
|
+
return true;
|
|
5215
|
+
};
|
|
4876
5216
|
}
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
return results;
|
|
4892
|
-
};
|
|
4893
|
-
FlightEnterpriseSearch.prototype.filterByReturnDepartureTime = function (minDep, maxDep, results) {
|
|
4894
|
-
if (!minDep && !maxDep) {
|
|
4895
|
-
return results;
|
|
4896
|
-
}
|
|
4897
|
-
var newNumString1 = Number(Math.floor(Number(minDep / 100)).toString() +
|
|
4898
|
-
this.transformMin(Math.ceil(Number(minDep % 100))));
|
|
4899
|
-
var newNumString2 = Number(Math.floor(Number(maxDep / 100)).toString() +
|
|
4900
|
-
this.transformMin(Math.ceil(Number(maxDep % 100))));
|
|
4901
|
-
results = results.filter(function (result) {
|
|
4902
|
-
if (!result.inboundFlights || !result.inboundFlights[0]) {
|
|
4903
|
-
return true;
|
|
4904
|
-
}
|
|
4905
|
-
var departureTime = Number(moment__default['default'](result.inboundFlights[0].dateTimeDeparting).format('HHmm'));
|
|
4906
|
-
return departureTime >= newNumString1 && departureTime <= newNumString2;
|
|
4907
|
-
});
|
|
4908
|
-
return results;
|
|
4909
|
-
};
|
|
4910
|
-
FlightEnterpriseSearch.prototype.filterByReturnArrivalTime = function (minArr, maxArr, results) {
|
|
4911
|
-
if (!minArr && !maxArr) {
|
|
4912
|
-
return results;
|
|
4913
|
-
}
|
|
4914
|
-
var newNumString1 = Number(Math.floor(Number(minArr / 100)).toString() +
|
|
4915
|
-
this.transformMin(Math.ceil(Number(minArr % 100))));
|
|
4916
|
-
var newNumString2 = Number(Math.floor(Number(maxArr / 100)).toString() +
|
|
4917
|
-
this.transformMin(Math.ceil(Number(maxArr % 100))));
|
|
4918
|
-
results = results.filter(function (result) {
|
|
4919
|
-
if (!result.inboundFlights || !result.inboundFlights[0]) {
|
|
4920
|
-
return true;
|
|
4921
|
-
}
|
|
4922
|
-
var arrivalTime = Number(moment__default['default'](result.inboundFlights[result.inboundFlights.length - 1]
|
|
4923
|
-
.dateTimeArriving).format('HHmm'));
|
|
4924
|
-
var retVal = arrivalTime >= newNumString1 && arrivalTime <= newNumString2;
|
|
4925
|
-
// for debugging
|
|
4926
|
-
// if (!retVal) {
|
|
4927
|
-
// console.warn(`+++ Filtering Out: ${arrivalTime} +++`);
|
|
4928
|
-
// }
|
|
4929
|
-
return retVal;
|
|
4930
|
-
});
|
|
4931
|
-
return results;
|
|
4932
|
-
};
|
|
4933
|
-
FlightEnterpriseSearch.prototype.filterByArrivalTime = function (minArr, maxArr, results) {
|
|
4934
|
-
var newNumString1 = Number(Math.floor(Number(minArr / 100)).toString() +
|
|
4935
|
-
this.transformMin(Math.ceil(Number(minArr % 100))));
|
|
4936
|
-
var newNumString2 = Number(Math.floor(Number(maxArr / 100)).toString() +
|
|
4937
|
-
this.transformMin(Math.ceil(Number(maxArr % 100))));
|
|
4938
|
-
results = results.filter(function (result) {
|
|
4939
|
-
var arrivalTime = Number(moment__default['default'](result.outboundFlights[result.outboundFlights.length - 1]
|
|
4940
|
-
.dateTimeArriving).format('HHmm'));
|
|
4941
|
-
return arrivalTime >= newNumString1 && arrivalTime <= newNumString2;
|
|
4942
|
-
});
|
|
4943
|
-
return results;
|
|
4944
|
-
};
|
|
4945
|
-
FlightEnterpriseSearch.prototype.filterByBaggage = function (baggageFilters, results) {
|
|
4946
|
-
var _this = this;
|
|
4947
|
-
var selected = baggageFilters.filter(function (x) { return x.selected; });
|
|
4948
|
-
if ((selected === null || selected === void 0 ? void 0 : selected.length) >= 1 && selected.length !== baggageFilters.length) {
|
|
4949
|
-
results = results.filter(function (result) {
|
|
4950
|
-
try {
|
|
4951
|
-
var totalBags_1 = _this.getTotalBaggage(result);
|
|
4952
|
-
return selected.find(function (x) { return x.value === totalBags_1; });
|
|
4953
|
-
}
|
|
4954
|
-
catch (error) {
|
|
4955
|
-
console.error('+++ Error determening baggage: ${error} +++');
|
|
4956
|
-
return false;
|
|
4957
|
-
}
|
|
4958
|
-
});
|
|
4959
|
-
}
|
|
4960
|
-
return results;
|
|
4961
|
-
};
|
|
4962
|
-
FlightEnterpriseSearch.prototype.filterByPrice = function (minPrice, maxPrice, results) {
|
|
4963
|
-
results = results.filter(function (result) {
|
|
4964
|
-
// console.log(`+++ Price: ${result.total.price} is between: ${minPrice} and ${maxPrice}: ${result.total.price >= minPrice && result.total.price <= maxPrice} +++`)
|
|
4965
|
-
return result.total.price >= minPrice && result.total.price <= maxPrice;
|
|
4966
|
-
});
|
|
4967
|
-
return results;
|
|
4968
|
-
};
|
|
4969
|
-
/**
|
|
4970
|
-
* @description - filter the results by the number of stops
|
|
4971
|
-
* @param stopFilters - the selected stops
|
|
4972
|
-
* @param fullResults - all of our results so far
|
|
4973
|
-
*/
|
|
4974
|
-
FlightEnterpriseSearch.prototype.filterResultsByStops = function (stopFilters, fullResults) {
|
|
4975
|
-
var selected = stopFilters.filter(function (x) { return x.selected; });
|
|
4976
|
-
if ((selected === null || selected === void 0 ? void 0 : selected.length) >= 1 && selected.length !== stopFilters.length) {
|
|
4977
|
-
fullResults = fullResults.filter(function (result) {
|
|
4978
|
-
var totalStops = result.outboundFlights.length - 1;
|
|
4979
|
-
var haveStop = selected.find(function (selected1) { return selected1.value === totalStops; });
|
|
4980
|
-
return haveStop;
|
|
4981
|
-
});
|
|
4982
|
-
}
|
|
4983
|
-
return fullResults;
|
|
4984
|
-
};
|
|
4985
|
-
FlightEnterpriseSearch.prototype.filterResultsByAirline = function (airlineFilters, results) {
|
|
4986
|
-
var selected = airlineFilters.filter(function (x) { return x.selected; });
|
|
4987
|
-
if ((selected === null || selected === void 0 ? void 0 : selected.length) >= 1 && selected.length !== airlineFilters.length) {
|
|
4988
|
-
results = results.filter(function (result) {
|
|
4989
|
-
return selected.find(function (x) { return x.value === result.outboundFlights[0].operatingCarrier; });
|
|
4990
|
-
});
|
|
4991
|
-
}
|
|
4992
|
-
return results;
|
|
4993
|
-
};
|
|
4994
|
-
FlightEnterpriseSearch.prototype.filterResultsByClass = function (classFilters, results) {
|
|
4995
|
-
var selected = classFilters.filter(function (x) { return x.selected; });
|
|
4996
|
-
if ((selected === null || selected === void 0 ? void 0 : selected.length) >= 1 && selected.length !== classFilters.length) {
|
|
4997
|
-
results = results.filter(function (result) {
|
|
4998
|
-
return selected.find(function (x) { return x.value === result.outboundFlights[0].cabinClass; });
|
|
4999
|
-
});
|
|
5000
|
-
}
|
|
5001
|
-
return results;
|
|
5002
|
-
};
|
|
5003
|
-
FlightEnterpriseSearch.prototype.filterByDepartureAirport = function (departureAirports, results) {
|
|
5004
|
-
var selected = departureAirports.filter(function (x) { return x.selected; });
|
|
5005
|
-
if ((selected === null || selected === void 0 ? void 0 : selected.length) >= 1 && selected.length !== departureAirports.length) {
|
|
5006
|
-
results = results.filter(function (result) {
|
|
5007
|
-
return selected.find(function (x) { return x.value === result.outboundFlights[0].originAirport; });
|
|
5008
|
-
});
|
|
5009
|
-
}
|
|
5010
|
-
return results;
|
|
5011
|
-
};
|
|
5012
|
-
FlightEnterpriseSearch.prototype.filterByArrivalAirport = function (arrivalAirports, results) {
|
|
5013
|
-
var selected = arrivalAirports.filter(function (x) { return x.selected; });
|
|
5014
|
-
if ((selected === null || selected === void 0 ? void 0 : selected.length) >= 1 && selected.length !== arrivalAirports.length) {
|
|
5015
|
-
results = results.filter(function (result) {
|
|
5016
|
-
var destinationAirport = result.outboundFlights[result.outboundFlights.length - 1]
|
|
5017
|
-
.destinationAirport;
|
|
5018
|
-
return selected.find(function (x) { return x.value === destinationAirport; });
|
|
5019
|
-
});
|
|
5020
|
-
}
|
|
5021
|
-
return results;
|
|
5022
|
-
};
|
|
5023
|
-
FlightEnterpriseSearch.prototype.filterByDepartureReturnAirport = function (departureAirports, results) {
|
|
5024
|
-
var selected = departureAirports.filter(function (x) { return x.selected; });
|
|
5025
|
-
if ((selected === null || selected === void 0 ? void 0 : selected.length) >= 1 && selected.length !== departureAirports.length) {
|
|
5026
|
-
results = results.filter(function (result) {
|
|
5027
|
-
var _a;
|
|
5028
|
-
if (!((_a = result.inboundFlights) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
5029
|
-
return true;
|
|
5030
|
-
}
|
|
5031
|
-
return selected.find(function (x) { return x.value === result.inboundFlights[0].originAirport; });
|
|
5032
|
-
});
|
|
5033
|
-
}
|
|
5034
|
-
return results;
|
|
5035
|
-
};
|
|
5036
|
-
FlightEnterpriseSearch.prototype.filterByArrivalReturnAirport = function (arrivalAirports, results) {
|
|
5037
|
-
var selected = arrivalAirports.filter(function (x) { return x.selected; });
|
|
5038
|
-
if ((selected === null || selected === void 0 ? void 0 : selected.length) >= 1 && selected.length !== arrivalAirports.length) {
|
|
5039
|
-
results = results.filter(function (result) {
|
|
5040
|
-
var _a;
|
|
5041
|
-
if (!((_a = result.inboundFlights) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
5042
|
-
return true;
|
|
5043
|
-
}
|
|
5044
|
-
var destinationAirport = result.inboundFlights[result.inboundFlights.length - 1]
|
|
5045
|
-
.destinationAirport;
|
|
5046
|
-
return selected.find(function (x) { return x.value === destinationAirport; });
|
|
5047
|
-
});
|
|
5048
|
-
}
|
|
5049
|
-
return results;
|
|
5050
|
-
};
|
|
5051
|
-
FlightEnterpriseSearch.prototype.filterByFlightNumber = function (flightNumber, results) {
|
|
5052
|
-
if (flightNumber) {
|
|
5053
|
-
// make sure to check both outbound and inbound
|
|
5054
|
-
results = results.filter(function (result) {
|
|
5055
|
-
var _a;
|
|
5056
|
-
var inOutbound = result.outboundFlights.find(function (out) {
|
|
5057
|
-
return out.operatingFlightNumber
|
|
5058
|
-
.toUpperCase()
|
|
5059
|
-
.includes(flightNumber.toUpperCase());
|
|
5060
|
-
});
|
|
5061
|
-
var inInbound;
|
|
5062
|
-
if ((_a = result.inboundFlights) === null || _a === void 0 ? void 0 : _a.length) {
|
|
5063
|
-
inInbound = result.inboundFlights.find(function (inB) {
|
|
5064
|
-
return inB.operatingFlightNumber
|
|
5065
|
-
.toUpperCase()
|
|
5066
|
-
.includes(flightNumber.toUpperCase());
|
|
5067
|
-
});
|
|
5068
|
-
}
|
|
5069
|
-
return inOutbound || inInbound;
|
|
5070
|
-
});
|
|
5071
|
-
}
|
|
5072
|
-
return results;
|
|
5073
|
-
};
|
|
5074
|
-
FlightEnterpriseSearch.prototype.createFilters = function (results) {
|
|
5075
|
-
if (results === void 0) { results = []; }
|
|
5076
|
-
var minPrice = this.getMinPrice(results);
|
|
5077
|
-
var maxPrice = this.getMaxPrice(results);
|
|
5078
|
-
var newFilters = {
|
|
5079
|
-
stops: this.getAllStops(results),
|
|
5080
|
-
mustInclude: [],
|
|
5081
|
-
classes: this.getAllClasses(results),
|
|
5082
|
-
airlines: this.getAllAirlines(results),
|
|
5083
|
-
travelPolicy: [],
|
|
5084
|
-
depatureAirport: this.getAllDepartureAirports(results),
|
|
5085
|
-
arrivalAirport: this.getAllArrivalAirports(results),
|
|
5086
|
-
minPrice: minPrice,
|
|
5087
|
-
maxPrice: maxPrice,
|
|
5088
|
-
depatureReturnAirport: this.getAllDepartureAirports(results, true),
|
|
5089
|
-
arrivalReturnAirport: this.getAllArrivalAirports(results, true),
|
|
5090
|
-
baggage: this.getBaggage(results),
|
|
5091
|
-
fareTypes: [],
|
|
5092
|
-
minDuration: this.getMinDuration(results),
|
|
5093
|
-
maxDuration: this.getMaxDuration(results),
|
|
5094
|
-
minReturnDuration: this.getMinDuration(results, true),
|
|
5095
|
-
maxReturnDuration: this.getMaxDuration(results, true),
|
|
5096
|
-
minDepartureTime: this.getMinDepartureTime(results),
|
|
5097
|
-
maxDepartureTime: this.getMaxDepartureTime(results),
|
|
5098
|
-
minArrivalTime: this.getMinArrivalTime(results),
|
|
5099
|
-
maxArrivalTime: this.getMaxArrivalTime(results),
|
|
5100
|
-
minReturnDepartureTime: this.getMinReturnDepartureTime(results),
|
|
5101
|
-
maxReturnDepartureTime: this.getMaxReturnDepartureTime(results),
|
|
5102
|
-
maxReturnArrivalTime: this.getMaxReturnArrivalTime(results),
|
|
5103
|
-
minReturnArrivalTime: this.getMinReturnArrivalTime(results),
|
|
5104
|
-
flightNumber: ''
|
|
5105
|
-
};
|
|
5106
|
-
return newFilters;
|
|
5107
|
-
};
|
|
5108
|
-
FlightEnterpriseSearch.prototype.getMinDuration = function (results, isReturn) {
|
|
5109
|
-
if (isReturn === void 0) { isReturn = false; }
|
|
5110
|
-
var min = 0;
|
|
5111
|
-
results.forEach(function (result) {
|
|
5112
|
-
var _a;
|
|
5113
|
-
var dur = 0;
|
|
5114
|
-
if (!isReturn) {
|
|
5115
|
-
result.outboundFlights.forEach(function (out) {
|
|
5116
|
-
dur += out.totalDuration;
|
|
5117
|
-
});
|
|
5118
|
-
}
|
|
5119
|
-
if (((_a = result.inboundFlights) === null || _a === void 0 ? void 0 : _a.length) && isReturn) {
|
|
5120
|
-
result.inboundFlights.forEach(function (inb) {
|
|
5121
|
-
dur += inb.totalDuration;
|
|
5122
|
-
});
|
|
5123
|
-
}
|
|
5124
|
-
if (!min || dur < min) {
|
|
5125
|
-
min = dur;
|
|
5126
|
-
}
|
|
5127
|
-
});
|
|
5128
|
-
return min;
|
|
5129
|
-
};
|
|
5130
|
-
FlightEnterpriseSearch.prototype.getMaxDuration = function (results, isReturn) {
|
|
5131
|
-
if (isReturn === void 0) { isReturn = false; }
|
|
5132
|
-
var max = 0;
|
|
5133
|
-
results.forEach(function (result) {
|
|
5134
|
-
var _a;
|
|
5135
|
-
var dur = 0;
|
|
5136
|
-
if (!isReturn) {
|
|
5137
|
-
result.outboundFlights.forEach(function (out) {
|
|
5138
|
-
dur += out.totalDuration;
|
|
5139
|
-
});
|
|
5140
|
-
}
|
|
5141
|
-
if (((_a = result.inboundFlights) === null || _a === void 0 ? void 0 : _a.length) && isReturn) {
|
|
5142
|
-
result.inboundFlights.forEach(function (inb) {
|
|
5143
|
-
dur += inb.totalDuration;
|
|
5144
|
-
});
|
|
5145
|
-
}
|
|
5146
|
-
if (!max || dur > max) {
|
|
5147
|
-
max = dur;
|
|
5148
|
-
}
|
|
5149
|
-
});
|
|
5150
|
-
return max;
|
|
5151
|
-
};
|
|
5152
|
-
FlightEnterpriseSearch.prototype.getMinArrivalTime = function (results) {
|
|
5153
|
-
var min;
|
|
5154
|
-
results.forEach(function (result) {
|
|
5155
|
-
var minDepTime = Number(moment__default['default'](result.outboundFlights[result.outboundFlights.length - 1]
|
|
5156
|
-
.dateTimeArriving).format('HHmm'));
|
|
5157
|
-
minDepTime = Math.floor(minDepTime / 100) * 100;
|
|
5158
|
-
if (!min || minDepTime < min) {
|
|
5159
|
-
min = minDepTime;
|
|
5160
|
-
}
|
|
5161
|
-
});
|
|
5162
|
-
return min;
|
|
5163
|
-
};
|
|
5164
|
-
FlightEnterpriseSearch.prototype.getMinReturnArrivalTime = function (results) {
|
|
5165
|
-
var min;
|
|
5166
|
-
results.forEach(function (result) {
|
|
5167
|
-
if (result.inboundFlights && result.inboundFlights.length) {
|
|
5168
|
-
var minDepTime = Number(moment__default['default'](result.inboundFlights[result.inboundFlights.length - 1]
|
|
5169
|
-
.dateTimeArriving).format('HHmm'));
|
|
5170
|
-
minDepTime = Math.floor(minDepTime / 100) * 100;
|
|
5171
|
-
if (!min || minDepTime < min) {
|
|
5172
|
-
min = minDepTime;
|
|
5173
|
-
}
|
|
5174
|
-
}
|
|
5175
|
-
});
|
|
5176
|
-
return min;
|
|
5177
|
-
};
|
|
5178
|
-
FlightEnterpriseSearch.prototype.getMaxReturnArrivalTime = function (results) {
|
|
5179
|
-
var max;
|
|
5180
|
-
results.forEach(function (result) {
|
|
5181
|
-
if (result.inboundFlights && result.inboundFlights.length) {
|
|
5182
|
-
var maxDepTime = Number(moment__default['default'](result.inboundFlights[result.inboundFlights.length - 1]
|
|
5183
|
-
.dateTimeArriving).format('HHmm'));
|
|
5184
|
-
maxDepTime = Math.ceil(maxDepTime / 100) * 100;
|
|
5185
|
-
if (!max || maxDepTime > max) {
|
|
5186
|
-
max = maxDepTime;
|
|
5187
|
-
}
|
|
5188
|
-
}
|
|
5189
|
-
});
|
|
5190
|
-
return max;
|
|
5191
|
-
};
|
|
5192
|
-
FlightEnterpriseSearch.prototype.getMaxArrivalTime = function (results) {
|
|
5193
|
-
var max;
|
|
5194
|
-
results.forEach(function (result) {
|
|
5195
|
-
var maxDepTime = Number(moment__default['default'](result.outboundFlights[result.outboundFlights.length - 1]
|
|
5196
|
-
.dateTimeArriving).format('HHmm'));
|
|
5197
|
-
maxDepTime = Math.ceil(maxDepTime / 100) * 100;
|
|
5198
|
-
if (!max || maxDepTime > max) {
|
|
5199
|
-
max = maxDepTime;
|
|
5200
|
-
}
|
|
5201
|
-
});
|
|
5202
|
-
return max;
|
|
5203
|
-
};
|
|
5204
|
-
FlightEnterpriseSearch.prototype.getMinDepartureTime = function (results) {
|
|
5205
|
-
var min;
|
|
5206
|
-
results.forEach(function (result) {
|
|
5207
|
-
var minDepTime = Number(moment__default['default'](result.outboundFlights[0].dateTimeDeparting).format('HHmm'));
|
|
5208
|
-
minDepTime = Math.floor(minDepTime / 100) * 100;
|
|
5209
|
-
if (!min || minDepTime < min) {
|
|
5210
|
-
min = minDepTime;
|
|
5211
|
-
}
|
|
5212
|
-
});
|
|
5213
|
-
return min;
|
|
5214
|
-
};
|
|
5215
|
-
FlightEnterpriseSearch.prototype.getMinReturnDepartureTime = function (results) {
|
|
5216
|
-
var min;
|
|
5217
|
-
results.forEach(function (result) {
|
|
5218
|
-
if (result.inboundFlights && result.inboundFlights[0]) {
|
|
5219
|
-
var minDepTime = Number(moment__default['default'](result.inboundFlights[0].dateTimeDeparting).format('HHmm'));
|
|
5220
|
-
minDepTime = Math.floor(minDepTime / 100) * 100;
|
|
5221
|
-
if (!min || minDepTime < min) {
|
|
5222
|
-
min = minDepTime;
|
|
5223
|
-
}
|
|
5224
|
-
}
|
|
5225
|
-
});
|
|
5226
|
-
return min;
|
|
5227
|
-
};
|
|
5228
|
-
FlightEnterpriseSearch.prototype.getMaxReturnDepartureTime = function (results) {
|
|
5229
|
-
var max;
|
|
5230
|
-
results.forEach(function (result) {
|
|
5231
|
-
if (result.inboundFlights && result.inboundFlights[0]) {
|
|
5232
|
-
var maxDepTime = Number(moment__default['default'](result.inboundFlights[0].dateTimeDeparting).format('HHmm'));
|
|
5233
|
-
maxDepTime = Math.ceil(maxDepTime / 100) * 100;
|
|
5234
|
-
if (!max || maxDepTime > max) {
|
|
5235
|
-
max = maxDepTime;
|
|
5236
|
-
}
|
|
5237
|
-
}
|
|
5238
|
-
});
|
|
5239
|
-
return max;
|
|
5240
|
-
};
|
|
5241
|
-
FlightEnterpriseSearch.prototype.getMaxDepartureTime = function (results) {
|
|
5242
|
-
var max;
|
|
5243
|
-
results.forEach(function (result) {
|
|
5244
|
-
var maxDepTime = Number(moment__default['default'](result.outboundFlights[0].dateTimeDeparting).format('HHmm'));
|
|
5245
|
-
maxDepTime = Math.ceil(maxDepTime / 100) * 100;
|
|
5246
|
-
if (!max || maxDepTime > max) {
|
|
5247
|
-
max = maxDepTime;
|
|
5248
|
-
}
|
|
5249
|
-
});
|
|
5250
|
-
return max;
|
|
5251
|
-
};
|
|
5252
|
-
FlightEnterpriseSearch.prototype.getBaggage = function (results) {
|
|
5253
|
-
var baggage = {};
|
|
5254
|
-
results.forEach(function (result) {
|
|
5255
|
-
var _a, _b, _c, _d, _e, _f;
|
|
5256
|
-
try {
|
|
5257
|
-
if (result.baggageAllowance.length) {
|
|
5258
|
-
var total = +((_a = result.baggageAllowance[0]) === null || _a === void 0 ? void 0 : _a.qty);
|
|
5259
|
-
if (result.inboundFlights.length) {
|
|
5260
|
-
// ! assuming second item is inbound if the airlines are different, steven said he would sort this out
|
|
5261
|
-
if (result.baggageAllowance[1] &&
|
|
5262
|
-
+result.baggageAllowance[1].qty > total) {
|
|
5263
|
-
total = +((_b = result.baggageAllowance[1]) === null || _b === void 0 ? void 0 : _b.qty);
|
|
5264
|
-
}
|
|
5265
|
-
else if (+((_c = result.baggageAllowance[0]) === null || _c === void 0 ? void 0 : _c.qty) > total) {
|
|
5266
|
-
total = +((_d = result.baggageAllowance[0]) === null || _d === void 0 ? void 0 : _d.qty);
|
|
5267
|
-
}
|
|
5268
|
-
}
|
|
5269
|
-
if (+((_e = result.baggageAllowance[0]) === null || _e === void 0 ? void 0 : _e.qty) > total) {
|
|
5270
|
-
total = +((_f = result.baggageAllowance[0]) === null || _f === void 0 ? void 0 : _f.qty);
|
|
5271
|
-
}
|
|
5272
|
-
baggage[total] = {
|
|
5273
|
-
selected: false,
|
|
5274
|
-
value: total,
|
|
5275
|
-
display: total + " bag" + (total !== 1 ? 's' : '')
|
|
5276
|
-
};
|
|
5277
|
-
}
|
|
5278
|
-
}
|
|
5279
|
-
catch (error) {
|
|
5280
|
-
console.error("+++ Error parsing additional flight data: " + error + " +++");
|
|
5281
|
-
}
|
|
5282
|
-
});
|
|
5283
|
-
return Object.values(baggage);
|
|
5284
|
-
};
|
|
5285
|
-
FlightEnterpriseSearch.prototype.getMinPrice = function (results) {
|
|
5286
|
-
var minPrice;
|
|
5287
|
-
results.forEach(function (result) {
|
|
5288
|
-
if (!minPrice || result.total.price < minPrice) {
|
|
5289
|
-
minPrice = result.total.price;
|
|
5290
|
-
}
|
|
5291
|
-
});
|
|
5292
|
-
return minPrice;
|
|
5293
|
-
};
|
|
5294
|
-
FlightEnterpriseSearch.prototype.getMaxPrice = function (results) {
|
|
5295
|
-
var maxPrice;
|
|
5296
|
-
results.forEach(function (result) {
|
|
5297
|
-
if (!maxPrice || result.total.price > maxPrice) {
|
|
5298
|
-
maxPrice = result.total.price;
|
|
5299
|
-
}
|
|
5300
|
-
});
|
|
5301
|
-
return maxPrice;
|
|
5302
|
-
};
|
|
5303
|
-
FlightEnterpriseSearch.prototype.getAllStops = function (results) {
|
|
5304
|
-
var allStops = {};
|
|
5305
|
-
results.forEach(function (result) {
|
|
5306
|
-
var totalStops = result.outboundFlights.length - 1; // might have to recalculate this
|
|
5307
|
-
allStops[totalStops] = {
|
|
5308
|
-
value: totalStops,
|
|
5309
|
-
display: totalStops + " stop" + (totalStops !== 1 ? 's' : ''),
|
|
5310
|
-
selected: false
|
|
5217
|
+
};
|
|
5218
|
+
var replaceFields = function (field, flightItinerary) {
|
|
5219
|
+
return field
|
|
5220
|
+
.replace('OUTBOUND_DEPARTURE', 'outboundFlights.0')
|
|
5221
|
+
.replace('OUTBOUND_ARRIVAL', 'outboundFlights.' + (flightItinerary.outboundFlights.length - 1))
|
|
5222
|
+
.replace('INBOUND_DEPARTURE', 'inboundFlights.0')
|
|
5223
|
+
.replace('INBOUND_ARRIVAL', 'inboundFlights.' +
|
|
5224
|
+
((flightItinerary.inboundFlights || []).length - 1));
|
|
5225
|
+
};
|
|
5226
|
+
var isBetween = function (minmax, field) {
|
|
5227
|
+
return function (flightItinerary) {
|
|
5228
|
+
var _o;
|
|
5229
|
+
var val = (_o = _this.helpers).fromObject.apply(_o, __spread([flightItinerary], replaceFields(field, flightItinerary).split('.')));
|
|
5230
|
+
return val >= minmax.min && val <= minmax.max;
|
|
5311
5231
|
};
|
|
5312
|
-
}
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
results.forEach(function (result) {
|
|
5232
|
+
};
|
|
5233
|
+
var isHourBetween = function (minmax, field) {
|
|
5234
|
+
return function (flightItinerary) {
|
|
5235
|
+
var _o;
|
|
5236
|
+
var val = moment__default['default']((_o = _this.helpers).fromObject.apply(_o, __spread([flightItinerary], replaceFields(field, flightItinerary).split('.')))).get('hour');
|
|
5237
|
+
return val >= minmax.min && val <= minmax.max;
|
|
5238
|
+
};
|
|
5239
|
+
};
|
|
5240
|
+
var hasValue = function (field) {
|
|
5241
|
+
return function (flightItinerary, toTest) {
|
|
5242
|
+
var _o;
|
|
5243
|
+
var val = (_o = _this.helpers).fromObject.apply(_o, __spread([flightItinerary], replaceFields(field, flightItinerary).split('.')));
|
|
5244
|
+
return val === toTest;
|
|
5245
|
+
};
|
|
5246
|
+
};
|
|
5247
|
+
var fieldHasValue = function (field) {
|
|
5248
|
+
return function (flight, value) {
|
|
5249
|
+
return flight[field] === value;
|
|
5250
|
+
};
|
|
5251
|
+
};
|
|
5252
|
+
var outItineraryTesters = [];
|
|
5253
|
+
var inItineraryTesters = [];
|
|
5254
|
+
outItineraryTesters.push(isHourBetween(filters.arrivalTime, 'OUTBOUND_ARRIVAL.dateTimeArriving'));
|
|
5255
|
+
outItineraryTesters.push(isHourBetween(filters.departureTime, 'OUTBOUND_ARRIVAL.dateTimeDeparting'));
|
|
5256
|
+
outItineraryTesters.push(isBetween(filters.duration, 'outboundTotalDuration'));
|
|
5257
|
+
outItineraryTesters.push(isBetween(filters.price, 'total.price'));
|
|
5258
|
+
outItineraryTesters.push(tester(filters.stops, function (flightItinerary, value) {
|
|
5259
|
+
return (flightItinerary.outboundFlights.length === value ||
|
|
5260
|
+
(flightItinerary.inboundFlights || []).length === value);
|
|
5261
|
+
}));
|
|
5262
|
+
outItineraryTesters.push(isHourBetween(filters.arrivalTime, 'OUTBOUND_ARRIVAL.dateTimeArriving'));
|
|
5263
|
+
outItineraryTesters.push(tester(filters.depatureAirport, function (flightItinerary, value) {
|
|
5345
5264
|
var _a;
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
display: result.outboundFlights[0].originAirportName,
|
|
5350
|
-
selected: false
|
|
5351
|
-
};
|
|
5352
|
-
}
|
|
5353
|
-
if (((_a = result.inboundFlights) === null || _a === void 0 ? void 0 : _a.length) && inbound) {
|
|
5354
|
-
allAirports[result.inboundFlights[0].originAirport] = {
|
|
5355
|
-
value: result.inboundFlights[0].originAirport,
|
|
5356
|
-
display: result.inboundFlights[0].originAirportName,
|
|
5357
|
-
selected: false
|
|
5358
|
-
};
|
|
5359
|
-
}
|
|
5360
|
-
});
|
|
5361
|
-
return Object.values(allAirports);
|
|
5362
|
-
};
|
|
5363
|
-
/**
|
|
5364
|
-
* @description - create select filters for all unique departure airports returned in the search
|
|
5365
|
-
* @param results - the flight results
|
|
5366
|
-
*/
|
|
5367
|
-
FlightEnterpriseSearch.prototype.getAllArrivalAirports = function (results, inbound) {
|
|
5368
|
-
if (inbound === void 0) { inbound = false; }
|
|
5369
|
-
var allAirports = {};
|
|
5370
|
-
results.forEach(function (result) {
|
|
5265
|
+
return ((_a = flightItinerary.outboundFlights[0]) === null || _a === void 0 ? void 0 : _a.originAirport) === value;
|
|
5266
|
+
}));
|
|
5267
|
+
outItineraryTesters.push(tester(filters.arrivalAirport, function (flightItinerary, value) {
|
|
5371
5268
|
var _a;
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
var
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5269
|
+
return (((_a = flightItinerary.outboundFlights[flightItinerary.outboundFlights.length - 1]) === null || _a === void 0 ? void 0 : _a.destinationAirport) === value);
|
|
5270
|
+
}));
|
|
5271
|
+
inItineraryTesters.push(isBetween(filters.duration, 'outboundTotalDuration'));
|
|
5272
|
+
inItineraryTesters.push(isBetween(filters.price, 'total.price'));
|
|
5273
|
+
inItineraryTesters.push(isHourBetween(filters.arrivalTime, 'INBOUND_ARRIVAL.dateTimeArriving'));
|
|
5274
|
+
inItineraryTesters.push(isHourBetween(filters.departureTime, 'INBOUND_ARRIVAL.dateTimeDeparting'));
|
|
5275
|
+
inItineraryTesters.push(isBetween(filters.returnDuration, 'inboundTotalDuration'));
|
|
5276
|
+
inItineraryTesters.push(tester(filters.stops, function (flightItinerary, value) {
|
|
5277
|
+
return (flightItinerary.outboundFlights.length === value ||
|
|
5278
|
+
(flightItinerary.inboundFlights || []).length === value);
|
|
5279
|
+
}));
|
|
5280
|
+
inItineraryTesters.push(isHourBetween(filters.arrivalTime, 'INBOUND_ARRIVAL.dateTimeArriving'));
|
|
5281
|
+
inItineraryTesters.push(tester(filters.depatureReturnAirport, function (flightItinerary, value) {
|
|
5282
|
+
var _a;
|
|
5283
|
+
return ((_a = flightItinerary.inboundFlights[0]) === null || _a === void 0 ? void 0 : _a.originAirport) === value;
|
|
5284
|
+
}));
|
|
5285
|
+
inItineraryTesters.push(tester(filters.arrivalReturnAirport, function (flightItinerary, value) {
|
|
5286
|
+
var _a;
|
|
5287
|
+
return (((_a = flightItinerary.inboundFlights[flightItinerary.inboundFlights.length - 1]) === null || _a === void 0 ? void 0 : _a.destinationAirport) === value);
|
|
5288
|
+
}));
|
|
5289
|
+
var outJourneyTesters = [];
|
|
5290
|
+
outJourneyTesters.push(tester(filters.classes, fieldHasValue('cabinClass')));
|
|
5291
|
+
outJourneyTesters.push(tester(filters.airlines, fieldHasValue('marketingCarrier')));
|
|
5292
|
+
var inJourneyTesters = [];
|
|
5293
|
+
inJourneyTesters.push(tester(filters.classes, fieldHasValue('cabinClass')));
|
|
5294
|
+
inJourneyTesters.push(tester(filters.airlines, fieldHasValue('marketingCarrier')));
|
|
5295
|
+
var outFilterItineraries = function (flightItinerary) {
|
|
5296
|
+
return (outItineraryTesters.reduce(function (acc, tester1) {
|
|
5297
|
+
acc = acc && tester1(flightItinerary);
|
|
5298
|
+
return acc;
|
|
5299
|
+
}, true) &&
|
|
5300
|
+
(!flightItinerary.outboundFlights ||
|
|
5301
|
+
!!(flightItinerary.outboundFlights || []).find(function (flightJourney) {
|
|
5302
|
+
return !!outJourneyTesters.reduce(function (acc, tester2) {
|
|
5303
|
+
return acc && tester2(flightJourney);
|
|
5304
|
+
}, true);
|
|
5305
|
+
})));
|
|
5306
|
+
};
|
|
5307
|
+
var inFilterItineraries = function (flightItinerary) {
|
|
5308
|
+
return (inItineraryTesters.reduce(function (acc, tester1) {
|
|
5309
|
+
return acc && tester1(flightItinerary);
|
|
5310
|
+
}, true) &&
|
|
5311
|
+
(!flightItinerary.inboundFlights ||
|
|
5312
|
+
!!(flightItinerary.inboundFlights || []).find(function (flightJourney) {
|
|
5313
|
+
return !!inJourneyTesters.reduce(function (acc, tester2) {
|
|
5314
|
+
return acc && tester2(flightJourney);
|
|
5315
|
+
}, true);
|
|
5316
|
+
})));
|
|
5317
|
+
};
|
|
5318
|
+
if (this.isGroupedFlights(this.fullResults)) {
|
|
5319
|
+
this.results.next(this.helpers
|
|
5320
|
+
.clone(this.fullResults)
|
|
5321
|
+
.filter(function (result) {
|
|
5322
|
+
return !!result;
|
|
5323
|
+
})
|
|
5324
|
+
.map(function (result) {
|
|
5325
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5326
|
+
var filterItineraries = result.direction === exports.FlightDirectionEnum.Outbound
|
|
5327
|
+
? outFilterItineraries
|
|
5328
|
+
: inFilterItineraries;
|
|
5329
|
+
if (result.classes.EconomyNoBags) {
|
|
5330
|
+
result.classes.EconomyNoBags.flights = (((_a = result.classes.EconomyNoBags) === null || _a === void 0 ? void 0 : _a.flights) || [])
|
|
5331
|
+
.filter(function (flightItinerary) { return !!flightItinerary; })
|
|
5332
|
+
.filter(filterItineraries);
|
|
5333
|
+
}
|
|
5334
|
+
if (result.classes.EconomyRestricted) {
|
|
5335
|
+
result.classes.EconomyRestricted.flights = (((_b = result.classes.EconomyRestricted) === null || _b === void 0 ? void 0 : _b.flights) || [])
|
|
5336
|
+
.filter(function (flightItinerary) { return !!flightItinerary; })
|
|
5337
|
+
.filter(filterItineraries);
|
|
5338
|
+
}
|
|
5339
|
+
if (result.classes.EconomyFlexi) {
|
|
5340
|
+
result.classes.EconomyFlexi.flights = (((_c = result.classes.EconomyFlexi) === null || _c === void 0 ? void 0 : _c.flights) || [])
|
|
5341
|
+
.filter(function (flightItinerary) { return !!flightItinerary; })
|
|
5342
|
+
.filter(filterItineraries);
|
|
5343
|
+
}
|
|
5344
|
+
if (result.classes.PremiumEconomy) {
|
|
5345
|
+
result.classes.PremiumEconomy.flights = (((_d = result.classes.PremiumEconomy) === null || _d === void 0 ? void 0 : _d.flights) || [])
|
|
5346
|
+
.filter(function (flightItinerary) { return !!flightItinerary; })
|
|
5347
|
+
.filter(filterItineraries);
|
|
5348
|
+
}
|
|
5349
|
+
if (result.classes.Business) {
|
|
5350
|
+
result.classes.Business.flights = (((_e = result.classes.Business) === null || _e === void 0 ? void 0 : _e.flights) || [])
|
|
5351
|
+
.filter(function (flightItinerary) { return !!flightItinerary; })
|
|
5352
|
+
.filter(filterItineraries);
|
|
5353
|
+
}
|
|
5354
|
+
if (result.classes.First) {
|
|
5355
|
+
result.classes.First.flights = (((_f = result.classes.First) === null || _f === void 0 ? void 0 : _f.flights) || [])
|
|
5356
|
+
.filter(function (flightItinerary) { return !!flightItinerary; })
|
|
5357
|
+
.filter(filterItineraries);
|
|
5358
|
+
}
|
|
5359
|
+
return result;
|
|
5360
|
+
})
|
|
5361
|
+
.filter(function (result) {
|
|
5362
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
5363
|
+
return ((((_b = (_a = result.classes) === null || _a === void 0 ? void 0 : _a.EconomyNoBags) === null || _b === void 0 ? void 0 : _b.flights.length) || 0) +
|
|
5364
|
+
(((_d = (_c = result.classes) === null || _c === void 0 ? void 0 : _c.EconomyRestricted) === null || _d === void 0 ? void 0 : _d.flights.length) || 0) +
|
|
5365
|
+
(((_f = (_e = result.classes) === null || _e === void 0 ? void 0 : _e.EconomyFlexi) === null || _f === void 0 ? void 0 : _f.flights.length) || 0) +
|
|
5366
|
+
(((_h = (_g = result.classes) === null || _g === void 0 ? void 0 : _g.PremiumEconomy) === null || _h === void 0 ? void 0 : _h.flights.length) || 0) +
|
|
5367
|
+
(((_k = (_j = result.classes) === null || _j === void 0 ? void 0 : _j.Business) === null || _k === void 0 ? void 0 : _k.flights.length) || 0) +
|
|
5368
|
+
(((_m = (_l = result.classes) === null || _l === void 0 ? void 0 : _l.First) === null || _m === void 0 ? void 0 : _m.flights.length) || 0) >
|
|
5369
|
+
0);
|
|
5370
|
+
})
|
|
5371
|
+
.sort(this._sortGroupedRoutines[sortValue]));
|
|
5372
|
+
}
|
|
5373
|
+
else {
|
|
5374
|
+
this.results.next(Object.freeze(this.helpers
|
|
5375
|
+
.clone(this.fullResults)
|
|
5376
|
+
.map(function (result) {
|
|
5377
|
+
// return {
|
|
5378
|
+
// type: 'FlightAllQuoteResult',
|
|
5379
|
+
// journeys: result.journeys.filter(filterItineraries)
|
|
5380
|
+
// };
|
|
5381
|
+
return result;
|
|
5382
|
+
})));
|
|
5383
|
+
}
|
|
5418
5384
|
};
|
|
5419
5385
|
FlightEnterpriseSearch.prototype.updateLowestPrice = function (results) {
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5386
|
+
if (!results.length || this.searchService.isFlightsGrouped()) {
|
|
5387
|
+
return;
|
|
5388
|
+
}
|
|
5389
|
+
var journeys = results[0].journeys;
|
|
5390
|
+
var currency = journeys[0].total.currency;
|
|
5391
|
+
return journeys.reduce(function (cheapestPrice, result) {
|
|
5392
|
+
var price = result.total.price;
|
|
5393
|
+
if (cheapestPrice.amount > price)
|
|
5394
|
+
cheapestPrice.amount = price;
|
|
5395
|
+
return cheapestPrice;
|
|
5396
|
+
}, { amount: Number.MAX_SAFE_INTEGER, currencyCode: currency });
|
|
5431
5397
|
};
|
|
5432
5398
|
FlightEnterpriseSearch.prototype.selectGroupedFlight = function (selectedFlight, direction) {
|
|
5433
5399
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -5524,7 +5490,9 @@
|
|
|
5524
5490
|
operatingCarrier: selectedFlight.operatingCarrier,
|
|
5525
5491
|
operatingFlightNumber: selectedFlight.operatingFlightNumber,
|
|
5526
5492
|
originAirport: selectedFlight.originAirport,
|
|
5527
|
-
totalDuration: selectedFlight.totalDuration
|
|
5493
|
+
totalDuration: selectedFlight.totalDuration,
|
|
5494
|
+
originTerminal: selectedFlight.originTerminal,
|
|
5495
|
+
destinationTerminal: selectedFlight.destinationTerminal
|
|
5528
5496
|
};
|
|
5529
5497
|
};
|
|
5530
5498
|
FlightEnterpriseSearch.prototype.addFlightJourneysToBasket = function (flightQuote) {
|
|
@@ -6301,22 +6269,43 @@
|
|
|
6301
6269
|
};
|
|
6302
6270
|
};
|
|
6303
6271
|
BaseHelperRoutines.prototype.removeNulls = function (query) {
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6272
|
+
var _this = this;
|
|
6273
|
+
if (!query) {
|
|
6274
|
+
return query;
|
|
6275
|
+
}
|
|
6276
|
+
if (moment__default['default'].isMoment(query)) {
|
|
6277
|
+
return query;
|
|
6278
|
+
}
|
|
6279
|
+
else if (Array.isArray(query)) {
|
|
6280
|
+
return (query
|
|
6281
|
+
.map(function (item) {
|
|
6282
|
+
return _this.removeNulls(item);
|
|
6283
|
+
})
|
|
6284
|
+
.filter(function (item1) {
|
|
6285
|
+
return !!item1;
|
|
6286
|
+
}) || null);
|
|
6287
|
+
}
|
|
6288
|
+
else if (typeof query === 'object') {
|
|
6289
|
+
return Object.keys(query).reduce(function (accum, key) {
|
|
6290
|
+
var value = query[key];
|
|
6291
|
+
var data = _this.removeNulls(value);
|
|
6292
|
+
if ((data !== null && data !== undefined && data !== 'null') ||
|
|
6293
|
+
(Array.isArray(data) && data.length > 0)) {
|
|
6294
|
+
accum[key] = data;
|
|
6295
|
+
}
|
|
6296
|
+
return accum;
|
|
6297
|
+
}, {});
|
|
6298
|
+
}
|
|
6299
|
+
else {
|
|
6300
|
+
return query;
|
|
6301
|
+
}
|
|
6315
6302
|
};
|
|
6316
6303
|
BaseHelperRoutines.prototype.getTravellersId = function (travellers) {
|
|
6317
6304
|
if (travellers) {
|
|
6318
6305
|
return travellers.reduce(function (previousValue, currentValue, idx) {
|
|
6319
|
-
return idx === 0
|
|
6306
|
+
return idx === 0
|
|
6307
|
+
? [currentValue.id]
|
|
6308
|
+
: __spread(previousValue, [currentValue.id]);
|
|
6320
6309
|
}, []);
|
|
6321
6310
|
}
|
|
6322
6311
|
};
|
|
@@ -6532,7 +6521,6 @@
|
|
|
6532
6521
|
* @desc - generates ics file body content based on the provided basketItems param
|
|
6533
6522
|
*/
|
|
6534
6523
|
BaseHelperRoutines.prototype.generateIcsFileBodyContent = function (basketItems) {
|
|
6535
|
-
// TODO: currently only basket items with ServiceType.Lounge are handled. See below to TODOs for remaining tasks
|
|
6536
6524
|
var bodyContent = [];
|
|
6537
6525
|
// generate calendar data for each basket item
|
|
6538
6526
|
basketItems.map(function (basketItem, index) {
|
|
@@ -6546,11 +6534,12 @@
|
|
|
6546
6534
|
serviceType: '',
|
|
6547
6535
|
summary: ''
|
|
6548
6536
|
};
|
|
6537
|
+
var dateFormat = 'DD MMMM YYYY HH:mm';
|
|
6549
6538
|
var type = basketItem.service.type;
|
|
6539
|
+
var adults = basketItem.adults, children = basketItem.children, bookingThirdPartyReference = basketItem.bookingThirdPartyReference, detail = basketItem.detail, service = basketItem.service;
|
|
6550
6540
|
// populate data object depending on the service type in the basket
|
|
6551
6541
|
switch (type) {
|
|
6552
6542
|
case ServiceType.Lounge:
|
|
6553
|
-
var adults = basketItem.adults, children = basketItem.children, bookingThirdPartyReference = basketItem.bookingThirdPartyReference, detail = basketItem.detail, service = basketItem.service;
|
|
6554
6543
|
data.basketId = basketItem.id;
|
|
6555
6544
|
data.dStart = detail === null || detail === void 0 ? void 0 : detail.arrivalDatetime;
|
|
6556
6545
|
data.dEnd = '';
|
|
@@ -6558,31 +6547,113 @@
|
|
|
6558
6547
|
data.serviceType = service.type.toLowerCase();
|
|
6559
6548
|
data.description = [
|
|
6560
6549
|
"Lounge: " + detail.name + "\r\n",
|
|
6561
|
-
"Starts: " + detail.arrivalDatetime + "\r\n",
|
|
6550
|
+
"Starts: " + moment__default['default'](detail.arrivalDatetime).format(dateFormat) + "\r\n",
|
|
6562
6551
|
"Adults: " + adults + "\r\n",
|
|
6563
6552
|
"Children: " + children + "\r\n",
|
|
6564
6553
|
"Booking Ref: " + bookingThirdPartyReference
|
|
6565
6554
|
].join('');
|
|
6566
6555
|
break;
|
|
6567
6556
|
case ServiceType.Cab:
|
|
6568
|
-
|
|
6569
|
-
|
|
6557
|
+
data.basketId = basketItem.id;
|
|
6558
|
+
data.serviceType = service.type.toLowerCase();
|
|
6559
|
+
data.dStart = detail === null || detail === void 0 ? void 0 : detail.departs;
|
|
6560
|
+
data.dEnd = '';
|
|
6561
|
+
data.summary = "Taxi booking - from " + detail.fromLocation.address + " to " + detail.toLocation.address;
|
|
6562
|
+
data.description = [
|
|
6563
|
+
"Pickup Point: " + detail.fromLocation.address + "\r\n",
|
|
6564
|
+
"Time: " + moment__default['default'](detail.departs).format(dateFormat) + "\r\n",
|
|
6565
|
+
"Booking Ref: " + bookingThirdPartyReference
|
|
6566
|
+
].join('');
|
|
6567
|
+
break;
|
|
6570
6568
|
case ServiceType.Car:
|
|
6571
|
-
|
|
6569
|
+
data.basketId = basketItem.id;
|
|
6570
|
+
data.serviceType = service.type.toLowerCase();
|
|
6571
|
+
data.dStart = detail === null || detail === void 0 ? void 0 : detail.pickUpDatetime;
|
|
6572
|
+
data.dEnd = detail === null || detail === void 0 ? void 0 : detail.dropOffDatetime;
|
|
6573
|
+
data.summary = "Car booking - from " + detail.pickUpLocation.address + " to " + detail.dropOffLocation.address;
|
|
6574
|
+
data.description = [
|
|
6575
|
+
"Pickup Point: " + detail.pickUpLocation.address + "\r\n",
|
|
6576
|
+
"Time: " + moment__default['default'](detail.pickUpDatetime).format(dateFormat) + "\r\n",
|
|
6577
|
+
"Arrival Point: " + detail.dropOffLocation.address + "\r\n",
|
|
6578
|
+
"Booking Ref: " + bookingThirdPartyReference
|
|
6579
|
+
].join('');
|
|
6580
|
+
(data.locationFrom = detail.pickUpLocation.address),
|
|
6581
|
+
(data.locationTo = detail.dropOffLocation.address);
|
|
6582
|
+
break;
|
|
6572
6583
|
case ServiceType.Coach:
|
|
6573
6584
|
// TODO: handle this case
|
|
6574
6585
|
case ServiceType.FastTrack:
|
|
6575
6586
|
// TODO: handle this case
|
|
6576
6587
|
case ServiceType.Flight:
|
|
6577
|
-
|
|
6588
|
+
data.basketId = basketItem.id;
|
|
6589
|
+
data.serviceType = service.type.toLowerCase();
|
|
6590
|
+
data.dStart = detail === null || detail === void 0 ? void 0 : detail.outboundFlights[0].dateTimeDeparting;
|
|
6591
|
+
data.dEnd = detail === null || detail === void 0 ? void 0 : detail.outboundFlights[0].dateTimeArriving;
|
|
6592
|
+
data.summary = "Flight Booking - From " + detail.outboundFlights[0].originAirport + " to " + detail.outboundFlights[0].destinationAirport;
|
|
6593
|
+
data.description = [
|
|
6594
|
+
"From: " + detail.outboundFlights[0].originAirport + "\r\n",
|
|
6595
|
+
"Depart: " + moment__default['default'](detail.outboundFlights[0].dateTimeDeparting).format(dateFormat) + "\r\n",
|
|
6596
|
+
"To: " + detail.outboundFlights[0].destinationAirport + "\r\n",
|
|
6597
|
+
"Arrive: " + moment__default['default'](detail.outboundFlights[0].dateTimeArriving).format(dateFormat) + "\r\n",
|
|
6598
|
+
"Booking Ref: " + bookingThirdPartyReference
|
|
6599
|
+
].join('');
|
|
6600
|
+
break;
|
|
6578
6601
|
case ServiceType.Hotel:
|
|
6579
|
-
|
|
6602
|
+
data.basketId = basketItem.id;
|
|
6603
|
+
data.serviceType = service.type.toLowerCase();
|
|
6604
|
+
data.dStart = detail === null || detail === void 0 ? void 0 : detail.checkIn;
|
|
6605
|
+
data.dEnd = detail === null || detail === void 0 ? void 0 : detail.checkOut;
|
|
6606
|
+
data.summary = "Hotel booking - " + detail.hotelName;
|
|
6607
|
+
data.description = [
|
|
6608
|
+
"Hotel: " + detail.hotelName + "\r\n",
|
|
6609
|
+
"Arrival: " + moment__default['default'](detail.checkIn).format(dateFormat) + "\r\n",
|
|
6610
|
+
"Departure: " + moment__default['default'](detail.checkOut).format(dateFormat) + "\r\n",
|
|
6611
|
+
"Booking Ref: " + bookingThirdPartyReference
|
|
6612
|
+
].join('');
|
|
6613
|
+
break;
|
|
6580
6614
|
case ServiceType.InternationalRail:
|
|
6581
|
-
|
|
6615
|
+
data.basketId = basketItem.id;
|
|
6616
|
+
data.serviceType = service.type.toLowerCase();
|
|
6617
|
+
data.dStart = detail === null || detail === void 0 ? void 0 : detail.outwardDetail.departureDateTime;
|
|
6618
|
+
data.dEnd = detail === null || detail === void 0 ? void 0 : detail.outwardDetail.arrivalDateTime;
|
|
6619
|
+
data.locationFrom = detail.outwardDetail.departureStationName;
|
|
6620
|
+
data.locationTo = detail.outwardDetail.arrivalDateTime;
|
|
6621
|
+
data.summary = "Train Booking - From " + detail.outwardDetail.departureStationName + " to " + detail.outwardDetail.arrivalStationName;
|
|
6622
|
+
data.description = [
|
|
6623
|
+
"From " + detail.outwardDetail.departureStationName + "\r\n",
|
|
6624
|
+
"To " + detail.outwardDetail.arrivalStationName + "\r\n",
|
|
6625
|
+
"Departure " + moment__default['default'](detail.outwardDetail.departureDateTime).format(dateFormat) + "\r\n",
|
|
6626
|
+
"Arrival " + moment__default['default'](detail.outwardDetail.arrivalDateTime).format(dateFormat) + "\r\n",
|
|
6627
|
+
"Booking Ref: " + bookingThirdPartyReference
|
|
6628
|
+
].join('');
|
|
6629
|
+
break;
|
|
6582
6630
|
case ServiceType.Parking:
|
|
6583
|
-
|
|
6631
|
+
data.basketId = basketItem.id;
|
|
6632
|
+
data.serviceType = service.type.toLowerCase();
|
|
6633
|
+
data.dStart = detail === null || detail === void 0 ? void 0 : detail.arrivalDatetime;
|
|
6634
|
+
data.dEnd = detail === null || detail === void 0 ? void 0 : detail.departDatetime;
|
|
6635
|
+
data.summary = "Airport parking - " + detail.name;
|
|
6636
|
+
data.description = [
|
|
6637
|
+
"Airport Parking: " + detail.name + "\r\n",
|
|
6638
|
+
"Booking Ref: " + bookingThirdPartyReference
|
|
6639
|
+
].join('');
|
|
6640
|
+
break;
|
|
6584
6641
|
case ServiceType.Rail:
|
|
6585
|
-
|
|
6642
|
+
data.basketId = basketItem.id;
|
|
6643
|
+
data.serviceType = service.type.toLowerCase();
|
|
6644
|
+
data.dStart = detail === null || detail === void 0 ? void 0 : detail.outwardDetail.departureDateTime;
|
|
6645
|
+
data.dEnd = detail === null || detail === void 0 ? void 0 : detail.outwardDetail.arrivalDateTime;
|
|
6646
|
+
data.locationFrom = detail.outwardDetail.departureStationName;
|
|
6647
|
+
data.locationTo = detail.outwardDetail.arrivalDateTime;
|
|
6648
|
+
data.summary = "Train Booking - From " + detail.outwardDetail.departureStationName + " to " + detail.outwardDetail.arrivalStationName;
|
|
6649
|
+
data.description = [
|
|
6650
|
+
"From " + detail.outwardDetail.departureStationName + "\r\n",
|
|
6651
|
+
"To " + detail.outwardDetail.arrivalStationName + "\r\n",
|
|
6652
|
+
"Departure " + moment__default['default'](detail.outwardDetail.departureDateTime).format(dateFormat) + "\r\n",
|
|
6653
|
+
"Arrival " + moment__default['default'](detail.outwardDetail.arrivalDateTime).format(dateFormat) + "\r\n",
|
|
6654
|
+
"Booking Ref: " + bookingThirdPartyReference
|
|
6655
|
+
].join('');
|
|
6656
|
+
break;
|
|
6586
6657
|
}
|
|
6587
6658
|
bodyContent.push([
|
|
6588
6659
|
'BEGIN:VEVENT\r\n',
|
|
@@ -6632,6 +6703,119 @@
|
|
|
6632
6703
|
}
|
|
6633
6704
|
return splitString;
|
|
6634
6705
|
};
|
|
6706
|
+
BaseHelperRoutines.prototype.createFlightFilters = function (journeys, defaultFilters) {
|
|
6707
|
+
return journeys.reduce(function (filters, result1) {
|
|
6708
|
+
var totalStops = result1.outboundFlights.length - 1;
|
|
6709
|
+
filters.stops[totalStops] = filters.stops[totalStops] || {
|
|
6710
|
+
display: totalStops + " stop" + (totalStops !== 1 ? 's' : ''),
|
|
6711
|
+
selected: false,
|
|
6712
|
+
value: totalStops + 1
|
|
6713
|
+
};
|
|
6714
|
+
var updateFlightItems = function (flight) {
|
|
6715
|
+
filters.classes[flight.cabinClass] = filters.classes[flight.cabinClass] || {
|
|
6716
|
+
display: flight.cabinClass,
|
|
6717
|
+
selected: false,
|
|
6718
|
+
value: flight.cabinClass
|
|
6719
|
+
};
|
|
6720
|
+
filters.airlines[flight.marketingCarrier] = filters.airlines[flight.marketingCarrier] || {
|
|
6721
|
+
display: flight.marketingCarrierName,
|
|
6722
|
+
selected: false,
|
|
6723
|
+
value: flight.marketingCarrier
|
|
6724
|
+
};
|
|
6725
|
+
};
|
|
6726
|
+
result1.outboundFlights.forEach(updateFlightItems);
|
|
6727
|
+
var baggage = Math.min.apply(Math, __spread(result1.baggageAllowance.map(function (baggageAllowance) { return baggageAllowance.qty; })));
|
|
6728
|
+
filters.baggage[baggage] = filters.baggage[baggage] || {
|
|
6729
|
+
selected: false,
|
|
6730
|
+
display: baggage + " bag" + (baggage !== 1 ? 's' : ''),
|
|
6731
|
+
value: baggage
|
|
6732
|
+
};
|
|
6733
|
+
var indexedFlight = function (flights, filterAttribute, flightAttribute, flightAttributeName, index) {
|
|
6734
|
+
var temp = flights[index][flightAttribute];
|
|
6735
|
+
filters[filterAttribute][temp] = filters[filterAttribute][temp] || {
|
|
6736
|
+
value: flights[index][flightAttribute],
|
|
6737
|
+
display: flights[index][flightAttributeName],
|
|
6738
|
+
selected: false
|
|
6739
|
+
};
|
|
6740
|
+
};
|
|
6741
|
+
indexedFlight(result1.outboundFlights, 'depatureAirport', 'originAirport', 'originAirportName', 0);
|
|
6742
|
+
indexedFlight(result1.outboundFlights, 'arrivalAirport', 'destinationAirport', 'destinationAirportName', result1.outboundFlights.length - 1);
|
|
6743
|
+
filters.price.min =
|
|
6744
|
+
filters.price.min < result1.total.price
|
|
6745
|
+
? filters.price.min
|
|
6746
|
+
: result1.total.price;
|
|
6747
|
+
filters.price.max =
|
|
6748
|
+
filters.price.max > result1.total.price
|
|
6749
|
+
? filters.price.max
|
|
6750
|
+
: result1.total.price;
|
|
6751
|
+
filters.duration.min =
|
|
6752
|
+
filters.duration.min < result1.outboundTotalDuration
|
|
6753
|
+
? filters.duration.min
|
|
6754
|
+
: result1.outboundTotalDuration;
|
|
6755
|
+
filters.duration.max =
|
|
6756
|
+
filters.duration.max > result1.outboundTotalDuration
|
|
6757
|
+
? filters.duration.max
|
|
6758
|
+
: result1.outboundTotalDuration;
|
|
6759
|
+
var departTime = moment__default['default'](result1.outboundFlights[0].dateTimeDeparting).get('hour');
|
|
6760
|
+
filters.departureTime.min =
|
|
6761
|
+
filters.departureTime.min < departTime
|
|
6762
|
+
? filters.departureTime.min
|
|
6763
|
+
: departTime;
|
|
6764
|
+
filters.departureTime.max =
|
|
6765
|
+
filters.departureTime.max > departTime
|
|
6766
|
+
? filters.departureTime.max
|
|
6767
|
+
: departTime;
|
|
6768
|
+
var arrivalTime = moment__default['default'](result1.outboundFlights[result1.outboundFlights.length - 1]
|
|
6769
|
+
.dateTimeArriving).get('hour');
|
|
6770
|
+
filters.arrivalTime.min =
|
|
6771
|
+
filters.arrivalTime.min < arrivalTime
|
|
6772
|
+
? filters.arrivalTime.min
|
|
6773
|
+
: arrivalTime;
|
|
6774
|
+
filters.arrivalTime.max =
|
|
6775
|
+
filters.arrivalTime.max > arrivalTime
|
|
6776
|
+
? filters.arrivalTime.max
|
|
6777
|
+
: arrivalTime;
|
|
6778
|
+
if (result1.inboundFlights && result1.outboundFlights.length > 0) {
|
|
6779
|
+
filters.returnDuration.min =
|
|
6780
|
+
filters.returnDuration.min < result1.inboundTotalDuration
|
|
6781
|
+
? filters.returnDuration.min
|
|
6782
|
+
: result1.inboundTotalDuration;
|
|
6783
|
+
filters.returnDuration.max =
|
|
6784
|
+
filters.returnDuration.max > result1.inboundTotalDuration
|
|
6785
|
+
? filters.returnDuration.max
|
|
6786
|
+
: result1.inboundTotalDuration;
|
|
6787
|
+
var departTimeReturn = moment__default['default'](result1.inboundFlights[0].dateTimeDeparting).get('hour');
|
|
6788
|
+
filters.returnDepartureTime.min =
|
|
6789
|
+
filters.returnDepartureTime.min < departTimeReturn
|
|
6790
|
+
? filters.returnDepartureTime.min
|
|
6791
|
+
: departTimeReturn;
|
|
6792
|
+
filters.returnDepartureTime.max =
|
|
6793
|
+
filters.returnDepartureTime.max > departTimeReturn
|
|
6794
|
+
? filters.returnDepartureTime.max
|
|
6795
|
+
: departTimeReturn;
|
|
6796
|
+
var arrivalTimeReturn = moment__default['default'](result1.outboundFlights[result1.outboundFlights.length - 1]
|
|
6797
|
+
.dateTimeArriving).get('hour');
|
|
6798
|
+
filters.returnArrivalTime.min =
|
|
6799
|
+
filters.returnArrivalTime.min < arrivalTimeReturn
|
|
6800
|
+
? filters.returnArrivalTime.min
|
|
6801
|
+
: arrivalTimeReturn;
|
|
6802
|
+
filters.returnArrivalTime.max =
|
|
6803
|
+
filters.returnArrivalTime.max > arrivalTimeReturn
|
|
6804
|
+
? filters.returnArrivalTime.max
|
|
6805
|
+
: arrivalTimeReturn;
|
|
6806
|
+
(result1.inboundFlights || []).forEach(updateFlightItems);
|
|
6807
|
+
indexedFlight(result1.inboundFlights, 'depatureReturnAirport', 'originAirport', 'originAirportName', 0);
|
|
6808
|
+
indexedFlight(result1.inboundFlights, 'arrivalReturnAirport', 'destinationAirport', 'destinationAirportName', result1.outboundFlights.length - 1);
|
|
6809
|
+
}
|
|
6810
|
+
return filters;
|
|
6811
|
+
}, this.clone(defaultFilters));
|
|
6812
|
+
};
|
|
6813
|
+
BaseHelperRoutines.prototype.mapOverObject = function (items, callback) {
|
|
6814
|
+
return Object.entries(items).reduce(function (accum, entries) {
|
|
6815
|
+
accum[entries[0]] = callback(entries[1], entries[0]);
|
|
6816
|
+
return accum;
|
|
6817
|
+
}, {});
|
|
6818
|
+
};
|
|
6635
6819
|
return BaseHelperRoutines;
|
|
6636
6820
|
}());
|
|
6637
6821
|
BaseHelperRoutines.READ_DATE_FORMAT = 'dd, D MMM YYYY';
|
|
@@ -6776,6 +6960,7 @@
|
|
|
6776
6960
|
_this._distance_list = [1, 2, 5, 10, 20, 25]; // copied from old frontend for now
|
|
6777
6961
|
_this._default_currency = null;
|
|
6778
6962
|
_this.resultsSessionName = HotelEnterpriseSearch.STORAGE_SESSION_RESULTS;
|
|
6963
|
+
_this.multiResultsSessionName = HotelEnterpriseSearch.STORAGE_SESSION_RESULTS;
|
|
6779
6964
|
_this.query = {};
|
|
6780
6965
|
_this.filterResults = function () {
|
|
6781
6966
|
_this.results.next(_this.fullResults.filter(function (hotel) {
|
|
@@ -7174,7 +7359,7 @@
|
|
|
7174
7359
|
this._isValid();
|
|
7175
7360
|
};
|
|
7176
7361
|
HotelEnterpriseSearch.prototype._isValid = function () {
|
|
7177
|
-
var _a, _b, _c, _d, _e;
|
|
7362
|
+
var _a, _b, _c, _d, _e, _f;
|
|
7178
7363
|
if (!this.doChecks) {
|
|
7179
7364
|
return;
|
|
7180
7365
|
}
|
|
@@ -7196,7 +7381,7 @@
|
|
|
7196
7381
|
}
|
|
7197
7382
|
break;
|
|
7198
7383
|
case exports.LocationTypes.Office:
|
|
7199
|
-
if (
|
|
7384
|
+
if (((_a = this.tempParams.location) === null || _a === void 0 ? void 0 : _a.type) !== 'Office' && !this.office) {
|
|
7200
7385
|
this.validationMessages.push('Please select an office.');
|
|
7201
7386
|
}
|
|
7202
7387
|
break;
|
|
@@ -7212,13 +7397,7 @@
|
|
|
7212
7397
|
}
|
|
7213
7398
|
break;
|
|
7214
7399
|
case exports.LocationTypes.TrainStation:
|
|
7215
|
-
if ((_d = this.tempParams) === null || _d === void 0 ? void 0 : _d.
|
|
7216
|
-
if (!((_e = this.tempParams.location.railstation) === null || _e === void 0 ? void 0 : _e.stationCode)) {
|
|
7217
|
-
this.validationMessages.push('Please select a train station.');
|
|
7218
|
-
}
|
|
7219
|
-
break;
|
|
7220
|
-
}
|
|
7221
|
-
else {
|
|
7400
|
+
if (!((_e = (_d = this.tempParams.location) === null || _d === void 0 ? void 0 : _d.railstation) === null || _e === void 0 ? void 0 : _e.stationCode) && !((_f = this.trainsStation) === null || _f === void 0 ? void 0 : _f.stationCode)) {
|
|
7222
7401
|
this.validationMessages.push('Please select a train station.');
|
|
7223
7402
|
}
|
|
7224
7403
|
break;
|
|
@@ -7270,18 +7449,21 @@
|
|
|
7270
7449
|
};
|
|
7271
7450
|
HotelEnterpriseSearch.prototype.getRecentSearchQuery = function (query) {
|
|
7272
7451
|
var _a;
|
|
7452
|
+
var recentSearchQuery = query;
|
|
7453
|
+
recentSearchQuery.location_type_select = this.location_type_select;
|
|
7273
7454
|
if ((_a = this.location) === null || _a === void 0 ? void 0 : _a.name) {
|
|
7274
|
-
|
|
7455
|
+
recentSearchQuery.cityName = this.location.name;
|
|
7275
7456
|
}
|
|
7276
7457
|
return {
|
|
7277
7458
|
serviceType: ServiceType.Hotel,
|
|
7278
|
-
searchArgs:
|
|
7459
|
+
searchArgs: recentSearchQuery,
|
|
7279
7460
|
travelDate: this.checkin_date.format(),
|
|
7280
7461
|
travellers: this.helpers.getTravellersId(this.travellers)
|
|
7281
7462
|
};
|
|
7282
7463
|
};
|
|
7283
7464
|
HotelEnterpriseSearch.prototype.startRecentSearch = function (recentSearch) {
|
|
7284
7465
|
var _this = this;
|
|
7466
|
+
this.location_type_select = recentSearch.searchArgs.location_type_select;
|
|
7285
7467
|
this.currency = recentSearch.searchArgs.currency;
|
|
7286
7468
|
this.distance = recentSearch.searchArgs.distance;
|
|
7287
7469
|
this.no_of_rooms = recentSearch.searchArgs.rooms;
|
|
@@ -7289,72 +7471,68 @@
|
|
|
7289
7471
|
this.checkout_date = moment__default['default'](recentSearch.searchArgs.endDate);
|
|
7290
7472
|
this.hotel_name = recentSearch.searchArgs.hotelName;
|
|
7291
7473
|
if (recentSearch.searchArgs.groupName) {
|
|
7292
|
-
this.hotel_chain = {
|
|
7293
|
-
name: recentSearch.searchArgs.groupName
|
|
7294
|
-
};
|
|
7295
|
-
}
|
|
7296
|
-
// get location_type_select
|
|
7297
|
-
if (recentSearch.searchArgs.iata) {
|
|
7298
|
-
this.location_type_select = exports.LocationTypes.Airport;
|
|
7299
|
-
this.searchService.getAirportByCode(recentSearch.searchArgs.iata).subscribe(function (iata) {
|
|
7300
|
-
var airport = {
|
|
7301
|
-
airport: {
|
|
7302
|
-
gateway: iata.iataMatch.iata
|
|
7303
|
-
}
|
|
7304
|
-
};
|
|
7305
|
-
_this.location = Object.assign(Object.assign({}, airport), iata.iataMatch);
|
|
7306
|
-
_this.searchService.startSearches();
|
|
7307
|
-
});
|
|
7308
|
-
}
|
|
7309
|
-
else if ((recentSearch.searchArgs.latitude && recentSearch.searchArgs.longitude) || recentSearch.searchArgs.postOrZipCode) {
|
|
7310
|
-
this.location_type_select = exports.LocationTypes.City;
|
|
7311
|
-
this.country = {
|
|
7312
|
-
cCode: recentSearch.searchArgs.countryCode,
|
|
7313
|
-
cName: ''
|
|
7314
|
-
};
|
|
7315
|
-
// should be one search metod for the city search: location or postcode
|
|
7316
|
-
if (recentSearch.searchArgs.latitude && recentSearch.searchArgs.longitude) {
|
|
7317
|
-
this.location = {
|
|
7318
|
-
name: recentSearch.searchArgs.cityName,
|
|
7319
|
-
latitude: recentSearch.searchArgs.latitude,
|
|
7320
|
-
longitude: recentSearch.searchArgs.longitude
|
|
7321
|
-
};
|
|
7322
|
-
}
|
|
7323
|
-
else if (recentSearch.searchArgs.postOrZipCode) {
|
|
7324
|
-
this.postcode = {
|
|
7325
|
-
name: recentSearch.searchArgs.postOrZipCode,
|
|
7326
|
-
type: exports.LocationTypes.Postcode
|
|
7327
|
-
};
|
|
7328
|
-
}
|
|
7329
|
-
this.searchService.startSearches();
|
|
7474
|
+
this.hotel_chain = {
|
|
7475
|
+
name: recentSearch.searchArgs.groupName
|
|
7476
|
+
};
|
|
7330
7477
|
}
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
var
|
|
7478
|
+
// get location_type_select
|
|
7479
|
+
switch (this.location_type_select) {
|
|
7480
|
+
case exports.LocationTypes.Airport:
|
|
7481
|
+
this.searchService.getAirportByCode(recentSearch.searchArgs.iata).subscribe(function (iata) {
|
|
7482
|
+
var airport = {
|
|
7483
|
+
airport: {
|
|
7484
|
+
gateway: iata.iataMatch.iata
|
|
7485
|
+
}
|
|
7486
|
+
};
|
|
7487
|
+
_this.location = Object.assign(Object.assign({}, airport), iata.iataMatch);
|
|
7488
|
+
_this.searchService.startSearches();
|
|
7489
|
+
});
|
|
7490
|
+
break;
|
|
7491
|
+
case exports.LocationTypes.City:
|
|
7492
|
+
this.country = {
|
|
7493
|
+
cCode: recentSearch.searchArgs.countryCode,
|
|
7494
|
+
cName: ''
|
|
7495
|
+
};
|
|
7496
|
+
// should be one search metod for the city search: location or postcode
|
|
7497
|
+
if (recentSearch.searchArgs.latitude && recentSearch.searchArgs.longitude) {
|
|
7498
|
+
this.location = {
|
|
7499
|
+
name: recentSearch.searchArgs.cityName,
|
|
7500
|
+
latitude: recentSearch.searchArgs.latitude,
|
|
7501
|
+
longitude: recentSearch.searchArgs.longitude
|
|
7502
|
+
};
|
|
7503
|
+
}
|
|
7504
|
+
else if (recentSearch.searchArgs.postOrZipCode) {
|
|
7505
|
+
this.postcode = {
|
|
7506
|
+
name: recentSearch.searchArgs.postOrZipCode,
|
|
7507
|
+
type: exports.LocationTypes.Postcode
|
|
7508
|
+
};
|
|
7509
|
+
}
|
|
7510
|
+
this.searchService.startSearches();
|
|
7511
|
+
break;
|
|
7512
|
+
case exports.LocationTypes.Office:
|
|
7513
|
+
this.searchService.getOffice(recentSearch.searchArgs.officeId).pipe(operators.take(1)).subscribe(function (office) {
|
|
7336
7514
|
_this.office = {
|
|
7337
|
-
id:
|
|
7515
|
+
id: office.id,
|
|
7338
7516
|
name: office.name
|
|
7339
7517
|
};
|
|
7340
7518
|
_this.searchService.startSearches();
|
|
7341
|
-
}
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
|
|
7519
|
+
});
|
|
7520
|
+
break;
|
|
7521
|
+
case exports.LocationTypes.TrainStation:
|
|
7522
|
+
this.getRailStationByCode(recentSearch.searchArgs.trainStationCode).subscribe(function (trainsStation) {
|
|
7523
|
+
_this.trainsStation = trainsStation;
|
|
7524
|
+
_this.searchService.startSearches();
|
|
7525
|
+
});
|
|
7526
|
+
break;
|
|
7527
|
+
case exports.LocationTypes.Shortlist:
|
|
7528
|
+
this.country = {
|
|
7529
|
+
cCode: recentSearch.searchArgs.countryCode,
|
|
7530
|
+
cName: ''
|
|
7531
|
+
};
|
|
7532
|
+
this.searchService.startSearches();
|
|
7533
|
+
break;
|
|
7534
|
+
default:
|
|
7535
|
+
break;
|
|
7358
7536
|
}
|
|
7359
7537
|
};
|
|
7360
7538
|
HotelEnterpriseSearch.prototype.getRailStationByCode = function (code) {
|
|
@@ -7370,7 +7548,7 @@
|
|
|
7370
7548
|
return this.helpers.removeNulls(this.query);
|
|
7371
7549
|
};
|
|
7372
7550
|
HotelEnterpriseSearch.prototype.buildQuery = function () {
|
|
7373
|
-
var _a, _b;
|
|
7551
|
+
var _a, _b, _c, _d, _e, _f;
|
|
7374
7552
|
var query = {
|
|
7375
7553
|
startDate: this.tempParams.checkin_date.format('YYYY-MM-DD'),
|
|
7376
7554
|
endDate: this.tempParams.checkout_date.format('YYYY-MM-DD'),
|
|
@@ -7399,10 +7577,20 @@
|
|
|
7399
7577
|
}
|
|
7400
7578
|
break;
|
|
7401
7579
|
case exports.LocationTypes.TrainStation:
|
|
7402
|
-
|
|
7580
|
+
if ((_b = (_a = this.location) === null || _a === void 0 ? void 0 : _a.railstation) === null || _b === void 0 ? void 0 : _b.stationCode) {
|
|
7581
|
+
query.trainStationCode = this.location.railstation.stationCode;
|
|
7582
|
+
}
|
|
7583
|
+
else if ((_c = this.trainsStation) === null || _c === void 0 ? void 0 : _c.stationCode) {
|
|
7584
|
+
query.trainStationCode = this.trainsStation.stationCode;
|
|
7585
|
+
}
|
|
7403
7586
|
break;
|
|
7404
7587
|
case exports.LocationTypes.Office: // Needs to fix in next PR
|
|
7405
|
-
|
|
7588
|
+
if ((_d = this.location) === null || _d === void 0 ? void 0 : _d.id) {
|
|
7589
|
+
query.officeId = +this.location.id;
|
|
7590
|
+
}
|
|
7591
|
+
else if ((_e = this.office) === null || _e === void 0 ? void 0 : _e.id) {
|
|
7592
|
+
query.officeId = +this.office.id;
|
|
7593
|
+
}
|
|
7406
7594
|
break;
|
|
7407
7595
|
case exports.LocationTypes.Shortlist:
|
|
7408
7596
|
query.countryCode = this.country.cCode;
|
|
@@ -7414,7 +7602,7 @@
|
|
|
7414
7602
|
}
|
|
7415
7603
|
// add chain or group name int he query
|
|
7416
7604
|
if (this.hotel_chain) {
|
|
7417
|
-
query.groupName = (
|
|
7605
|
+
query.groupName = (_f = this.tempParams.hotel_chain) === null || _f === void 0 ? void 0 : _f.name;
|
|
7418
7606
|
}
|
|
7419
7607
|
this.query = query;
|
|
7420
7608
|
};
|
|
@@ -7772,8 +7960,8 @@
|
|
|
7772
7960
|
HotelEnterpriseSearch.prototype.addHotelRoomToBasket = function (hotel, hotelRoom, hotelQuery, travellers) {
|
|
7773
7961
|
return __awaiter(this, void 0, void 0, function () {
|
|
7774
7962
|
var searchQuery, intBasket, basket, hotelAaddress, rateDescription, roomDescription, roomId, roomType;
|
|
7775
|
-
return __generator(this, function (
|
|
7776
|
-
switch (
|
|
7963
|
+
return __generator(this, function (_g) {
|
|
7964
|
+
switch (_g.label) {
|
|
7777
7965
|
case 0:
|
|
7778
7966
|
if (hotel.unavailable) {
|
|
7779
7967
|
return [2 /*return*/, Promise.resolve(false)];
|
|
@@ -7785,7 +7973,7 @@
|
|
|
7785
7973
|
delete searchQuery.adults;
|
|
7786
7974
|
return [4 /*yield*/, this.basketService.getDefaultBasket()];
|
|
7787
7975
|
case 1:
|
|
7788
|
-
intBasket =
|
|
7976
|
+
intBasket = _g.sent();
|
|
7789
7977
|
basket = intBasket === null || intBasket === void 0 ? void 0 : intBasket.subject.value;
|
|
7790
7978
|
if (basket) {
|
|
7791
7979
|
hotelAaddress = hotel.address;
|
|
@@ -7850,6 +8038,7 @@
|
|
|
7850
8038
|
_this._date = null;
|
|
7851
8039
|
_this._time = null;
|
|
7852
8040
|
_this.resultsSessionName = LoungesEnterpriseSearch.STORAGE_SESSION_RESULTS;
|
|
8041
|
+
_this.multiResultsSessionName = LoungesEnterpriseSearch.STORAGE_SESSION_RESULTS;
|
|
7853
8042
|
var data = storageService.getSessionItem(LoungesEnterpriseSearch.STORAGE_SESSION_PARAMS) || {
|
|
7854
8043
|
tempParams: {}
|
|
7855
8044
|
};
|
|
@@ -8238,6 +8427,7 @@
|
|
|
8238
8427
|
day: moment__default['default']().date() + 1 // min 1 night stay
|
|
8239
8428
|
};
|
|
8240
8429
|
_this.resultsSessionName = ParkingEnterpriseSearch.STORAGE_SESSION_RESULTS;
|
|
8430
|
+
_this.multiResultsSessionName = ParkingEnterpriseSearch.STORAGE_SESSION_RESULTS;
|
|
8241
8431
|
_this._outdate = null;
|
|
8242
8432
|
_this._outtime = null;
|
|
8243
8433
|
_this._indate = null;
|
|
@@ -8569,7 +8759,9 @@
|
|
|
8569
8759
|
this.departDatetime = moment__default['default'](recentSearch.searchArgs.departDatetime);
|
|
8570
8760
|
this.outFlightNumber = recentSearch.searchArgs.outFlightNumber;
|
|
8571
8761
|
this.terminal = recentSearch.searchArgs.terminal;
|
|
8572
|
-
this.searchService
|
|
8762
|
+
this.searchService
|
|
8763
|
+
.getAirportByCode(recentSearch.searchArgs.locationCode)
|
|
8764
|
+
.subscribe(function (airport) {
|
|
8573
8765
|
var _a, _b, _c, _d, _e, _f;
|
|
8574
8766
|
if (airport) {
|
|
8575
8767
|
_this.locationCode = {
|
|
@@ -8578,7 +8770,7 @@
|
|
|
8578
8770
|
destination: airport.iataMatch.name,
|
|
8579
8771
|
gateway: airport.iataMatch.iata,
|
|
8580
8772
|
postcode: (_f = (_e = airport.iataMatch) === null || _e === void 0 ? void 0 : _e.locationDetails) === null || _f === void 0 ? void 0 : _f.postcode,
|
|
8581
|
-
terminals: _this.searchService.processTerminals(airport.iataMatch.terminals)
|
|
8773
|
+
terminals: _this.searchService.processTerminals(airport.iataMatch.terminals)
|
|
8582
8774
|
};
|
|
8583
8775
|
_this.searchService.startSearches();
|
|
8584
8776
|
}
|
|
@@ -8678,9 +8870,52 @@
|
|
|
8678
8870
|
EurostarSearchType["oneWay"] = "oneWay";
|
|
8679
8871
|
})(exports.EurostarSearchType || (exports.EurostarSearchType = {}));
|
|
8680
8872
|
|
|
8873
|
+
var DEFAULT_FILTERS = Object.freeze({
|
|
8874
|
+
stops: {},
|
|
8875
|
+
mustInclude: {},
|
|
8876
|
+
classes: {},
|
|
8877
|
+
airlines: {},
|
|
8878
|
+
travelPolicy: {},
|
|
8879
|
+
depatureAirport: {},
|
|
8880
|
+
depatureReturnAirport: {},
|
|
8881
|
+
arrivalAirport: {},
|
|
8882
|
+
arrivalReturnAirport: {},
|
|
8883
|
+
baggage: {},
|
|
8884
|
+
fareTypes: {},
|
|
8885
|
+
price: {
|
|
8886
|
+
min: Number.MAX_SAFE_INTEGER,
|
|
8887
|
+
max: Number.MIN_SAFE_INTEGER
|
|
8888
|
+
},
|
|
8889
|
+
duration: {
|
|
8890
|
+
min: Number.MAX_SAFE_INTEGER,
|
|
8891
|
+
max: Number.MIN_SAFE_INTEGER
|
|
8892
|
+
},
|
|
8893
|
+
returnDuration: {
|
|
8894
|
+
min: Number.MAX_SAFE_INTEGER,
|
|
8895
|
+
max: Number.MIN_SAFE_INTEGER
|
|
8896
|
+
},
|
|
8897
|
+
departureTime: {
|
|
8898
|
+
min: 0,
|
|
8899
|
+
max: 2359
|
|
8900
|
+
},
|
|
8901
|
+
arrivalTime: {
|
|
8902
|
+
min: 0,
|
|
8903
|
+
max: 2359
|
|
8904
|
+
},
|
|
8905
|
+
returnDepartureTime: {
|
|
8906
|
+
min: 0,
|
|
8907
|
+
max: 2359
|
|
8908
|
+
},
|
|
8909
|
+
returnArrivalTime: {
|
|
8910
|
+
min: 0,
|
|
8911
|
+
max: 2359
|
|
8912
|
+
},
|
|
8913
|
+
flightNumber: ''
|
|
8914
|
+
});
|
|
8681
8915
|
(function (SortTypesEurostar) {
|
|
8682
8916
|
SortTypesEurostar["CheapestFirst"] = "C";
|
|
8683
8917
|
SortTypesEurostar["EarliestFirst"] = "E";
|
|
8918
|
+
SortTypesEurostar["LatestFirst"] = "L";
|
|
8684
8919
|
})(exports.SortTypesEurostar || (exports.SortTypesEurostar = {}));
|
|
8685
8920
|
(function (SortMethod) {
|
|
8686
8921
|
SortMethod["sortByPrice"] = "sortByPrice";
|
|
@@ -8692,6 +8927,7 @@
|
|
|
8692
8927
|
var _this = _super.call(this, storageService, function (results1) {
|
|
8693
8928
|
_this.resultQuery = _this.getSearchQuery();
|
|
8694
8929
|
delete _this.resultQuery.withGrouped;
|
|
8930
|
+
_this.filters.next(_this.helpers.createFlightFilters(results1.journeys, DEFAULT_FILTERS));
|
|
8695
8931
|
if (results1 && _this.searchService.isFlightsGrouped()) {
|
|
8696
8932
|
var returndata = (results1.journeys || []).reduce(function (acc, result) {
|
|
8697
8933
|
if (result.outboundFlights.length) {
|
|
@@ -8748,6 +8984,13 @@
|
|
|
8748
8984
|
icon: 'ico-calendar',
|
|
8749
8985
|
dir: true,
|
|
8750
8986
|
code: exports.SortTypesEurostar.EarliestFirst
|
|
8987
|
+
},
|
|
8988
|
+
{
|
|
8989
|
+
title: 'Time (Descending)',
|
|
8990
|
+
method: exports.SortMethod.sortByDate,
|
|
8991
|
+
icon: 'ico-calendar',
|
|
8992
|
+
dir: true,
|
|
8993
|
+
code: exports.SortTypesEurostar.LatestFirst
|
|
8751
8994
|
}
|
|
8752
8995
|
];
|
|
8753
8996
|
_this._fareTypeArray = [
|
|
@@ -8771,13 +9014,15 @@
|
|
|
8771
9014
|
};
|
|
8772
9015
|
_this.searchTypes = [
|
|
8773
9016
|
{ value: exports.EurostarSearchType.return, display: 'Return' },
|
|
8774
|
-
{ value: exports.EurostarSearchType.oneWay, display: 'One-way' }
|
|
9017
|
+
{ value: exports.EurostarSearchType.oneWay, display: 'One-way' }
|
|
8775
9018
|
];
|
|
8776
9019
|
_this.flightsToGroup = {};
|
|
8777
9020
|
_this.grouped = null;
|
|
8778
9021
|
_this.travellers = null;
|
|
8779
9022
|
_this.resultsSessionName = EurostarEnterpriseSearch.STORAGE_SESSION_RESULTS;
|
|
9023
|
+
_this.multiResultsSessionName = EurostarEnterpriseSearch.STORAGE_SESSION_RESULTS;
|
|
8780
9024
|
_this._displayAddHotel = false;
|
|
9025
|
+
_this.filters = new rxjs.BehaviorSubject(DEFAULT_FILTERS);
|
|
8781
9026
|
_this._multiDestination = [];
|
|
8782
9027
|
_this.minToHour = function (dur) { return Math.floor(dur / 60) + "h " + dur % 60 + "m"; };
|
|
8783
9028
|
var data = storageService.getSessionItem(EurostarEnterpriseSearch.STORAGE_SESSION_PARAMS) || {
|
|
@@ -8818,6 +9063,10 @@
|
|
|
8818
9063
|
_this.fullResults = _this.helpers.clone(results.results);
|
|
8819
9064
|
_this.flightsToGroup = results.groupData || {};
|
|
8820
9065
|
_this.resultQuery = results.query;
|
|
9066
|
+
var isFlightsGrouped = _this.searchService.isFlightsGrouped();
|
|
9067
|
+
if (!isFlightsGrouped) {
|
|
9068
|
+
_this._cheapestResultPrice = _this.updateLowestPrice(results.results);
|
|
9069
|
+
}
|
|
8821
9070
|
_this.results.next(results.results || []);
|
|
8822
9071
|
_this._isValid();
|
|
8823
9072
|
_this.negotiated =
|
|
@@ -9344,13 +9593,104 @@
|
|
|
9344
9593
|
tempParams: this.tempParams,
|
|
9345
9594
|
originalUserSearch: this.originalUserSearch
|
|
9346
9595
|
});
|
|
9596
|
+
var query = this.getSearchQuery();
|
|
9597
|
+
this.searchService.saveRecentSearch(this.getRecentSearchQuery(query));
|
|
9347
9598
|
return this._startSearch(this.eurostarFetcher.fetchList(this.getSearchQuery()));
|
|
9348
9599
|
}
|
|
9349
9600
|
else {
|
|
9350
9601
|
return Promise.resolve(false);
|
|
9351
9602
|
}
|
|
9352
9603
|
};
|
|
9353
|
-
EurostarEnterpriseSearch.prototype.
|
|
9604
|
+
EurostarEnterpriseSearch.prototype.getRecentSearchQuery = function (query) {
|
|
9605
|
+
return {
|
|
9606
|
+
serviceType: ServiceType.Eurostar,
|
|
9607
|
+
searchArgs: query,
|
|
9608
|
+
travelDate: this.outBoundDate.format(),
|
|
9609
|
+
travellers: this.helpers.getTravellersId(this.travellers)
|
|
9610
|
+
};
|
|
9611
|
+
};
|
|
9612
|
+
EurostarEnterpriseSearch.prototype.startRecentSearch = function (recentSearch) {
|
|
9613
|
+
var _this = this;
|
|
9614
|
+
if (recentSearch.searchArgs.outboundDate) {
|
|
9615
|
+
this.outBoundDate = this.convertRecentSearchDateTime(recentSearch.searchArgs.outboundDate, recentSearch.searchArgs.outboundDepartureTimeWindow);
|
|
9616
|
+
}
|
|
9617
|
+
if (recentSearch.searchArgs.returnDate) {
|
|
9618
|
+
this.inboundDate = this.convertRecentSearchDateTime(recentSearch.searchArgs.returnDate, recentSearch.searchArgs.returnDepartureTimeWindow);
|
|
9619
|
+
}
|
|
9620
|
+
this.fareType = recentSearch.searchArgs.fareType;
|
|
9621
|
+
this.maxConnections = recentSearch.searchArgs.maxConnections;
|
|
9622
|
+
if (recentSearch.searchArgs.outboundCabinClass) {
|
|
9623
|
+
this.cabinClass = recentSearch.searchArgs.outboundCabinClass[0];
|
|
9624
|
+
}
|
|
9625
|
+
if (recentSearch.searchArgs.returnCabinClass) {
|
|
9626
|
+
this.returnCabinClass = recentSearch.searchArgs.returnCabinClass[0];
|
|
9627
|
+
}
|
|
9628
|
+
this.includeNearbyAirports = recentSearch.searchArgs.includeNearbyAirports;
|
|
9629
|
+
this.chosenSearchType = recentSearch.searchArgs.returnTrip
|
|
9630
|
+
? exports.EurostarSearchType.return
|
|
9631
|
+
: exports.EurostarSearchType.oneWay;
|
|
9632
|
+
if (recentSearch.searchArgs.outboundDepartureTimeWindow) {
|
|
9633
|
+
this.outTimeCriteria = exports.TimeWindow.Depart;
|
|
9634
|
+
}
|
|
9635
|
+
else if (recentSearch.searchArgs.outboundArrivalTimeWindow) {
|
|
9636
|
+
this.outTimeCriteria = exports.TimeWindow.Arrive;
|
|
9637
|
+
}
|
|
9638
|
+
else {
|
|
9639
|
+
this.outTimeCriteria = exports.TimeWindow.Anytime;
|
|
9640
|
+
}
|
|
9641
|
+
if (recentSearch.searchArgs.returnDepartureTimeWindow) {
|
|
9642
|
+
this.inTimeCriteria = exports.TimeWindow.Depart;
|
|
9643
|
+
}
|
|
9644
|
+
else if (recentSearch.searchArgs.returnArrivalTimeWindow) {
|
|
9645
|
+
this.inTimeCriteria = exports.TimeWindow.Arrive;
|
|
9646
|
+
}
|
|
9647
|
+
else {
|
|
9648
|
+
this.inTimeCriteria = exports.TimeWindow.Anytime;
|
|
9649
|
+
}
|
|
9650
|
+
rxjs.combineLatest([
|
|
9651
|
+
this.searchService.getAirportByCode(recentSearch.searchArgs.originAirport),
|
|
9652
|
+
this.searchService.getAirportByCode(recentSearch.searchArgs.destinationAirport)
|
|
9653
|
+
]).subscribe(function (_o) {
|
|
9654
|
+
var _p = __read(_o, 2), departLocation = _p[0], arriveLocation = _p[1];
|
|
9655
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
9656
|
+
if (departLocation && arriveLocation) {
|
|
9657
|
+
_this.departLocation = {
|
|
9658
|
+
destination: departLocation.iataMatch.name,
|
|
9659
|
+
gateway: departLocation.iataMatch.iata,
|
|
9660
|
+
terminals: _this.searchService.processTerminals(departLocation.iataMatch.terminals),
|
|
9661
|
+
country: (_b = (_a = departLocation.iataMatch) === null || _a === void 0 ? void 0 : _a.locationDetails) === null || _b === void 0 ? void 0 : _b.country,
|
|
9662
|
+
postcode: (_d = (_c = departLocation.iataMatch) === null || _c === void 0 ? void 0 : _c.locationDetails) === null || _d === void 0 ? void 0 : _d.postcode,
|
|
9663
|
+
countryCode: (_f = (_e = departLocation.iataMatch) === null || _e === void 0 ? void 0 : _e.locationDetails) === null || _f === void 0 ? void 0 : _f.countryCode
|
|
9664
|
+
};
|
|
9665
|
+
_this.arriveLocation = {
|
|
9666
|
+
destination: arriveLocation.iataMatch.name,
|
|
9667
|
+
gateway: arriveLocation.iataMatch.iata,
|
|
9668
|
+
terminals: _this.searchService.processTerminals(arriveLocation.iataMatch.terminals),
|
|
9669
|
+
country: (_h = (_g = arriveLocation.iataMatch) === null || _g === void 0 ? void 0 : _g.locationDetails) === null || _h === void 0 ? void 0 : _h.country,
|
|
9670
|
+
postcode: (_k = (_j = arriveLocation.iataMatch) === null || _j === void 0 ? void 0 : _j.locationDetails) === null || _k === void 0 ? void 0 : _k.postcode,
|
|
9671
|
+
countryCode: (_m = (_l = arriveLocation.iataMatch) === null || _l === void 0 ? void 0 : _l.locationDetails) === null || _m === void 0 ? void 0 : _m.countryCode
|
|
9672
|
+
};
|
|
9673
|
+
if (recentSearch.searchArgs.preferredCarriers) {
|
|
9674
|
+
var preferredCarriers_1 = [];
|
|
9675
|
+
recentSearch.searchArgs.preferredCarriers.map(function (preferredCarry) {
|
|
9676
|
+
_this.searchService
|
|
9677
|
+
.getAirlinesList(preferredCarry)
|
|
9678
|
+
.subscribe(function (items) {
|
|
9679
|
+
items.map(function (item) {
|
|
9680
|
+
if (item.code === preferredCarry) {
|
|
9681
|
+
preferredCarriers_1.push(item);
|
|
9682
|
+
}
|
|
9683
|
+
});
|
|
9684
|
+
_this.preferredCarriers = preferredCarriers_1;
|
|
9685
|
+
_this.searchService.startSearches();
|
|
9686
|
+
});
|
|
9687
|
+
});
|
|
9688
|
+
}
|
|
9689
|
+
_this.searchService.startSearches();
|
|
9690
|
+
}
|
|
9691
|
+
});
|
|
9692
|
+
this.searchService.startSearches();
|
|
9693
|
+
};
|
|
9354
9694
|
EurostarEnterpriseSearch.prototype.makeDepartureTimeWindow = function (dateTime, window) {
|
|
9355
9695
|
return window === exports.TimeWindow.Depart
|
|
9356
9696
|
? this.helpers.makeTimeWindow(dateTime, -2, 2)
|
|
@@ -9362,6 +9702,17 @@
|
|
|
9362
9702
|
}
|
|
9363
9703
|
return this.helpers.makeTimeWindow(dateTime, -2, 2);
|
|
9364
9704
|
};
|
|
9705
|
+
EurostarEnterpriseSearch.prototype.convertRecentSearchDateTime = function (date, timeWindow) {
|
|
9706
|
+
if (timeWindow) {
|
|
9707
|
+
var flightTime = timeWindow.split('-');
|
|
9708
|
+
var timeAndDate = moment__default['default'](date).add(moment__default['default'].duration(this.helpers.hhmmToTime(flightTime[0])));
|
|
9709
|
+
// add 2 hour
|
|
9710
|
+
return timeAndDate.clone().add(2, 'hour');
|
|
9711
|
+
}
|
|
9712
|
+
else {
|
|
9713
|
+
return moment__default['default'](date);
|
|
9714
|
+
}
|
|
9715
|
+
};
|
|
9365
9716
|
EurostarEnterpriseSearch.prototype.getSearchQuery = function () {
|
|
9366
9717
|
return this.helpers.removeNulls(Object.assign({}, {
|
|
9367
9718
|
originAirport: this._originAirport,
|
|
@@ -9443,6 +9794,53 @@
|
|
|
9443
9794
|
}
|
|
9444
9795
|
this.results.next(results);
|
|
9445
9796
|
};
|
|
9797
|
+
EurostarEnterpriseSearch.prototype.sortResultsFlightJourneys = function (sortMethodValue, inbound, givenResults) {
|
|
9798
|
+
if (inbound === void 0) { inbound = false; }
|
|
9799
|
+
var results = this.helpers.clone(givenResults);
|
|
9800
|
+
switch (sortMethodValue) {
|
|
9801
|
+
case exports.SortTypesEurostar.CheapestFirst:
|
|
9802
|
+
results = this.sortByPriceFlight(results);
|
|
9803
|
+
break;
|
|
9804
|
+
case exports.SortTypesEurostar.EarliestFirst:
|
|
9805
|
+
results = this.sortByDateFlight(results, inbound);
|
|
9806
|
+
break;
|
|
9807
|
+
case exports.SortTypesEurostar.LatestFirst:
|
|
9808
|
+
results = this.sortByDateFlightDecending(results, inbound);
|
|
9809
|
+
break;
|
|
9810
|
+
default:
|
|
9811
|
+
console.error("+++ Unknown sorting method: " + sortMethodValue + " +++");
|
|
9812
|
+
}
|
|
9813
|
+
return results;
|
|
9814
|
+
};
|
|
9815
|
+
EurostarEnterpriseSearch.prototype.sortByPriceFlight = function (results) {
|
|
9816
|
+
return results.sort(function (a, b) {
|
|
9817
|
+
return Number(a.total.price) - Number(b.total.price);
|
|
9818
|
+
});
|
|
9819
|
+
};
|
|
9820
|
+
EurostarEnterpriseSearch.prototype.sortByDateFlight = function (results, inbound) {
|
|
9821
|
+
return results.sort(function (a, b) {
|
|
9822
|
+
if (inbound) {
|
|
9823
|
+
return (moment__default['default'](a.inboundFlights[0].dateTimeDeparting).unix() -
|
|
9824
|
+
moment__default['default'](b.inboundFlights[0].dateTimeDeparting).unix());
|
|
9825
|
+
}
|
|
9826
|
+
else {
|
|
9827
|
+
return (moment__default['default'](a.outboundFlights[0].dateTimeDeparting).unix() -
|
|
9828
|
+
moment__default['default'](b.outboundFlights[0].dateTimeDeparting).unix());
|
|
9829
|
+
}
|
|
9830
|
+
});
|
|
9831
|
+
};
|
|
9832
|
+
EurostarEnterpriseSearch.prototype.sortByDateFlightDecending = function (results, inbound) {
|
|
9833
|
+
return results.sort(function (a, b) {
|
|
9834
|
+
if (inbound) {
|
|
9835
|
+
return (moment__default['default'](b.inboundFlights[0].dateTimeDeparting).unix() -
|
|
9836
|
+
moment__default['default'](a.inboundFlights[0].dateTimeDeparting).unix());
|
|
9837
|
+
}
|
|
9838
|
+
else {
|
|
9839
|
+
return (moment__default['default'](b.outboundFlights[0].dateTimeDeparting).unix() -
|
|
9840
|
+
moment__default['default'](a.outboundFlights[0].dateTimeDeparting).unix());
|
|
9841
|
+
}
|
|
9842
|
+
});
|
|
9843
|
+
};
|
|
9446
9844
|
/**
|
|
9447
9845
|
* Sort results by departure time
|
|
9448
9846
|
*
|
|
@@ -9531,6 +9929,47 @@
|
|
|
9531
9929
|
}
|
|
9532
9930
|
return num.toString().padStart(2, '0');
|
|
9533
9931
|
};
|
|
9932
|
+
/**
|
|
9933
|
+
* @description - apply all filters to results
|
|
9934
|
+
* @param filters
|
|
9935
|
+
* @param inbound
|
|
9936
|
+
* @param results
|
|
9937
|
+
* @returns
|
|
9938
|
+
*/
|
|
9939
|
+
EurostarEnterpriseSearch.prototype.applyFilters = function (filters, inbound) {
|
|
9940
|
+
if (inbound === void 0) { inbound = false; }
|
|
9941
|
+
// let newResults = this.helpers.clone(results);
|
|
9942
|
+
// if (inbound) {
|
|
9943
|
+
// newResults = this.filterByReturnDepartureTime(
|
|
9944
|
+
// filters.minReturnDepartureTime,
|
|
9945
|
+
// filters.maxReturnDepartureTime,
|
|
9946
|
+
// newResults
|
|
9947
|
+
// );
|
|
9948
|
+
// newResults = this.filterByReturnArrivalTime(
|
|
9949
|
+
// filters.minReturnArrivalTime,
|
|
9950
|
+
// filters.maxReturnArrivalTime,
|
|
9951
|
+
// newResults
|
|
9952
|
+
// );
|
|
9953
|
+
// }
|
|
9954
|
+
// // Global (apply to both inbound and outbound results) filters
|
|
9955
|
+
// newResults = this.filterByDepartureTime(
|
|
9956
|
+
// filters.minDepartureTime,
|
|
9957
|
+
// filters.maxDepartureTime,
|
|
9958
|
+
// newResults
|
|
9959
|
+
// );
|
|
9960
|
+
// newResults = this.filterByArrivalTime(
|
|
9961
|
+
// filters.minArrivalTime,
|
|
9962
|
+
// filters.maxArrivalTime,
|
|
9963
|
+
// newResults
|
|
9964
|
+
// );
|
|
9965
|
+
// newResults = this.filterResultsByStops(filters.stops, newResults);
|
|
9966
|
+
// newResults = this.filterByPrice(
|
|
9967
|
+
// filters.minPrice,
|
|
9968
|
+
// filters.maxPrice,
|
|
9969
|
+
// newResults
|
|
9970
|
+
// );
|
|
9971
|
+
// return newResults;
|
|
9972
|
+
};
|
|
9534
9973
|
EurostarEnterpriseSearch.prototype.filterByDuration = function (minDuration, maxDuration, results, isReturn) {
|
|
9535
9974
|
if (isReturn === void 0) { isReturn = false; }
|
|
9536
9975
|
results = results.filter(function (result) {
|
|
@@ -9720,40 +10159,6 @@
|
|
|
9720
10159
|
}
|
|
9721
10160
|
return results;
|
|
9722
10161
|
};
|
|
9723
|
-
EurostarEnterpriseSearch.prototype.createFilters = function (results) {
|
|
9724
|
-
if (results === void 0) { results = []; }
|
|
9725
|
-
var minPrice = this.getMinPrice(results);
|
|
9726
|
-
var maxPrice = this.getMaxPrice(results);
|
|
9727
|
-
var newFilters = {
|
|
9728
|
-
stops: this.getAllStops(results),
|
|
9729
|
-
mustInclude: [],
|
|
9730
|
-
classes: this.getAllClasses(results),
|
|
9731
|
-
airlines: this.getAllAirlines(results),
|
|
9732
|
-
travelPolicy: [],
|
|
9733
|
-
depatureAirport: this.getAllDepartureAirports(results),
|
|
9734
|
-
arrivalAirport: this.getAllArrivalAirports(results),
|
|
9735
|
-
minPrice: minPrice,
|
|
9736
|
-
maxPrice: maxPrice,
|
|
9737
|
-
depatureReturnAirport: this.getAllDepartureAirports(results, true),
|
|
9738
|
-
arrivalReturnAirport: this.getAllArrivalAirports(results, true),
|
|
9739
|
-
baggage: this.getBaggage(results),
|
|
9740
|
-
fareTypes: [],
|
|
9741
|
-
minDuration: this.getMinDuration(results),
|
|
9742
|
-
maxDuration: this.getMaxDuration(results),
|
|
9743
|
-
minReturnDuration: this.getMinDuration(results, true),
|
|
9744
|
-
maxReturnDuration: this.getMaxDuration(results, true),
|
|
9745
|
-
minDepartureTime: this.getMinDepartureTime(results),
|
|
9746
|
-
maxDepartureTime: this.getMaxDepartureTime(results),
|
|
9747
|
-
minArrivalTime: this.getMinArrivalTime(results),
|
|
9748
|
-
maxArrivalTime: this.getMaxArrivalTime(results),
|
|
9749
|
-
minReturnDepartureTime: this.getMinReturnDepartureTime(results),
|
|
9750
|
-
maxReturnDepartureTime: this.getMaxReturnDepartureTime(results),
|
|
9751
|
-
maxReturnArrivalTime: this.getMaxReturnArrivalTime(results),
|
|
9752
|
-
minReturnArrivalTime: this.getMinReturnArrivalTime(results),
|
|
9753
|
-
flightNumber: ''
|
|
9754
|
-
};
|
|
9755
|
-
return newFilters;
|
|
9756
|
-
};
|
|
9757
10162
|
EurostarEnterpriseSearch.prototype.getMinDuration = function (results, isReturn) {
|
|
9758
10163
|
if (isReturn === void 0) { isReturn = false; }
|
|
9759
10164
|
var min = 0;
|
|
@@ -10070,11 +10475,11 @@
|
|
|
10070
10475
|
EurostarEnterpriseSearch.prototype.selectGroupedEurostar = function (selectedEurostar, fare, direction) {
|
|
10071
10476
|
return __awaiter(this, void 0, void 0, function () {
|
|
10072
10477
|
var intBasket, basket, index_1;
|
|
10073
|
-
return __generator(this, function (
|
|
10074
|
-
switch (
|
|
10478
|
+
return __generator(this, function (_o) {
|
|
10479
|
+
switch (_o.label) {
|
|
10075
10480
|
case 0: return [4 /*yield*/, this.basketService.getDefaultBasket()];
|
|
10076
10481
|
case 1:
|
|
10077
|
-
intBasket =
|
|
10482
|
+
intBasket = _o.sent();
|
|
10078
10483
|
basket = intBasket === null || intBasket === void 0 ? void 0 : intBasket.subject.value;
|
|
10079
10484
|
if (basket &&
|
|
10080
10485
|
this.originalUserSearch.chosenSearchType === exports.EurostarSearchType.oneWay &&
|
|
@@ -10105,9 +10510,7 @@
|
|
|
10105
10510
|
outboundFlights: [
|
|
10106
10511
|
this.makeSchemaFlights(this.selectedEurostarFare.fare, 'outbound', 0)
|
|
10107
10512
|
],
|
|
10108
|
-
inboundFlights: [
|
|
10109
|
-
this.makeSchemaFlights(fare.fare, 'inbound', 0)
|
|
10110
|
-
],
|
|
10513
|
+
inboundFlights: [this.makeSchemaFlights(fare.fare, 'inbound', 0)],
|
|
10111
10514
|
journeyType: 'roundtrip'
|
|
10112
10515
|
}, selectedEurostar.dateDeparture, this.selectedGroupEurostar.dateArrival);
|
|
10113
10516
|
this.results.next(this.fullResults);
|
|
@@ -10118,17 +10521,17 @@
|
|
|
10118
10521
|
});
|
|
10119
10522
|
};
|
|
10120
10523
|
EurostarEnterpriseSearch.prototype.updateLowestPrice = function (results) {
|
|
10121
|
-
|
|
10122
|
-
|
|
10123
|
-
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
|
|
10131
|
-
|
|
10524
|
+
if (!results.length)
|
|
10525
|
+
return;
|
|
10526
|
+
var result = results[0];
|
|
10527
|
+
var journeys = result.journeys;
|
|
10528
|
+
var currency = journeys[0].total.currency;
|
|
10529
|
+
return journeys.reduce(function (cheapestPrice, result) {
|
|
10530
|
+
var price = result.total.price;
|
|
10531
|
+
if (cheapestPrice.amount > price)
|
|
10532
|
+
cheapestPrice.amount = price;
|
|
10533
|
+
return cheapestPrice;
|
|
10534
|
+
}, { amount: Number.MAX_SAFE_INTEGER, currencyCode: currency });
|
|
10132
10535
|
};
|
|
10133
10536
|
EurostarEnterpriseSearch.prototype.doBooking = function (intBasket, selectedFlight, schemaDetails, outboundDate, inboundDate) {
|
|
10134
10537
|
var sourceId = selectedFlight.sourceId, co2PerItem = selectedFlight.co2PerItem, co2PerPassenger = selectedFlight.co2PerPassenger, total = selectedFlight.total;
|
|
@@ -10241,20 +10644,22 @@
|
|
|
10241
10644
|
return __awaiter(this, void 0, void 0, function () {
|
|
10242
10645
|
var intBasket, basket, sourceId, co2PerItem, co2PerPassenger, total, outboundDate, inboundDate, schemaDetails, booking;
|
|
10243
10646
|
var _this = this;
|
|
10244
|
-
return __generator(this, function (
|
|
10245
|
-
switch (
|
|
10647
|
+
return __generator(this, function (_o) {
|
|
10648
|
+
switch (_o.label) {
|
|
10246
10649
|
case 0:
|
|
10247
10650
|
if (eurostarQuote.unavailable) {
|
|
10248
10651
|
return [2 /*return*/, Promise.resolve(false)];
|
|
10249
10652
|
}
|
|
10250
10653
|
return [4 /*yield*/, this.basketService.getDefaultBasket()];
|
|
10251
10654
|
case 1:
|
|
10252
|
-
intBasket =
|
|
10655
|
+
intBasket = _o.sent();
|
|
10253
10656
|
basket = intBasket === null || intBasket === void 0 ? void 0 : intBasket.subject.value;
|
|
10254
10657
|
if (basket) {
|
|
10255
10658
|
sourceId = eurostarQuote.sourceId, co2PerItem = eurostarQuote.co2PerItem, co2PerPassenger = eurostarQuote.co2PerPassenger, total = eurostarQuote.total;
|
|
10256
10659
|
outboundDate = moment__default['default'](eurostarQuote.outboundFlights[0].dateTimeDeparting);
|
|
10257
|
-
inboundDate = eurostarQuote.inboundFlights.length
|
|
10660
|
+
inboundDate = eurostarQuote.inboundFlights.length
|
|
10661
|
+
? moment__default['default'](eurostarQuote.inboundFlights[0].dateTimeDeparting)
|
|
10662
|
+
: null;
|
|
10258
10663
|
schemaDetails = {
|
|
10259
10664
|
outboundFlights: __spread(eurostarQuote.outboundFlights.map(function (flight, segmentIndex) { return _this.makeSchemaFlights(flight, 'outbound', 0, segmentIndex); })),
|
|
10260
10665
|
inboundFlights: __spread(eurostarQuote.inboundFlights.map(function (flight, segmentIndex) { return _this.makeSchemaFlights(flight, 'inbound', 0, segmentIndex); })),
|
|
@@ -10307,6 +10712,7 @@
|
|
|
10307
10712
|
_this.basketService = basketService;
|
|
10308
10713
|
_this.searchService = searchService;
|
|
10309
10714
|
_this.resultsSessionName = RailEnterpriseSearch.STORAGE_SESSION_RESULTS;
|
|
10715
|
+
_this.multiResultsSessionName = RailEnterpriseSearch.STORAGE_SESSION_RESULTS;
|
|
10310
10716
|
_this.searchTypes = [
|
|
10311
10717
|
{ display: 'Return', value: RailJourneyType.ReturnJourney },
|
|
10312
10718
|
{ display: 'One-Way', value: RailJourneyType.SingleJourney }
|
|
@@ -11747,21 +12153,68 @@
|
|
|
11747
12153
|
});
|
|
11748
12154
|
return foundETicket ? true : null;
|
|
11749
12155
|
};
|
|
11750
|
-
/**
|
|
11751
|
-
* @description - clear all of our chosen tickets/other rail stuff, call this when kicking off a new search
|
|
11752
|
-
*/
|
|
11753
|
-
RailEnterpriseSearch.prototype.clearChosenTickets = function () {
|
|
11754
|
-
this._chosenInboundTicket = null;
|
|
11755
|
-
this._chosenOutboundTicket = null;
|
|
11756
|
-
this._chosenInboundJourney = null;
|
|
11757
|
-
this._chosenOutboundJourney = null;
|
|
11758
|
-
this._chosenTicketGroup = null;
|
|
12156
|
+
/**
|
|
12157
|
+
* @description - clear all of our chosen tickets/other rail stuff, call this when kicking off a new search
|
|
12158
|
+
*/
|
|
12159
|
+
RailEnterpriseSearch.prototype.clearChosenTickets = function () {
|
|
12160
|
+
this._chosenInboundTicket = null;
|
|
12161
|
+
this._chosenOutboundTicket = null;
|
|
12162
|
+
this._chosenInboundJourney = null;
|
|
12163
|
+
this._chosenOutboundJourney = null;
|
|
12164
|
+
this._chosenTicketGroup = null;
|
|
12165
|
+
};
|
|
12166
|
+
return RailEnterpriseSearch;
|
|
12167
|
+
}(BaseEnterpriseSearch));
|
|
12168
|
+
RailEnterpriseSearch.STORAGE_SESSION_PARAMS = 'search_rail';
|
|
12169
|
+
RailEnterpriseSearch.STORAGE_SESSION_RESULTS = 'rail_results';
|
|
12170
|
+
RailEnterpriseSearch.PASSING_POINT = 'Passing';
|
|
12171
|
+
|
|
12172
|
+
(function (ages) {
|
|
12173
|
+
ages["Child"] = "Child";
|
|
12174
|
+
ages["Youth"] = "Youth";
|
|
12175
|
+
ages["Adult"] = "Adult";
|
|
12176
|
+
ages["Senior"] = "Senior";
|
|
12177
|
+
})(exports.ages || (exports.ages = {}));
|
|
12178
|
+
// @dynamic
|
|
12179
|
+
var TravellerObject = /** @class */ (function () {
|
|
12180
|
+
function TravellerObject() {
|
|
12181
|
+
}
|
|
12182
|
+
TravellerObject.hasItem = function (item) {
|
|
12183
|
+
return !!item;
|
|
12184
|
+
};
|
|
12185
|
+
TravellerObject.fullname = function (traveller) {
|
|
12186
|
+
return [traveller.title, traveller.forename, traveller.surname].filter(this.hasItem).join(' ');
|
|
12187
|
+
};
|
|
12188
|
+
TravellerObject.makeTravellerObjectFromUser = function (user) {
|
|
12189
|
+
return {
|
|
12190
|
+
id: user.user_id.toString(),
|
|
12191
|
+
forename: user.forename,
|
|
12192
|
+
surname: user.surname,
|
|
12193
|
+
email: user.username,
|
|
12194
|
+
title: user.title,
|
|
12195
|
+
isChild: false,
|
|
12196
|
+
isInfant: false,
|
|
12197
|
+
childDOB: null,
|
|
12198
|
+
guest: false,
|
|
12199
|
+
name: user.surname + ' ' + user.forename
|
|
12200
|
+
};
|
|
12201
|
+
};
|
|
12202
|
+
TravellerObject.equals = function (first, second) {
|
|
12203
|
+
return first.email === second.email;
|
|
11759
12204
|
};
|
|
11760
|
-
|
|
11761
|
-
|
|
11762
|
-
|
|
11763
|
-
|
|
11764
|
-
|
|
12205
|
+
TravellerObject.compare = function (first, second) {
|
|
12206
|
+
var name1 = TravellerObject.fullname(first);
|
|
12207
|
+
var name2 = TravellerObject.fullname(second);
|
|
12208
|
+
if (name1 === name2) {
|
|
12209
|
+
return 0;
|
|
12210
|
+
}
|
|
12211
|
+
if (name1 < name2) {
|
|
12212
|
+
return -1;
|
|
12213
|
+
}
|
|
12214
|
+
return 1;
|
|
12215
|
+
};
|
|
12216
|
+
return TravellerObject;
|
|
12217
|
+
}());
|
|
11765
12218
|
|
|
11766
12219
|
(function (IrlSearchCriteria) {
|
|
11767
12220
|
IrlSearchCriteria["Depart"] = "Depart After";
|
|
@@ -11769,15 +12222,15 @@
|
|
|
11769
12222
|
})(exports.IrlSearchCriteria || (exports.IrlSearchCriteria = {}));
|
|
11770
12223
|
var IRLEnterpriseSearch = /** @class */ (function (_super) {
|
|
11771
12224
|
__extends(IRLEnterpriseSearch, _super);
|
|
11772
|
-
function IRLEnterpriseSearch(Irlfetcher,
|
|
11773
|
-
// private getRailStationFetcher: BaseGetRailStationFetcher<GRS_Q>, // doesnt exist yet
|
|
11774
|
-
helpers, basketService, storageService, searchService) {
|
|
12225
|
+
function IRLEnterpriseSearch(Irlfetcher, searchIrlStationsFetcher, helpers, basketService, storageService, searchService) {
|
|
11775
12226
|
var _this = _super.call(this, storageService) || this;
|
|
11776
12227
|
_this.Irlfetcher = Irlfetcher;
|
|
12228
|
+
_this.searchIrlStationsFetcher = searchIrlStationsFetcher;
|
|
11777
12229
|
_this.helpers = helpers;
|
|
11778
12230
|
_this.basketService = basketService;
|
|
11779
12231
|
_this.searchService = searchService;
|
|
11780
12232
|
_this.resultsSessionName = IRLEnterpriseSearch.STORAGE_SESSION_RESULTS;
|
|
12233
|
+
_this.multiResultsSessionName = IRLEnterpriseSearch.STORAGE_SESSION_RESULTS;
|
|
11781
12234
|
_this.searchTypes = [
|
|
11782
12235
|
{ display: 'Return', value: IrlJourneyType.ReturnJourney },
|
|
11783
12236
|
{ display: 'One-Way', value: IrlJourneyType.SingleJourney }
|
|
@@ -11789,8 +12242,8 @@
|
|
|
11789
12242
|
{ display: 'Standard', value: IrlClass.Standard },
|
|
11790
12243
|
{ display: 'First', value: IrlClass.First }
|
|
11791
12244
|
];
|
|
11792
|
-
_this.ageRanges = [{ key:
|
|
11793
|
-
_this.
|
|
12245
|
+
_this.ageRanges = [{ key: exports.ages.Child, value: 'Child (0-3)' }, { key: exports.ages.Child, value: 'Child (4-5)' }, { key: exports.ages.Child, value: 'Child (6-11)' }, { key: exports.ages.Youth, value: 'Youth (12-14)' }, { key: exports.ages.Youth, value: 'Youth (15-25)' }, { key: exports.ages.Adult, value: 'Adult (26-59)' }, { key: exports.ages.Youth, value: 'Senior (60+)' }];
|
|
12246
|
+
_this.irlCriteria = [exports.IrlSearchCriteria.Depart, exports.IrlSearchCriteria.Arrive];
|
|
11794
12247
|
_this.travelCards = [
|
|
11795
12248
|
{ display: 'Young persons railcard', value: 'YNG' },
|
|
11796
12249
|
{ display: 'Disability railcard', value: 'DIS' },
|
|
@@ -11819,22 +12272,6 @@
|
|
|
11819
12272
|
_this._children = 0;
|
|
11820
12273
|
_this._returnDepartureDateTime = null;
|
|
11821
12274
|
_this._ageRange = null;
|
|
11822
|
-
// get outboundCriteria(): IrlSearchCriteria {
|
|
11823
|
-
// return this.tempParams.outboundCriteria;
|
|
11824
|
-
// }
|
|
11825
|
-
// set outboundCriteria(newCrit: IrlSearchCriteria) {
|
|
11826
|
-
// // console.warn(`+++ Setting New Criteria: ${newCrit} +++`);
|
|
11827
|
-
// this.tempParams.outboundCriteria = newCrit;
|
|
11828
|
-
// this._isValid();
|
|
11829
|
-
// }
|
|
11830
|
-
// ! might not need this?
|
|
11831
|
-
// get inBoundDateTime(): moment.Moment {
|
|
11832
|
-
// return this.tempParams.inBoundDateTime;
|
|
11833
|
-
// }
|
|
11834
|
-
// set inBoundDateTime(newDateTime: moment.Moment) {
|
|
11835
|
-
// this.tempParams.inBoundDateTime = moment(newDateTime);
|
|
11836
|
-
// this._isValid();
|
|
11837
|
-
// }
|
|
11838
12275
|
// !date and time is handled differently for LU
|
|
11839
12276
|
_this._outbound_date = null;
|
|
11840
12277
|
_this._outbound_time = null;
|
|
@@ -11843,7 +12280,7 @@
|
|
|
11843
12280
|
_this._cheapestStandard = null;
|
|
11844
12281
|
_this._cheapestFirst = null;
|
|
11845
12282
|
_this._irlClass = null;
|
|
11846
|
-
_this._journeytype =
|
|
12283
|
+
_this._journeytype = IrlJourneyType.SingleJourney;
|
|
11847
12284
|
var data = storageService.getSessionItem(IRLEnterpriseSearch.STORAGE_SESSION_PARAMS) || {
|
|
11848
12285
|
query: {},
|
|
11849
12286
|
tempParams: {},
|
|
@@ -11854,7 +12291,10 @@
|
|
|
11854
12291
|
if (searchService.shouldAddTravellerSubscription()) {
|
|
11855
12292
|
searchService.travellerInformation.subscribe(function (travellers) {
|
|
11856
12293
|
_this.travellers = travellers;
|
|
11857
|
-
|
|
12294
|
+
if (_this.travellers[0] && !_this.travellers[0].ageType) {
|
|
12295
|
+
_this.travellers[0].ageType = exports.ages.Adult;
|
|
12296
|
+
}
|
|
12297
|
+
var splitTravellers = _this.helpers.selectedTravellers(travellers, ServiceType.InternationalRail);
|
|
11858
12298
|
_this.tempParams.adults = splitTravellers.adults.length;
|
|
11859
12299
|
_this.tempParams.children = splitTravellers.children.length;
|
|
11860
12300
|
_this.travellers = travellers;
|
|
@@ -11966,6 +12406,7 @@
|
|
|
11966
12406
|
this._travellingFrom = '';
|
|
11967
12407
|
if ((_a = tt === null || tt === void 0 ? void 0 : tt.railstation) === null || _a === void 0 ? void 0 : _a.id) {
|
|
11968
12408
|
this._travellingFrom = tt.railstation.id;
|
|
12409
|
+
this.supplier = tt.railstation.supplier;
|
|
11969
12410
|
}
|
|
11970
12411
|
this._isValid();
|
|
11971
12412
|
},
|
|
@@ -12006,8 +12447,13 @@
|
|
|
12006
12447
|
get: function () {
|
|
12007
12448
|
return this._outboundDepartureDateTime;
|
|
12008
12449
|
},
|
|
12009
|
-
set: function (
|
|
12010
|
-
this._outboundDepartureDateTime =
|
|
12450
|
+
set: function (newDateTime) {
|
|
12451
|
+
this._outboundDepartureDateTime = newDateTime;
|
|
12452
|
+
this._outbound_date = this.helpers.momentToNgDate(newDateTime);
|
|
12453
|
+
this._outbound_time = moment__default['default'](newDateTime).format('HHmm')
|
|
12454
|
+
? moment__default['default'](newDateTime).format('HHmm')
|
|
12455
|
+
: '0700';
|
|
12456
|
+
this._updateOutboundDateTime();
|
|
12011
12457
|
},
|
|
12012
12458
|
enumerable: false,
|
|
12013
12459
|
configurable: true
|
|
@@ -12056,8 +12502,13 @@
|
|
|
12056
12502
|
get: function () {
|
|
12057
12503
|
return this._returnDepartureDateTime;
|
|
12058
12504
|
},
|
|
12059
|
-
set: function (
|
|
12060
|
-
this._returnDepartureDateTime =
|
|
12505
|
+
set: function (newDateTime) {
|
|
12506
|
+
this._returnDepartureDateTime = newDateTime;
|
|
12507
|
+
this._return_date = this.helpers.momentToNgDate(newDateTime);
|
|
12508
|
+
this._return_time = moment__default['default'](newDateTime).format('HHmm')
|
|
12509
|
+
? moment__default['default'](newDateTime).format('HHmm')
|
|
12510
|
+
: '0700';
|
|
12511
|
+
this._updateReturnDateTime();
|
|
12061
12512
|
},
|
|
12062
12513
|
enumerable: false,
|
|
12063
12514
|
configurable: true
|
|
@@ -12097,13 +12548,46 @@
|
|
|
12097
12548
|
month: newDateTime.month() + 1,
|
|
12098
12549
|
day: newDateTime.date()
|
|
12099
12550
|
};
|
|
12100
|
-
|
|
12101
|
-
|
|
12102
|
-
|
|
12103
|
-
|
|
12104
|
-
|
|
12105
|
-
|
|
12106
|
-
|
|
12551
|
+
if (newDateTime && newDateTime.isValid()) {
|
|
12552
|
+
this._outbound_date = this.helpers.momentToNgDate(newDateTime);
|
|
12553
|
+
this._outbound_time = moment__default['default'](newDateTime).format('HHmm')
|
|
12554
|
+
? moment__default['default'](newDateTime).format('HHmm')
|
|
12555
|
+
: '0700';
|
|
12556
|
+
}
|
|
12557
|
+
if (this.outBoundDateTime &&
|
|
12558
|
+
this.inBoundDateTime &&
|
|
12559
|
+
this.outBoundDateTime.isAfter(this.inBoundDateTime)) {
|
|
12560
|
+
this.inBoundDateTime = this.outBoundDateTime.clone().add(1, 'day');
|
|
12561
|
+
}
|
|
12562
|
+
this._isValid();
|
|
12563
|
+
},
|
|
12564
|
+
enumerable: false,
|
|
12565
|
+
configurable: true
|
|
12566
|
+
});
|
|
12567
|
+
Object.defineProperty(IRLEnterpriseSearch.prototype, "outboundCriteria", {
|
|
12568
|
+
get: function () {
|
|
12569
|
+
return this.tempParams.outboundCriteria;
|
|
12570
|
+
},
|
|
12571
|
+
set: function (newCrit) {
|
|
12572
|
+
// console.warn(`+++ Setting New Criteria: ${newCrit} +++`);
|
|
12573
|
+
this.tempParams.outboundCriteria = newCrit;
|
|
12574
|
+
this._isValid();
|
|
12575
|
+
},
|
|
12576
|
+
enumerable: false,
|
|
12577
|
+
configurable: true
|
|
12578
|
+
});
|
|
12579
|
+
Object.defineProperty(IRLEnterpriseSearch.prototype, "inBoundDateTime", {
|
|
12580
|
+
get: function () {
|
|
12581
|
+
return this.tempParams.returnDepartureDateTime;
|
|
12582
|
+
},
|
|
12583
|
+
set: function (newDateTime) {
|
|
12584
|
+
this.tempParams.returnDepartureDateTime = newDateTime;
|
|
12585
|
+
if (newDateTime && newDateTime.isValid()) {
|
|
12586
|
+
this._return_date = this.helpers.momentToNgDate(newDateTime);
|
|
12587
|
+
this._return_time = moment__default['default'](newDateTime).format('HHmm')
|
|
12588
|
+
? moment__default['default'](newDateTime).format('HHmm')
|
|
12589
|
+
: '1600';
|
|
12590
|
+
}
|
|
12107
12591
|
this._isValid();
|
|
12108
12592
|
},
|
|
12109
12593
|
enumerable: false,
|
|
@@ -12153,14 +12637,18 @@
|
|
|
12153
12637
|
enumerable: false,
|
|
12154
12638
|
configurable: true
|
|
12155
12639
|
});
|
|
12640
|
+
Object.defineProperty(IRLEnterpriseSearch.prototype, "returnCriteria", {
|
|
12641
|
+
get: function () {
|
|
12642
|
+
return this.tempParams.returnCriteria;
|
|
12643
|
+
},
|
|
12644
|
+
set: function (newCrit) {
|
|
12645
|
+
this.tempParams.returnCriteria = newCrit;
|
|
12646
|
+
this._isValid();
|
|
12647
|
+
},
|
|
12648
|
+
enumerable: false,
|
|
12649
|
+
configurable: true
|
|
12650
|
+
});
|
|
12156
12651
|
Object.defineProperty(IRLEnterpriseSearch.prototype, "timeArray", {
|
|
12157
|
-
// get returnCriteria(): IrlSearchCriteria {
|
|
12158
|
-
// return this.tempParams.returnCriteria;
|
|
12159
|
-
// }
|
|
12160
|
-
// set returnCriteria(newCrit: IrlSearchCriteria) {
|
|
12161
|
-
// this.tempParams.returnCriteria = newCrit;
|
|
12162
|
-
// this._isValid();
|
|
12163
|
-
// }
|
|
12164
12652
|
// set railCards(newRailCards: string[]) {
|
|
12165
12653
|
// this.tempParams.railCards = newRailCards;
|
|
12166
12654
|
// this._isValid();
|
|
@@ -12312,11 +12800,14 @@
|
|
|
12312
12800
|
IRLEnterpriseSearch.prototype._updateReturnDateTime = function () {
|
|
12313
12801
|
if (this._return_date && this._return_time) {
|
|
12314
12802
|
var time = this.helpers.ngDateToMoment(this._return_date, this._return_time);
|
|
12315
|
-
|
|
12803
|
+
this.inBoundDateTime = time.isValid() ? time : null;
|
|
12316
12804
|
this._isValid();
|
|
12317
12805
|
}
|
|
12318
12806
|
};
|
|
12319
12807
|
IRLEnterpriseSearch.prototype.getSearchQuery = function () {
|
|
12808
|
+
// this.travellers = travellers;
|
|
12809
|
+
this.noOfAdults = this.travellers.filter(function (traveller) { return traveller.ageType === exports.ages.Adult || traveller.ageType === exports.ages.Youth || traveller.ageType === exports.ages.Senior; }).length;
|
|
12810
|
+
this.noOfChildren = this.travellers.filter(function (traveller) { return traveller.ageType === exports.ages.Child; }).length;
|
|
12320
12811
|
var query = {
|
|
12321
12812
|
supplier: this.supplier,
|
|
12322
12813
|
countryCode: 'GB',
|
|
@@ -12328,14 +12819,14 @@
|
|
|
12328
12819
|
adults: this.tempParams.adults,
|
|
12329
12820
|
children: this.tempParams.children,
|
|
12330
12821
|
returnDepartureDateTime: this.tempParams.returnDepartureDateTime,
|
|
12331
|
-
journeyType: this.
|
|
12822
|
+
journeyType: this.journeyType,
|
|
12332
12823
|
};
|
|
12333
12824
|
if (this.tempParams.children === 0) {
|
|
12334
12825
|
query.children = null;
|
|
12335
12826
|
}
|
|
12336
12827
|
// switch (this.tempParams.outboundCriteria) {
|
|
12337
12828
|
// case IrlSearchCriteria.Depart:
|
|
12338
|
-
// query.
|
|
12829
|
+
// query.outboundDepartureDateTime = null;
|
|
12339
12830
|
// break;
|
|
12340
12831
|
// case IrlSearchCriteria.Arrive:
|
|
12341
12832
|
// query.outboundDepartureDateTime = null;
|
|
@@ -12347,7 +12838,7 @@
|
|
|
12347
12838
|
// }
|
|
12348
12839
|
// switch (this.tempParams.returnCriteria) {
|
|
12349
12840
|
// case IrlSearchCriteria.Depart:
|
|
12350
|
-
// query.
|
|
12841
|
+
// query.returnDepartureDateTime = null;
|
|
12351
12842
|
// break;
|
|
12352
12843
|
// case IrlSearchCriteria.Arrive:
|
|
12353
12844
|
// query.returnDepartureDateTime = null;
|
|
@@ -12749,78 +13240,90 @@
|
|
|
12749
13240
|
}
|
|
12750
13241
|
return legs;
|
|
12751
13242
|
};
|
|
12752
|
-
|
|
12753
|
-
|
|
12754
|
-
|
|
12755
|
-
|
|
12756
|
-
|
|
12757
|
-
|
|
12758
|
-
|
|
12759
|
-
|
|
12760
|
-
|
|
12761
|
-
|
|
12762
|
-
|
|
12763
|
-
|
|
12764
|
-
|
|
12765
|
-
|
|
12766
|
-
|
|
12767
|
-
|
|
12768
|
-
|
|
12769
|
-
|
|
12770
|
-
|
|
12771
|
-
|
|
12772
|
-
|
|
12773
|
-
|
|
12774
|
-
|
|
12775
|
-
|
|
12776
|
-
|
|
12777
|
-
|
|
12778
|
-
|
|
12779
|
-
|
|
12780
|
-
|
|
12781
|
-
|
|
12782
|
-
|
|
12783
|
-
|
|
12784
|
-
|
|
12785
|
-
|
|
12786
|
-
|
|
12787
|
-
|
|
12788
|
-
|
|
12789
|
-
|
|
12790
|
-
|
|
12791
|
-
|
|
12792
|
-
|
|
12793
|
-
|
|
12794
|
-
|
|
12795
|
-
|
|
12796
|
-
|
|
12797
|
-
|
|
12798
|
-
|
|
12799
|
-
|
|
12800
|
-
|
|
12801
|
-
|
|
12802
|
-
|
|
12803
|
-
|
|
12804
|
-
|
|
12805
|
-
|
|
12806
|
-
|
|
12807
|
-
|
|
12808
|
-
|
|
12809
|
-
|
|
12810
|
-
|
|
12811
|
-
|
|
12812
|
-
|
|
12813
|
-
|
|
12814
|
-
|
|
12815
|
-
|
|
12816
|
-
|
|
12817
|
-
|
|
12818
|
-
|
|
12819
|
-
|
|
12820
|
-
|
|
12821
|
-
|
|
12822
|
-
|
|
12823
|
-
|
|
13243
|
+
IRLEnterpriseSearch.prototype.addSingleJourneyToBasket = function (serviceId, railQuery, irlJourneyOption) {
|
|
13244
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
13245
|
+
var intBasket, basket;
|
|
13246
|
+
return __generator(this, function (_c) {
|
|
13247
|
+
switch (_c.label) {
|
|
13248
|
+
case 0:
|
|
13249
|
+
console.log(serviceId, railQuery, irlJourneyOption);
|
|
13250
|
+
return [4 /*yield*/, this.basketService.getDefaultBasket()];
|
|
13251
|
+
case 1:
|
|
13252
|
+
intBasket = _c.sent();
|
|
13253
|
+
basket = intBasket === null || intBasket === void 0 ? void 0 : intBasket.subject.value;
|
|
13254
|
+
if (basket) {
|
|
13255
|
+
// const selectedIrlTicketOption = this.getSelectedIrlTicketOption(
|
|
13256
|
+
// irlJourneyOption,
|
|
13257
|
+
// railTicketGroup,
|
|
13258
|
+
// 0
|
|
13259
|
+
// );
|
|
13260
|
+
// const legs = this.getLegsFromRailJourneyOption(railJourneyOption);
|
|
13261
|
+
// const ticketQueueList = selectedIrlTicketOption.ticketQueueList.map(
|
|
13262
|
+
// (ticketQueueList) => {
|
|
13263
|
+
// return {
|
|
13264
|
+
// id: ticketQueueList.id,
|
|
13265
|
+
// name: ticketQueueList.name,
|
|
13266
|
+
// type: ticketQueueList.type
|
|
13267
|
+
// };
|
|
13268
|
+
// }
|
|
13269
|
+
// );
|
|
13270
|
+
// const basketItem = {
|
|
13271
|
+
// basket: basket.id,
|
|
13272
|
+
// service: serviceId,
|
|
13273
|
+
// detail: {
|
|
13274
|
+
// // accountsList: irlJourneyOption.accountsList.map(
|
|
13275
|
+
// // (account: RailAccount) => {
|
|
13276
|
+
// // return { id: account.id, description: account.description };
|
|
13277
|
+
// // }
|
|
13278
|
+
// // ),
|
|
13279
|
+
// outwardDetail: {
|
|
13280
|
+
// arrivalDateTime: railJourneyOption.arriveDateTime,
|
|
13281
|
+
// arrivalStationName: railJourneyOption.to,
|
|
13282
|
+
// departureDateTime: railJourneyOption.departDateTime,
|
|
13283
|
+
// departureStationName: railJourneyOption.from,
|
|
13284
|
+
// supplierTickets: [
|
|
13285
|
+
// {
|
|
13286
|
+
// supplierName: railJourneyOption.providers[0].name,
|
|
13287
|
+
// ticketDescription: selectedRailTicketOption.type,
|
|
13288
|
+
// price: selectedRailTicketOption.price,
|
|
13289
|
+
// legs
|
|
13290
|
+
// }
|
|
13291
|
+
// ]
|
|
13292
|
+
// },
|
|
13293
|
+
// transactionIdentifier:
|
|
13294
|
+
// railJourneyOption.identifiers.transactionIdentifier,
|
|
13295
|
+
// outbound: {
|
|
13296
|
+
// fareIdentifiers: [
|
|
13297
|
+
// selectedRailTicketOption.identifiers.fareIdentifier
|
|
13298
|
+
// ],
|
|
13299
|
+
// journeyIdentifier: selectedRailTicketOption.identifiers.journeyIdentifier
|
|
13300
|
+
// },
|
|
13301
|
+
// ticketQueueList
|
|
13302
|
+
// },
|
|
13303
|
+
// adults: railQuery.adults,
|
|
13304
|
+
// price: selectedRailTicketOption.price,
|
|
13305
|
+
// currency: selectedRailTicketOption.currency as CurrencyCode,
|
|
13306
|
+
// searchQuery: railQuery,
|
|
13307
|
+
// // co2PerItem: irlJourneyOption.co2PerItem,
|
|
13308
|
+
// // co2PerPassenger: irlJourneyOption.co2PerPassenger,
|
|
13309
|
+
// outboundDate: irlJourneyOption.
|
|
13310
|
+
// }
|
|
13311
|
+
// // if outTicketExtras exists add the object to basketItem
|
|
13312
|
+
// if (outTicketExtras) {
|
|
13313
|
+
// basketItem.detail.outbound.ticketExtras = outTicketExtras;
|
|
13314
|
+
// }
|
|
13315
|
+
// return this.basketService.addToBasket(
|
|
13316
|
+
// basketItem,
|
|
13317
|
+
// intBasket,
|
|
13318
|
+
// this.searchService,
|
|
13319
|
+
// this.travellers
|
|
13320
|
+
// );
|
|
13321
|
+
}
|
|
13322
|
+
return [2 /*return*/, Promise.resolve(false)];
|
|
13323
|
+
}
|
|
13324
|
+
});
|
|
13325
|
+
});
|
|
13326
|
+
};
|
|
12824
13327
|
// async addReturnJourneyToBasket(
|
|
12825
13328
|
// serviceId: string,
|
|
12826
13329
|
// railQuery: SearchRailQueryVariables,
|
|
@@ -13525,7 +14028,7 @@
|
|
|
13525
14028
|
}
|
|
13526
14029
|
BaseIrlQuoteFetcher.prototype.getDataFromResult = function (results) {
|
|
13527
14030
|
var _a, _b;
|
|
13528
|
-
return (_b = (_a = results === null || results === void 0 ? void 0 : results.data) === null || _a === void 0 ? void 0 : _a.
|
|
14031
|
+
return (_b = (_a = results === null || results === void 0 ? void 0 : results.data) === null || _a === void 0 ? void 0 : _a.searchIRL) === null || _b === void 0 ? void 0 : _b.results;
|
|
13529
14032
|
};
|
|
13530
14033
|
return BaseIrlQuoteFetcher;
|
|
13531
14034
|
}(FetchableList));
|
|
@@ -13719,6 +14222,18 @@
|
|
|
13719
14222
|
return BaseConfermaOfficeNamesFetcher;
|
|
13720
14223
|
}(FetchableList));
|
|
13721
14224
|
|
|
14225
|
+
var BaseConfermaOfficeFetcher = /** @class */ (function (_super) {
|
|
14226
|
+
__extends(BaseConfermaOfficeFetcher, _super);
|
|
14227
|
+
function BaseConfermaOfficeFetcher(getUserAddressGQL, modalService) {
|
|
14228
|
+
return _super.call(this, getUserAddressGQL, modalService) || this;
|
|
14229
|
+
}
|
|
14230
|
+
BaseConfermaOfficeFetcher.prototype.getDataFromResult = function (results) {
|
|
14231
|
+
var _a;
|
|
14232
|
+
return (_a = results === null || results === void 0 ? void 0 : results.data) === null || _a === void 0 ? void 0 : _a.getConfermaOffice;
|
|
14233
|
+
};
|
|
14234
|
+
return BaseConfermaOfficeFetcher;
|
|
14235
|
+
}(FetchableObject));
|
|
14236
|
+
|
|
13722
14237
|
var BaseGetUserCurrentCarbonAllowanceFetcher = /** @class */ (function (_super) {
|
|
13723
14238
|
__extends(BaseGetUserCurrentCarbonAllowanceFetcher, _super);
|
|
13724
14239
|
function BaseGetUserCurrentCarbonAllowanceFetcher(getUserBasketsGQL, helpers, modalService) {
|
|
@@ -13778,6 +14293,20 @@
|
|
|
13778
14293
|
return BaseEurostarQuoteFetcher;
|
|
13779
14294
|
}(FetchableList));
|
|
13780
14295
|
|
|
14296
|
+
var BaseSearchIrlStationsFetcher = /** @class */ (function (_super) {
|
|
14297
|
+
__extends(BaseSearchIrlStationsFetcher, _super);
|
|
14298
|
+
function BaseSearchIrlStationsFetcher(gql, helpers, modalService) {
|
|
14299
|
+
return _super.call(this, gql, helpers, modalService) || this;
|
|
14300
|
+
}
|
|
14301
|
+
BaseSearchIrlStationsFetcher.prototype.getDataFromResult = function (results) {
|
|
14302
|
+
var _a;
|
|
14303
|
+
return (_a = results === null || results === void 0 ? void 0 : results.data) === null || _a === void 0 ? void 0 : _a.searchIRLSupplierStations;
|
|
14304
|
+
};
|
|
14305
|
+
return BaseSearchIrlStationsFetcher;
|
|
14306
|
+
}(FetchableList));
|
|
14307
|
+
|
|
14308
|
+
// | 'fareTypes';
|
|
14309
|
+
|
|
13781
14310
|
/**
|
|
13782
14311
|
* @desc Known reg expresions
|
|
13783
14312
|
*/
|
|
@@ -13860,47 +14389,6 @@
|
|
|
13860
14389
|
return AuthInfo;
|
|
13861
14390
|
}());
|
|
13862
14391
|
|
|
13863
|
-
// @dynamic
|
|
13864
|
-
var TravellerObject = /** @class */ (function () {
|
|
13865
|
-
function TravellerObject() {
|
|
13866
|
-
}
|
|
13867
|
-
TravellerObject.hasItem = function (item) {
|
|
13868
|
-
return !!item;
|
|
13869
|
-
};
|
|
13870
|
-
TravellerObject.fullname = function (traveller) {
|
|
13871
|
-
return [traveller.title, traveller.forename, traveller.surname].filter(this.hasItem).join(' ');
|
|
13872
|
-
};
|
|
13873
|
-
TravellerObject.makeTravellerObjectFromUser = function (user) {
|
|
13874
|
-
return {
|
|
13875
|
-
id: user.user_id.toString(),
|
|
13876
|
-
forename: user.forename,
|
|
13877
|
-
surname: user.surname,
|
|
13878
|
-
email: user.username,
|
|
13879
|
-
title: user.title,
|
|
13880
|
-
isChild: false,
|
|
13881
|
-
isInfant: false,
|
|
13882
|
-
childDOB: null,
|
|
13883
|
-
guest: false,
|
|
13884
|
-
name: user.surname + ' ' + user.forename
|
|
13885
|
-
};
|
|
13886
|
-
};
|
|
13887
|
-
TravellerObject.equals = function (first, second) {
|
|
13888
|
-
return first.email === second.email;
|
|
13889
|
-
};
|
|
13890
|
-
TravellerObject.compare = function (first, second) {
|
|
13891
|
-
var name1 = TravellerObject.fullname(first);
|
|
13892
|
-
var name2 = TravellerObject.fullname(second);
|
|
13893
|
-
if (name1 === name2) {
|
|
13894
|
-
return 0;
|
|
13895
|
-
}
|
|
13896
|
-
if (name1 < name2) {
|
|
13897
|
-
return -1;
|
|
13898
|
-
}
|
|
13899
|
-
return 1;
|
|
13900
|
-
};
|
|
13901
|
-
return TravellerObject;
|
|
13902
|
-
}());
|
|
13903
|
-
|
|
13904
14392
|
var TEMPID = 'TEMPID_';
|
|
13905
14393
|
var InternalBasket = /** @class */ (function () {
|
|
13906
14394
|
function InternalBasket(basket, helpers, basketService, getUserFetcher) {
|
|
@@ -14361,6 +14849,7 @@
|
|
|
14361
14849
|
var validateSearchSchema = ajv.compile(serviceToCheck.searchQuerySchema);
|
|
14362
14850
|
// if there are any moment date objects in the searchQuery object convert these to date-time strings
|
|
14363
14851
|
item.searchQuery = this.helpers.sanitizeMomentDates(item.searchQuery);
|
|
14852
|
+
item.detail = this.helpers.removeNulls(item.detail);
|
|
14364
14853
|
if (!validateSearchSchema(item.searchQuery)) {
|
|
14365
14854
|
var error = "Item searchQuery is not valid for " + serviceToCheck.name + " search schema.";
|
|
14366
14855
|
console.warn('searchSchema', serviceToCheck.searchQuerySchema);
|
|
@@ -14567,7 +15056,7 @@
|
|
|
14567
15056
|
});
|
|
14568
15057
|
};
|
|
14569
15058
|
BaseEnterpriseBasketService.prototype.sendBasketForApproval = function (basketid) {
|
|
14570
|
-
this.updateBasket(basketid, this.sendBasketForApprovalUpdater
|
|
15059
|
+
return this.updateBasket(basketid, this.sendBasketForApprovalUpdater
|
|
14571
15060
|
.updateOne({ basket: basketid })
|
|
14572
15061
|
.pipe(operators.take(1)));
|
|
14573
15062
|
};
|
|
@@ -16633,7 +17122,7 @@
|
|
|
16633
17122
|
TravellerSearchTypes["employeeNumber"] = "employeeNumber";
|
|
16634
17123
|
})(exports.TravellerSearchTypes || (exports.TravellerSearchTypes = {}));
|
|
16635
17124
|
var BaseEnterpriseSearchService = /** @class */ (function () {
|
|
16636
|
-
function BaseEnterpriseSearchService(searchAirportsFetcher, searchAirlinesFetcher, storageService, userService, router, helpers, hotelAvalibilityService, citiesFetcher, confermaCitiesFetcher, postcodeFetcher, railStationFetcher, saveUserAddressUpdater, userAddressesFetcher, basketService, getUserCompanyOfficesFetcher, searchHotelChainsFetcher, baseValidateIsPostcodeValidTester, depotFetcher, confermaOfficeNamesFetcher, baseDeleteUserAddressUpdater, baseDeleteRecentSearchUpdater, baseSaveRecentSearchUpdater, getUserCurrentCarbonAllowanceFetcher, environment, loungeFetcher, parkingFetcher, httpCallService, flightFetcher, hotelFetcher, carhireFetcher, carHireAvailabilityDetailFetcher, cabhireFetcher, railFetcher, irlFetcher, getRailStationFetcher, baseWebTokenService, riskAlertsFetcher, quicklistFetcher, getUserRecentSearchesFetcher, getRailCardsFetcher, eurostarFetcher, searchUsersCanBookForFetcher) {
|
|
17125
|
+
function BaseEnterpriseSearchService(searchAirportsFetcher, searchAirlinesFetcher, storageService, userService, router, helpers, hotelAvalibilityService, citiesFetcher, confermaCitiesFetcher, postcodeFetcher, railStationFetcher, saveUserAddressUpdater, userAddressesFetcher, basketService, getUserCompanyOfficesFetcher, searchHotelChainsFetcher, baseValidateIsPostcodeValidTester, depotFetcher, confermaOfficeNamesFetcher, confermaOfficeFetcher, baseDeleteUserAddressUpdater, baseDeleteRecentSearchUpdater, baseSaveRecentSearchUpdater, getUserCurrentCarbonAllowanceFetcher, environment, loungeFetcher, parkingFetcher, httpCallService, flightFetcher, hotelFetcher, carhireFetcher, carHireAvailabilityDetailFetcher, cabhireFetcher, railFetcher, irlFetcher, getRailStationFetcher, baseWebTokenService, riskAlertsFetcher, quicklistFetcher, getUserRecentSearchesFetcher, getRailCardsFetcher, eurostarFetcher, searchUsersCanBookForFetcher, searchIrlStationsFetcher) {
|
|
16637
17126
|
var _d;
|
|
16638
17127
|
var _this = this;
|
|
16639
17128
|
this.searchAirportsFetcher = searchAirportsFetcher;
|
|
@@ -16655,6 +17144,7 @@
|
|
|
16655
17144
|
this.baseValidateIsPostcodeValidTester = baseValidateIsPostcodeValidTester;
|
|
16656
17145
|
this.depotFetcher = depotFetcher;
|
|
16657
17146
|
this.confermaOfficeNamesFetcher = confermaOfficeNamesFetcher;
|
|
17147
|
+
this.confermaOfficeFetcher = confermaOfficeFetcher;
|
|
16658
17148
|
this.baseDeleteUserAddressUpdater = baseDeleteUserAddressUpdater;
|
|
16659
17149
|
this.baseDeleteRecentSearchUpdater = baseDeleteRecentSearchUpdater;
|
|
16660
17150
|
this.baseSaveRecentSearchUpdater = baseSaveRecentSearchUpdater;
|
|
@@ -16665,6 +17155,7 @@
|
|
|
16665
17155
|
this.getUserRecentSearchesFetcher = getUserRecentSearchesFetcher;
|
|
16666
17156
|
this.getRailCardsFetcher = getRailCardsFetcher;
|
|
16667
17157
|
this.searchUsersCanBookForFetcher = searchUsersCanBookForFetcher;
|
|
17158
|
+
this.searchIrlStationsFetcher = searchIrlStationsFetcher;
|
|
16668
17159
|
this.traveller_error = false;
|
|
16669
17160
|
this.travellerInformation = new rxjs.BehaviorSubject([]);
|
|
16670
17161
|
this.errors = new rxjs.BehaviorSubject([]);
|
|
@@ -16689,9 +17180,7 @@
|
|
|
16689
17180
|
_d[ServiceType.Hotel] = new HotelEnterpriseSearch(hotelFetcher, helpers, userService, environment, hotelAvalibilityService, basketService, storageService, this, httpCallService, quicklistFetcher, getRailStationFetcher),
|
|
16690
17181
|
_d[ServiceType.Car] = new CarhireEnterpriseSearch(carhireFetcher, carHireAvailabilityDetailFetcher, helpers, basketService, storageService, this),
|
|
16691
17182
|
_d[ServiceType.Cab] = new CabHireEnterpriseSearch(cabhireFetcher, helpers, storageService, this, basketService),
|
|
16692
|
-
_d[ServiceType.InternationalRail] = new IRLEnterpriseSearch(irlFetcher,
|
|
16693
|
-
// getRailStationFetcher,
|
|
16694
|
-
helpers, basketService, storageService, this),
|
|
17183
|
+
_d[ServiceType.InternationalRail] = new IRLEnterpriseSearch(irlFetcher, searchIrlStationsFetcher, helpers, basketService, storageService, this),
|
|
16695
17184
|
_d[ServiceType.FastTrack] = null,
|
|
16696
17185
|
_d[ServiceType.Coach] = null,
|
|
16697
17186
|
_d[ServiceType.Rail] = new RailEnterpriseSearch(railFetcher, getRailStationFetcher, helpers, basketService, storageService, this),
|
|
@@ -16949,6 +17438,23 @@
|
|
|
16949
17438
|
BaseEnterpriseSearchService.prototype.getSelectedPlaceById = function (placeId) {
|
|
16950
17439
|
return this.selectedPlaces.find(function (place) { return place.place_id === placeId; });
|
|
16951
17440
|
};
|
|
17441
|
+
BaseEnterpriseSearchService.prototype.getConfirmaOffices = function (term) {
|
|
17442
|
+
if ((term === null || term === void 0 ? void 0 : term.length) > 2) {
|
|
17443
|
+
var obs = this.confermaOfficeNamesFetcher.fetchList();
|
|
17444
|
+
var func = function (results) {
|
|
17445
|
+
var data = results.results.map(function (result) {
|
|
17446
|
+
return {
|
|
17447
|
+
name: result.name,
|
|
17448
|
+
type: exports.LocationTypes.Office,
|
|
17449
|
+
id: result.id
|
|
17450
|
+
};
|
|
17451
|
+
});
|
|
17452
|
+
return data;
|
|
17453
|
+
};
|
|
17454
|
+
return obs.pipe(operators.take(1), operators.map(func));
|
|
17455
|
+
}
|
|
17456
|
+
return rxjs.of([]);
|
|
17457
|
+
};
|
|
16952
17458
|
/*
|
|
16953
17459
|
* @description - get the list of Office locations based on search term given
|
|
16954
17460
|
* @todo - fill this out so that it actually performs a http call
|
|
@@ -16996,6 +17502,31 @@
|
|
|
16996
17502
|
return rxjs.of([]);
|
|
16997
17503
|
}
|
|
16998
17504
|
};
|
|
17505
|
+
BaseEnterpriseSearchService.prototype.searchIrlStationsLocations = function (term, isLoading) {
|
|
17506
|
+
if (term.length > 2) {
|
|
17507
|
+
isLoading === null || isLoading === void 0 ? void 0 : isLoading.next(true);
|
|
17508
|
+
return this.searchIrlStationsFetcher
|
|
17509
|
+
.fetchList({
|
|
17510
|
+
query: term
|
|
17511
|
+
})
|
|
17512
|
+
.pipe(operators.take(1), operators.map(function (results) {
|
|
17513
|
+
if (isLoading) {
|
|
17514
|
+
isLoading.next(false);
|
|
17515
|
+
}
|
|
17516
|
+
return results
|
|
17517
|
+
.map(function (result) {
|
|
17518
|
+
return {
|
|
17519
|
+
type: exports.LocationTypes.TrainStation,
|
|
17520
|
+
name: result.name + " (" + result.supplier + ")",
|
|
17521
|
+
railstation: result
|
|
17522
|
+
};
|
|
17523
|
+
});
|
|
17524
|
+
}));
|
|
17525
|
+
}
|
|
17526
|
+
else {
|
|
17527
|
+
return rxjs.of([]);
|
|
17528
|
+
}
|
|
17529
|
+
};
|
|
16999
17530
|
/**
|
|
17000
17531
|
* @description - get hotel locations, these should be city, office, airport, railstation
|
|
17001
17532
|
* @todo - fill this out for the other location types, may need to mergeMap them or some other rxjs magic
|
|
@@ -17014,7 +17545,7 @@
|
|
|
17014
17545
|
this.getAirportLocations(term, countryCode, isLoading),
|
|
17015
17546
|
this.getCityLocations(term, countryCode, isLoading),
|
|
17016
17547
|
this.getStationLocations(term, isLoading),
|
|
17017
|
-
this.
|
|
17548
|
+
this.getConfirmaOffices(term)
|
|
17018
17549
|
]).pipe(operators.map(function (results) {
|
|
17019
17550
|
if (isLoading === null || isLoading === void 0 ? void 0 : isLoading.value) {
|
|
17020
17551
|
isLoading.next(false);
|
|
@@ -17452,6 +17983,18 @@
|
|
|
17452
17983
|
}));
|
|
17453
17984
|
isLoading === null || isLoading === void 0 ? void 0 : isLoading.next(false);
|
|
17454
17985
|
};
|
|
17986
|
+
BaseEnterpriseSearchService.prototype.getOffice = function (officeId) {
|
|
17987
|
+
if (officeId) {
|
|
17988
|
+
return this.confermaOfficeFetcher.fetchOne({ officeId: officeId }).pipe(operators.take(1), operators.map(function (results) {
|
|
17989
|
+
if (results) {
|
|
17990
|
+
return results.results;
|
|
17991
|
+
}
|
|
17992
|
+
}));
|
|
17993
|
+
}
|
|
17994
|
+
else {
|
|
17995
|
+
return rxjs.of();
|
|
17996
|
+
}
|
|
17997
|
+
};
|
|
17455
17998
|
BaseEnterpriseSearchService.prototype.getRailCards = function () {
|
|
17456
17999
|
return this.getRailCardsFetcher.fetchList().pipe(operators.take(1), operators.map(function (results) {
|
|
17457
18000
|
if (results) {
|
|
@@ -17773,7 +18316,7 @@
|
|
|
17773
18316
|
};
|
|
17774
18317
|
/*
|
|
17775
18318
|
* Creates a Rail search query with supplied params, auto fills with defaults if fields are empty.
|
|
17776
|
-
* @param {any} ...args Example - searchService.
|
|
18319
|
+
* @param {any} ...args Example - searchService.makeIrlQuery(data.query, { override: "property" })
|
|
17777
18320
|
* @return {QuerySearchRailArgs} Returns QuerySearchRailArgs type
|
|
17778
18321
|
*/
|
|
17779
18322
|
BaseEnterpriseSearchService.prototype.makeIrlQuery = function () {
|
|
@@ -17783,17 +18326,18 @@
|
|
|
17783
18326
|
}
|
|
17784
18327
|
var time = this.helpers.momentRoundMinutes(moment__default['default'](), 30);
|
|
17785
18328
|
var defaultVal = {
|
|
18329
|
+
returnCriteria: exports.IrlSearchCriteria.Depart,
|
|
18330
|
+
outboundCriteria: exports.IrlSearchCriteria.Depart,
|
|
17786
18331
|
supplier: null,
|
|
17787
18332
|
countryCode: '',
|
|
17788
|
-
|
|
18333
|
+
journeyType: IrlJourneyType.ReturnJourney,
|
|
17789
18334
|
class: null,
|
|
17790
18335
|
outboundDepartureDateTime: time,
|
|
17791
18336
|
departureLocationId: null,
|
|
17792
18337
|
arrivalLocationId: null,
|
|
17793
18338
|
adults: 0,
|
|
17794
18339
|
children: 0,
|
|
17795
|
-
returnDepartureDateTime: time
|
|
17796
|
-
journeyType: null
|
|
18340
|
+
returnDepartureDateTime: time
|
|
17797
18341
|
};
|
|
17798
18342
|
return this.helpers.sanatizeReturns(defaultVal, Object.assign.apply(Object, __spread([{}], args)), ['returnDepartureDateTime', 'outboundDepartureDateTime']);
|
|
17799
18343
|
};
|
|
@@ -18497,6 +19041,7 @@
|
|
|
18497
19041
|
exports.BaseCabhireQuoteFetcher = BaseCabhireQuoteFetcher;
|
|
18498
19042
|
exports.BaseCarHireAvailabilityDetailFetcher = BaseCarHireAvailabilityDetailFetcher;
|
|
18499
19043
|
exports.BaseCarhireQuoteFetcher = BaseCarhireQuoteFetcher;
|
|
19044
|
+
exports.BaseConfermaOfficeFetcher = BaseConfermaOfficeFetcher;
|
|
18500
19045
|
exports.BaseConfermaOfficeNamesFetcher = BaseConfermaOfficeNamesFetcher;
|
|
18501
19046
|
exports.BaseCreateBasketUpdater = BaseCreateBasketUpdater;
|
|
18502
19047
|
exports.BaseDeleteBasketUpdater = BaseDeleteBasketUpdater;
|
|
@@ -18543,6 +19088,7 @@
|
|
|
18543
19088
|
exports.BaseSearchConfermaQuicklistFetcher = BaseSearchConfermaQuicklistFetcher;
|
|
18544
19089
|
exports.BaseSearchDepotFetcher = BaseSearchDepotFetcher;
|
|
18545
19090
|
exports.BaseSearchHotelChainsFetcher = BaseSearchHotelChainsFetcher;
|
|
19091
|
+
exports.BaseSearchIrlStationsFetcher = BaseSearchIrlStationsFetcher;
|
|
18546
19092
|
exports.BaseSearchPostcodeFetcher = BaseSearchPostcodeFetcher;
|
|
18547
19093
|
exports.BaseSearchRailStationsFetcher = BaseSearchRailStationsFetcher;
|
|
18548
19094
|
exports.BaseSearchUsersCanBookForFetcher = BaseSearchUsersCanBookForFetcher;
|
|
@@ -18567,6 +19113,7 @@
|
|
|
18567
19113
|
exports.BookableBasket = BookableBasket;
|
|
18568
19114
|
exports.CabHireEnterpriseSearch = CabHireEnterpriseSearch;
|
|
18569
19115
|
exports.CarhireEnterpriseSearch = CarhireEnterpriseSearch;
|
|
19116
|
+
exports.DEFAULT_FLIGHT_FILTERS = DEFAULT_FLIGHT_FILTERS;
|
|
18570
19117
|
exports.EurostarEnterpriseSearch = EurostarEnterpriseSearch;
|
|
18571
19118
|
exports.FlightEnterpriseSearch = FlightEnterpriseSearch;
|
|
18572
19119
|
exports.HotelEnterpriseSearch = HotelEnterpriseSearch;
|