@sabstravtech/obtservices 0.2.2606091300 → 0.2.2606301620

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.
@@ -0,0 +1,54 @@
1
+ import { ChatSearchParameters, ChatbotTravelHandler } from '@sabstravtech/obtservices/base';
2
+ import { ChatbotService } from './chatbot.service';
3
+ import { EnterpriseSearchService } from './search.service';
4
+ import { ResultAwareService } from './result-aware.service';
5
+ import { UserService } from './user.service';
6
+ import * as i0 from "@angular/core";
7
+ /**
8
+ * Handles chatbot-driven car hire searches. Registered with
9
+ * `ChatbotSearchDispatcherService`; not used directly.
10
+ *
11
+ * Populates the car hire search state from the chatbot's parameters, runs the
12
+ * search headlessly, then injects a `ChatCarHireResults` message so the chat
13
+ * widget can render car hire cards.
14
+ */
15
+ export declare class ChatbotCarHireSearchService implements ChatbotTravelHandler {
16
+ private chatbotService;
17
+ private searchService;
18
+ private resultAwareService;
19
+ private userService;
20
+ readonly travelType: "car-hire";
21
+ private pendingDepotChoice;
22
+ constructor(chatbotService: ChatbotService, searchService: EnterpriseSearchService, resultAwareService: ResultAwareService, userService: UserService);
23
+ private ensureSelfTraveller;
24
+ handle(parameters: ChatSearchParameters, autoSearch: boolean): Promise<void>;
25
+ private runSearch;
26
+ private buildCarHireCards;
27
+ private calculateDays;
28
+ private injectNoResultsMessage;
29
+ private injectLocationHelpMessage;
30
+ private handleDepotSelectionReply;
31
+ private populateCarHireParams;
32
+ private prefersAirport;
33
+ private resolveVendorCode;
34
+ private resolveLocation;
35
+ private resolveAirportLocation;
36
+ private airportToLocation;
37
+ private pickBestLocation;
38
+ private toAirportDetails;
39
+ private enrichAirportDetails;
40
+ private applyAirportDropoff;
41
+ private applyCityPickup;
42
+ private applyCityDropoff;
43
+ private toCityLocation;
44
+ private resolveCityDepots;
45
+ private fetchDepotsWithinRadius;
46
+ private resolveDepot;
47
+ private resolveEnterpriseDepot;
48
+ private fetchEnterpriseDepots;
49
+ private toEnterpriseDepot;
50
+ private applyPostcodePickupAndDropoff;
51
+ private resolvePostcode;
52
+ static ɵfac: i0.ɵɵFactoryDeclaration<ChatbotCarHireSearchService, never>;
53
+ static ɵprov: i0.ɵɵInjectableDeclaration<ChatbotCarHireSearchService>;
54
+ }
@@ -20,10 +20,41 @@ export declare class ChatbotFlightSearchService implements ChatbotTravelHandler
20
20
  private resultAwareService;
21
21
  private userService;
22
22
  readonly travelType: "flight";
23
+ /** The flight form exposes four preferred-carrier slots. */
24
+ private static readonly MAX_PREFERRED_CARRIERS;
25
+ /** Terms that mean "no airline preference" and should be ignored. */
26
+ private static readonly NO_CARRIER_PREFERENCE;
27
+ /** Regional/subsidiary markers, so "KLM" doesn't resolve to "KLM Cityhopper". */
28
+ private static readonly CARRIER_SUBSIDIARY;
23
29
  private resultsSubscription;
30
+ /**
31
+ * The most recent full search parameters (origin, destination, dates,
32
+ * cabin, etc.). Cached so a {@link resort} call — whose own parameters carry
33
+ * only the new ranking intent (sortType / time target) — can still render
34
+ * card headers and dates for the trip that produced the cached results.
35
+ */
36
+ private lastSearchParameters;
24
37
  constructor(chatbotService: ChatbotService, searchService: EnterpriseSearchService, resultAwareService: ResultAwareService, userService: UserService);
25
38
  handle(parameters: ChatSearchParameters, autoSearch: boolean): Promise<void>;
26
39
  private subscribeToFlightResults;
