@sabstravtech/obtservices 0.0.0
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/.editorconfig +13 -0
- package/.gitmodules +0 -0
- package/.vscode/settings.json +4 -0
- package/README.md +27 -0
- package/angular.json +45 -0
- package/audit.config.json +6 -0
- package/codegen.yml +18 -0
- package/ng-package.json +7 -0
- package/package.json +84 -0
- package/projects/obtservices/README.md +24 -0
- package/projects/obtservices/angular/package.json +3 -0
- package/projects/obtservices/angular/src/classes.ts +3 -0
- package/projects/obtservices/angular/src/components/basket-panel.ts +139 -0
- package/projects/obtservices/angular/src/components/with-component.ts +40 -0
- package/projects/obtservices/angular/src/components.ts +2 -0
- package/projects/obtservices/angular/src/data.ts +5 -0
- package/projects/obtservices/angular/src/fetchers.ts +32 -0
- package/projects/obtservices/angular/src/lib/vendor/classes/environment.ts +5 -0
- package/projects/obtservices/angular/src/lib/vendor/classes/event-messenager.ts +11 -0
- package/projects/obtservices/angular/src/lib/vendor/classes/helpers.ts +87 -0
- package/projects/obtservices/angular/src/lib/vendor/data/airports.data.json +5508 -0
- package/projects/obtservices/angular/src/lib/vendor/data/animations.ts +38 -0
- package/projects/obtservices/angular/src/lib/vendor/data/booking-expected-responses.json +100 -0
- package/projects/obtservices/angular/src/lib/vendor/data/cities.data.json +31499 -0
- package/projects/obtservices/angular/src/lib/vendor/data/countries.json +1212 -0
- package/projects/obtservices/angular/src/lib/vendor/data/flight-booking.data.json +136 -0
- package/projects/obtservices/angular/src/lib/vendor/data/postcodes1.json +194 -0
- package/projects/obtservices/angular/src/lib/vendor/data/rail_addresses.json +2524 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/basket-fetcher.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/cabhire-quote-fetcher.ts +15 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/carhire-availability-detail.fetcher.ts +17 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/carhire-quote-fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/conferma-office-names.fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/conferma-quicklist.fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/eurostar-quote.fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/flight-quote.fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/get-rail-cards.fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/get-rail-station.fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/get-risk-alerts.fetcher.ts +18 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/get-user-company-offices.fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/get-user-current-carbon-allowance.fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/get-user-recent-searches.fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/get-users-baskets-fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/getMiAutoSugestions.fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/hotel-avaliability-fetcher.ts +17 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/hotel-quote-fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/irl-quote-fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/lounge-quote.fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/parking-quote-fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/rail-quote-fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/search-airlines-fetcher.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/search-airports-fetcher.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/search-cities.fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/search-conferma-cities.fetcher.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/search-depots.fetcher.ts +18 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/search-hotel-chains.fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/search-postcodes.fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/search-rail-stations.fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/search-users-can-book-for-fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/user-addresses.fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/user-fetcher.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/user-message.fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/user-products-fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/fetchers/user-ui-configs-fetcher.ts +16 -0
- package/projects/obtservices/angular/src/lib/vendor/services/enterprise-basket.service.ts +133 -0
- package/projects/obtservices/angular/src/lib/vendor/services/hotel-avallibility.service.ts +19 -0
- package/projects/obtservices/angular/src/lib/vendor/services/http-call.service.ts +252 -0
- package/projects/obtservices/angular/src/lib/vendor/services/logon.service.ts +40 -0
- package/projects/obtservices/angular/src/lib/vendor/services/modal-opener.service.ts +9 -0
- package/projects/obtservices/angular/src/lib/vendor/services/my-bookings.service.ts +21 -0
- package/projects/obtservices/angular/src/lib/vendor/services/route-happy.service.ts +11 -0
- package/projects/obtservices/angular/src/lib/vendor/services/search.service.ts +213 -0
- package/projects/obtservices/angular/src/lib/vendor/services/storage.service.ts +82 -0
- package/projects/obtservices/angular/src/lib/vendor/services/user.service.ts +36 -0
- package/projects/obtservices/angular/src/lib/vendor/services/webtoken.service.ts +62 -0
- package/projects/obtservices/angular/src/lib/vendor/testers/postcode-validate.tester.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/testers/validate-mi-free-value.tester.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/types/graphql.angular.types.ts +11081 -0
- package/projects/obtservices/angular/src/lib/vendor/updaters/accept-new-price.updater.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/updaters/add-item-to-basket.updater.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/updaters/addUserToBasketItem.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/updaters/book-basket-updater.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/updaters/create-basket-updater.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/updaters/move-basket-item-to-basket.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/updaters/remove-basket-updater.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/updaters/remove-item-from-basket.updater.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/updaters/remove-recent-search.updater.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/updaters/remove-user-address.updater.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/updaters/revalidate-basket-updater.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/updaters/save-recent-search.updater.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/updaters/save-user-address.updater.ts +11 -0
- package/projects/obtservices/angular/src/lib/vendor/updaters/send-basket-for-approval.updater.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/updaters/set-basket-item-lead-passenger.updater.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/updaters/set-basket-item-mi-group.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/updaters/set-basket-item-mi-value-updater.ts +15 -0
- package/projects/obtservices/angular/src/lib/vendor/updaters/set-payment-option.updater.ts +15 -0
- package/projects/obtservices/angular/src/lib/vendor/updaters/update-basket-notes-updater.ts +14 -0
- package/projects/obtservices/angular/src/lib/vendor/updaters/update-basket-title-updater.ts +14 -0
- package/projects/obtservices/angular/src/obtservices.module.ts +131 -0
- package/projects/obtservices/angular/src/public_api.ts +8 -0
- package/projects/obtservices/angular/src/services.ts +11 -0
- package/projects/obtservices/angular/src/testers.ts +2 -0
- package/projects/obtservices/angular/src/types.ts +1 -0
- package/projects/obtservices/angular/src/updaters.ts +13 -0
- package/projects/obtservices/base/package.json +3 -0
- package/projects/obtservices/base/src/classes.ts +27 -0
- package/projects/obtservices/base/src/custom.d.ts +3 -0
- package/projects/obtservices/base/src/fetchers.ts +36 -0
- package/projects/obtservices/base/src/interfaces.ts +29 -0
- package/projects/obtservices/base/src/lib/vendor/classes/base-enterprise.ts +126 -0
- package/projects/obtservices/base/src/lib/vendor/classes/base-network-call.ts +40 -0
- package/projects/obtservices/base/src/lib/vendor/classes/basket-info-mi-details.impl.ts +68 -0
- package/projects/obtservices/base/src/lib/vendor/classes/bookable-basket.ts +343 -0
- package/projects/obtservices/base/src/lib/vendor/classes/cabhire-enterprise-search.ts +907 -0
- package/projects/obtservices/base/src/lib/vendor/classes/carhire-enterprise-search.ts +1597 -0
- package/projects/obtservices/base/src/lib/vendor/classes/empty-enterprise-search.ts +75 -0
- package/projects/obtservices/base/src/lib/vendor/classes/enviroment.ts +25 -0
- package/projects/obtservices/base/src/lib/vendor/classes/eurostar-enterprise-search.ts +2126 -0
- package/projects/obtservices/base/src/lib/vendor/classes/eurostar-search-type.enum.ts +4 -0
- package/projects/obtservices/base/src/lib/vendor/classes/event-messenager.ts +23 -0
- package/projects/obtservices/base/src/lib/vendor/classes/flight-enterprise-search.ts +2399 -0
- package/projects/obtservices/base/src/lib/vendor/classes/flight-search-type.enum.ts +5 -0
- package/projects/obtservices/base/src/lib/vendor/classes/helpers.ts +1233 -0
- package/projects/obtservices/base/src/lib/vendor/classes/hotel-enterprise-search.ts +1370 -0
- package/projects/obtservices/base/src/lib/vendor/classes/irl-enterprise-search.ts +1380 -0
- package/projects/obtservices/base/src/lib/vendor/classes/limited-cache.class.ts +70 -0
- package/projects/obtservices/base/src/lib/vendor/classes/lounges-enterprise-search.ts +444 -0
- package/projects/obtservices/base/src/lib/vendor/classes/management-info-and-valid.ts +268 -0
- package/projects/obtservices/base/src/lib/vendor/classes/modal-types.enum.ts +28 -0
- package/projects/obtservices/base/src/lib/vendor/classes/parking-enterprise-search.ts +541 -0
- package/projects/obtservices/base/src/lib/vendor/classes/rail-direction.enum.ts +4 -0
- package/projects/obtservices/base/src/lib/vendor/classes/rail-enterprise-search.ts +1751 -0
- package/projects/obtservices/base/src/lib/vendor/classes/routehappy-request.ts +146 -0
- package/projects/obtservices/base/src/lib/vendor/classes/routehappy-response.ts +128 -0
- package/projects/obtservices/base/src/lib/vendor/classes/supplementary-booking-info-impl.ts +375 -0
- package/projects/obtservices/base/src/lib/vendor/classes/user-favourite.enum.ts +12 -0
- package/projects/obtservices/base/src/lib/vendor/classes/validator.checker.ts +7 -0
- package/projects/obtservices/base/src/lib/vendor/data/airports.data.json +5508 -0
- package/projects/obtservices/base/src/lib/vendor/data/booking-expected-responses.json +100 -0
- package/projects/obtservices/base/src/lib/vendor/data/cities.data.json +31499 -0
- package/projects/obtservices/base/src/lib/vendor/data/countries.json +1212 -0
- package/projects/obtservices/base/src/lib/vendor/data/euro-stations.json +30 -0
- package/projects/obtservices/base/src/lib/vendor/data/flight-booking.data.json +136 -0
- package/projects/obtservices/base/src/lib/vendor/data/postcodes1.json +194 -0
- package/projects/obtservices/base/src/lib/vendor/data/rail_addresses.json +2524 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/basket-fetcher.ts +29 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/cabhire-quote-fetcher.ts +34 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/carhire-availability-detail.fetcher.ts +35 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/carhire-quote-fetcher.ts +34 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/conferma-office-names.fetcher.ts +34 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/conferma-quicklist.fetcher.ts +35 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/eurostar-quote.fetcher.ts +35 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/flight-quote.fetcher.ts +35 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/get-rail-cards.fetcher.ts +35 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/get-rail-station.fetcher.ts +35 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/get-risk-alerts.fetcher.ts +35 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/get-user-company-offices.fetcher.ts +34 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/get-user-current-carbon-allowance.fetcher.ts +35 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/get-user-recent-searches.fetcher.ts +36 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/get-users-baskets-fetcher.ts +33 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/getMiAutoSugestions.fetcher.ts +35 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/hotel-avaliability-fetcher.ts +53 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/hotel-quote-fetcher.ts +35 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/irl-quote-fetcher.ts +34 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/list-fetchable-enterprise.ts +59 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/lounge-quote.fetcher.ts +34 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/object-fetchable-enterprise.ts +20 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/parking-quote-fetcher.ts +34 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/rail-quote-fetcher.ts +34 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/search-airlines.fetcher.ts +30 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/search-airports-fetcher.ts +29 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/search-cities.fetcher.ts +34 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/search-conferma-cities.fetcher.ts +32 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/search-depots.fetcher.ts +34 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/search-hotel-chains.fetcher.ts +34 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/search-postcodes.fetcher.ts +37 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/search-rail-stations.fetcher.ts +35 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/search-users-can-book-for-fetcher.ts +35 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/user-addresses.fetcher.ts +34 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/user-fetcher.ts +27 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/user-message.fetcher.ts +34 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/user-products-fetcher.ts +35 -0
- package/projects/obtservices/base/src/lib/vendor/fetchers/user-ui-configs-fetcher.ts +35 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/Icabhire-enterprise-search.ts +174 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/Icarhire-enterprise-search.ts +143 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/Ienterprise-basket.service.ts +127 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/Ieurostar-enterprise-search.ts +197 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/Iflight-enterprise-search.ts +196 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/Ihotel-enterprise-search.ts +219 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/Iirl-enterprise-search.ts +135 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/Ilounges-enterprise-search.ts +58 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/Imybookings.service.ts +27 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/Iparking-enterprise-search.ts +72 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/Irail-enterprise-search.ts +161 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/Isearch.service.ts +178 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/Isupplementary-booking-info-impl.ts +63 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/Iuser.service.ts +87 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/car-hire-classes.interface.ts +8 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/car-hire-filters.interface.ts +11 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/car-hire-sort.interface.ts +4 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/cheapest-price.ts +4 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/code-name.ts +4 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/flight-filters.interface.ts +41 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/flight-multi-destination.interface.ts +8 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/rail-airport-express-stations.interface.ts +4 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/rail-basket-item.interface.ts +79 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/rail-journey-leg.interface.ts +6 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/rail-recent-search-args.interface.ts +20 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/rail-selected-ticket.interface.ts +11 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/rail-ticket-group.interface.ts +29 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/rail-ticket-groups.interface.ts +5 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/search-objects.interface.ts +17 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/select-filter.interface.ts +5 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/user.data.ts +22 -0
- package/projects/obtservices/base/src/lib/vendor/interfaces/value-display.ts +4 -0
- package/projects/obtservices/base/src/lib/vendor/models/login.model.ts +97 -0
- package/projects/obtservices/base/src/lib/vendor/models/regexp.model.ts +13 -0
- package/projects/obtservices/base/src/lib/vendor/models/traveller.object.ts +61 -0
- package/projects/obtservices/base/src/lib/vendor/services/enterprise-basket.service.ts +1150 -0
- package/projects/obtservices/base/src/lib/vendor/services/hotel-avallibility.service.ts +251 -0
- package/projects/obtservices/base/src/lib/vendor/services/http-call.service.ts +57 -0
- package/projects/obtservices/base/src/lib/vendor/services/logon.service.ts +245 -0
- package/projects/obtservices/base/src/lib/vendor/services/modal-opener.service.ts +30 -0
- package/projects/obtservices/base/src/lib/vendor/services/my-bookings.service.ts +184 -0
- package/projects/obtservices/base/src/lib/vendor/services/routehappy.service.ts +275 -0
- package/projects/obtservices/base/src/lib/vendor/services/search.service.ts +2026 -0
- package/projects/obtservices/base/src/lib/vendor/services/storage.service.ts +15 -0
- package/projects/obtservices/base/src/lib/vendor/services/url.service.ts +12 -0
- package/projects/obtservices/base/src/lib/vendor/services/user.service.ts +354 -0
- package/projects/obtservices/base/src/lib/vendor/services/webtoken.service.ts +66 -0
- package/projects/obtservices/base/src/lib/vendor/testers/base.tester.ts +18 -0
- package/projects/obtservices/base/src/lib/vendor/testers/postcode-validate.tester.ts +24 -0
- package/projects/obtservices/base/src/lib/vendor/testers/validate-mi-free-value.tester.ts +23 -0
- package/projects/obtservices/base/src/lib/vendor/types/graphql.types.ts +6184 -0
- package/projects/obtservices/base/src/lib/vendor/types/types.ts +630 -0
- package/projects/obtservices/base/src/lib/vendor/updaters/accept-new-price.updater.ts +31 -0
- package/projects/obtservices/base/src/lib/vendor/updaters/add-item-to-basket.updater.ts +29 -0
- package/projects/obtservices/base/src/lib/vendor/updaters/addUserToBasketItem.ts +30 -0
- package/projects/obtservices/base/src/lib/vendor/updaters/book-basket-updater.ts +28 -0
- package/projects/obtservices/base/src/lib/vendor/updaters/create-basket-updater.ts +29 -0
- package/projects/obtservices/base/src/lib/vendor/updaters/move-basket-item-to-basket.ts +30 -0
- package/projects/obtservices/base/src/lib/vendor/updaters/object-updater-enterprise.ts +20 -0
- package/projects/obtservices/base/src/lib/vendor/updaters/remove-basket-updater.ts +29 -0
- package/projects/obtservices/base/src/lib/vendor/updaters/remove-item-from-basket.updater.ts +28 -0
- package/projects/obtservices/base/src/lib/vendor/updaters/remove-recent-search-updater.ts +29 -0
- package/projects/obtservices/base/src/lib/vendor/updaters/remove-user-address-updater.ts +29 -0
- package/projects/obtservices/base/src/lib/vendor/updaters/revalidate-basket-updater.ts +29 -0
- package/projects/obtservices/base/src/lib/vendor/updaters/save-recent-search-updater.ts +30 -0
- package/projects/obtservices/base/src/lib/vendor/updaters/save-user-address.updater.ts +30 -0
- package/projects/obtservices/base/src/lib/vendor/updaters/send-basket-for-approval.updater.ts +31 -0
- package/projects/obtservices/base/src/lib/vendor/updaters/set-basket-item-lead-passenger.updater.ts +30 -0
- package/projects/obtservices/base/src/lib/vendor/updaters/set-basket-item-mi-group.ts +32 -0
- package/projects/obtservices/base/src/lib/vendor/updaters/set-basket-item-mi-value-updater.ts +30 -0
- package/projects/obtservices/base/src/lib/vendor/updaters/set-basket-item-paymenr-option.updater.ts +28 -0
- package/projects/obtservices/base/src/lib/vendor/updaters/update-basket-notes-updater.ts +30 -0
- package/projects/obtservices/base/src/lib/vendor/updaters/update-basket-title-updater.ts +30 -0
- package/projects/obtservices/base/src/models.ts +3 -0
- package/projects/obtservices/base/src/public_api.ts +8 -0
- package/projects/obtservices/base/src/services.ts +12 -0
- package/projects/obtservices/base/src/testers.ts +2 -0
- package/projects/obtservices/base/src/types.ts +1 -0
- package/projects/obtservices/base/src/updaters.ts +20 -0
- package/projects/obtservices/graphQL/autogenerated/index.js +2 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/acceptNewPrice.gql +1580 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/addItemToBasket.gql +1580 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/addUsersToBasketItem.gql +1580 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/bookBasket.gql +1580 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/cancelBooking.gql +6 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/confermaCreateCard.gql +23 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/confermaDeleteCard.gql +3 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/createBasket.gql +1580 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/deleteBasket.gql +3 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/deleteFavouriteSearch.gql +3 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/deleteRecentSearch.gql +3 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/deleteUserAddress.gql +3 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/index.js +36 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/moveItemToADifferentBasket.gql +1580 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/removeItemFromBasket.gql +1580 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/removeItemsFromBasket.gql +1580 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/removeUserFromBasketItem.gql +1580 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/reopenBasket.gql +1580 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/revalidateBasket.gql +1580 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/revalidateBasketItem.gql +1580 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/saveFavouriteSearch.gql +348 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/saveRecentSearch.gql +348 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/saveUserAddress.gql +14 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/sendBasketForApproval.gql +1580 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/setAddressAsUserPrimary.gql +14 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/setBasketItemLeadPassenger.gql +1580 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/setBasketItemMIGroup.gql +1580 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/setBasketItemMIValue.gql +1580 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/setBasketItemPaymentMethod.gql +1580 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/setMIDefaultValue.gql +3 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/setUserLanguage.gql +339 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/updateBasketNotes.gql +1580 -0
- package/projects/obtservices/graphQL/autogenerated/mutations/updateBasketTitle.gql +1580 -0
- package/projects/obtservices/graphQL/autogenerated/queries/alive.gql +3 -0
- package/projects/obtservices/graphQL/autogenerated/queries/carHireAvailabilityDetailRequest.gql +42 -0
- package/projects/obtservices/graphQL/autogenerated/queries/confermaBlockClientHotels.gql +23 -0
- package/projects/obtservices/graphQL/autogenerated/queries/confermaBlockConsumerHotels.gql +23 -0
- package/projects/obtservices/graphQL/autogenerated/queries/confermaListCards.gql +11 -0
- package/projects/obtservices/graphQL/autogenerated/queries/confermaUnblockClientHotels.gql +23 -0
- package/projects/obtservices/graphQL/autogenerated/queries/confermaUnblockConsumerHotels.gql +23 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getCOVIDMicrositeToken.gql +3 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getCancellationInfo.gql +7 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getCarHireDepots.gql +13 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getConfermaOffice.gql +50 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getConfermaOfficeNames.gql +26 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getConfermaQuicklist.gql +131 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getCountries.gql +8 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getHotelAvailability.gql +78 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getHotelChains.gql +3 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getIRLSupplierStation.gql +28 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getMultipleHotelsAvailability.gql +78 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getPostcodeDetails.gql +25 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getRailStation.gql +27 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getRailcards.gql +6 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getRiskAlerts.gql +17 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getUser.gql +339 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getUserAddresses.gql +14 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getUserBasket.gql +1580 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getUserBaskets.gql +1580 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getUserCompanyOffices.gql +88 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getUserCurrentCarbonAllowance.gql +524 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getUserFavouriteSearches.gql +348 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getUserMIAutoSuggestValues.gql +10 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getUserMessages.gql +10 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getUserPhoneNumbers.gql +13 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getUserRecentSearches.gql +348 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getUserServices.gql +16 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getUserTravelRules.gql +111 -0
- package/projects/obtservices/graphQL/autogenerated/queries/getUserUIConfigs.gql +52 -0
- package/projects/obtservices/graphQL/autogenerated/queries/index.js +64 -0
- package/projects/obtservices/graphQL/autogenerated/queries/isPostcodeValid.gql +3 -0
- package/projects/obtservices/graphQL/autogenerated/queries/postcodeAutoSuggest.gql +3 -0
- package/projects/obtservices/graphQL/autogenerated/queries/searchAirlines.gql +32 -0
- package/projects/obtservices/graphQL/autogenerated/queries/searchAirports.gql +60 -0
- package/projects/obtservices/graphQL/autogenerated/queries/searchCabHire.gql +63 -0
- package/projects/obtservices/graphQL/autogenerated/queries/searchCarHire.gql +104 -0
- package/projects/obtservices/graphQL/autogenerated/queries/searchCities.gql +14 -0
- package/projects/obtservices/graphQL/autogenerated/queries/searchConfermaCities.gql +11 -0
- package/projects/obtservices/graphQL/autogenerated/queries/searchEurostar.gql +833 -0
- package/projects/obtservices/graphQL/autogenerated/queries/searchFastTrack.gql +46 -0
- package/projects/obtservices/graphQL/autogenerated/queries/searchFlights.gql +23 -0
- package/projects/obtservices/graphQL/autogenerated/queries/searchFlightsV2.gql +833 -0
- package/projects/obtservices/graphQL/autogenerated/queries/searchHotelChains.gql +3 -0
- package/projects/obtservices/graphQL/autogenerated/queries/searchHotels.gql +131 -0
- package/projects/obtservices/graphQL/autogenerated/queries/searchIRL.gql +514 -0
- package/projects/obtservices/graphQL/autogenerated/queries/searchIRLSupplierStations.gql +28 -0
- package/projects/obtservices/graphQL/autogenerated/queries/searchLounges.gql +89 -0
- package/projects/obtservices/graphQL/autogenerated/queries/searchParking.gql +70 -0
- package/projects/obtservices/graphQL/autogenerated/queries/searchPostcodes.gql +25 -0
- package/projects/obtservices/graphQL/autogenerated/queries/searchRail.gql +840 -0
- package/projects/obtservices/graphQL/autogenerated/queries/searchRailStations.gql +27 -0
- package/projects/obtservices/graphQL/autogenerated/queries/searchUserCanBookFor.gql +339 -0
- package/projects/obtservices/graphQL/autogenerated/queries/validateBasketItemMI.gql +3 -0
- package/projects/obtservices/graphQL/autogenerated/queries/validateUserMIFreeValue.gql +3 -0
- package/projects/obtservices/graphQL/documents/acceptNewPrice.graphql +5 -0
- package/projects/obtservices/graphQL/documents/addUserToBasketItem.graphql +9 -0
- package/projects/obtservices/graphQL/documents/basket.fragments.graphql +171 -0
- package/projects/obtservices/graphQL/documents/baskets.graphql +111 -0
- package/projects/obtservices/graphQL/documents/bookBasket.graphql +9 -0
- package/projects/obtservices/graphQL/documents/cabhire.graphql +66 -0
- package/projects/obtservices/graphQL/documents/carHireAvailabilityDetailRequest.graphql +44 -0
- package/projects/obtservices/graphQL/documents/carhire.graphql +117 -0
- package/projects/obtservices/graphQL/documents/deleteRecentSearch.graphql +3 -0
- package/projects/obtservices/graphQL/documents/deleteUserAddress.graphql +3 -0
- package/projects/obtservices/graphQL/documents/error.fragments.graphql +10 -0
- package/projects/obtservices/graphQL/documents/flights.graphql +830 -0
- package/projects/obtservices/graphQL/documents/getCarHireDepots.graphql +13 -0
- package/projects/obtservices/graphQL/documents/getConfermaOfficeNames.graphql +11 -0
- package/projects/obtservices/graphQL/documents/getConfermaQuicklist.graphql +108 -0
- package/projects/obtservices/graphQL/documents/getRailStation.graphql +31 -0
- package/projects/obtservices/graphQL/documents/getRailcards.graphql +6 -0
- package/projects/obtservices/graphQL/documents/getRiskAlerts.graphql +24 -0
- package/projects/obtservices/graphQL/documents/getUserAddresses.graphql +14 -0
- package/projects/obtservices/graphQL/documents/getUserCompanyOffices.graphql +18 -0
- package/projects/obtservices/graphQL/documents/getUserCurrentCarbonAllowance.graphql +29 -0
- package/projects/obtservices/graphQL/documents/getUserMIAutoSuggestValues.graphql +10 -0
- package/projects/obtservices/graphQL/documents/getUserPhoneNumbers.graphql +13 -0
- package/projects/obtservices/graphQL/documents/getUserRecentSearches.graphql +20 -0
- package/projects/obtservices/graphQL/documents/hotels.graphql +242 -0
- package/projects/obtservices/graphQL/documents/isPostcodeValid.graphql +3 -0
- package/projects/obtservices/graphQL/documents/lookups.graphql +54 -0
- package/projects/obtservices/graphQL/documents/lounges.graphql +88 -0
- package/projects/obtservices/graphQL/documents/moveItemToADifferentBasket.graphql +9 -0
- package/projects/obtservices/graphQL/documents/parking.graphql +79 -0
- package/projects/obtservices/graphQL/documents/rail.graphql +645 -0
- package/projects/obtservices/graphQL/documents/saveRecentSearch.graphql +5 -0
- package/projects/obtservices/graphQL/documents/saveUserAddress.graphql +14 -0
- package/projects/obtservices/graphQL/documents/searchAirlines.graphql +32 -0
- package/projects/obtservices/graphQL/documents/searchCities.graphql +14 -0
- package/projects/obtservices/graphQL/documents/searchConfermaCities.graphql +11 -0
- package/projects/obtservices/graphQL/documents/searchEurostar.graphql +810 -0
- package/projects/obtservices/graphQL/documents/searchHotelChains.graphql +3 -0
- package/projects/obtservices/graphQL/documents/searchIRL.graphql +521 -0
- package/projects/obtservices/graphQL/documents/searchPostcodes.graphql +7 -0
- package/projects/obtservices/graphQL/documents/searchRailStations.graphql +27 -0
- package/projects/obtservices/graphQL/documents/searchUserAddresses.graphql +14 -0
- package/projects/obtservices/graphQL/documents/set-basker-item-mi-group.graphql +9 -0
- package/projects/obtservices/graphQL/documents/setBasketItemLeadPassenger.graphql +5 -0
- package/projects/obtservices/graphQL/documents/setBasketItemMIValue.graphql +16 -0
- package/projects/obtservices/graphQL/documents/setBasketItemPaymentMethod.graphql +12 -0
- package/projects/obtservices/graphQL/documents/updateBasketNotes.graphql +10 -0
- package/projects/obtservices/graphQL/documents/updateBasketTitle.graphql +10 -0
- package/projects/obtservices/graphQL/documents/user.fragments.graphql +65 -0
- package/projects/obtservices/graphQL/documents/user.graphql +95 -0
- package/projects/obtservices/graphQL/documents/validateUserMIFreeValue.graphql +3 -0
- package/projects/obtservices/graphQL/schema/schema.graphql +2635 -0
- package/projects/obtservices/karma.conf.js +32 -0
- package/projects/obtservices/ng-package.json +7 -0
- package/projects/obtservices/package-lock.json +5 -0
- package/projects/obtservices/package.json +12 -0
- package/projects/obtservices/src/obtservices.ts +0 -0
- package/projects/obtservices/src/public_api.ts +1 -0
- package/projects/obtservices/tsconfig.lib.json +30 -0
- package/projects/obtservices/tsconfig.spec.json +17 -0
- package/projects/obtservices/tslint.json +17 -0
- package/tsconfig.json +36 -0
- package/tslint.json +62 -0
|
@@ -0,0 +1,2026 @@
|
|
|
1
|
+
import { map, take } from 'rxjs/operators';
|
|
2
|
+
import moment from 'moment';
|
|
3
|
+
import Countries from '../data/countries.json';
|
|
4
|
+
import { BehaviorSubject, forkJoin, of } from 'rxjs';
|
|
5
|
+
import { BaseEnterpriseSearch } from '../classes/base-enterprise';
|
|
6
|
+
import { Observable } from 'rxjs';
|
|
7
|
+
import { ParkingEnterpriseSearch } from '../classes/parking-enterprise-search';
|
|
8
|
+
import {
|
|
9
|
+
SearchObject,
|
|
10
|
+
SearchObjects
|
|
11
|
+
} from '../interfaces/search-objects.interface';
|
|
12
|
+
import {
|
|
13
|
+
Address,
|
|
14
|
+
Airport,
|
|
15
|
+
BasketItem,
|
|
16
|
+
BookerType,
|
|
17
|
+
FareType,
|
|
18
|
+
RailClass,
|
|
19
|
+
RailJourneyType,
|
|
20
|
+
SearchAirports,
|
|
21
|
+
ServiceType,
|
|
22
|
+
SaveUserAddressMutationVariables,
|
|
23
|
+
CarHireDepot,
|
|
24
|
+
CabHireVehicleType,
|
|
25
|
+
ConfermaOfficeNames,
|
|
26
|
+
CarbonAllowance,
|
|
27
|
+
RiskAlert,
|
|
28
|
+
RiskLevel,
|
|
29
|
+
RailStation,
|
|
30
|
+
GetRiskAlertsQueryVariables,
|
|
31
|
+
SearchAirlines,
|
|
32
|
+
AirlineResult,
|
|
33
|
+
HotelItinerary,
|
|
34
|
+
FlightCabinClass,
|
|
35
|
+
ReferenceRailCardQualifier,
|
|
36
|
+
SearchUserCanBookForQueryVariables,
|
|
37
|
+
Search,
|
|
38
|
+
SaveRecentSearchMutationVariables
|
|
39
|
+
} from '../types/graphql.types';
|
|
40
|
+
import { LoungesEnterpriseSearch } from '../classes/lounges-enterprise-search';
|
|
41
|
+
import { HotelEnterpriseSearch } from '../classes/hotel-enterprise-search';
|
|
42
|
+
import { CarhireEnterpriseSearch } from '../classes/carhire-enterprise-search';
|
|
43
|
+
import {
|
|
44
|
+
FlightEnterpriseSearch,
|
|
45
|
+
TimeWindow
|
|
46
|
+
} from '../classes/flight-enterprise-search';
|
|
47
|
+
import { CabHireEnterpriseSearch } from '../classes/cabhire-enterprise-search';
|
|
48
|
+
import {
|
|
49
|
+
RailEnterpriseSearch,
|
|
50
|
+
RailSearchCriteria
|
|
51
|
+
} from '../classes/rail-enterprise-search';
|
|
52
|
+
import { Traveller, TravellerObject } from '../models/traveller.object';
|
|
53
|
+
import { BaseStorageService } from './storage.service';
|
|
54
|
+
import { BaseHelperRoutines } from '../classes/helpers';
|
|
55
|
+
import { BaseHotelAvalibilityService } from './hotel-avallibility.service';
|
|
56
|
+
import { BaseEnvironment } from '../classes/enviroment';
|
|
57
|
+
import {
|
|
58
|
+
BaseSearchPostcodeFetcher,
|
|
59
|
+
SearchPostcodesQuoteFetcherType
|
|
60
|
+
} from '../fetchers/search-postcodes.fetcher';
|
|
61
|
+
import {
|
|
62
|
+
AddressForm,
|
|
63
|
+
AirportSearchResults,
|
|
64
|
+
CarHireDepotResultArray,
|
|
65
|
+
CountryCode,
|
|
66
|
+
LocationDetails,
|
|
67
|
+
LocationTypes,
|
|
68
|
+
OBTAirportDetails,
|
|
69
|
+
RailAirport,
|
|
70
|
+
Router,
|
|
71
|
+
SearchCitiesResult,
|
|
72
|
+
SearchCitiesResultArray,
|
|
73
|
+
SearchPostcodesResult,
|
|
74
|
+
SearchPostcodesResultArray,
|
|
75
|
+
SearchRailStationsResult,
|
|
76
|
+
SearchRailStationsResultArray,
|
|
77
|
+
TerminalsType,
|
|
78
|
+
GetUserCompanyOfficesResultArray,
|
|
79
|
+
GetUserCompanyOfficesResult,
|
|
80
|
+
SearchHotelChainsResultArray,
|
|
81
|
+
SearchHotelChainsResult,
|
|
82
|
+
SearchRiskAlertsResult,
|
|
83
|
+
AirlinesSearchResult,
|
|
84
|
+
OBTAirlinesDetails,
|
|
85
|
+
GetUserRecentSearchesResultArray,
|
|
86
|
+
GetUserRecentSearchesResult,
|
|
87
|
+
RecentSearch,
|
|
88
|
+
HotelQuoteResultArray,
|
|
89
|
+
SearchConfermaCitiesResult
|
|
90
|
+
} from '../types/types';
|
|
91
|
+
import {
|
|
92
|
+
BaseSearchRailStationsFetcher,
|
|
93
|
+
SearchRailStationsFetcherType
|
|
94
|
+
} from '../fetchers/search-rail-stations.fetcher';
|
|
95
|
+
import {
|
|
96
|
+
BaseLoungeQuoteFetcher,
|
|
97
|
+
LoungeQuoteFetcherType
|
|
98
|
+
} from '../fetchers/lounge-quote.fetcher';
|
|
99
|
+
import {
|
|
100
|
+
BaseParkingQuoteFetcher,
|
|
101
|
+
ParkingQuoteFetcherType
|
|
102
|
+
} from '../fetchers/parking-quote-fetcher';
|
|
103
|
+
import {
|
|
104
|
+
BaseFlightQuoteFetcher,
|
|
105
|
+
FlightQuoteFetcherType
|
|
106
|
+
} from '../fetchers/flight-quote.fetcher';
|
|
107
|
+
import {
|
|
108
|
+
BaseHotelQuoteFetcher,
|
|
109
|
+
HotelQuoteFetcherType
|
|
110
|
+
} from '../fetchers/hotel-quote-fetcher';
|
|
111
|
+
import {
|
|
112
|
+
BaseCarhireQuoteFetcher,
|
|
113
|
+
CarHireFetcherType
|
|
114
|
+
} from '../fetchers/carhire-quote-fetcher';
|
|
115
|
+
import {
|
|
116
|
+
BaseCarHireAvailabilityDetailFetcher,
|
|
117
|
+
CarHireAvailabilityDetailFetcherType
|
|
118
|
+
} from '../fetchers/carhire-availability-detail.fetcher';
|
|
119
|
+
import {
|
|
120
|
+
BaseCabhireQuoteFetcher,
|
|
121
|
+
CabhireQuoteFetcherType
|
|
122
|
+
} from '../fetchers/cabhire-quote-fetcher';
|
|
123
|
+
import {
|
|
124
|
+
BaseRailQuoteFetcher,
|
|
125
|
+
RailQuoteFetcherType
|
|
126
|
+
} from '../fetchers/rail-quote-fetcher';
|
|
127
|
+
import {
|
|
128
|
+
BaseIrlQuoteFetcher,
|
|
129
|
+
IrlQuoteFetcherType
|
|
130
|
+
} from '../fetchers/irl-quote-fetcher';
|
|
131
|
+
import { RegExps } from '../models/regexp.model';
|
|
132
|
+
import {
|
|
133
|
+
EnterpriseSearchServiceInterface,
|
|
134
|
+
SearchParams
|
|
135
|
+
} from '../interfaces/Isearch.service';
|
|
136
|
+
import {
|
|
137
|
+
BaseSearchAirportsFetcher,
|
|
138
|
+
SearchAirportsQuoteFetcherType
|
|
139
|
+
} from '../fetchers/search-airports-fetcher';
|
|
140
|
+
import {
|
|
141
|
+
BaseSearchAirlinesFetcher,
|
|
142
|
+
SearchAirlinesQuoteFetcherType
|
|
143
|
+
} from '../fetchers/search-airlines.fetcher';
|
|
144
|
+
import {
|
|
145
|
+
UserServiceInterface,
|
|
146
|
+
UserServices
|
|
147
|
+
} from '../interfaces/Iuser.service';
|
|
148
|
+
import {
|
|
149
|
+
BaseSearchCityFetcher,
|
|
150
|
+
SearchCitiesQuoteFetcherType
|
|
151
|
+
} from '../fetchers/search-cities.fetcher';
|
|
152
|
+
import {
|
|
153
|
+
BaseSearchConfermaCityFetcher,
|
|
154
|
+
SearchConfermaCitiesQuoteFetcherType
|
|
155
|
+
} from '../fetchers/search-conferma-cities.fetcher';
|
|
156
|
+
import { AbstractHttpCallService } from './http-call.service';
|
|
157
|
+
import { EnterpriseBasketServiceInterface } from '../interfaces/Ienterprise-basket.service';
|
|
158
|
+
import { HotelAvalinilityFetcherType } from '../fetchers/hotel-avaliability-fetcher';
|
|
159
|
+
import {
|
|
160
|
+
BaseSaveUserAddressUpdater,
|
|
161
|
+
SaveUserAddressUpdaterType
|
|
162
|
+
} from '../updaters/save-user-address.updater';
|
|
163
|
+
import {
|
|
164
|
+
BaseUserAddressesFetcher,
|
|
165
|
+
UserAddressFetcherType
|
|
166
|
+
} from '../fetchers/user-addresses.fetcher';
|
|
167
|
+
|
|
168
|
+
import {
|
|
169
|
+
BaseConfermaOfficeNamesFetcher,
|
|
170
|
+
ConfermaOfficeNameFetcherType
|
|
171
|
+
} from '../fetchers/conferma-office-names.fetcher';
|
|
172
|
+
|
|
173
|
+
import {
|
|
174
|
+
BaseGetUserCompanyOfficesFetcher,
|
|
175
|
+
GetUserCompanyOfficesQuoteFetcherType
|
|
176
|
+
} from '../fetchers/get-user-company-offices.fetcher';
|
|
177
|
+
import {
|
|
178
|
+
BaseSearchHotelChainsFetcher,
|
|
179
|
+
SearchHotelChainsQuoteFetcherType
|
|
180
|
+
} from '../fetchers/search-hotel-chains.fetcher';
|
|
181
|
+
import {
|
|
182
|
+
BaseValidateIsPostcodeValidTester,
|
|
183
|
+
ValidateIsPostcodeValidType
|
|
184
|
+
} from '../testers/postcode-validate.tester';
|
|
185
|
+
|
|
186
|
+
import {
|
|
187
|
+
BaseSearchDepotFetcher,
|
|
188
|
+
SearchDepotQuoteFetcherType
|
|
189
|
+
} from '../fetchers/search-depots.fetcher';
|
|
190
|
+
|
|
191
|
+
import {
|
|
192
|
+
BaseGetRailStationFetcher,
|
|
193
|
+
GetRailStationFetcherType
|
|
194
|
+
} from '../fetchers/get-rail-station.fetcher';
|
|
195
|
+
|
|
196
|
+
import {
|
|
197
|
+
BaseSearchConfermaQuicklistFetcher,
|
|
198
|
+
ConfermaQuicklistFetcherType
|
|
199
|
+
} from '../fetchers/conferma-quicklist.fetcher';
|
|
200
|
+
|
|
201
|
+
import {
|
|
202
|
+
BaseDeleteUserAddressUpdater,
|
|
203
|
+
DeleteUserAddressFetcherType
|
|
204
|
+
} from '../updaters/remove-user-address-updater';
|
|
205
|
+
|
|
206
|
+
import {
|
|
207
|
+
BaseDeleteRecentSearchUpdater,
|
|
208
|
+
DeleteRecentSearchFetcherType
|
|
209
|
+
} from '../updaters/remove-recent-search-updater';
|
|
210
|
+
|
|
211
|
+
import {
|
|
212
|
+
BaseSaveRecentSearchUpdater,
|
|
213
|
+
SaveRecentSearchFetcherType
|
|
214
|
+
} from '../updaters/save-recent-search-updater';
|
|
215
|
+
|
|
216
|
+
import { HotelTempParams } from '../interfaces/Ihotel-enterprise-search';
|
|
217
|
+
import { RailTempParams } from '../interfaces/Irail-enterprise-search';
|
|
218
|
+
import { FlightTempParams } from '../interfaces/Iflight-enterprise-search';
|
|
219
|
+
import { LoungesTempParams } from '../interfaces/Ilounges-enterprise-search';
|
|
220
|
+
import { ParkingTempParams } from '../interfaces/Iparking-enterprise-search';
|
|
221
|
+
import { CabHireTempParams, TaxiFormMode } from '../interfaces/Icabhire-enterprise-search';
|
|
222
|
+
import { CarHireTempParams } from '../interfaces/Icarhire-enterprise-search';
|
|
223
|
+
import {
|
|
224
|
+
BaseGetUserCurrentCarbonAllowanceFetcher,
|
|
225
|
+
GetUserCurrentCarbonAllowanceType
|
|
226
|
+
} from '../fetchers/get-user-current-carbon-allowance.fetcher';
|
|
227
|
+
import { BaseWebTokenService } from './webtoken.service';
|
|
228
|
+
import {
|
|
229
|
+
BaseGetRiskAlertsFetcher,
|
|
230
|
+
GetRiskAlertsFetcherType
|
|
231
|
+
} from '../fetchers/get-risk-alerts.fetcher';
|
|
232
|
+
import { IrlTempParams } from '../interfaces/Iirl-enterprise-search';
|
|
233
|
+
import { IRLEnterpriseSearch } from '../classes/irl-enterprise-search';
|
|
234
|
+
import { FlightSearchType } from '../classes/flight-search-type.enum';
|
|
235
|
+
|
|
236
|
+
import {
|
|
237
|
+
BaseGetUserRecentSearchesFetcher,
|
|
238
|
+
GetUserRecentSearchesFetcherType
|
|
239
|
+
} from '../fetchers/get-user-recent-searches.fetcher';
|
|
240
|
+
|
|
241
|
+
import {
|
|
242
|
+
BaseGetRailcardsFetcher,
|
|
243
|
+
GetRailCardsFetcherType
|
|
244
|
+
} from '../fetchers/get-rail-cards.fetcher';
|
|
245
|
+
|
|
246
|
+
import {
|
|
247
|
+
BaseEurostarQuoteFetcher,
|
|
248
|
+
EurostarQuoteFetcherType
|
|
249
|
+
} from '../fetchers/eurostar-quote.fetcher';
|
|
250
|
+
import { EurostarEnterpriseSearch } from '../classes/eurostar-enterprise-search';
|
|
251
|
+
import { EurostarTempParams } from '../interfaces/Ieurostar-enterprise-search';
|
|
252
|
+
import EuroStations from '../data/euro-stations.json';
|
|
253
|
+
import _ from 'lodash';
|
|
254
|
+
import {
|
|
255
|
+
BaseSearchUsersCanBookForFetcher,
|
|
256
|
+
SearchUserCanBookForFetcherType
|
|
257
|
+
} from '../fetchers/search-users-can-book-for-fetcher';
|
|
258
|
+
import { EurostarSearchType } from '../classes/eurostar-search-type.enum';
|
|
259
|
+
|
|
260
|
+
export const MAX_TRAVELLERS = 8;
|
|
261
|
+
|
|
262
|
+
export enum TravellerSearchTypes {
|
|
263
|
+
email = 'email',
|
|
264
|
+
name = 'name',
|
|
265
|
+
employeeNumber = 'employeeNumber'
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
interface HighestSearchPriorityObjectInterface {
|
|
269
|
+
highest: number;
|
|
270
|
+
currentItem: SearchObject;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export class BaseEnterpriseSearchService<
|
|
274
|
+
SP_Q extends SearchPostcodesQuoteFetcherType,
|
|
275
|
+
SR_Q extends SearchRailStationsFetcherType,
|
|
276
|
+
SL_Q extends LoungeQuoteFetcherType,
|
|
277
|
+
SPA_Q extends ParkingQuoteFetcherType,
|
|
278
|
+
SFL_Q extends FlightQuoteFetcherType,
|
|
279
|
+
SHO_Q extends HotelQuoteFetcherType,
|
|
280
|
+
SCH_Q extends CarHireFetcherType,
|
|
281
|
+
CHAD_Q extends CarHireAvailabilityDetailFetcherType,
|
|
282
|
+
STH_Q extends CabhireQuoteFetcherType,
|
|
283
|
+
SA_Q extends SearchAirportsQuoteFetcherType,
|
|
284
|
+
SAL_Q extends SearchAirlinesQuoteFetcherType,
|
|
285
|
+
HA_Q extends HotelAvalinilityFetcherType,
|
|
286
|
+
SC_Q extends SearchCitiesQuoteFetcherType,
|
|
287
|
+
SCC_Q extends SearchConfermaCitiesQuoteFetcherType,
|
|
288
|
+
SRA_Q extends RailQuoteFetcherType,
|
|
289
|
+
SI_Q extends IrlQuoteFetcherType,
|
|
290
|
+
SUA_Q extends SaveUserAddressUpdaterType,
|
|
291
|
+
SU_Q extends UserAddressFetcherType,
|
|
292
|
+
GUCO_Q extends GetUserCompanyOfficesQuoteFetcherType,
|
|
293
|
+
SHC_Q extends SearchHotelChainsQuoteFetcherType,
|
|
294
|
+
IPV_Q extends ValidateIsPostcodeValidType,
|
|
295
|
+
SD_Q extends SearchDepotQuoteFetcherType,
|
|
296
|
+
GRS_Q extends GetRailStationFetcherType,
|
|
297
|
+
GON_Q extends ConfermaOfficeNameFetcherType,
|
|
298
|
+
DUA_Q extends DeleteUserAddressFetcherType,
|
|
299
|
+
DRS_Q extends DeleteRecentSearchFetcherType,
|
|
300
|
+
SRS_Q extends SaveRecentSearchFetcherType,
|
|
301
|
+
UCA_Q extends GetUserCurrentCarbonAllowanceType,
|
|
302
|
+
GRA_Q extends GetRiskAlertsFetcherType,
|
|
303
|
+
QL_Q extends ConfermaQuicklistFetcherType,
|
|
304
|
+
GURSF_Q extends GetUserRecentSearchesFetcherType,
|
|
305
|
+
GRCF_Q extends GetRailCardsFetcherType,
|
|
306
|
+
SE_Q extends EurostarQuoteFetcherType,
|
|
307
|
+
SUCBF extends SearchUserCanBookForFetcherType
|
|
308
|
+
> implements EnterpriseSearchServiceInterface {
|
|
309
|
+
static SESSION_TRAVELLER: string = 'search_travellers';
|
|
310
|
+
|
|
311
|
+
searches: SearchParams;
|
|
312
|
+
traveller_error = false;
|
|
313
|
+
travellerInformation: BehaviorSubject<Traveller[]> = new BehaviorSubject<
|
|
314
|
+
Traveller[]
|
|
315
|
+
>([]);
|
|
316
|
+
errors: BehaviorSubject<string[]> = new BehaviorSubject<string[]>([]);
|
|
317
|
+
searchLoadingDone: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(
|
|
318
|
+
false
|
|
319
|
+
);
|
|
320
|
+
searchTimedOut: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(
|
|
321
|
+
false
|
|
322
|
+
);
|
|
323
|
+
newSearchStarted: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(
|
|
324
|
+
false
|
|
325
|
+
);
|
|
326
|
+
|
|
327
|
+
firstLoad = true;
|
|
328
|
+
|
|
329
|
+
search_objects: SearchObjects;
|
|
330
|
+
highest_search_priority = 8;
|
|
331
|
+
show_errors = false;
|
|
332
|
+
travellerValidationMessages: string[] = [];
|
|
333
|
+
search_loading = false;
|
|
334
|
+
search_airport_loading = false;
|
|
335
|
+
|
|
336
|
+
private selectedTravellers: Traveller[] = [];
|
|
337
|
+
selectedPlaces: any = [];
|
|
338
|
+
countries = Countries;
|
|
339
|
+
eurostations: { gateway: string; destination: string }[] =
|
|
340
|
+
_.toArray(EuroStations);
|
|
341
|
+
|
|
342
|
+
constructor(
|
|
343
|
+
protected searchAirportsFetcher: BaseSearchAirportsFetcher<SA_Q>,
|
|
344
|
+
protected searchAirlinesFetcher: BaseSearchAirlinesFetcher<SAL_Q>,
|
|
345
|
+
protected storageService: BaseStorageService,
|
|
346
|
+
protected userService: UserServiceInterface,
|
|
347
|
+
protected router: Router,
|
|
348
|
+
protected helpers: BaseHelperRoutines,
|
|
349
|
+
protected hotelAvalibilityService: BaseHotelAvalibilityService<HA_Q>,
|
|
350
|
+
private citiesFetcher: BaseSearchCityFetcher<SC_Q>,
|
|
351
|
+
private confermaCitiesFetcher: BaseSearchConfermaCityFetcher<SCC_Q>,
|
|
352
|
+
private postcodeFetcher: BaseSearchPostcodeFetcher<SP_Q>,
|
|
353
|
+
private railStationFetcher: BaseSearchRailStationsFetcher<SR_Q>,
|
|
354
|
+
private saveUserAddressUpdater: BaseSaveUserAddressUpdater<SUA_Q>,
|
|
355
|
+
private userAddressesFetcher: BaseUserAddressesFetcher<SU_Q>,
|
|
356
|
+
private basketService: EnterpriseBasketServiceInterface,
|
|
357
|
+
private getUserCompanyOfficesFetcher: BaseGetUserCompanyOfficesFetcher<GUCO_Q>,
|
|
358
|
+
private searchHotelChainsFetcher: BaseSearchHotelChainsFetcher<SHC_Q>,
|
|
359
|
+
private baseValidateIsPostcodeValidTester: BaseValidateIsPostcodeValidTester<IPV_Q>,
|
|
360
|
+
private depotFetcher: BaseSearchDepotFetcher<SD_Q>,
|
|
361
|
+
private confermaOfficeNamesFetcher: BaseConfermaOfficeNamesFetcher<GON_Q>,
|
|
362
|
+
private baseDeleteUserAddressUpdater: BaseDeleteUserAddressUpdater<DUA_Q>,
|
|
363
|
+
private baseDeleteRecentSearchUpdater: BaseDeleteRecentSearchUpdater<DRS_Q>,
|
|
364
|
+
private baseSaveRecentSearchUpdater: BaseSaveRecentSearchUpdater<SRS_Q>,
|
|
365
|
+
private getUserCurrentCarbonAllowanceFetcher: BaseGetUserCurrentCarbonAllowanceFetcher<UCA_Q>,
|
|
366
|
+
environment: BaseEnvironment,
|
|
367
|
+
loungeFetcher: BaseLoungeQuoteFetcher<SL_Q>,
|
|
368
|
+
parkingFetcher: BaseParkingQuoteFetcher<SPA_Q>,
|
|
369
|
+
httpCallService: AbstractHttpCallService,
|
|
370
|
+
flightFetcher: BaseFlightQuoteFetcher<SFL_Q>,
|
|
371
|
+
hotelFetcher: BaseHotelQuoteFetcher<SHO_Q>,
|
|
372
|
+
carhireFetcher: BaseCarhireQuoteFetcher<SCH_Q>,
|
|
373
|
+
carHireAvailabilityDetailFetcher: BaseCarHireAvailabilityDetailFetcher<CHAD_Q>,
|
|
374
|
+
cabhireFetcher: BaseCabhireQuoteFetcher<STH_Q>,
|
|
375
|
+
railFetcher: BaseRailQuoteFetcher<SRA_Q>,
|
|
376
|
+
irlFetcher: BaseIrlQuoteFetcher<SI_Q>,
|
|
377
|
+
protected getRailStationFetcher: BaseGetRailStationFetcher<GRS_Q>,
|
|
378
|
+
baseWebTokenService: BaseWebTokenService,
|
|
379
|
+
private riskAlertsFetcher: BaseGetRiskAlertsFetcher<GRA_Q>,
|
|
380
|
+
private quicklistFetcher: BaseSearchConfermaQuicklistFetcher<QL_Q>,
|
|
381
|
+
private getUserRecentSearchesFetcher: BaseGetUserRecentSearchesFetcher<GURSF_Q>,
|
|
382
|
+
protected getRailCardsFetcher: BaseGetRailcardsFetcher<GRCF_Q>,
|
|
383
|
+
eurostarFetcher: BaseEurostarQuoteFetcher<SE_Q>,
|
|
384
|
+
public searchUsersCanBookForFetcher: BaseSearchUsersCanBookForFetcher<SUCBF>
|
|
385
|
+
) {
|
|
386
|
+
console.log('Enterpise search service being inited');
|
|
387
|
+
this.searches = {
|
|
388
|
+
[ServiceType.Lounge]: new LoungesEnterpriseSearch(
|
|
389
|
+
loungeFetcher,
|
|
390
|
+
helpers,
|
|
391
|
+
basketService,
|
|
392
|
+
storageService,
|
|
393
|
+
this
|
|
394
|
+
),
|
|
395
|
+
[ServiceType.Parking]: new ParkingEnterpriseSearch(
|
|
396
|
+
parkingFetcher,
|
|
397
|
+
helpers,
|
|
398
|
+
basketService,
|
|
399
|
+
storageService,
|
|
400
|
+
this
|
|
401
|
+
),
|
|
402
|
+
[ServiceType.Flight]: new FlightEnterpriseSearch(
|
|
403
|
+
flightFetcher,
|
|
404
|
+
helpers,
|
|
405
|
+
userService,
|
|
406
|
+
basketService,
|
|
407
|
+
storageService,
|
|
408
|
+
this
|
|
409
|
+
),
|
|
410
|
+
[ServiceType.Hotel]: new HotelEnterpriseSearch(
|
|
411
|
+
hotelFetcher,
|
|
412
|
+
helpers,
|
|
413
|
+
userService,
|
|
414
|
+
environment,
|
|
415
|
+
hotelAvalibilityService,
|
|
416
|
+
basketService,
|
|
417
|
+
storageService,
|
|
418
|
+
this,
|
|
419
|
+
httpCallService,
|
|
420
|
+
quicklistFetcher,
|
|
421
|
+
getRailStationFetcher
|
|
422
|
+
),
|
|
423
|
+
[ServiceType.Car]: new CarhireEnterpriseSearch(
|
|
424
|
+
carhireFetcher,
|
|
425
|
+
carHireAvailabilityDetailFetcher,
|
|
426
|
+
helpers,
|
|
427
|
+
basketService,
|
|
428
|
+
storageService,
|
|
429
|
+
this
|
|
430
|
+
),
|
|
431
|
+
[ServiceType.Cab]: new CabHireEnterpriseSearch(
|
|
432
|
+
cabhireFetcher,
|
|
433
|
+
helpers,
|
|
434
|
+
storageService,
|
|
435
|
+
this,
|
|
436
|
+
basketService
|
|
437
|
+
),
|
|
438
|
+
[ServiceType.InternationalRail]: new IRLEnterpriseSearch(
|
|
439
|
+
irlFetcher,
|
|
440
|
+
// getRailStationFetcher,
|
|
441
|
+
helpers,
|
|
442
|
+
basketService,
|
|
443
|
+
storageService,
|
|
444
|
+
this
|
|
445
|
+
),
|
|
446
|
+
[ServiceType.FastTrack]: null,
|
|
447
|
+
[ServiceType.Coach]: null,
|
|
448
|
+
[ServiceType.Rail]: new RailEnterpriseSearch(
|
|
449
|
+
railFetcher,
|
|
450
|
+
getRailStationFetcher,
|
|
451
|
+
helpers,
|
|
452
|
+
basketService,
|
|
453
|
+
storageService,
|
|
454
|
+
this
|
|
455
|
+
),
|
|
456
|
+
[ServiceType.Eurostar]: new EurostarEnterpriseSearch(
|
|
457
|
+
eurostarFetcher,
|
|
458
|
+
helpers,
|
|
459
|
+
userService,
|
|
460
|
+
basketService,
|
|
461
|
+
storageService,
|
|
462
|
+
this
|
|
463
|
+
)
|
|
464
|
+
};
|
|
465
|
+
console.log('Newly created search objects: ', this.searches);
|
|
466
|
+
this.search_objects = this.helpers.clone(this.init_search_objects());
|
|
467
|
+
this.selectedTravellers = this.storageService.getSessionItemAsList<
|
|
468
|
+
Traveller[]
|
|
469
|
+
>(BaseEnterpriseSearchService.SESSION_TRAVELLER);
|
|
470
|
+
this.travellerInformation.next(this.selectedTravellers);
|
|
471
|
+
userService.fullUserDetails.userServices.subscribe(
|
|
472
|
+
(services: UserServices) => {
|
|
473
|
+
if (services) {
|
|
474
|
+
this.search_objects = Object.keys(this.search_objects).reduce(
|
|
475
|
+
(objects: SearchObjects, key: string) => {
|
|
476
|
+
(objects as Record<string, any>)[key].enabled =
|
|
477
|
+
!!services && !!services[key];
|
|
478
|
+
return objects;
|
|
479
|
+
},
|
|
480
|
+
this.search_objects
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
);
|
|
485
|
+
|
|
486
|
+
if (Array.isArray(this.countries)) {
|
|
487
|
+
this.countries = this.countries.sort((a, b) => {
|
|
488
|
+
if (a.cName < b.cName) {
|
|
489
|
+
return -1;
|
|
490
|
+
}
|
|
491
|
+
if (a.cName > b.cName) {
|
|
492
|
+
return 1;
|
|
493
|
+
}
|
|
494
|
+
return 0;
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
baseWebTokenService.autoLogoutConfig = this.getAutoLogoutConfig();
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
reset() {
|
|
502
|
+
Object.values(this.searches).forEach(
|
|
503
|
+
(item: BaseEnterpriseSearch<any, any, any[]>) => {
|
|
504
|
+
item?.reset();
|
|
505
|
+
}
|
|
506
|
+
);
|
|
507
|
+
this.removeAllTravellers();
|
|
508
|
+
this.basketService.reset();
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
getUserCurrentCarbonAllowance(
|
|
512
|
+
user?: string,
|
|
513
|
+
isLoading?: BehaviorSubject<boolean>
|
|
514
|
+
): Observable<CarbonAllowance> {
|
|
515
|
+
if (isLoading) {
|
|
516
|
+
isLoading.next(true);
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
const query = { user };
|
|
520
|
+
return this.getUserCurrentCarbonAllowanceFetcher.fetchList(query).pipe(
|
|
521
|
+
take(1),
|
|
522
|
+
map((results: CarbonAllowance) => {
|
|
523
|
+
return results;
|
|
524
|
+
})
|
|
525
|
+
);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
getRiskAlerts(
|
|
529
|
+
minLevel: RiskLevel,
|
|
530
|
+
maxLevel: RiskLevel,
|
|
531
|
+
countryIsoCode: string,
|
|
532
|
+
isLoading?: BehaviorSubject<boolean>,
|
|
533
|
+
airport?: Airport,
|
|
534
|
+
railStation?: RailStation,
|
|
535
|
+
airportIata?: string
|
|
536
|
+
): Observable<RiskAlert[]> {
|
|
537
|
+
if (isLoading) {
|
|
538
|
+
isLoading.next(true);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
const query: GetRiskAlertsQueryVariables = {
|
|
542
|
+
minLevel,
|
|
543
|
+
maxLevel,
|
|
544
|
+
countryIsoCode
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
return this.riskAlertsFetcher.fetchList(query).pipe(
|
|
548
|
+
take(1),
|
|
549
|
+
map((result: RiskAlert[]) => {
|
|
550
|
+
if (isLoading) {
|
|
551
|
+
isLoading.next(false);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
return result;
|
|
555
|
+
})
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
getAirportsList(
|
|
560
|
+
term: string,
|
|
561
|
+
countryCode?: CountryCode,
|
|
562
|
+
isLoading?: BehaviorSubject<boolean>,
|
|
563
|
+
hasLounge?: boolean,
|
|
564
|
+
hasParking?: boolean,
|
|
565
|
+
hasFastTrack?: boolean
|
|
566
|
+
): Observable<OBTAirportDetails[]> {
|
|
567
|
+
if (term.length > 2) {
|
|
568
|
+
if (isLoading) {
|
|
569
|
+
isLoading.next(true);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
const query: SearchAirports.Variables = { query: term };
|
|
573
|
+
if (!!countryCode) {
|
|
574
|
+
query.countryCode = countryCode;
|
|
575
|
+
}
|
|
576
|
+
if (typeof hasLounge === 'boolean') {
|
|
577
|
+
query.hasLounge = hasLounge;
|
|
578
|
+
}
|
|
579
|
+
if (typeof hasParking === 'boolean') {
|
|
580
|
+
query.hasParking = hasParking;
|
|
581
|
+
}
|
|
582
|
+
if (typeof hasFastTrack === 'boolean') {
|
|
583
|
+
query.hasFastTrack = hasFastTrack;
|
|
584
|
+
}
|
|
585
|
+
return this.searchAirportsFetcher.fetchOne(query).pipe(
|
|
586
|
+
take(1),
|
|
587
|
+
map((results: AirportSearchResults) => {
|
|
588
|
+
if (isLoading) {
|
|
589
|
+
isLoading.next(false);
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
if (results && results.generalMatches) {
|
|
593
|
+
const generalMatches = this.helpers.clone(results.generalMatches);
|
|
594
|
+
|
|
595
|
+
// Removing this as this creates duplicate airports in the list
|
|
596
|
+
// if (results.iataMatch) {
|
|
597
|
+
// generalMatches.push(results.iataMatch);
|
|
598
|
+
// }
|
|
599
|
+
return (
|
|
600
|
+
generalMatches
|
|
601
|
+
// .filter((airport: AirportResult) => {
|
|
602
|
+
// return !!countryCode
|
|
603
|
+
// ? countryCode === airport.details.countryCode
|
|
604
|
+
// : airport;
|
|
605
|
+
// })
|
|
606
|
+
.map((airport: Airport): OBTAirportDetails => {
|
|
607
|
+
return {
|
|
608
|
+
destination: airport.name,
|
|
609
|
+
gateway: airport.iata,
|
|
610
|
+
terminals: this.processTerminals(airport.terminals),
|
|
611
|
+
country: airport?.locationDetails?.country,
|
|
612
|
+
postcode: airport?.locationDetails?.postcode,
|
|
613
|
+
countryCode: airport?.locationDetails?.countryCode
|
|
614
|
+
};
|
|
615
|
+
})
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
})
|
|
619
|
+
);
|
|
620
|
+
} else {
|
|
621
|
+
return of([]);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
getAirlinesList(
|
|
625
|
+
term: string,
|
|
626
|
+
isLoading?: BehaviorSubject<boolean>
|
|
627
|
+
): Observable<OBTAirlinesDetails[]> {
|
|
628
|
+
if (term.length >= 2) {
|
|
629
|
+
if (isLoading) {
|
|
630
|
+
isLoading.next(true);
|
|
631
|
+
}
|
|
632
|
+
const query: SearchAirlines.Variables = { query: term };
|
|
633
|
+
return this.searchAirlinesFetcher.fetchOne(query).pipe(
|
|
634
|
+
take(1),
|
|
635
|
+
map((results: AirlinesSearchResult) => {
|
|
636
|
+
if (isLoading) {
|
|
637
|
+
isLoading.next(false);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
if (results && results.generalMatches) {
|
|
641
|
+
const generalMatches = this.helpers.clone(results.generalMatches);
|
|
642
|
+
return generalMatches.map(
|
|
643
|
+
(airlines: AirlineResult): OBTAirlinesDetails => {
|
|
644
|
+
return {
|
|
645
|
+
code: airlines.iata,
|
|
646
|
+
name: airlines.name
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
);
|
|
650
|
+
}
|
|
651
|
+
})
|
|
652
|
+
);
|
|
653
|
+
} else {
|
|
654
|
+
return of([]);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
getAirportLocations(
|
|
658
|
+
term: string,
|
|
659
|
+
countryCode: CountryCode,
|
|
660
|
+
isLoading?: BehaviorSubject<boolean>,
|
|
661
|
+
hasLounge?: boolean,
|
|
662
|
+
hasParking?: boolean,
|
|
663
|
+
hasFastTrack?: boolean
|
|
664
|
+
): Observable<LocationDetails[]> {
|
|
665
|
+
const convert = (results: OBTAirportDetails[]): LocationDetails[] => {
|
|
666
|
+
return results.map((result: OBTAirportDetails) => {
|
|
667
|
+
return {
|
|
668
|
+
name: result.destination,
|
|
669
|
+
type: LocationTypes.Airport,
|
|
670
|
+
airport: result
|
|
671
|
+
};
|
|
672
|
+
});
|
|
673
|
+
};
|
|
674
|
+
return this.getAirportsList(
|
|
675
|
+
term,
|
|
676
|
+
countryCode,
|
|
677
|
+
isLoading,
|
|
678
|
+
hasLounge,
|
|
679
|
+
hasParking,
|
|
680
|
+
hasFastTrack
|
|
681
|
+
).pipe(map(convert));
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
getCityLocations(
|
|
685
|
+
term: string,
|
|
686
|
+
countryCode?: CountryCode,
|
|
687
|
+
isLoading?: BehaviorSubject<boolean>,
|
|
688
|
+
isConfirma?: boolean
|
|
689
|
+
): Observable<LocationDetails[]> {
|
|
690
|
+
if (term.length <= 2) {
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
if (isConfirma) {
|
|
694
|
+
return this.getConfermaCityLocations(term, countryCode, isLoading);
|
|
695
|
+
} else {
|
|
696
|
+
return this._getCityLocations(term, countryCode, isLoading);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
_getCityLocations(
|
|
701
|
+
term: string,
|
|
702
|
+
countryCode?: CountryCode,
|
|
703
|
+
isLoading?: BehaviorSubject<boolean>
|
|
704
|
+
): Observable<LocationDetails[]> {
|
|
705
|
+
isLoading?.next(true);
|
|
706
|
+
const query: any = { query: term };
|
|
707
|
+
if (countryCode) {
|
|
708
|
+
query.countryCode = countryCode;
|
|
709
|
+
}
|
|
710
|
+
const obs: Observable<SearchCitiesResultArray> =
|
|
711
|
+
this.citiesFetcher.fetchList(query);
|
|
712
|
+
const func = (results: SearchCitiesResultArray): LocationDetails[] => {
|
|
713
|
+
const data: LocationDetails[] = results.map(
|
|
714
|
+
(result: SearchCitiesResult): LocationDetails => {
|
|
715
|
+
return {
|
|
716
|
+
name: result.name,
|
|
717
|
+
longitude: result.coordinates.longitude,
|
|
718
|
+
latitude: result.coordinates.latitude,
|
|
719
|
+
type: LocationTypes.City,
|
|
720
|
+
countryCode: result.countryCode,
|
|
721
|
+
id: result.id
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
);
|
|
725
|
+
isLoading?.next(false);
|
|
726
|
+
return data;
|
|
727
|
+
};
|
|
728
|
+
return obs.pipe(take(1), map(func));
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
private getConfermaCityLocations(
|
|
732
|
+
term: string,
|
|
733
|
+
countryCode?: CountryCode,
|
|
734
|
+
isLoading?: BehaviorSubject<boolean>
|
|
735
|
+
): Observable<LocationDetails[]> {
|
|
736
|
+
isLoading?.next(true);
|
|
737
|
+
const query: any = { cityName: term };
|
|
738
|
+
if (countryCode) {
|
|
739
|
+
query.countryCode = countryCode;
|
|
740
|
+
}
|
|
741
|
+
const obs: Observable<SearchConfermaCitiesResult> =
|
|
742
|
+
this.confermaCitiesFetcher.fetchOne(query);
|
|
743
|
+
const func = (results: SearchConfermaCitiesResult): LocationDetails[] => {
|
|
744
|
+
const data: LocationDetails[] = results.suggestions.map(
|
|
745
|
+
(result): LocationDetails => {
|
|
746
|
+
return {
|
|
747
|
+
name: result.name,
|
|
748
|
+
longitude: result.longitude,
|
|
749
|
+
latitude: result.latitude,
|
|
750
|
+
type: LocationTypes.City,
|
|
751
|
+
countryCode: result.countryCode
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
);
|
|
755
|
+
isLoading?.next(false);
|
|
756
|
+
return data;
|
|
757
|
+
};
|
|
758
|
+
return obs.pipe(take(1), map(func));
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* @description - get car hire depots based on city cords
|
|
763
|
+
*/
|
|
764
|
+
getCarHireDepots(
|
|
765
|
+
latitude: number,
|
|
766
|
+
longitude: number,
|
|
767
|
+
isLoading?: BehaviorSubject<boolean>
|
|
768
|
+
): Observable<CarHireDepotResultArray> {
|
|
769
|
+
isLoading?.next(true);
|
|
770
|
+
|
|
771
|
+
const obs: Observable<CarHireDepotResultArray> =
|
|
772
|
+
this.depotFetcher.fetchList({ latitude, longitude });
|
|
773
|
+
|
|
774
|
+
const func = (
|
|
775
|
+
results: CarHireDepotResultArray
|
|
776
|
+
): CarHireDepotResultArray => {
|
|
777
|
+
const data: CarHireDepotResultArray = results.map(
|
|
778
|
+
(result: CarHireDepot): CarHireDepot => {
|
|
779
|
+
console.log(result);
|
|
780
|
+
return result;
|
|
781
|
+
}
|
|
782
|
+
);
|
|
783
|
+
isLoading?.next(false);
|
|
784
|
+
return data;
|
|
785
|
+
};
|
|
786
|
+
return obs; // .pipe(take(1), map(func));
|
|
787
|
+
|
|
788
|
+
// return of([]);
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* @description - get postcode locations, these will use partial postcode,
|
|
793
|
+
* full and then grabbing them will let us fill in the address form
|
|
794
|
+
* @todo - fill this out for the other location types, may need to mergeMap them or some other rxjs magic
|
|
795
|
+
* @param term - the term to search by e.g. 'wa14' should bring back, our office, 'm33' shoiuld bring back my addrs
|
|
796
|
+
*/
|
|
797
|
+
getPostcodeList(term: string): Observable<LocationDetails[]> {
|
|
798
|
+
if (RegExps.UK_POSTCODE.test(term)) {
|
|
799
|
+
const subs = this.postcodeFetcher.fetchList({ postcode: term }).pipe(
|
|
800
|
+
map((results: SearchPostcodesResultArray) => {
|
|
801
|
+
return results.map(
|
|
802
|
+
(result: SearchPostcodesResult): LocationDetails => {
|
|
803
|
+
return {
|
|
804
|
+
name: result.postcode,
|
|
805
|
+
type: LocationTypes.Postcode,
|
|
806
|
+
latitude: result.latitude,
|
|
807
|
+
longitude: result.longitude
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
);
|
|
811
|
+
})
|
|
812
|
+
); // expand this with the other searches when they are done
|
|
813
|
+
|
|
814
|
+
return subs;
|
|
815
|
+
} else {
|
|
816
|
+
return of([]);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
addToSelectedPlaces(address: Address): void {
|
|
821
|
+
this.selectedPlaces.push(address);
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
getSelectedPlaceById(placeId: string): Address {
|
|
825
|
+
return this.selectedPlaces.find(
|
|
826
|
+
(place: { place_id: string }) => place.place_id === placeId
|
|
827
|
+
);
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
/*
|
|
831
|
+
* @description - get the list of Office locations based on search term given
|
|
832
|
+
* @todo - fill this out so that it actually performs a http call
|
|
833
|
+
* @param term - the term we want to search by
|
|
834
|
+
* @returns
|
|
835
|
+
*/
|
|
836
|
+
getOfficeLocations(term: string): Observable<LocationDetails[]> {
|
|
837
|
+
if (term.length > 2) {
|
|
838
|
+
const obs: Observable<GetUserCompanyOfficesResultArray> =
|
|
839
|
+
this.getUserCompanyOfficesFetcher.fetchList();
|
|
840
|
+
const func = (
|
|
841
|
+
results: GetUserCompanyOfficesResultArray
|
|
842
|
+
): LocationDetails[] => {
|
|
843
|
+
const data: LocationDetails[] = results.map(
|
|
844
|
+
(result: GetUserCompanyOfficesResult): LocationDetails => {
|
|
845
|
+
return {
|
|
846
|
+
name: result.name,
|
|
847
|
+
office: result.addresses[0],
|
|
848
|
+
type: LocationTypes.Office
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
);
|
|
852
|
+
return data;
|
|
853
|
+
};
|
|
854
|
+
return obs.pipe(take(1), map(func));
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
return of([]);
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
getStationLocations(
|
|
861
|
+
term: string,
|
|
862
|
+
isLoading?: BehaviorSubject<boolean>
|
|
863
|
+
): Observable<LocationDetails[]> {
|
|
864
|
+
if (term.length > 2) {
|
|
865
|
+
isLoading?.next(true);
|
|
866
|
+
return this.railStationFetcher
|
|
867
|
+
.fetchList({
|
|
868
|
+
query: term
|
|
869
|
+
})
|
|
870
|
+
.pipe(
|
|
871
|
+
take(1),
|
|
872
|
+
map((results: SearchRailStationsResultArray): LocationDetails[] => {
|
|
873
|
+
if (isLoading) {
|
|
874
|
+
isLoading.next(false);
|
|
875
|
+
}
|
|
876
|
+
return results.map((result: SearchRailStationsResult) => {
|
|
877
|
+
return {
|
|
878
|
+
type: LocationTypes.TrainStation,
|
|
879
|
+
name: result.name,
|
|
880
|
+
railstation: result
|
|
881
|
+
};
|
|
882
|
+
});
|
|
883
|
+
})
|
|
884
|
+
);
|
|
885
|
+
} else {
|
|
886
|
+
return of([]);
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* @description - get hotel locations, these should be city, office, airport, railstation
|
|
891
|
+
* @todo - fill this out for the other location types, may need to mergeMap them or some other rxjs magic
|
|
892
|
+
* @param term - the term to search by e.g. 'Man' should bring back, manchester, manchester airport, manchester picadilly, etc
|
|
893
|
+
*/
|
|
894
|
+
getHotelLocationsList(
|
|
895
|
+
term: string,
|
|
896
|
+
countryCode: CountryCode,
|
|
897
|
+
isLoading?: BehaviorSubject<boolean>
|
|
898
|
+
): Observable<LocationDetails[]> {
|
|
899
|
+
if (term.length > 2) {
|
|
900
|
+
if (RegExps.UK_POSTCODE.test(term)) {
|
|
901
|
+
return this.getPostcodeList(term);
|
|
902
|
+
} else {
|
|
903
|
+
if (!isLoading?.value) {
|
|
904
|
+
isLoading.next(true);
|
|
905
|
+
}
|
|
906
|
+
const subs = forkJoin([
|
|
907
|
+
this.getAirportLocations(term, countryCode, isLoading),
|
|
908
|
+
this.getCityLocations(term, countryCode, isLoading),
|
|
909
|
+
this.getStationLocations(term, isLoading),
|
|
910
|
+
this.getOfficeLocations(term)
|
|
911
|
+
]).pipe(
|
|
912
|
+
map((results: any[]) => {
|
|
913
|
+
if (isLoading?.value) {
|
|
914
|
+
isLoading.next(false);
|
|
915
|
+
}
|
|
916
|
+
return results.reduce((accum: LocationDetails[], result: any) => {
|
|
917
|
+
accum.push(...result);
|
|
918
|
+
return accum;
|
|
919
|
+
}, []);
|
|
920
|
+
})
|
|
921
|
+
); // expand this with the other searches when they are done
|
|
922
|
+
return subs;
|
|
923
|
+
}
|
|
924
|
+
} else {
|
|
925
|
+
return of([]);
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
getStationsAndAirportsList(
|
|
930
|
+
term: string,
|
|
931
|
+
countryCode: CountryCode,
|
|
932
|
+
isLoading?: BehaviorSubject<boolean>
|
|
933
|
+
): Observable<LocationDetails[]> {
|
|
934
|
+
if (term.length > 2) {
|
|
935
|
+
if (!isLoading?.value) {
|
|
936
|
+
isLoading.next(true);
|
|
937
|
+
}
|
|
938
|
+
const subs = forkJoin([
|
|
939
|
+
this.getAirportLocations(term, countryCode, isLoading),
|
|
940
|
+
this.getStationLocations(term, isLoading)
|
|
941
|
+
]).pipe(
|
|
942
|
+
map((results: any[]) => {
|
|
943
|
+
if (isLoading?.value) {
|
|
944
|
+
isLoading.next(false);
|
|
945
|
+
}
|
|
946
|
+
return results.reduce((accum: any[], result: any[]) => {
|
|
947
|
+
accum.push(...result);
|
|
948
|
+
return accum;
|
|
949
|
+
}, []);
|
|
950
|
+
})
|
|
951
|
+
); // expand this with the other searches when they are done
|
|
952
|
+
return subs;
|
|
953
|
+
} else {
|
|
954
|
+
return of([]);
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
/*
|
|
959
|
+
@desc - remove a specified traveller from the selected array
|
|
960
|
+
**/
|
|
961
|
+
removeTraveller(traveller: Traveller): void {
|
|
962
|
+
this._removeTraveller(traveller);
|
|
963
|
+
|
|
964
|
+
this.storageService.setSessionItem(
|
|
965
|
+
BaseEnterpriseSearchService.SESSION_TRAVELLER,
|
|
966
|
+
this.selectedTravellers
|
|
967
|
+
);
|
|
968
|
+
this.updateTravellerInformation();
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
_removeTraveller(traveller: Traveller) {
|
|
972
|
+
this.selectedTravellers = this.selectedTravellers.filter(
|
|
973
|
+
(travellerToTest: Traveller) => {
|
|
974
|
+
return !TravellerObject.equals(travellerToTest, traveller);
|
|
975
|
+
}
|
|
976
|
+
);
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
removeAllTravellers(): void {
|
|
980
|
+
console.log('remove all travellers called!');
|
|
981
|
+
console.log(this.selectedTravellers);
|
|
982
|
+
if (!this.selectedTravellers) {
|
|
983
|
+
this.selectedTravellers = [];
|
|
984
|
+
}
|
|
985
|
+
this.selectedTravellers.forEach((traveller: Traveller) => {
|
|
986
|
+
this._removeTraveller(traveller);
|
|
987
|
+
});
|
|
988
|
+
|
|
989
|
+
this.storageService.setSessionItem(
|
|
990
|
+
BaseEnterpriseSearchService.SESSION_TRAVELLER,
|
|
991
|
+
this.selectedTravellers
|
|
992
|
+
);
|
|
993
|
+
this.updateTravellerInformation();
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
addTraveller(traveller: Traveller) {
|
|
997
|
+
if (
|
|
998
|
+
!this.travellerAlreadyAdded(traveller) &&
|
|
999
|
+
!this.currentNoOfTravellersGreaterOrEqualToMax()
|
|
1000
|
+
) {
|
|
1001
|
+
this.selectedTravellers.push(traveller);
|
|
1002
|
+
this.storageService.setSessionItem(
|
|
1003
|
+
BaseEnterpriseSearchService.SESSION_TRAVELLER,
|
|
1004
|
+
this.selectedTravellers
|
|
1005
|
+
);
|
|
1006
|
+
this.updateTravellerInformation();
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
currentNoOfTravellersGreaterOrEqualToMax(): boolean {
|
|
1010
|
+
return this.selectedTravellers.length >= this.maxTravellers();
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
maxTravellers(): number {
|
|
1014
|
+
return /*this.userService.useTravellerProfile &&*/ this.canUseTravellerProfile()
|
|
1015
|
+
? 1
|
|
1016
|
+
: MAX_TRAVELLERS;
|
|
1017
|
+
}
|
|
1018
|
+
/*
|
|
1019
|
+
@desc - helper function - determines if a selected traveller is already added -
|
|
1020
|
+
used to prevent same traveller being added more than once
|
|
1021
|
+
**/
|
|
1022
|
+
travellerAlreadyAdded(traveller: Traveller): boolean {
|
|
1023
|
+
// iterate through the selected travellers and return true if found, false other wise
|
|
1024
|
+
return !!this.selectedTravellers.find((travellers: Traveller) =>
|
|
1025
|
+
TravellerObject.equals(travellers, traveller)
|
|
1026
|
+
);
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
canUseTravellerProfile(): boolean {
|
|
1030
|
+
/*
|
|
1031
|
+
if (this.userService.isUserFavoriteSet(UserFavorurite.DontUseTravellerPolicy)) {
|
|
1032
|
+
return false;
|
|
1033
|
+
}
|
|
1034
|
+
const user = this.userService.getUserDetails();
|
|
1035
|
+
return (
|
|
1036
|
+
this.selectedTravellers.length === 1 &&
|
|
1037
|
+
!this.selectedTravellers[0]
|
|
1038
|
+
.guest /*&&
|
|
1039
|
+
this.selectedTravellers[0].pax_id &&
|
|
1040
|
+
this.selectedTravellers[0].pax_id !== user.PaxId
|
|
1041
|
+
);*/
|
|
1042
|
+
return false;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
getCurrentNoOfTravellers(): number {
|
|
1046
|
+
return this.selectedTravellers.length;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
updateTravellerInformation() {
|
|
1050
|
+
this.storageService.setSessionItem(
|
|
1051
|
+
BaseEnterpriseSearchService.SESSION_TRAVELLER,
|
|
1052
|
+
this.selectedTravellers
|
|
1053
|
+
);
|
|
1054
|
+
this.travellerInformation.next([...this.selectedTravellers]);
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
/*
|
|
1058
|
+
* @desc - determine and return the highest priority value,
|
|
1059
|
+
* the highest is based on the priority value of the search type,
|
|
1060
|
+
* if it is chosen and if the booking has not been chosen
|
|
1061
|
+
**/
|
|
1062
|
+
determineHighestSearchPriority(): number {
|
|
1063
|
+
return (this.highest_search_priority =
|
|
1064
|
+
this._getHighestSearchPriorityObject().highest);
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
getHighestSearchPriorityObject(
|
|
1068
|
+
basketItems: Record<ServiceType, BasketItem>
|
|
1069
|
+
): SearchObject {
|
|
1070
|
+
return this._getHighestSearchPriorityObject(basketItems).currentItem;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
private _getHighestSearchPriorityObject(
|
|
1074
|
+
basketItems: Record<ServiceType, BasketItem> = {} as Record<
|
|
1075
|
+
ServiceType,
|
|
1076
|
+
BasketItem
|
|
1077
|
+
>
|
|
1078
|
+
): HighestSearchPriorityObjectInterface {
|
|
1079
|
+
return Object.values(this.search_objects).reduce(
|
|
1080
|
+
({ highest, currentItem }, item: SearchObject) => {
|
|
1081
|
+
if (item.chosen && item.priority < highest) {
|
|
1082
|
+
if (!basketItems[item.type as ServiceType]) {
|
|
1083
|
+
return { highest: item.priority, currentItem: item };
|
|
1084
|
+
} else {
|
|
1085
|
+
item.chosen = false;
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
return { highest, currentItem };
|
|
1089
|
+
},
|
|
1090
|
+
{ highest: Number.MAX_SAFE_INTEGER, currentItem: null }
|
|
1091
|
+
);
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
getSelectedOptions(): ServiceType[] {
|
|
1095
|
+
return Object.keys(this.search_objects).reduce((cv, itemIndex) => {
|
|
1096
|
+
if ((this.search_objects as Record<string, any>)[itemIndex].chosen) {
|
|
1097
|
+
cv.push(itemIndex as ServiceType);
|
|
1098
|
+
}
|
|
1099
|
+
return cv;
|
|
1100
|
+
}, []);
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
/**
|
|
1104
|
+
* Checks if selected travellers contains any guests without all of details
|
|
1105
|
+
*/
|
|
1106
|
+
hasSimpleGuests(): boolean {
|
|
1107
|
+
/*return !!this.selectedTravellers.find(({ guest, phone, nationality, email }) => {
|
|
1108
|
+
return guest && !(!!email && !!phone && !!nationality);
|
|
1109
|
+
});*/
|
|
1110
|
+
return false;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
/**
|
|
1114
|
+
* @description - set the search objects to the get me there objects - called before starting the get me there searches
|
|
1115
|
+
*/
|
|
1116
|
+
setGetMeThereSearchObjects(): void {
|
|
1117
|
+
console.log('+++ Setting GetMeThere Search Objects +++');
|
|
1118
|
+
this.search_objects = this.helpers.clone(this.getMeThereSearchObjects());
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
resetSearchParams(): void {
|
|
1122
|
+
console.log('Reseting Search Params!');
|
|
1123
|
+
this.search_objects = this.helpers.clone(this.init_search_objects());
|
|
1124
|
+
this.storageService.setSessionItem(
|
|
1125
|
+
BaseEnterpriseSearchService.SESSION_TRAVELLER,
|
|
1126
|
+
this.search_objects
|
|
1127
|
+
);
|
|
1128
|
+
Object.values(this.searches).forEach(
|
|
1129
|
+
(productSearchService: BaseEnterpriseSearch<any, any, any[]>) => {
|
|
1130
|
+
productSearchService.reset();
|
|
1131
|
+
}
|
|
1132
|
+
);
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
canSearch(type: ServiceType | string): boolean {
|
|
1136
|
+
// check that the selected type is chosen, has highest priority and has not already had a booking chosen
|
|
1137
|
+
|
|
1138
|
+
this.determineHighestSearchPriority();
|
|
1139
|
+
// firstly check that the type of search exists
|
|
1140
|
+
if ((this.search_objects as Record<string, any>)[type]) {
|
|
1141
|
+
console.log('can search here');
|
|
1142
|
+
// now check that the type is chosen has highest priority
|
|
1143
|
+
if (
|
|
1144
|
+
(this.search_objects as Record<string, any>)[type].chosen &&
|
|
1145
|
+
this.hasHighestSearchPriority(
|
|
1146
|
+
(this.search_objects as Record<string, any>)[type].priority
|
|
1147
|
+
)
|
|
1148
|
+
) {
|
|
1149
|
+
console.log(type + ' can be searched');
|
|
1150
|
+
return true;
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
return false;
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
hasHighestSearchPriority(priorityVal: number): boolean {
|
|
1157
|
+
this.determineHighestSearchPriority();
|
|
1158
|
+
return priorityVal <= this.highest_search_priority;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
/*
|
|
1162
|
+
* @desc - concatinats all the validation messages across all selected types +
|
|
1163
|
+
* travellers (or will do when it's complete) TODO - add Flight, Rail Car
|
|
1164
|
+
**/
|
|
1165
|
+
getAllErrorMessages(): string[] {
|
|
1166
|
+
const concattedErrors: string[] = this.travellerValidationMessages;
|
|
1167
|
+
if (
|
|
1168
|
+
this.search_objects[ServiceType.Lounge].chosen &&
|
|
1169
|
+
this.canSearch(ServiceType.Lounge)
|
|
1170
|
+
) {
|
|
1171
|
+
concattedErrors.push(
|
|
1172
|
+
...this.searches[ServiceType.Lounge].validationMessages
|
|
1173
|
+
);
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
if (
|
|
1177
|
+
this.search_objects[ServiceType.Car].chosen &&
|
|
1178
|
+
this.canSearch(ServiceType.Car)
|
|
1179
|
+
) {
|
|
1180
|
+
concattedErrors.push(
|
|
1181
|
+
...this.searches[ServiceType.Car].validationMessages
|
|
1182
|
+
);
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
if (
|
|
1186
|
+
this.search_objects[ServiceType.Rail].chosen &&
|
|
1187
|
+
this.canSearch(ServiceType.Rail)
|
|
1188
|
+
) {
|
|
1189
|
+
concattedErrors.push(
|
|
1190
|
+
...this.searches[ServiceType.Rail].validationMessages
|
|
1191
|
+
);
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
if (
|
|
1195
|
+
this.search_objects[ServiceType.Parking].chosen &&
|
|
1196
|
+
this.canSearch(ServiceType.Parking)
|
|
1197
|
+
) {
|
|
1198
|
+
concattedErrors.push(
|
|
1199
|
+
...this.searches[ServiceType.Parking].validationMessages
|
|
1200
|
+
);
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
if (
|
|
1204
|
+
this.search_objects[ServiceType.Cab].chosen &&
|
|
1205
|
+
this.canSearch(ServiceType.Cab)
|
|
1206
|
+
) {
|
|
1207
|
+
concattedErrors.push(
|
|
1208
|
+
...this.searches[ServiceType.Cab].validationMessages
|
|
1209
|
+
);
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
if (
|
|
1213
|
+
this.search_objects[ServiceType.Hotel].chosen &&
|
|
1214
|
+
this.canSearch(ServiceType.Hotel)
|
|
1215
|
+
) {
|
|
1216
|
+
concattedErrors.push(
|
|
1217
|
+
...this.searches[ServiceType.Hotel].validationMessages
|
|
1218
|
+
);
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
/*
|
|
1222
|
+
if (this.search_objects.hotel.chosen && this.canSearch(TravelTypeEnum.HOTEL)) {
|
|
1223
|
+
concattedErrors = concattedErrors.concat(this.hotel.validationMessages);
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
|
|
1227
|
+
|
|
1228
|
+
if (this.search_objects.flight.chosen && this.canSearch(TravelTypeEnum.FLIGHT)) {
|
|
1229
|
+
concattedErrors = concattedErrors.concat(this.flight.validationMessages);
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
if (this.search_objects.parking.chosen && this.canSearch(TravelTypeEnum.AIR_PARKING)) {
|
|
1233
|
+
concattedErrors.push(...this.parking.validationMessages);
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
if (this.search_objects.taxi.chosen && this.canSearch(TravelTypeEnum.TAXI)) {
|
|
1237
|
+
concattedErrors.push(...this.taxi.validationMessages);
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
if (this.search_objects.eurostar.chosen && this.canSearch(TravelTypeEnum.EUROSTAR)) {
|
|
1241
|
+
concattedErrors.push(...this.eurostar.validationMessages);
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
if (this.search_objects.coach.chosen && this.canSearch(TravelTypeEnum.COACH)) {
|
|
1245
|
+
concattedErrors.push(...this.coach.validationMessages);
|
|
1246
|
+
}*/
|
|
1247
|
+
this.errors.next(concattedErrors);
|
|
1248
|
+
return concattedErrors;
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
protected travellersContainUser(): boolean {
|
|
1252
|
+
return !!this.selectedTravellers.find((traveller: Traveller) => {
|
|
1253
|
+
return traveller.id === this.userService.getUserId().toString();
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
public validateTravellers(): boolean {
|
|
1258
|
+
this.travellerValidationMessages = [];
|
|
1259
|
+
|
|
1260
|
+
switch (this.userService.fullUserDetails.userData.value.booker_type) {
|
|
1261
|
+
case BookerType.SelfBook:
|
|
1262
|
+
if (
|
|
1263
|
+
!(
|
|
1264
|
+
this.selectedTravellers.length === 1 && this.travellersContainUser()
|
|
1265
|
+
)
|
|
1266
|
+
) {
|
|
1267
|
+
// this should never trigger under normal conditions as the user should be loaded in as a traveller on login
|
|
1268
|
+
this.travellerValidationMessages.push(
|
|
1269
|
+
'Current user must be a traveller'
|
|
1270
|
+
);
|
|
1271
|
+
}
|
|
1272
|
+
break;
|
|
1273
|
+
|
|
1274
|
+
case BookerType.BookerWithSelf:
|
|
1275
|
+
if (
|
|
1276
|
+
!(this.selectedTravellers.length < 1) ||
|
|
1277
|
+
!this.travellersContainUser()
|
|
1278
|
+
) {
|
|
1279
|
+
this.travellerValidationMessages.push('Please add your self.');
|
|
1280
|
+
this.traveller_error = true;
|
|
1281
|
+
}
|
|
1282
|
+
break;
|
|
1283
|
+
case BookerType.Booker:
|
|
1284
|
+
case BookerType.Company:
|
|
1285
|
+
case BookerType.CompanyGroup:
|
|
1286
|
+
case BookerType.Office:
|
|
1287
|
+
case BookerType.Tmc:
|
|
1288
|
+
case BookerType.Root:
|
|
1289
|
+
if (!(this.selectedTravellers.length >= 1)) {
|
|
1290
|
+
this.travellerValidationMessages.push(
|
|
1291
|
+
'Please select at least one traveller'
|
|
1292
|
+
);
|
|
1293
|
+
this.traveller_error = true;
|
|
1294
|
+
}
|
|
1295
|
+
break;
|
|
1296
|
+
default:
|
|
1297
|
+
this.travellerValidationMessages.push(
|
|
1298
|
+
'Unrecognised user type! - Please contact support.'
|
|
1299
|
+
);
|
|
1300
|
+
return false;
|
|
1301
|
+
}
|
|
1302
|
+
// console.log(this.travellerValidationMessages);
|
|
1303
|
+
return this.travellerValidationMessages.length === 0;
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
findPaxInTravellers(username: string) {
|
|
1307
|
+
return this.selectedTravellers.find((traveller: Traveller) => {
|
|
1308
|
+
return username === traveller.email;
|
|
1309
|
+
});
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
validateForms(): boolean {
|
|
1313
|
+
const searchObject: SearchObject = this._findSearchObtect();
|
|
1314
|
+
this.getAllErrorMessages();
|
|
1315
|
+
if (searchObject) {
|
|
1316
|
+
this.errors.next(
|
|
1317
|
+
this.searches[searchObject.type as keyof SearchParams].messages.value
|
|
1318
|
+
);
|
|
1319
|
+
return (
|
|
1320
|
+
this.validateTravellers() &&
|
|
1321
|
+
this.searches[searchObject.type as keyof SearchParams].isValid.value
|
|
1322
|
+
);
|
|
1323
|
+
} else {
|
|
1324
|
+
return false;
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
private _findSearchObtect(): SearchObject | null {
|
|
1329
|
+
return Object.values(this.search_objects).find((obj: SearchObject) => {
|
|
1330
|
+
return !!obj && obj.priority === this.highest_search_priority;
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
startSearches(): void {
|
|
1335
|
+
this.newSearchStarted.next(true);
|
|
1336
|
+
this.search_loading = true;
|
|
1337
|
+
let searchObject: SearchObject;
|
|
1338
|
+
searchObject = this._findSearchObtect();
|
|
1339
|
+
if (searchObject) {
|
|
1340
|
+
searchObject.chosen = true;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
if (searchObject && !this.router.url.includes(searchObject.resultUrl)) {
|
|
1344
|
+
this.router.navigate([searchObject.resultUrl]);
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
/*If the search exceeds the timeout time, cancel search and tell OBT that it's timed out*/
|
|
1348
|
+
const context = this;
|
|
1349
|
+
setTimeout(function () {
|
|
1350
|
+
if (context.search_loading) {
|
|
1351
|
+
context.search_loading = false;
|
|
1352
|
+
context.searchTimedOut.next(true);
|
|
1353
|
+
context.searchLoadingDone.next(true);
|
|
1354
|
+
}
|
|
1355
|
+
}, 12000);
|
|
1356
|
+
|
|
1357
|
+
try {
|
|
1358
|
+
Promise.all(
|
|
1359
|
+
Object.values(this.searches).map(
|
|
1360
|
+
(search: BaseEnterpriseSearch<any, any, any[]>) => {
|
|
1361
|
+
return !!search &&
|
|
1362
|
+
this.search_objects[search.type] &&
|
|
1363
|
+
this.search_objects[search.type].chosen
|
|
1364
|
+
? search.startSearch()
|
|
1365
|
+
: Promise.resolve(false);
|
|
1366
|
+
}
|
|
1367
|
+
)
|
|
1368
|
+
).finally(() => {
|
|
1369
|
+
this.search_loading = false;
|
|
1370
|
+
this.searchLoadingDone.next(true);
|
|
1371
|
+
});
|
|
1372
|
+
} catch (error) {
|
|
1373
|
+
console.error(error);
|
|
1374
|
+
this.search_loading = false;
|
|
1375
|
+
this.searchLoadingDone.next(true);
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
getTaxiStationLocations(
|
|
1380
|
+
term: string,
|
|
1381
|
+
isLoading?: BehaviorSubject<boolean>
|
|
1382
|
+
): Observable<RailAirport[]> {
|
|
1383
|
+
return term.length < 3
|
|
1384
|
+
? of([])
|
|
1385
|
+
: of([
|
|
1386
|
+
{
|
|
1387
|
+
destination: 'Manchester Airpot',
|
|
1388
|
+
isairport: true,
|
|
1389
|
+
supplier_code: 'MAN',
|
|
1390
|
+
address: 'Manchester Airport',
|
|
1391
|
+
postcode: 'M90 1QX'
|
|
1392
|
+
},
|
|
1393
|
+
{
|
|
1394
|
+
destination: 'Manchester Piccadilly',
|
|
1395
|
+
isairport: false,
|
|
1396
|
+
supplier_code: 'MMAN',
|
|
1397
|
+
address: 'Manchester Piccadilly',
|
|
1398
|
+
postcode: 'M1 2PZ'
|
|
1399
|
+
},
|
|
1400
|
+
{
|
|
1401
|
+
destination: 'London Heathrow',
|
|
1402
|
+
isairport: true,
|
|
1403
|
+
supplier_code: 'LHR',
|
|
1404
|
+
address: 'London Heathrow Airport',
|
|
1405
|
+
postcode: 'TW6 1EW'
|
|
1406
|
+
}
|
|
1407
|
+
]);
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
getAddresses(isLoading: BehaviorSubject<boolean>): Observable<AddressForm[]> {
|
|
1411
|
+
return of([
|
|
1412
|
+
{
|
|
1413
|
+
House: 'Cecil Court',
|
|
1414
|
+
Street: '28-36 Cecil Road',
|
|
1415
|
+
Town: 'Hale',
|
|
1416
|
+
PostCode: 'WA15 9PB',
|
|
1417
|
+
Country: 'UK'
|
|
1418
|
+
}
|
|
1419
|
+
]);
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
getUserAddresses(
|
|
1423
|
+
isLoading?: BehaviorSubject<boolean>
|
|
1424
|
+
): Observable<AddressForm[]> {
|
|
1425
|
+
return this.userAddressesFetcher.fetchList().pipe(
|
|
1426
|
+
take(1),
|
|
1427
|
+
map((results: any): any => {
|
|
1428
|
+
return results.map((result: any) => {
|
|
1429
|
+
return {
|
|
1430
|
+
ID: result.id,
|
|
1431
|
+
House: result.numberOrName,
|
|
1432
|
+
Street: result.street,
|
|
1433
|
+
Town: result.town,
|
|
1434
|
+
PostCode: result.postcode,
|
|
1435
|
+
Country: result.countryCode
|
|
1436
|
+
};
|
|
1437
|
+
});
|
|
1438
|
+
})
|
|
1439
|
+
);
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
deleteUserAddressByID(id: string): Observable<any> {
|
|
1443
|
+
return this.baseDeleteUserAddressUpdater.updateOne({ id: id });
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
getHotelChain(
|
|
1447
|
+
term: string,
|
|
1448
|
+
isLoading?: BehaviorSubject<boolean>
|
|
1449
|
+
): Observable<any[]> {
|
|
1450
|
+
if (term.length > 2) {
|
|
1451
|
+
isLoading?.next(true);
|
|
1452
|
+
const obs: Observable<SearchHotelChainsResultArray> =
|
|
1453
|
+
this.searchHotelChainsFetcher.fetchList({ query: term });
|
|
1454
|
+
const func = (results: SearchHotelChainsResultArray): any[] => {
|
|
1455
|
+
const data: any[] = results.map(
|
|
1456
|
+
(result: SearchHotelChainsResult): any => {
|
|
1457
|
+
return {
|
|
1458
|
+
name: result
|
|
1459
|
+
};
|
|
1460
|
+
}
|
|
1461
|
+
);
|
|
1462
|
+
isLoading?.next(false);
|
|
1463
|
+
return data;
|
|
1464
|
+
};
|
|
1465
|
+
return obs.pipe(take(1), map(func));
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
return of([]);
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
getOfficeNames(
|
|
1472
|
+
isLoading?: BehaviorSubject<boolean>
|
|
1473
|
+
): Observable<ConfermaOfficeNames[]> {
|
|
1474
|
+
return this.confermaOfficeNamesFetcher.fetchList().pipe(
|
|
1475
|
+
take(1),
|
|
1476
|
+
map((results): any => {
|
|
1477
|
+
if (results) {
|
|
1478
|
+
return results?.results?.map((result: ConfermaOfficeNames) => {
|
|
1479
|
+
return {
|
|
1480
|
+
id: result.id,
|
|
1481
|
+
name: result.name
|
|
1482
|
+
};
|
|
1483
|
+
});
|
|
1484
|
+
}
|
|
1485
|
+
})
|
|
1486
|
+
);
|
|
1487
|
+
isLoading?.next(false);
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
getRailCards(): Observable<ReferenceRailCardQualifier[]> {
|
|
1491
|
+
return this.getRailCardsFetcher.fetchList().pipe(
|
|
1492
|
+
take(1),
|
|
1493
|
+
map((results): any => {
|
|
1494
|
+
if (results) {
|
|
1495
|
+
return results?.map((result: ReferenceRailCardQualifier) => {
|
|
1496
|
+
return {
|
|
1497
|
+
name: result.name,
|
|
1498
|
+
code: result.code
|
|
1499
|
+
};
|
|
1500
|
+
});
|
|
1501
|
+
}
|
|
1502
|
+
})
|
|
1503
|
+
);
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
public getAirportByCode(code: string): Observable<AirportSearchResults> {
|
|
1507
|
+
if (code) {
|
|
1508
|
+
return this.searchAirportsFetcher.fetchOne({ query: code }).pipe(
|
|
1509
|
+
take(1),
|
|
1510
|
+
map((result: AirportSearchResults) => {
|
|
1511
|
+
return result
|
|
1512
|
+
})
|
|
1513
|
+
);
|
|
1514
|
+
} else {
|
|
1515
|
+
return of();
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
// TO BE OVER RIDDEN BY OBT SUBCLASSES
|
|
1520
|
+
protected init_search_objects(): SearchObjects {
|
|
1521
|
+
return {};
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
/********************************************************
|
|
1525
|
+
* SEARCH OBJECTS FOR GET ME THERE DOOR 2 DOOR *
|
|
1526
|
+
* Difference(s): *
|
|
1527
|
+
* All objects have a priority of 1 so that they are *
|
|
1528
|
+
* searched at the same time *
|
|
1529
|
+
* Urls changed to getmethere *
|
|
1530
|
+
*******************************************************/
|
|
1531
|
+
protected getMeThereSearchObjects(): SearchObjects {
|
|
1532
|
+
return {};
|
|
1533
|
+
}
|
|
1534
|
+
/*
|
|
1535
|
+
* @desc - gets all selected travellers
|
|
1536
|
+
* Implemented for rail card reasons in LU
|
|
1537
|
+
**/
|
|
1538
|
+
getSelectedtravellers(): Traveller[] {
|
|
1539
|
+
return this.selectedTravellers;
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
resetSearchObjects(): void {
|
|
1543
|
+
this.search_objects = this.helpers.clone(this.init_search_objects());
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
/*
|
|
1547
|
+
These are the possible array of values from API are exptected and function manipulate to create the list
|
|
1548
|
+
["Main"]
|
|
1549
|
+
["1"]
|
|
1550
|
+
["1", "2"]
|
|
1551
|
+
["1", "2", "3"]
|
|
1552
|
+
["1", "2", "3", "4"]
|
|
1553
|
+
["1", "2", "3", "4", "5"]
|
|
1554
|
+
["South", "North"]
|
|
1555
|
+
*/
|
|
1556
|
+
public processTerminals(terminals: string[]): TerminalsType[] {
|
|
1557
|
+
const tempTerminal: TerminalsType[] = [];
|
|
1558
|
+
if (
|
|
1559
|
+
terminals.includes('1') ||
|
|
1560
|
+
terminals.includes('2') ||
|
|
1561
|
+
terminals.includes('3') ||
|
|
1562
|
+
terminals.includes('4') ||
|
|
1563
|
+
terminals.includes('5')
|
|
1564
|
+
) {
|
|
1565
|
+
tempTerminal.push({ key: 'Any Terminal', value: 'Any' });
|
|
1566
|
+
terminals.forEach((item) => {
|
|
1567
|
+
tempTerminal.push({ key: `Terminal ${item}`, value: `${item}` });
|
|
1568
|
+
});
|
|
1569
|
+
} else {
|
|
1570
|
+
if (terminals.length === 1) {
|
|
1571
|
+
tempTerminal.push({ key: `${terminals[0]} Terminal`, value: 'Any' });
|
|
1572
|
+
} else {
|
|
1573
|
+
tempTerminal.push({ key: 'Any Terminal', value: 'Any' });
|
|
1574
|
+
terminals.forEach((item) => {
|
|
1575
|
+
tempTerminal.push({ key: `${item} Terminal`, value: `${item}` });
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
return tempTerminal;
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
async saveUserAddress(
|
|
1583
|
+
address: SaveUserAddressMutationVariables
|
|
1584
|
+
): Promise<void> {
|
|
1585
|
+
if (address) {
|
|
1586
|
+
await this.saveUserAddressUpdater.updateOne(address).toPromise();
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
public canBook(service: ServiceType) {
|
|
1591
|
+
return this.userService.canBook(service) ? true : false;
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
isPostcodeVaild(postcode: string): Observable<boolean> {
|
|
1595
|
+
return this.baseValidateIsPostcodeValidTester.test({ postcode });
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
/* Create Query Defaults Start */
|
|
1599
|
+
/*
|
|
1600
|
+
* Create the Cab Hire search query with supplied param, auto fill with defaults if fields are empty.
|
|
1601
|
+
* @param {any} ...args example - searchService.setCabHireQuery(data.query, { departs: momentDateTime })
|
|
1602
|
+
* @return {QuerySearchCabHireArgs} Returns QuerySearchCabHireArgs type
|
|
1603
|
+
*/
|
|
1604
|
+
public makeCabHireQuery(...args: any): CabHireTempParams {
|
|
1605
|
+
const defaultVal: CabHireTempParams = {
|
|
1606
|
+
adults: 0,
|
|
1607
|
+
airport: null,
|
|
1608
|
+
children: 0,
|
|
1609
|
+
countryCode: null,
|
|
1610
|
+
departs: this.helpers.makeMomentDayTime(),
|
|
1611
|
+
fromAddress: null,
|
|
1612
|
+
fromStation: null,
|
|
1613
|
+
fromLocationType: TaxiFormMode.ADDRESS,
|
|
1614
|
+
infants: 0,
|
|
1615
|
+
toAddress: null,
|
|
1616
|
+
toStation: null,
|
|
1617
|
+
toLocationType: TaxiFormMode.ADDRESS,
|
|
1618
|
+
vehicleType: CabHireVehicleType.Any,
|
|
1619
|
+
viasFrom: null,
|
|
1620
|
+
viasTo: null
|
|
1621
|
+
};
|
|
1622
|
+
|
|
1623
|
+
return this.helpers.sanatizeReturns<CabHireTempParams>(
|
|
1624
|
+
defaultVal,
|
|
1625
|
+
Object.assign({}, ...args),
|
|
1626
|
+
['departs']
|
|
1627
|
+
);
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
/*
|
|
1631
|
+
* Create the Car Hire search query with supplied param, auto fill with defaults if fields are empty.
|
|
1632
|
+
* @param {any} ...args example - searchService.setCarHireQuery(data.query, { departs: momentDateTime })
|
|
1633
|
+
* @return {QuerySearchCarHireArgs} Returns QuerySearchCarHireArgs type
|
|
1634
|
+
*/
|
|
1635
|
+
public makeCarHireQuery(...args: any): CarHireTempParams {
|
|
1636
|
+
const defaultVal: CarHireTempParams = {
|
|
1637
|
+
adults: 0,
|
|
1638
|
+
airCon: null,
|
|
1639
|
+
carClass: null,
|
|
1640
|
+
carType: null,
|
|
1641
|
+
children: 0,
|
|
1642
|
+
chosenVendor: null,
|
|
1643
|
+
cityDropoff: null,
|
|
1644
|
+
cityDropoffDepot: null,
|
|
1645
|
+
cityPickup: null,
|
|
1646
|
+
cityPickupDepot: null,
|
|
1647
|
+
dropoff_country: 'GB',
|
|
1648
|
+
dropoff_datetime: null,
|
|
1649
|
+
dropoff_location: null,
|
|
1650
|
+
estimatedMileage: null,
|
|
1651
|
+
locationType: null,
|
|
1652
|
+
pickup_country: null,
|
|
1653
|
+
pickup_datetime: null,
|
|
1654
|
+
pickup_location: null,
|
|
1655
|
+
postcodeDropoff: null,
|
|
1656
|
+
postcodeDropoffRaw: null,
|
|
1657
|
+
postcodePickup: null,
|
|
1658
|
+
postcodePickupRaw: null,
|
|
1659
|
+
return_to_pickup: true,
|
|
1660
|
+
transmission: null
|
|
1661
|
+
};
|
|
1662
|
+
|
|
1663
|
+
return this.helpers.sanatizeReturns<CarHireTempParams>(
|
|
1664
|
+
defaultVal,
|
|
1665
|
+
Object.assign({}, ...args),
|
|
1666
|
+
['pickup_datetime', 'dropoff_datetime']
|
|
1667
|
+
);
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
/*
|
|
1671
|
+
* Creates a Flight search query with supplied params, auto fills with defaults if fields are empty.
|
|
1672
|
+
* @param {any} ...args Example - searchService.makeFlightQuery(data.query, { override: "property" })
|
|
1673
|
+
* @return {QuerySearchFlightsArgs} Returns QuerySearchFlightsArgs type
|
|
1674
|
+
*/
|
|
1675
|
+
public makeFlightQuery(...args: any): FlightTempParams {
|
|
1676
|
+
const now = this.helpers.makeMomentDayTime();
|
|
1677
|
+
const tomorrow = this.helpers.makeMomentDayTime(1);
|
|
1678
|
+
const momentOutDateTime = this.helpers.momentRoundMinutes(now, 30);
|
|
1679
|
+
const momentInDateTime = this.helpers.momentRoundMinutes(tomorrow, 30);
|
|
1680
|
+
|
|
1681
|
+
const defaultVal: FlightTempParams = {
|
|
1682
|
+
adults: 0,
|
|
1683
|
+
arriveLocation: null,
|
|
1684
|
+
cabinClass: FlightCabinClass.Any,
|
|
1685
|
+
children: 0,
|
|
1686
|
+
chosenSearchType: null,
|
|
1687
|
+
departLocation: null,
|
|
1688
|
+
fareType: FareType.Flexible,
|
|
1689
|
+
inboundDate: momentOutDateTime,
|
|
1690
|
+
inTimeCriteria: TimeWindow.Depart,
|
|
1691
|
+
maxConnections: null,
|
|
1692
|
+
includeNearbyAirports: false,
|
|
1693
|
+
multiDestination: [],
|
|
1694
|
+
outBoundDate: momentInDateTime,
|
|
1695
|
+
outTimeCriteria: TimeWindow.Depart,
|
|
1696
|
+
preferredCarriers: [null, null, null, null],
|
|
1697
|
+
returnCabinClass: FlightCabinClass.Any
|
|
1698
|
+
};
|
|
1699
|
+
|
|
1700
|
+
return this.helpers.sanatizeReturns<FlightTempParams>(
|
|
1701
|
+
defaultVal,
|
|
1702
|
+
Object.assign({}, ...args),
|
|
1703
|
+
['outBoundDate', 'inboundDate']
|
|
1704
|
+
);
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
/*
|
|
1708
|
+
* Creates a Hotel search query with supplied params, auto fills with defaults if fields are empty.
|
|
1709
|
+
* @param {any} ...args Example - searchService.makeHotelQuery(data.query, { override: "property" })
|
|
1710
|
+
* @return {QuerySearchHotelsArgs} Returns QuerySearchHotelsArgs type
|
|
1711
|
+
*/
|
|
1712
|
+
public makeHotelQuery(...args: any): HotelTempParams {
|
|
1713
|
+
const defaultVal = {
|
|
1714
|
+
checkin_date: moment().set('hour', 23).set('minute', 59),
|
|
1715
|
+
checkout_date: moment().add(1, 'day').set('hour', 23).set('minute', 59),
|
|
1716
|
+
country: { cCode: 'GB', cName: 'United Kingdom' },
|
|
1717
|
+
currency: 'GBP',
|
|
1718
|
+
distance: 5, // default 5 miles radius
|
|
1719
|
+
hotel_availability: null,
|
|
1720
|
+
hotel_chain: null,
|
|
1721
|
+
hotel_name: null,
|
|
1722
|
+
location_type_select: LocationTypes.Airport,
|
|
1723
|
+
location: null, // might want to split this out to city, airport, office, railstation - this will do for now
|
|
1724
|
+
no_of_occupants: 1, // similarly think this is a max of 3
|
|
1725
|
+
no_of_rooms: 1, // max of 4 in old sabs, not sure here
|
|
1726
|
+
office: null,
|
|
1727
|
+
postcode: null,
|
|
1728
|
+
prefered_hotels_only: false,
|
|
1729
|
+
trainsStation: null
|
|
1730
|
+
} as HotelTempParams;
|
|
1731
|
+
|
|
1732
|
+
return this.helpers.sanatizeReturns<HotelTempParams>(
|
|
1733
|
+
defaultVal,
|
|
1734
|
+
Object.assign({}, ...args),
|
|
1735
|
+
['checkin_date', 'checkout_date']
|
|
1736
|
+
);
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
/*
|
|
1740
|
+
* Creates a Lounges search query with supplied params, auto fills with defaults if fields are empty.
|
|
1741
|
+
* @param {any} ...args Example - searchService.makeLoungesQuery(data.query, { override: "property" })
|
|
1742
|
+
* @return {QuerySearchLoungesArgs} Returns QuerySearchLoungesArgs type
|
|
1743
|
+
*/
|
|
1744
|
+
public makeLoungesQuery(...args: any): LoungesTempParams {
|
|
1745
|
+
const defaultVal = {
|
|
1746
|
+
adults: 0,
|
|
1747
|
+
arrivalDatetime: moment(),
|
|
1748
|
+
children: 0,
|
|
1749
|
+
infants: 0,
|
|
1750
|
+
locationCode: null,
|
|
1751
|
+
terminal: null
|
|
1752
|
+
} as LoungesTempParams;
|
|
1753
|
+
|
|
1754
|
+
return this.helpers.sanatizeReturns<LoungesTempParams>(
|
|
1755
|
+
defaultVal,
|
|
1756
|
+
Object.assign({}, ...args),
|
|
1757
|
+
['arrivalDatetime']
|
|
1758
|
+
);
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
/*
|
|
1762
|
+
* Creates a Parking search query with supplied params, auto fills with defaults if fields are empty.
|
|
1763
|
+
* @param {any} ...args Example - searchService.makeParkingQuery(data.query, { override: "property" })
|
|
1764
|
+
* @return {QuerySearchParkingArgs} Returns QuerySearchParkingArgs type
|
|
1765
|
+
*/
|
|
1766
|
+
public makeParkingQuery(...args: any): ParkingTempParams {
|
|
1767
|
+
const now = this.helpers.makeMomentDayTime();
|
|
1768
|
+
const tomorrow = this.helpers.makeMomentDayTime(1);
|
|
1769
|
+
const momentOutDateTime = this.helpers.momentRoundMinutes(now, 30);
|
|
1770
|
+
const momentInDateTime = this.helpers.momentRoundMinutes(tomorrow, 30);
|
|
1771
|
+
|
|
1772
|
+
const defaultVal = {
|
|
1773
|
+
arrivalDatetime: momentOutDateTime,
|
|
1774
|
+
carParkedForYou: null,
|
|
1775
|
+
departDatetime: momentInDateTime,
|
|
1776
|
+
locationCode: null,
|
|
1777
|
+
meetAndGreet: null,
|
|
1778
|
+
onAirport: null,
|
|
1779
|
+
outFlightNumber: null,
|
|
1780
|
+
parkAndRide: null,
|
|
1781
|
+
parkAndStroll: null,
|
|
1782
|
+
recommended: null,
|
|
1783
|
+
terminal: null
|
|
1784
|
+
} as ParkingTempParams;
|
|
1785
|
+
|
|
1786
|
+
return this.helpers.sanatizeReturns<ParkingTempParams>(
|
|
1787
|
+
defaultVal,
|
|
1788
|
+
Object.assign({}, ...args),
|
|
1789
|
+
['arrivalDatetime', 'departDatetime']
|
|
1790
|
+
);
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
/*
|
|
1794
|
+
* Creates a Rail search query with supplied params, auto fills with defaults if fields are empty.
|
|
1795
|
+
* @param {any} ...args Example - searchService.makeRailQuery(data.query, { override: "property" })
|
|
1796
|
+
* @return {QuerySearchRailArgs} Returns QuerySearchRailArgs type
|
|
1797
|
+
*/
|
|
1798
|
+
public makeRailQuery(...args: any): RailTempParams {
|
|
1799
|
+
const time = this.helpers.momentRoundMinutes(moment(), 30);
|
|
1800
|
+
const defaultVal: RailTempParams = {
|
|
1801
|
+
airportExpressStation: null,
|
|
1802
|
+
applyRailcards: false,
|
|
1803
|
+
carnetTicket: false,
|
|
1804
|
+
chosenSearchClass: RailClass.All,
|
|
1805
|
+
chosenSearchType: RailJourneyType.ReturnJourney,
|
|
1806
|
+
disableAutoDiscounts: false,
|
|
1807
|
+
extraTime: false,
|
|
1808
|
+
inBoundDateTime: time,
|
|
1809
|
+
isAirportExpress: false,
|
|
1810
|
+
noOfAdults: 0,
|
|
1811
|
+
noOfChildren: 0,
|
|
1812
|
+
openReturn: false,
|
|
1813
|
+
outboundCriteria: RailSearchCriteria.Depart,
|
|
1814
|
+
outBoundDateTime: time,
|
|
1815
|
+
prioritiseByPrice: false,
|
|
1816
|
+
returnCriteria: RailSearchCriteria.Depart,
|
|
1817
|
+
travellingFrom: null,
|
|
1818
|
+
travellingTo: null,
|
|
1819
|
+
via: false,
|
|
1820
|
+
viaLocation: null,
|
|
1821
|
+
railCards: null
|
|
1822
|
+
};
|
|
1823
|
+
|
|
1824
|
+
return this.helpers.sanatizeReturns<RailTempParams>(
|
|
1825
|
+
defaultVal,
|
|
1826
|
+
Object.assign({}, ...args),
|
|
1827
|
+
['inBoundDateTime', 'outBoundDateTime']
|
|
1828
|
+
);
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
/*
|
|
1832
|
+
* Creates a Rail search query with supplied params, auto fills with defaults if fields are empty.
|
|
1833
|
+
* @param {any} ...args Example - searchService.makeRailQuery(data.query, { override: "property" })
|
|
1834
|
+
* @return {QuerySearchRailArgs} Returns QuerySearchRailArgs type
|
|
1835
|
+
*/
|
|
1836
|
+
public makeIrlQuery(...args: any): IrlTempParams {
|
|
1837
|
+
const time = this.helpers.momentRoundMinutes(moment(), 30);
|
|
1838
|
+
const defaultVal: IrlTempParams = {
|
|
1839
|
+
supplier: null, // IRLSupplier!
|
|
1840
|
+
countryCode: '',
|
|
1841
|
+
// journeyType: this.journeyType, // IRLJourneyType!
|
|
1842
|
+
class: null, // IRLClass
|
|
1843
|
+
outboundDepartureDateTime: time,
|
|
1844
|
+
departureLocationId: null,
|
|
1845
|
+
arrivalLocationId: null,
|
|
1846
|
+
adults: 0,
|
|
1847
|
+
children: 0,
|
|
1848
|
+
returnDepartureDateTime: time,
|
|
1849
|
+
journeyType: null
|
|
1850
|
+
};
|
|
1851
|
+
|
|
1852
|
+
return this.helpers.sanatizeReturns<IrlTempParams>(
|
|
1853
|
+
defaultVal,
|
|
1854
|
+
Object.assign({}, ...args),
|
|
1855
|
+
['returnDepartureDateTime', 'outboundDepartureDateTime']
|
|
1856
|
+
);
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
/*
|
|
1860
|
+
* Creates a Eurostar search query with supplied params, auto fills with defaults if fields are empty.
|
|
1861
|
+
* @param {any} ...args Example - searchService.makeEurostarQuery(data.query, { override: "property" })
|
|
1862
|
+
* @return {EurostarTempParams} Returns QuerySearchEurostarArgs type
|
|
1863
|
+
*/
|
|
1864
|
+
public makeEurostarQuery(...args: any): EurostarTempParams {
|
|
1865
|
+
const now = this.helpers.makeMomentDayTime();
|
|
1866
|
+
const tomorrow = this.helpers.makeMomentDayTime(1);
|
|
1867
|
+
const momentOutDateTime = this.helpers.momentRoundMinutes(now, 30);
|
|
1868
|
+
const momentInDateTime = this.helpers.momentRoundMinutes(tomorrow, 30);
|
|
1869
|
+
|
|
1870
|
+
const defaultVal: EurostarTempParams = {
|
|
1871
|
+
adults: 0,
|
|
1872
|
+
arriveLocation: null,
|
|
1873
|
+
cabinClass: FlightCabinClass.Any,
|
|
1874
|
+
children: 0,
|
|
1875
|
+
chosenSearchType: EurostarSearchType.return,
|
|
1876
|
+
departLocation: null,
|
|
1877
|
+
fareType: FareType.Flexible,
|
|
1878
|
+
inboundDate: momentOutDateTime,
|
|
1879
|
+
inTimeCriteria: TimeWindow.Depart,
|
|
1880
|
+
maxConnections: null,
|
|
1881
|
+
includeNearbyAirports: false,
|
|
1882
|
+
multiDestination: [],
|
|
1883
|
+
outBoundDate: momentInDateTime,
|
|
1884
|
+
outTimeCriteria: TimeWindow.Depart,
|
|
1885
|
+
preferredCarriers: [null, null, null, null],
|
|
1886
|
+
returnCabinClass: FlightCabinClass.Any
|
|
1887
|
+
};
|
|
1888
|
+
|
|
1889
|
+
return this.helpers.sanatizeReturns<EurostarTempParams>(
|
|
1890
|
+
defaultVal,
|
|
1891
|
+
Object.assign({}, ...args),
|
|
1892
|
+
['outBoundDate', 'inboundDate']
|
|
1893
|
+
);
|
|
1894
|
+
}
|
|
1895
|
+
/* Create Query Defaults End */
|
|
1896
|
+
|
|
1897
|
+
shouldAddTravellerSubscription(): boolean {
|
|
1898
|
+
return false;
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
getAutoLogoutConfig() {
|
|
1902
|
+
return {};
|
|
1903
|
+
}
|
|
1904
|
+
/**
|
|
1905
|
+
* Overwrite if the OBT displays a list of offices instead of searching on them
|
|
1906
|
+
*/
|
|
1907
|
+
public shouldFetchAllOffices(): boolean {
|
|
1908
|
+
return false;
|
|
1909
|
+
}
|
|
1910
|
+
isFlightsGrouped(): boolean {
|
|
1911
|
+
return false;
|
|
1912
|
+
}
|
|
1913
|
+
getCountryFullNameFromCountryCode(code: string): string {
|
|
1914
|
+
let fullName = 'Unknown';
|
|
1915
|
+
|
|
1916
|
+
for (let i = 0; i < this.countries.length; i++) {
|
|
1917
|
+
const country = this.countries[i];
|
|
1918
|
+
|
|
1919
|
+
if (country.cCode === code) {
|
|
1920
|
+
return country.cName;
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
|
|
1924
|
+
return fullName;
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
getUserRecentSearches(
|
|
1928
|
+
serviceType?: ServiceType,
|
|
1929
|
+
isLoading?: BehaviorSubject<boolean>
|
|
1930
|
+
): Observable<RecentSearch[]> {
|
|
1931
|
+
isLoading?.next(true);
|
|
1932
|
+
const query = { serviceType };
|
|
1933
|
+
const obs: Observable<GetUserRecentSearchesResultArray> =
|
|
1934
|
+
this.getUserRecentSearchesFetcher.fetchList(query);
|
|
1935
|
+
|
|
1936
|
+
const func = (
|
|
1937
|
+
results: GetUserRecentSearchesResultArray
|
|
1938
|
+
): RecentSearch[] => {
|
|
1939
|
+
const data: RecentSearch[] = results.map(
|
|
1940
|
+
(result: GetUserRecentSearchesResult): RecentSearch => {
|
|
1941
|
+
return {
|
|
1942
|
+
id: result.id,
|
|
1943
|
+
name: result.name,
|
|
1944
|
+
serviceType: result.serviceType,
|
|
1945
|
+
searchArgs: result.searchArgs,
|
|
1946
|
+
createdAt: result.createdAt,
|
|
1947
|
+
updatedAt: result.updatedAt,
|
|
1948
|
+
travelDate: result.travelDate,
|
|
1949
|
+
travellers: result.travellers
|
|
1950
|
+
};
|
|
1951
|
+
}
|
|
1952
|
+
);
|
|
1953
|
+
isLoading?.next(false);
|
|
1954
|
+
return data;
|
|
1955
|
+
};
|
|
1956
|
+
return obs.pipe(take(1), map(func));
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1959
|
+
deleteRecentSearchByID(id: string): Observable<any> {
|
|
1960
|
+
return this.baseDeleteRecentSearchUpdater.updateOne({ id: id });
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1963
|
+
saveRecentSearch(query: SaveRecentSearchMutationVariables): void {
|
|
1964
|
+
if (query) {
|
|
1965
|
+
this.baseSaveRecentSearchUpdater.updateOne(query).pipe(take(1)).subscribe();
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
/**
|
|
1970
|
+
* @description - get the list of eurostar station locations based on search term given
|
|
1971
|
+
* @todo - fill this out so that it actually performs a http call
|
|
1972
|
+
* @param term - the term we want to search by
|
|
1973
|
+
* @returns
|
|
1974
|
+
*/
|
|
1975
|
+
lookupEurostarStations(term: string): Observable<any[]> {
|
|
1976
|
+
console.log('term| ', term);
|
|
1977
|
+
if (term === '') {
|
|
1978
|
+
return of(this.eurostations);
|
|
1979
|
+
} else {
|
|
1980
|
+
return of(this.eurostations.filter(v => v.destination.toLowerCase().indexOf(term.toLowerCase()) > -1));
|
|
1981
|
+
}
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
searchTravellers(
|
|
1985
|
+
input: string,
|
|
1986
|
+
searchTravellersBy: TravellerSearchTypes
|
|
1987
|
+
): Observable<Traveller[]> {
|
|
1988
|
+
const type: BookerType = this.userService.getUserBookingType();
|
|
1989
|
+
this.traveller_error = false;
|
|
1990
|
+
/* TODO
|
|
1991
|
+
if (this.userService.useAgentCanBookFor()) {
|
|
1992
|
+
type = this.userService.getUserFavoriteValue('AgentCanBookFor');
|
|
1993
|
+
}*/
|
|
1994
|
+
if (
|
|
1995
|
+
type &&
|
|
1996
|
+
type !== BookerType.SelfBook &&
|
|
1997
|
+
type !== BookerType.Traveller &&
|
|
1998
|
+
input.length >= 1
|
|
1999
|
+
) {
|
|
2000
|
+
const inputWords = input.toLowerCase().match(/([\w])+/g);
|
|
2001
|
+
const args: SearchUserCanBookForQueryVariables = {};
|
|
2002
|
+
switch (searchTravellersBy) {
|
|
2003
|
+
case TravellerSearchTypes.name:
|
|
2004
|
+
args.userName = inputWords.length > 1 ? inputWords[0] : input;
|
|
2005
|
+
break;
|
|
2006
|
+
case TravellerSearchTypes.email:
|
|
2007
|
+
args.email = input;
|
|
2008
|
+
break;
|
|
2009
|
+
case TravellerSearchTypes.employeeNumber:
|
|
2010
|
+
args.employeeId = input;
|
|
2011
|
+
break;
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
return this.searchUsersCanBookForFetcher.fetchList(args).pipe(
|
|
2015
|
+
map((data: Traveller[]) => {
|
|
2016
|
+
if (data) {
|
|
2017
|
+
return data.sort((a, b) => {
|
|
2018
|
+
return a.surname < b.surname ? -1 : a.surname > b.surname ? 1 : 0;
|
|
2019
|
+
});
|
|
2020
|
+
}
|
|
2021
|
+
return [];
|
|
2022
|
+
})
|
|
2023
|
+
);
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
}
|