@findhotel/sapi 0.26.5 → 1.0.0-beta.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/README.md +95 -98
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -0
- package/dist/types/packages/core/src/__fixtures__/offers.d.ts +65 -35
- package/dist/types/packages/core/src/offers-client.d.ts +4 -14
- package/dist/types/packages/core/src/search.d.ts +2 -19
- package/dist/types/packages/core/src/types/index.d.ts +2 -0
- package/dist/types/packages/core/src/types/offers.d.ts +74 -0
- package/dist/types/packages/core/src/types/options.d.ts +11 -10
- package/dist/types/packages/core/src/types/rooms.d.ts +3 -8
- package/dist/types/packages/core/src/types/search.d.ts +18 -0
- package/dist/types/packages/core/src/types/types.d.ts +23 -87
- package/dist/types/packages/core/src/utils/build-offers-response.d.ts +6 -3
- package/dist/types/packages/core/src/utils/cheapest-rate.d.ts +2 -2
- package/dist/types/packages/core/src/utils/deal-score.d.ts +3 -3
- package/dist/types/packages/core/src/utils/index.d.ts +1 -0
- package/dist/types/packages/core/src/utils/total-rate-formula.d.ts +7 -0
- package/package.json +1 -1
|
@@ -1,47 +1,77 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const offer1: {
|
|
2
|
+
accessTier: null;
|
|
2
3
|
availableRooms: number;
|
|
3
|
-
|
|
4
|
-
calculatedTotalRate: number;
|
|
5
|
-
canPayLater: boolean;
|
|
6
|
-
cug: null;
|
|
4
|
+
cancellationPenalties: never[];
|
|
7
5
|
currency: string;
|
|
8
|
-
hasAnchorPrice: boolean;
|
|
9
|
-
hasFreeCancellation: boolean;
|
|
10
6
|
id: string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
intermediaryProvider: string;
|
|
8
|
+
metadata: {
|
|
9
|
+
feedID: string;
|
|
10
|
+
};
|
|
11
|
+
package: {
|
|
12
|
+
amenities: string[];
|
|
13
|
+
canPayLater: boolean;
|
|
14
|
+
};
|
|
18
15
|
providerCode: string;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
rateBasedOnNumberOfRooms: null;
|
|
22
|
-
rateBreakdown: {
|
|
23
|
-
baseRate: number;
|
|
16
|
+
rate: {
|
|
17
|
+
base: number;
|
|
24
18
|
taxes: number;
|
|
25
|
-
|
|
19
|
+
hotelFees: number;
|
|
26
20
|
};
|
|
21
|
+
roomName: string;
|
|
22
|
+
tags: string[];
|
|
23
|
+
url: string;
|
|
27
24
|
};
|
|
28
|
-
export declare const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
export declare const offer2: {
|
|
26
|
+
accessTier: null;
|
|
27
|
+
availableRooms: number;
|
|
28
|
+
cancellationPenalties: never[];
|
|
29
|
+
currency: string;
|
|
30
|
+
id: string;
|
|
31
|
+
intermediaryProvider: string;
|
|
32
|
+
metadata: {
|
|
33
|
+
feedID: string;
|
|
34
|
+
};
|
|
35
|
+
package: {
|
|
36
|
+
amenities: string[];
|
|
37
|
+
canPayLater: boolean;
|
|
38
|
+
};
|
|
39
|
+
providerCode: string;
|
|
40
|
+
rate: {
|
|
41
|
+
base: number;
|
|
42
|
+
taxes: number;
|
|
43
|
+
hotelFees: number;
|
|
44
|
+
};
|
|
45
|
+
roomName: string;
|
|
46
|
+
tags: string[];
|
|
47
|
+
url: string;
|
|
35
48
|
};
|
|
36
|
-
export declare const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
49
|
+
export declare const offer3: {
|
|
50
|
+
accessTier: null;
|
|
51
|
+
availableRooms: number;
|
|
52
|
+
cancellationPenalties: never[];
|
|
53
|
+
currency: string;
|
|
54
|
+
id: string;
|
|
55
|
+
intermediaryProvider: string;
|
|
56
|
+
metadata: {
|
|
57
|
+
feedID: string;
|
|
58
|
+
};
|
|
59
|
+
package: {
|
|
60
|
+
amenities: string[];
|
|
61
|
+
canPayLater: boolean;
|
|
62
|
+
};
|
|
63
|
+
providerCode: string;
|
|
64
|
+
rate: {
|
|
65
|
+
base: number;
|
|
66
|
+
taxes: number;
|
|
67
|
+
hotelFees: number;
|
|
68
|
+
};
|
|
69
|
+
roomName: string;
|
|
70
|
+
tags: string[];
|
|
71
|
+
url: string;
|
|
40
72
|
};
|
|
41
73
|
export declare const anchorPriceRateBreakdown: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
localTaxes: number;
|
|
45
|
-
nightlyRate: number;
|
|
74
|
+
base: number;
|
|
75
|
+
hotelFees: number;
|
|
46
76
|
taxes: number;
|
|
47
77
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CugDeals, HotelId, HotelOfferEntity, Currency, RoomId,
|
|
1
|
+
import { CugDeals, HotelId, HotelOfferEntity, Currency, RoomId, Amenities, Options as ClientOptions, UserTier, Discount } from './types';
|
|
2
2
|
interface V3RateBreakdown {
|
|
3
3
|
base: number;
|
|
4
4
|
hotelFees: number;
|
|
@@ -10,7 +10,6 @@ interface CancellationPenalty {
|
|
|
10
10
|
end: string;
|
|
11
11
|
start: string;
|
|
12
12
|
}
|
|
13
|
-
declare type Amenities = Meals & 'internetIncluded';
|
|
14
13
|
declare type OfferTag = 'top_offer' | 'anchor_price' | 'exclusive_cheapest_offer';
|
|
15
14
|
interface SapiResponseOffer {
|
|
16
15
|
accessTier: string;
|
|
@@ -40,8 +39,6 @@ declare type Rooms = Record<RoomId, {
|
|
|
40
39
|
export interface SapiResponseOfferEntity {
|
|
41
40
|
anchorRate: V3RateBreakdown;
|
|
42
41
|
availableOffersCount: number;
|
|
43
|
-
fetchedAllOffers: boolean;
|
|
44
|
-
hasMoreOffers: boolean;
|
|
45
42
|
id: HotelId;
|
|
46
43
|
offers: SapiResponseOffer[];
|
|
47
44
|
rooms: Rooms;
|
|
@@ -71,21 +68,14 @@ export interface OffersResponse {
|
|
|
71
68
|
export interface OffersClient {
|
|
72
69
|
getOffers: (parameters: GetOffersParameters, onOffersReceived?: (response: OffersResponse) => void) => Promise<OffersResponse>;
|
|
73
70
|
}
|
|
74
|
-
export declare function
|
|
75
|
-
interface
|
|
76
|
-
checkIn: string;
|
|
77
|
-
checkOut: string;
|
|
78
|
-
includeTaxes?: boolean;
|
|
79
|
-
includeLocalTaxes?: boolean;
|
|
80
|
-
}
|
|
81
|
-
export declare function sapiResponseToHotelOfferEntity(offerEntity: SapiResponseOfferEntity, context: MappingContext): HotelOfferEntity;
|
|
82
|
-
interface ApiConfig {
|
|
71
|
+
export declare function sapiResponseToHotelOfferEntity(offerEntity: SapiResponseOfferEntity): HotelOfferEntity;
|
|
72
|
+
interface Config {
|
|
83
73
|
baseUrl: string;
|
|
84
74
|
endpoints: {
|
|
85
75
|
offers: string;
|
|
86
76
|
};
|
|
87
77
|
}
|
|
88
|
-
export declare function offersClient(config:
|
|
78
|
+
export declare function offersClient(config: Config, options: ClientOptions): {
|
|
89
79
|
getOffers: (parameters: GetOffersParameters, onOffersReceived?: ((response: OffersResponse) => void) | undefined) => Promise<OffersResponse>;
|
|
90
80
|
};
|
|
91
81
|
export {};
|
|
@@ -1,25 +1,8 @@
|
|
|
1
1
|
import { Except } from 'type-fest';
|
|
2
|
-
import {
|
|
2
|
+
import { DatesConfig } from './utils';
|
|
3
3
|
import { OffersClient } from './offers-client';
|
|
4
4
|
import { AppConfig, ProfileKey, Features } from './app-config';
|
|
5
|
-
import {
|
|
6
|
-
export interface SearchResults {
|
|
7
|
-
anchor: Anchor;
|
|
8
|
-
anchorHotelId?: HotelId;
|
|
9
|
-
anchorType: AnchorType;
|
|
10
|
-
hotelEntities: Record<HotelId, Hotel>;
|
|
11
|
-
hotelOfferEntities: Record<HotelId, HotelOfferEntity>;
|
|
12
|
-
hotelIds: HotelId[];
|
|
13
|
-
searchParameters: ApiSearchParameters | SearchParameters;
|
|
14
|
-
searchId: string;
|
|
15
|
-
hotelsHaveStaticPosition: boolean;
|
|
16
|
-
facets: Facets;
|
|
17
|
-
resultsCount: number;
|
|
18
|
-
resultsCountTotal: number;
|
|
19
|
-
offset: number;
|
|
20
|
-
dealScores: DealScores;
|
|
21
|
-
hasMoreResults: boolean;
|
|
22
|
-
}
|
|
5
|
+
import { SearchResults, HotelId, ApiSearchParameters, HotelOfferEntity, Options as ClientOptions } from './types';
|
|
23
6
|
declare type OnStart = (response: Pick<SearchResults, 'searchId' | 'searchParameters'>) => void;
|
|
24
7
|
declare type OnAnchorReceived = (response: Pick<SearchResults, 'searchId' | 'searchParameters' | 'anchor' | 'anchorHotelId' | 'anchorType'>) => void;
|
|
25
8
|
declare type OnHotelsReceived = (response: Except<SearchResults, 'hotelOfferEntities'>) => void;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { CancellationPenalties, Currency } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Object contains details about the price of the Offer, the rate is divided into 3 attributes:
|
|
4
|
+
*
|
|
5
|
+
* base: The rate charged by the hotel without considering extra taxes and other fees. \
|
|
6
|
+
* hotelFees: The sum of all other charges, like resort fee. \
|
|
7
|
+
* taxes: The sum of all taxes applied to the offer.
|
|
8
|
+
*/
|
|
9
|
+
export interface RateBreakdown {
|
|
10
|
+
base: number;
|
|
11
|
+
hotelFees: number;
|
|
12
|
+
taxes: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Available amenities within the offer
|
|
16
|
+
*/
|
|
17
|
+
export declare type Amenities = 'allInclusive' | 'breakfast' | 'partialBreakfast' | 'lunch' | 'dinner' | 'fullBoard' | 'halfBoard' | 'meals' | 'internetIncluded';
|
|
18
|
+
/**
|
|
19
|
+
* Tag is an attribute that annotates the offer indicating a particular characteristic
|
|
20
|
+
*
|
|
21
|
+
* "top_offer" - is offer a top offer \
|
|
22
|
+
* "anchor_price" - offer is an anchor price offer \
|
|
23
|
+
* "exclusive_cheapest_offer" - offer is the cheapest offer amoun others
|
|
24
|
+
*/
|
|
25
|
+
export declare type OfferTags = 'top_offer' | 'anchor_price' | 'exclusive_cheapest_offer';
|
|
26
|
+
/**
|
|
27
|
+
* Attribute indicating the minimum tier the user should be in order to be able to book this offer.
|
|
28
|
+
*/
|
|
29
|
+
export declare type AccessTier = string;
|
|
30
|
+
/**
|
|
31
|
+
* Hotel's offer
|
|
32
|
+
*/
|
|
33
|
+
export interface Offer {
|
|
34
|
+
accessTier: AccessTier;
|
|
35
|
+
availableRooms: number;
|
|
36
|
+
cancellationPenalties: CancellationPenalties[];
|
|
37
|
+
currency: Currency;
|
|
38
|
+
id: string;
|
|
39
|
+
intermediaryProvider: string;
|
|
40
|
+
metadata: {
|
|
41
|
+
feedID: string;
|
|
42
|
+
providerRateType?: string;
|
|
43
|
+
};
|
|
44
|
+
package: {
|
|
45
|
+
amenities: Amenities[];
|
|
46
|
+
canPayLater: boolean;
|
|
47
|
+
};
|
|
48
|
+
providerCode: string;
|
|
49
|
+
rate: RateBreakdown;
|
|
50
|
+
roomName?: string;
|
|
51
|
+
tags: OfferTags[] | null;
|
|
52
|
+
url: string;
|
|
53
|
+
}
|
|
54
|
+
export interface Discount {
|
|
55
|
+
modifier: string;
|
|
56
|
+
hasParityProvider: boolean;
|
|
57
|
+
hasDiscountProvider: boolean;
|
|
58
|
+
discountProvider: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Hotel offer entity contains offers array as well as meta information about offers and hotel
|
|
62
|
+
*/
|
|
63
|
+
export interface HotelOfferEntity {
|
|
64
|
+
/** Available offers count for the requested itinerary */
|
|
65
|
+
availableOffersCount: number;
|
|
66
|
+
/** The rate of the offer tagged as anchor price offer */
|
|
67
|
+
anchorRate: RateBreakdown;
|
|
68
|
+
/** Discount - meta information used in analytics */
|
|
69
|
+
discount?: Discount;
|
|
70
|
+
/** Id of the requested hotel */
|
|
71
|
+
id: string;
|
|
72
|
+
/** Hotel's offers */
|
|
73
|
+
offers: Offer[];
|
|
74
|
+
}
|
|
@@ -4,6 +4,8 @@ import { AppConfig } from '../app-config';
|
|
|
4
4
|
import { Configs } from './config';
|
|
5
5
|
import { AnonymousId, Language, Currency, Country, DeviceType, Brand } from './types';
|
|
6
6
|
import { Logger } from './logger';
|
|
7
|
+
import { RateBreakdown } from './offers';
|
|
8
|
+
export declare type TotalRateFormula = (rate: RateBreakdown) => number;
|
|
7
9
|
/** Options for initializing the Search API client. Persistent within single SAPI instance but may vary for different users */
|
|
8
10
|
export interface ClientOptions {
|
|
9
11
|
/** Unique ID identifying users */
|
|
@@ -12,18 +14,10 @@ export interface ClientOptions {
|
|
|
12
14
|
language: Language;
|
|
13
15
|
/** Currency code for selected user currency */
|
|
14
16
|
currency: Currency;
|
|
15
|
-
/**
|
|
16
|
-
userCountry?: Country;
|
|
17
|
-
/** Country code for selected user origin userCountry */
|
|
17
|
+
/** Country code for selected user origin country */
|
|
18
18
|
countryCode: Country;
|
|
19
19
|
/** Displayed page size */
|
|
20
20
|
pageSize?: number;
|
|
21
|
-
/** Include or not local taxes based on localisation logic */
|
|
22
|
-
includeLocalTaxes?: boolean;
|
|
23
|
-
/** Include or not taxes based on localisation logic */
|
|
24
|
-
includeTaxes?: boolean;
|
|
25
|
-
/** @deprecated since 0.23.0 use deviceType instead */
|
|
26
|
-
deviceCategory?: DeviceType;
|
|
27
21
|
/** User's device type */
|
|
28
22
|
deviceType: DeviceType;
|
|
29
23
|
/** Used to identify SAPI Cli interface on the RAA backend */
|
|
@@ -44,12 +38,19 @@ export interface ClientOptions {
|
|
|
44
38
|
};
|
|
45
39
|
/** Websoket implementation */
|
|
46
40
|
WebSocket?: WebSocket;
|
|
41
|
+
/**
|
|
42
|
+
* Formula to calculate total display rate based on tax display logic.
|
|
43
|
+
* If not provided SAPI will use rate including all taxes and fees.
|
|
44
|
+
* Used for price filter and sort by price functionalities.
|
|
45
|
+
*/
|
|
46
|
+
totalRateFormula?: TotalRateFormula;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Adjusted options
|
|
50
50
|
*/
|
|
51
|
-
export declare type Options = Except<ClientOptions, 'variations' | 'logger'> & {
|
|
51
|
+
export declare type Options = Except<ClientOptions, 'variations' | 'logger' | 'totalRateFormula'> & {
|
|
52
52
|
logger: Logger;
|
|
53
|
+
totalRateFormula: TotalRateFormula;
|
|
53
54
|
variations: string[];
|
|
54
55
|
pageSize: number;
|
|
55
56
|
languages: Language[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HotelId, AnonymousId, Currency, RoomId, UserTier } from './types';
|
|
1
|
+
import { HotelId, AnonymousId, Currency, RoomId, UserTier, CancellationPenalties } from './types';
|
|
2
2
|
export interface RoomsRequestParameters {
|
|
3
3
|
hotelId: HotelId;
|
|
4
4
|
checkIn: string;
|
|
@@ -12,14 +12,9 @@ export interface RoomsRequestParameters {
|
|
|
12
12
|
clickedOfferTaxes?: number;
|
|
13
13
|
clickedOfferHotelFees?: number;
|
|
14
14
|
preHeat?: number;
|
|
15
|
+
trafficSource?: string;
|
|
15
16
|
}
|
|
16
17
|
export declare type RoomPackageId = string;
|
|
17
|
-
export interface RoomCancellationPenalties {
|
|
18
|
-
start: string;
|
|
19
|
-
end: string;
|
|
20
|
-
amount: number;
|
|
21
|
-
currency: string;
|
|
22
|
-
}
|
|
23
18
|
export interface RoomLinks {
|
|
24
19
|
href: string;
|
|
25
20
|
method: 'GET' | 'POST';
|
|
@@ -53,7 +48,7 @@ export interface MatchedDim {
|
|
|
53
48
|
export interface RoomOffer {
|
|
54
49
|
id: string;
|
|
55
50
|
availableRooms: number;
|
|
56
|
-
cancellationPenalties:
|
|
51
|
+
cancellationPenalties: CancellationPenalties[];
|
|
57
52
|
cug: string[];
|
|
58
53
|
extraParams: unknown;
|
|
59
54
|
links: RoomLinks[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HotelId, Anchor, AnchorType, Hotel, Facets, ApiSearchParameters, SearchParameters, DealScores } from './types';
|
|
2
|
+
import { HotelOfferEntity } from './offers';
|
|
3
|
+
export interface SearchResults {
|
|
4
|
+
anchor: Anchor;
|
|
5
|
+
anchorHotelId?: HotelId;
|
|
6
|
+
anchorType: AnchorType;
|
|
7
|
+
hotelEntities: Record<HotelId, Hotel>;
|
|
8
|
+
hotelOfferEntities: Record<HotelId, HotelOfferEntity>;
|
|
9
|
+
hotelIds: HotelId[];
|
|
10
|
+
searchParameters: ApiSearchParameters | SearchParameters;
|
|
11
|
+
searchId: string;
|
|
12
|
+
hotelsHaveStaticPosition: boolean;
|
|
13
|
+
facets: Facets;
|
|
14
|
+
resultsCount: number;
|
|
15
|
+
resultsCountTotal: number;
|
|
16
|
+
offset: number;
|
|
17
|
+
dealScores: DealScores;
|
|
18
|
+
}
|
|
@@ -4,14 +4,36 @@
|
|
|
4
4
|
* @default new UUID
|
|
5
5
|
*/
|
|
6
6
|
export declare type AnonymousId = string;
|
|
7
|
+
/**
|
|
8
|
+
* 3-char uppercased ISO currency code
|
|
9
|
+
*/
|
|
7
10
|
export declare type Currency = string;
|
|
11
|
+
/**
|
|
12
|
+
* ISO language code
|
|
13
|
+
*/
|
|
8
14
|
export declare type Language = string;
|
|
15
|
+
/**
|
|
16
|
+
* 2-char uppercased ISO country code
|
|
17
|
+
*/
|
|
9
18
|
export declare type Country = string;
|
|
10
19
|
export declare type DateString = string;
|
|
11
20
|
export declare type DeviceType = 'desktop' | 'mobile' | 'tablet';
|
|
12
21
|
export declare type CugDeals = string[];
|
|
13
22
|
export declare type UserTier = string;
|
|
14
23
|
export declare type Brand = string;
|
|
24
|
+
/**
|
|
25
|
+
* Cancellation penalties
|
|
26
|
+
* used to calculate the refund amount in case of a booking cancellation,
|
|
27
|
+
* reflecting the cancellation information that was informed to the customers when they made their reservation.
|
|
28
|
+
*
|
|
29
|
+
* https://engdocs.fih.io/engineering/cancellation_penalties/
|
|
30
|
+
*/
|
|
31
|
+
export interface CancellationPenalties {
|
|
32
|
+
amount: number;
|
|
33
|
+
currency: string;
|
|
34
|
+
end: string;
|
|
35
|
+
start: string;
|
|
36
|
+
}
|
|
15
37
|
/**
|
|
16
38
|
* Search client types
|
|
17
39
|
*/
|
|
@@ -247,91 +269,5 @@ export interface Suggestion {
|
|
|
247
269
|
}
|
|
248
270
|
export declare type HotelId = Hotel['objectID'];
|
|
249
271
|
export declare type RoomId = string;
|
|
250
|
-
|
|
251
|
-
* RAA types
|
|
252
|
-
*/
|
|
253
|
-
export interface RateBreakdown {
|
|
254
|
-
baseRate: number;
|
|
255
|
-
localTaxes: number;
|
|
256
|
-
taxes: number;
|
|
257
|
-
}
|
|
258
|
-
export interface AnchorPriceRateBreakdown extends RateBreakdown {
|
|
259
|
-
calculatedTotalRate: number;
|
|
260
|
-
nightlyRate: number;
|
|
261
|
-
}
|
|
262
|
-
export interface TopOfferData {
|
|
263
|
-
anchorPrice?: number;
|
|
264
|
-
anchorPriceNightly?: number;
|
|
265
|
-
offerIndexes: number[];
|
|
266
|
-
}
|
|
267
|
-
export declare type Meals = 'allInclusive' | 'breakfast' | 'partialBreakfast' | 'lunch' | 'dinner' | 'fullBoard' | 'halfBoard' | 'meals';
|
|
268
|
-
export interface Offer {
|
|
269
|
-
additionalProviderParams: {
|
|
270
|
-
feedId: string;
|
|
271
|
-
rateType?: string;
|
|
272
|
-
};
|
|
273
|
-
id: string;
|
|
274
|
-
bookURI: string;
|
|
275
|
-
providerCode: string;
|
|
276
|
-
proxyProviderCode: string;
|
|
277
|
-
rateBreakdown: RateBreakdown;
|
|
278
|
-
nightlyRate: number;
|
|
279
|
-
calculatedTotalRate: number;
|
|
280
|
-
availableRooms: number;
|
|
281
|
-
cug: string[] | null;
|
|
282
|
-
currency: Currency;
|
|
283
|
-
meals: Meals[];
|
|
284
|
-
tags: string[];
|
|
285
|
-
canPayLater?: boolean;
|
|
286
|
-
hasAnchorPrice?: boolean;
|
|
287
|
-
hasFreeCancellation?: boolean;
|
|
288
|
-
integrationType?: string;
|
|
289
|
-
isAnchorPriceOffer?: boolean;
|
|
290
|
-
isCheapest?: boolean;
|
|
291
|
-
isSharedRoom?: boolean;
|
|
292
|
-
isTopOffer?: boolean;
|
|
293
|
-
packageID?: string;
|
|
294
|
-
providerHotelId?: string;
|
|
295
|
-
roomID?: string;
|
|
296
|
-
roomName?: string;
|
|
297
|
-
rateBasedOnNumberOfRooms?: number;
|
|
298
|
-
feedId?: string;
|
|
299
|
-
providerOfferId?: string;
|
|
300
|
-
rateType?: string;
|
|
301
|
-
}
|
|
302
|
-
export interface RaaResponseOffer {
|
|
303
|
-
availableOffersCount: number;
|
|
304
|
-
anchorPriceRateBreakdown?: AnchorPriceRateBreakdown;
|
|
305
|
-
cheapestPriceRateBreakdown?: RateBreakdown;
|
|
306
|
-
fetchedAllOffers: boolean;
|
|
307
|
-
hasMoreOffers: boolean;
|
|
308
|
-
id: string;
|
|
309
|
-
offers: Offer[];
|
|
310
|
-
topOfferData?: TopOfferData;
|
|
311
|
-
errors: Array<Record<string, number | string>>;
|
|
312
|
-
}
|
|
313
|
-
export interface HotelOfferEntity {
|
|
314
|
-
availableOffersCount: number;
|
|
315
|
-
anchorPriceRateBreakdown?: AnchorPriceRateBreakdown;
|
|
316
|
-
cheapestPriceRateBreakdown?: RateBreakdown;
|
|
317
|
-
fetchedAllOffers: boolean;
|
|
318
|
-
hasMoreOffers: boolean;
|
|
319
|
-
id: string;
|
|
320
|
-
offers: Offer[];
|
|
321
|
-
topOfferData?: TopOfferData;
|
|
322
|
-
discount?: Discount;
|
|
323
|
-
}
|
|
324
|
-
export interface Discount {
|
|
325
|
-
modifier: string;
|
|
326
|
-
hasParityProvider: boolean;
|
|
327
|
-
hasDiscountProvider: boolean;
|
|
328
|
-
discountProvider: string;
|
|
329
|
-
}
|
|
330
|
-
export interface RaaResponse {
|
|
331
|
-
errors: any[];
|
|
332
|
-
results: RaaResponseOffer[];
|
|
333
|
-
status: {
|
|
334
|
-
complete: boolean;
|
|
335
|
-
};
|
|
336
|
-
}
|
|
272
|
+
export declare type DealScores = Record<HotelId, number>;
|
|
337
273
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { OffersResponse } from '../offers-client';
|
|
2
|
-
import { HotelOfferEntity,
|
|
2
|
+
import { HotelOfferEntity, TotalRateFormula } from '../types';
|
|
3
3
|
interface Parameters {
|
|
4
|
+
checkIn: string;
|
|
5
|
+
checkOut: string;
|
|
4
6
|
sortField?: string;
|
|
5
7
|
sortOrder?: string;
|
|
6
8
|
filters?: {
|
|
@@ -10,10 +12,11 @@ interface Parameters {
|
|
|
10
12
|
priceBucketWidth?: number;
|
|
11
13
|
priceBucketsCount: number;
|
|
12
14
|
exchangeRate: number;
|
|
13
|
-
|
|
15
|
+
totalRateFormula: TotalRateFormula;
|
|
14
16
|
}
|
|
15
|
-
export declare function
|
|
17
|
+
export declare function isRateInPriceRange(rate: number, upperBound: number, priceMin?: number, priceMax?: number): boolean;
|
|
16
18
|
export declare function applyPriceFilter(parameters: Parameters, hotelOfferEntity: HotelOfferEntity): HotelOfferEntity;
|
|
19
|
+
export declare function applySort(hotelOfferEntity: HotelOfferEntity[], parameters: Parameters): HotelOfferEntity[];
|
|
17
20
|
export declare function buildOffersResponse(offersResults: OffersResponse, parameters: Parameters): {
|
|
18
21
|
hotelIds: string[];
|
|
19
22
|
hotelOfferEntities: Record<string, HotelOfferEntity>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { HotelOfferEntity } from '../types';
|
|
1
|
+
import { HotelOfferEntity, TotalRateFormula } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Returns cheapest display rate for provided hotel offer entity
|
|
4
4
|
*
|
|
5
5
|
* @param hotelOfferEntity
|
|
6
6
|
*/
|
|
7
|
-
export declare function getCheapestRate(hotelOfferEntity: HotelOfferEntity): number | undefined;
|
|
7
|
+
export declare function getCheapestRate(hotelOfferEntity: HotelOfferEntity, totalRateFormula: TotalRateFormula): number | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { HotelId, HotelOfferEntity, Hotel } from '../types';
|
|
2
|
-
export declare type DealScores = Record<HotelId, number>;
|
|
1
|
+
import { HotelId, HotelOfferEntity, Hotel, DealScores, SearchParameters } from '../types';
|
|
3
2
|
declare type DealScoreInput = [
|
|
4
3
|
hotelId: HotelId,
|
|
5
4
|
rate?: number,
|
|
@@ -20,6 +19,7 @@ export interface DealScoreParameters {
|
|
|
20
19
|
hotelIds: HotelId[];
|
|
21
20
|
hotelEntities: Record<HotelId, Hotel>;
|
|
22
21
|
hotelOfferEntities: Record<HotelId, HotelOfferEntity>;
|
|
22
|
+
searchParameters: SearchParameters;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Returns deal scores for provided hotels and offers
|
|
@@ -28,5 +28,5 @@ export interface DealScoreParameters {
|
|
|
28
28
|
*
|
|
29
29
|
* @returns DealScores - number in 0 to 1 range
|
|
30
30
|
*/
|
|
31
|
-
export declare function getDealScores({ offset, anchorHotelId, hotelIds, hotelEntities, hotelOfferEntities, }: DealScoreParameters): DealScores;
|
|
31
|
+
export declare function getDealScores({ offset, anchorHotelId, hotelIds, hotelEntities, hotelOfferEntities, searchParameters, }: DealScoreParameters): DealScores;
|
|
32
32
|
export {};
|