40
+ /**
41
+ * Re-render the chat flight cards from whatever the flight-search session
42
+ * currently holds — the same cached results that "View Full Results" shows.
43
+ * Used both by the post-search subscription and by {@link resort} (which
44
+ * re-ranks without a new backend search). Reads `results.value` (falling
45
+ * back to the unfiltered `fullResults`), re-extracts the journeys, and builds
46
+ * cards using `parameters` (sort/time/airline/stops) so the same data can be
47
+ * re-ordered for a new preference.
48
+ */
49
+ private buildAndPatchResultsFromCache;
50
+ /**
51
+ * Re-rank the results already in the flight-search session for a new user
52
+ * preference (cheapest / fastest / shortest / nearest-to-time) WITHOUT
53
+ * running a new backend search. The cached itineraries are the same set the
54
+ * results page shows; we just re-order them via `buildFlightResults` and
55
+ * patch fresh cards onto the latest assistant message.
56
+ */
57
+ resort(parameters: ChatSearchParameters): Promise<void>;
27
58
  private buildFlightResults;
28
59
  /**
29
60
  * Builds a map keyed by an itinerary's flight-number signature to all
@@ -56,6 +87,14 @@ export declare class ChatbotFlightSearchService implements ChatbotTravelHandler
56
87
  private splitFlightsByLeg;
57
88
  /** Build a `ChatFlightLeg` from the flights assigned to a single leg. */
58
89
  private flightsToChatLeg;
90
+ /**
91
+ * Calendar days the arrival falls after departure (0 = same day, 1 = next
92
+ * day). Compares date components rather than elapsed time so a 23:30 → 00:40
93
+ * hop still counts as +1. Returns 0 when datetimes are missing/invalid so a
94
+ * lack of data never hides an otherwise-valid result. Accepts either a full
95
+ * `CondensedResult` (outbound) or its `inbound` sub-leg.
96
+ */
97
+ private arrivalDayOffset;
59
98
  private formatHHmm;
60
99
  private formatDuration;
61
100
  private toFlightCard;
@@ -95,6 +134,20 @@ export declare class ChatbotFlightSearchService implements ChatbotTravelHandler
95
134
  private mapCabinClass;
96
135
  private normalizeTime;
97
136
  private resolveAirport;
137
+ /**
138
+ * Build the de-duplicated list of carrier search terms from the chat
139
+ * parameters. Prefers the `airlines` array (up to {@link MAX_PREFERRED_CARRIERS})
140
+ * when present, else falls back to the singular airline/airlineCode. Drops
141
+ * "no preference" sentinels ("any"/"all"/empty) and terms shorter than 2 chars.
142
+ */
143
+ private collectCarrierTerms;
144
+ /**
145
+ * Resolve a single airline search term to a real {code, name} from the
146
+ * searchAirlines GraphQL source, trying the highest-confidence match first:
147
+ * exact IATA code, exact name, then non-subsidiary startsWith/contains — so
148
+ * "KLM" resolves to "KLM Royal Dutch Airlines" rather than "KLM Cityhopper".
149
+ */
150
+ private resolveCarrier;
98
151
  static ɵfac: i0.ɵɵFactoryDeclaration<ChatbotFlightSearchService, never>;
99
152
  static ɵprov: i0.ɵɵInjectableDeclaration<ChatbotFlightSearchService>;
100
153
  }
@@ -3,6 +3,7 @@ import { ChatbotService } from './chatbot.service';
3
3
  import { EnterpriseSearchService } from './search.service';
4
4
  import { HotelAvalibilityService } from './hotel-avallibility.service';
5
5
  import { ResultAwareService } from './result-aware.service';
6
+ import { UserService } from './user.service';
6
7
  import * as i0 from "@angular/core";
7
8
  /**
8
9
  * Handles chatbot-driven hotel searches. Registered with
@@ -18,14 +19,21 @@ export declare class ChatbotHotelSearchService implements ChatbotTravelHandler {
18
19
  private searchService;
19
20
  private hotelAvalibilityService;
20
21
  private resultAwareService;
22
+ private userService;
21
23
  readonly travelType: "hotel";
22
24
  private availabilitySubscription;
23
- constructor(chatbotService: ChatbotService, searchService: EnterpriseSearchService, hotelAvalibilityService: HotelAvalibilityService, resultAwareService: ResultAwareService);
25
+ lastParameters: ChatSearchParameters | null;
26
+ markAsLoading(): void;
27
+ get hasHotelResults(): boolean;
28
+ constructor(chatbotService: ChatbotService, searchService: EnterpriseSearchService, hotelAvalibilityService: HotelAvalibilityService, resultAwareService: ResultAwareService, userService: UserService);
24
29
  handle(parameters: ChatSearchParameters, autoSearch: boolean): Promise<void>;
30
+ private ensureSelfTraveller;
25
31
  private runSearch;
32
+ private runSearchFromOffset;
26
33
  private buildHotelCards;
27
34
  private injectNoResultsMessage;
28
35
  private sortHotels;
36
+ private cheapestRoomTotal;
29
37
  private populateHotelParams;
30
38
  static ɵfac: i0.ɵɵFactoryDeclaration<ChatbotHotelSearchService, never>;
31
39
  static ɵprov: i0.ɵɵInjectableDeclaration<ChatbotHotelSearchService>;
@@ -0,0 +1,32 @@
1
+ import { ChatSearchParameters, ChatbotTravelHandler } from '@sabstravtech/obtservices/base';
2
+ import { ChatbotService } from './chatbot.service';
3
+ import { EnterpriseSearchService } from './search.service';
4
+ import { ResultAwareService } from './result-aware.service';
5
+ import { UserService } from './user.service';
6
+ import * as i0 from "@angular/core";
7
+ /**
8
+ * Handles chatbot-driven lounge searches. Registered with
9
+ * `ChatbotSearchDispatcherService`; not used directly.
10
+ *
11
+ * Populates the lounge search state from the chatbot's parameters and runs
12
+ * `startSearch()` headlessly so chatbot lounge searches work from any page.
13
+ * Once results arrive, builds `ChatLoungeResultCard`s and patches them onto
14
+ * the last assistant message via {@link ChatbotService.patchAssistantMessage}.
15
+ */
16
+ export declare class ChatbotLoungeSearchService implements ChatbotTravelHandler {
17
+ private chatbotService;
18
+ private searchService;
19
+ private resultAwareService;
20
+ private userService;
21
+ readonly travelType: "lounge";
22
+ private resultsSubscription;
23
+ constructor(chatbotService: ChatbotService, searchService: EnterpriseSearchService, resultAwareService: ResultAwareService, userService: UserService);
24
+ handle(parameters: ChatSearchParameters, autoSearch: boolean): Promise<void>;
25
+ private subscribeToLoungeResults;
26
+ private buildLoungeCards;
27
+ private formatValidationMessages;
28
+ private populateLoungeParams;
29
+ private resolveAirport;
30
+ static ɵfac: i0.ɵɵFactoryDeclaration<ChatbotLoungeSearchService, never>;
31
+ static ɵprov: i0.ɵɵInjectableDeclaration<ChatbotLoungeSearchService>;
32
+ }
@@ -3,6 +3,9 @@ import { ChatbotEurostarSearchService } from './chatbot-eurostar-search.service'
3
3
  import { ChatbotFlightSearchService } from './chatbot-flight-search.service';
4
4
  import { ChatbotRailSearchService } from './chatbot-rail-search.service';
5
5
  import { ChatbotHotelSearchService } from './chatbot-hotel-search.service';
6
+ import { ChatbotLoungeSearchService } from './chatbot-lounge-search.service';
7
+ import { ChatbotCarHireSearchService } from './chatbot-car-hire-search.service';
8
+ import { ChatbotTaxiSearchService } from './chatbot-taxi-search.service';
6
9
  import { ChatbotService } from './chatbot.service';
7
10
  import * as i0 from "@angular/core";
8
11
  /**
@@ -21,7 +24,7 @@ export declare class ChatbotSearchDispatcherService {
21
24
  private chatbotService;
22
25
  private initialised;
23
26
  private readonly handlers;
24
- constructor(chatbotService: ChatbotService, rail: ChatbotRailSearchService, flight: ChatbotFlightSearchService, hotel: ChatbotHotelSearchService, eurostar: ChatbotEurostarSearchService);
27
+ constructor(chatbotService: ChatbotService, rail: ChatbotRailSearchService, flight: ChatbotFlightSearchService, hotel: ChatbotHotelSearchService, carHire: ChatbotCarHireSearchService, eurostar: ChatbotEurostarSearchService, lounge: ChatbotLoungeSearchService, taxi: ChatbotTaxiSearchService);
25
28
  /** Call once at app start. Idempotent. */
26
29
  init(): void;
27
30
  /**
@@ -0,0 +1,21 @@
1
+ import { ChatSearchParameters, ChatbotTravelHandler } from '@sabstravtech/obtservices/base';
2
+ import { ChatbotService } from './chatbot.service';
3
+ import { EnterpriseSearchService } from './search.service';
4
+ import { ResultAwareService } from './result-aware.service';
5
+ import * as i0 from "@angular/core";
6
+ export declare class ChatbotTaxiSearchService implements ChatbotTravelHandler {
7
+ private chatbotService;
8
+ private searchService;
9
+ private resultAwareService;
10
+ readonly travelType: "taxi";
11
+ constructor(chatbotService: ChatbotService, searchService: EnterpriseSearchService, resultAwareService: ResultAwareService);
12
+ handle(parameters: ChatSearchParameters, autoSearch: boolean): Promise<void>;
13
+ private runSearch;
14
+ private buildTaxiCards;
15
+ private injectNoResultsMessage;
16
+ private populateTaxiParams;
17
+ private resolveGeoLocation;
18
+ private matchTerminal;
19
+ static ɵfac: i0.ɵɵFactoryDeclaration<ChatbotTaxiSearchService, never>;
20
+ static ɵprov: i0.ɵɵInjectableDeclaration<ChatbotTaxiSearchService>;
21
+ }
@@ -26,6 +26,13 @@ export declare class ChatbotService extends BaseChatbotService implements OnDest
26
26
  parameters: ChatSearchParameters;
27
27
  autoSearch: boolean;
28
28
  }>;
29
+ /** Fires after the car hire chatbot handler has finished populating city/depot params,
30
+ * so the component can call updateLocation() to populate the depot dropdown options. */
31
+ carHireParamsReady$: Subject<void>;
32
+ /** Re-rank already-cached results (no new search) — routed to the handler's resort(). */
33
+ resortResults$: Subject<{
34
+ parameters: ChatSearchParameters;
35
+ }>;
29
36
  private riskFlagSubject;
30
37
  riskFlag$: import("rxjs").Observable<IRiskFlag>;
31
38
  private faqsSubject;
@@ -46,6 +53,7 @@ export declare class ChatbotService extends BaseChatbotService implements OnDest
46
53
  protected notifyMessages(messages: ChatMessage[]): void;
47
54
  protected notifyLoading(loading: boolean): void;
48
55
  protected notifyFillForm(parameters: ChatSearchParameters, autoSearch: boolean): void;
56
+ protected notifyResort(parameters: ChatSearchParameters): void;
49
57
  protected notifyRiskFlag(flag: IRiskFlag): void;
50
58
  protected notifyFaqs(faqs: BotFaq[]): void;
51
59
  protected notifyToken(event: ChatTokenEvent): void;
@@ -56,9 +64,22 @@ export declare class ChatbotService extends BaseChatbotService implements OnDest
56
64
  protected executeSelection(selectedIndex: number, returnSelectedIndex?: number): Promise<void>;
57
65
  protected getSource(): string;
58
66
  protected getUserCapabilities(): UserCapabilities;
67
+ /**
68
+ * Translate the flight search form's `classSelection` config (where a `true`
69
+ * value HIDES a cabin) into the list of cabin classes the user is allowed to
70
+ * search/book, in the cabin enum the chatbot/AI uses. Returns undefined when
71
+ * no class is hidden (i.e. no restriction).
72
+ */
73
+ private resolveAllowedFlightCabins;
74
+ protected getUserFirstName(): string | undefined;
75
+ /** Set by ChatbotCarHireSearchService when the user is choosing from a depot list. */
76
+ depotSelectionHandler: ((text: string) => Promise<boolean>) | null;
59
77
  connect(): void;
60
78
  clearSession(): void;
61
79
  injectMessage(message: ChatMessage): void;
80
+ /** Remove the last assistant message from the UI (e.g. when it's been superseded). */
81
+ retractLastAssistantMessage(): void;
82
+ protected beforeEmit(text: string): Promise<boolean>;
62
83
  protected handleResponse(env: ChatWsResponse): void;
63
84
  /**
64
85
  * Toggle the chatbot's "searching" indicator from a travel-type handler.
@@ -1,7 +1,7 @@
1
1
  import { Router } from '@angular/router';
2
2
  import { EnterpriseSearchService } from './search.service';
3
3
  import { EnterpriseBasketService } from './enterprise-basket.service';
4
- import { CondensedResult, ChatRailFareTicket } from '@sabstravtech/obtservices/base';
4
+ import { CondensedResult, ChatRailFareTicket, ChatFlightFareTicket } from '@sabstravtech/obtservices/base';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare class ResultAwareService {
7
7
  private searchService;
@@ -12,12 +12,20 @@ export declare class ResultAwareService {
12
12
  private currentServiceType;
13
13
  private railSourceId;
14
14
  private railReturnJourneys;
15
+ /** Raw flight itineraries per leg, kept so the chat cards' "Fare Rules" links
16
+ * can resolve a fare back to its underlying journey. Outbound holds the
17
+ * outbound + combined-return journeys; inbound holds dual-single return
18
+ * journeys (priced separately). */
19
+ private flightOutboundRaw;
20
+ private flightInboundRaw;
15
21
  private resultsAvailableSubject;
16
22
  resultsAvailable$: import("rxjs").Observable<boolean>;
17
23
  constructor(searchService: EnterpriseSearchService, basketService: EnterpriseBasketService, router: Router);
18
24
  captureFlightResults(results: any[]): void;
19
25
  captureRailResults(quoteResult: any): void;
20
26
  captureHotelResults(results: any[]): void;
27
+ captureCarHireResults(results: any[]): void;
28
+ selectCarHire(cardIndex: number): Promise<void>;
21
29
  isHotelSearch(): boolean;
22
30
  getCondensedResults(): CondensedResult[];
23
31
  /**
@@ -42,6 +50,15 @@ export declare class ResultAwareService {
42
50
  * Open the existing OBT rail "View Conditions" dialog for a fare displayed in the chat.
43
51
  */
44
52
  openRailFareDetails(ticket: ChatRailFareTicket): Promise<void>;
53
+ /** Store the raw flight journeys for each leg so the chat cards can open fare
54
+ * rules. Called by the chat flight-search service after a search/re-rank. */
55
+ setFlightRawLegs(outbound: any[], inbound: any[]): void;
56
+ /**
57
+ * Open the existing OBT flight "Fare Rules" dialog for a fare displayed in the
58
+ * chat — mirrors the results page's fares-table behaviour (makeFareRules +
59
+ * openFlightFareRules) so the user sees the same conditions modal.
60
+ */
61
+ openFlightFareDetails(ticket: ChatFlightFareTicket): Promise<void>;
45
62
  private collectFareTickets;
46
63
  hasResults(): boolean;
47
64
  clearResults(): void;
@@ -3923,7 +3923,6 @@ export type ProcessTermsPriceResult = {
3923
3923
  __typename?: 'ProcessTermsPriceResult';
3924
3924
  amount: FieldWrapper<Scalars['String']['output']>;
3925
3925
  currency: FieldWrapper<Scalars['String']['output']>;
3926
- taxItemsWithoutCode: Array<FieldWrapper<ProcessTermsTaxItem>>;
3927
3926
  };
3928
3927
  export type ProcessTermsTaxItem = {
3929
3928
  __typename?: 'ProcessTermsTaxItem';
@@ -18989,12 +18988,6 @@ export type GetProcessTermsPriceQuery = {
18989
18988
  __typename?: 'ProcessTermsPriceResult';
18990
18989
  amount: string;
18991
18990
  currency: string;
18992
- taxItemsWithoutCode: Array<{
18993
- __typename?: 'ProcessTermsTaxItem';
18994
- name: string;
18995
- amount: string;
18996
- currency: string;
18997
- }>;
18998
18991
  };
18999
18992
  };
19000
18993
  export type GetRailLiveDeparturesQueryVariables = Exact<{
@@ -37434,7 +37427,6 @@ export declare namespace GetProcessTermsPrice {
37434
37427
  type Variables = GetProcessTermsPriceQueryVariables;
37435
37428
  type Query = GetProcessTermsPriceQuery;
37436
37429
  type GetProcessTermsPrice = GetProcessTermsPriceQuery['getProcessTermsPrice'];
37437
- type TaxItemsWithoutCode = GetProcessTermsPriceQuery['getProcessTermsPrice']['taxItemsWithoutCode'][number];
37438
37430
  }
37439
37431
  export declare namespace GetRailLiveDepartures {
37440
37432
  type Variables = GetRailLiveDeparturesQueryVariables;
@@ -21,6 +21,8 @@ export * from './lib/vendor/services/chatbot.service';
21
21
  export * from './lib/vendor/services/chatbot-rail-search.service';
22
22
  export * from './lib/vendor/services/chatbot-flight-search.service';
23
23
  export * from './lib/vendor/services/chatbot-hotel-search.service';
24
+ export * from './lib/vendor/services/chatbot-car-hire-search.service';
25
+ export * from './lib/vendor/services/chatbot-taxi-search.service';
24
26
  export * from './lib/vendor/services/chatbot-eurostar-search.service';
25
27
  export * from './lib/vendor/services/chatbot-search-dispatcher.service';
26
28
  export * from './lib/vendor/services/result-aware.service';
@@ -28,7 +28,6 @@ export * from './lib/vendor/interfaces/terms-and-conditions.interface';
28
28
  export * from './lib/vendor/interfaces/rail-basket-item.interface';
29
29
  export * from './lib/vendor/interfaces/enable-fresh-chat-interface';
30
30
  export * from './lib/vendor/interfaces/Ifast-track-enterprise-search';
31
- export * from './lib/vendor/interfaces/chatbot.types';
32
31
  export * from './lib/vendor/interfaces/fast-track-filters.interface';
33
32
  export * from './lib/vendor/interfaces/Iferry-enterprise-search';
34
33
  export * from './lib/vendor/interfaces/Iapartment-enterprise-search';
@@ -241,7 +241,7 @@ export declare class RailEnterpriseSearch<Q extends RailQuoteFetcherType, GRS_Q
241
241
  */
242
242
  addToBasket(sourceId: string, searchQuery: RailTempParams, journey: OBTRailJourneyOption, railFare: OBTRailJourneyFare, inboundRailFare?: OBTRailJourneyFare, inboundJourney?: OBTRailJourneyOption, ingoreInvoked?: boolean, ignoreTicketExtras?: boolean): Promise<DifferentInvokdedUserReasons>;
243
243
  addOpenReturnToBasket(sourceId: string, searchQuery: RailTempParams, journey: OBTRailJourneyOption, railFare: OBTRailJourneyFare, ignoreInvoked?: boolean): Promise<DifferentInvokdedUserReasons>;
244
- addDualSingleToBasket(serviceId: string, searchQuery: RailTempParams | SearchRailQueryVariables, outbound: OBTRailJourneyOption, inbound: OBTRailJourneyOption, outboundFare: OBTRailJourneyFare, inboundFare: OBTRailJourneyFare, ignoreInvoked?: boolean, isEu?: boolean, gmt?: boolean): Promise<DifferentInvokdedUserReasons>;
244
+ addDualSingleToBasket(serviceId: string, searchQuery: RailTempParams | SearchRailQueryVariables, outbound: OBTRailJourneyOption, inbound: OBTRailJourneyOption, outboundFare: OBTRailJourneyFare, inboundFare: OBTRailJourneyFare, ignoreInvoked?: boolean, isEu?: boolean, gmt?: boolean, isInbound?: boolean): Promise<DifferentInvokdedUserReasons>;
245
245
  private isFareTypeMatch;
246
246
  private findBestFareFromFiltered;
247
247
  findCheapestTicket(notSplit?: boolean, fareType?: RailSplitComparisonType): ICheapestPrice;