@findhotel/sapi 1.25.1 → 1.25.3
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/dist/index.js +1 -1
- package/dist/types/packages/core/src/errors.d.ts +1 -1
- package/dist/types/packages/core/src/free-text-suggest.d.ts +2 -2
- package/dist/types/packages/core/src/hotel-availability.d.ts +2 -2
- package/dist/types/packages/core/src/hotel.d.ts +2 -2
- package/dist/types/packages/core/src/hotels-offers.d.ts +4 -4
- package/dist/types/packages/core/src/offers-client.d.ts +1 -1
- package/dist/types/packages/core/src/offers.d.ts +4 -4
- package/dist/types/packages/core/src/reviews-v2.d.ts +2 -2
- package/dist/types/packages/core/src/reviews.d.ts +2 -2
- package/dist/types/packages/core/src/rooms.d.ts +2 -2
- package/dist/types/packages/core/src/sapi.d.ts +12 -12
- package/dist/types/packages/core/src/search.d.ts +5 -5
- package/dist/types/packages/core/src/suggest.d.ts +2 -2
- package/dist/types/packages/core/src/types/availability.d.ts +2 -2
- package/dist/types/packages/core/src/types/config.d.ts +2 -2
- package/dist/types/packages/core/src/types/errors.d.ts +2 -2
- package/dist/types/packages/core/src/types/offers.d.ts +1 -1
- package/dist/types/packages/core/src/types/options.d.ts +7 -7
- package/dist/types/packages/core/src/types/reviews.d.ts +1 -1
- package/dist/types/packages/core/src/types/rooms.d.ts +2 -2
- package/dist/types/packages/core/src/types/search.d.ts +2 -2
- package/dist/types/packages/core/src/types/types.d.ts +32 -32
- package/dist/types/packages/core/src/utils/algolia.d.ts +3 -4
- package/dist/types/packages/core/src/utils/autocomplete-api.d.ts +1 -1
- package/dist/types/packages/core/src/utils/build-offers-response.d.ts +3 -4
- package/dist/types/packages/core/src/utils/dates.d.ts +2 -2
- package/dist/types/packages/core/src/utils/get-total-rate.d.ts +1 -1
- package/dist/types/packages/core/src/utils/index.d.ts +0 -1
- package/dist/types/packages/core/src/utils/omit.d.ts +1 -1
- package/dist/types/packages/core/src/utils/rates.d.ts +1 -1
- package/dist/types/packages/core/src/utils/search-parameters.d.ts +1 -1
- package/dist/types/packages/core/src/utils/state.d.ts +1 -1
- package/package.json +9 -9
- package/dist/types/packages/core/src/__fixtures__/anchor.d.ts +0 -86
- package/dist/types/packages/core/src/utils/discount.d.ts +0 -8
- package/dist/types/packages/core/src/utils/discount.test.d.ts +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Suggestion, Options as ClientOptions } from './types';
|
|
2
|
-
import { AppConfig } from './app-config';
|
|
1
|
+
import { type Suggestion, type Options as ClientOptions } from './types';
|
|
2
|
+
import { type AppConfig } from './app-config';
|
|
3
3
|
export declare function loadFreeTextSuggests(query: string, { appConfig, options }: Parameters): Promise<Suggestion[]>;
|
|
4
4
|
interface Parameters {
|
|
5
5
|
appConfig: AppConfig;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HotelId, Options, RateBreakdown, AvailabilitySearchParameters, AvailabilityResults, SapiResponseOffer, OffersRooms, AvailabilityDate } from './types';
|
|
2
|
-
import { AppConfig } from './app-config';
|
|
1
|
+
import { type HotelId, type Options, type RateBreakdown, type AvailabilitySearchParameters, type AvailabilityResults, type SapiResponseOffer, type OffersRooms, type AvailabilityDate } from './types';
|
|
2
|
+
import { type AppConfig } from './app-config';
|
|
3
3
|
export declare type AvailabilityHandler = (parameters: AvailabilitySearchParameters, callbacks: {
|
|
4
4
|
onStart?: (result: AvailabilitySearchParameters) => void;
|
|
5
5
|
onAvailabilityReceived?: (result: AvailabilityResults) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Language, HotelId, TranslatedString, GuestRating, GuestType, Location, TranslatedArray, Pricing, ContentHotel, LOVItem, Currency, Options as ClientOptions, NavPathInfo } from './types';
|
|
2
|
-
import { AppConfig } from './app-config';
|
|
1
|
+
import { type Language, type HotelId, type TranslatedString, type GuestRating, type GuestType, type Location, type TranslatedArray, type Pricing, type ContentHotel, type LOVItem, type Currency, type Options as ClientOptions, type NavPathInfo } from './types';
|
|
2
|
+
import { type AppConfig } from './app-config';
|
|
3
3
|
export interface SafHotel {
|
|
4
4
|
objectID: HotelId;
|
|
5
5
|
_geoloc: Location;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { OffersClient, GetOffersParameters } from './offers-client';
|
|
2
|
-
import { HotelId, HotelOfferEntity, CugDeals, UserTier, FilterParameters } from './types';
|
|
3
|
-
import { AppConfig } from './app-config';
|
|
4
|
-
interface HotelsOffersParameters {
|
|
1
|
+
import { type OffersClient, type GetOffersParameters } from './offers-client';
|
|
2
|
+
import { type HotelId, type HotelOfferEntity, type CugDeals, type UserTier, type FilterParameters } from './types';
|
|
3
|
+
import { type AppConfig } from './app-config';
|
|
4
|
+
export interface HotelsOffersParameters {
|
|
5
5
|
hotelIds: HotelId[];
|
|
6
6
|
checkIn?: string;
|
|
7
7
|
checkOut?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CugDeals, HotelId, HotelOfferEntity, Brand, Currency, Country, Language, DeviceType, AnonymousId, Offer, Options as ClientOptions, UserTier, SapiResponseOffer, SapiResponseOfferEntity, OffersRooms, FilterParameters } from './types';
|
|
1
|
+
import { type CugDeals, type HotelId, type HotelOfferEntity, type Brand, type Currency, type Country, type Language, type DeviceType, type AnonymousId, type Offer, type Options as ClientOptions, type UserTier, type SapiResponseOffer, type SapiResponseOfferEntity, type OffersRooms, type FilterParameters } from './types';
|
|
2
2
|
export interface OffersClient {
|
|
3
3
|
getOffers: (parameters: GetOffersParameters, onOffersReceived?: (response: OffersResponse) => void) => Promise<OffersResponse>;
|
|
4
4
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { OffersClient, GetOffersParameters } from './offers-client';
|
|
2
|
-
import { HotelId, HotelOfferEntity, CugDeals, UserTier, FilterParameters } from './types';
|
|
3
|
-
import { AppConfig } from './app-config';
|
|
4
|
-
interface OffersParameters {
|
|
1
|
+
import { type OffersClient, type GetOffersParameters } from './offers-client';
|
|
2
|
+
import { type HotelId, type HotelOfferEntity, type CugDeals, type UserTier, type FilterParameters } from './types';
|
|
3
|
+
import { type AppConfig } from './app-config';
|
|
4
|
+
export interface OffersParameters {
|
|
5
5
|
hotelId: HotelId;
|
|
6
6
|
checkIn: string;
|
|
7
7
|
checkOut: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Options as ClientOptions, ReviewsResponseV2 } from './types';
|
|
2
|
-
import { AppConfig } from './app-config';
|
|
1
|
+
import { type Options as ClientOptions, type ReviewsResponseV2 } from './types';
|
|
2
|
+
import { type AppConfig } from './app-config';
|
|
3
3
|
interface HandlerParameters {
|
|
4
4
|
appConfig: AppConfig;
|
|
5
5
|
options: ClientOptions;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Options as ClientOptions, ReviewsResponse } from './types';
|
|
2
|
-
import { AppConfig } from './app-config';
|
|
1
|
+
import { type Options as ClientOptions, type ReviewsResponse } from './types';
|
|
2
|
+
import { type AppConfig } from './app-config';
|
|
3
3
|
interface HandlerParameters {
|
|
4
4
|
appConfig: AppConfig;
|
|
5
5
|
options: ClientOptions;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RoomsRequestParameters, RoomsResults, Options as ClientOptions } from './types';
|
|
2
|
-
import { AppConfig, ProfileKey } from './app-config';
|
|
1
|
+
import { type RoomsRequestParameters, type RoomsResults, type Options as ClientOptions } from './types';
|
|
2
|
+
import { type AppConfig, type ProfileKey } from './app-config';
|
|
3
3
|
export declare type RoomsHandler = (parameters: RoomsRequestParameters) => Promise<RoomsResults>;
|
|
4
4
|
/**
|
|
5
5
|
* Creates rooms request string.
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { RoomsHandler } from './rooms';
|
|
5
|
-
import { HotelHandler, HotelsHandler } from './hotel';
|
|
6
|
-
import { OffersHandler } from './offers';
|
|
7
|
-
import { AvailabilityHandler } from './hotel-availability';
|
|
8
|
-
import { ClientOptions } from './types';
|
|
9
|
-
import { FreeTextSuggestHandler } from './free-text-suggest';
|
|
10
|
-
import { ReviewsHandler } from './reviews';
|
|
11
|
-
import { ReviewsHandler as ReviewsHandlerV2 } from './reviews-v2';
|
|
12
|
-
import { HotelsOffersHandler } from './hotels-offers';
|
|
1
|
+
import { type SearchHandler } from './search';
|
|
2
|
+
import { type SuggestHandler } from './suggest';
|
|
3
|
+
import { type ProfileKey } from './app-config';
|
|
4
|
+
import { type RoomsHandler } from './rooms';
|
|
5
|
+
import { type HotelHandler, type HotelsHandler } from './hotel';
|
|
6
|
+
import { type OffersHandler } from './offers';
|
|
7
|
+
import { type AvailabilityHandler } from './hotel-availability';
|
|
8
|
+
import { type ClientOptions } from './types';
|
|
9
|
+
import { type FreeTextSuggestHandler } from './free-text-suggest';
|
|
10
|
+
import { type ReviewsHandler } from './reviews';
|
|
11
|
+
import { type ReviewsHandler as ReviewsHandlerV2 } from './reviews-v2';
|
|
12
|
+
import { type HotelsOffersHandler } from './hotels-offers';
|
|
13
13
|
/**
|
|
14
14
|
* Converts map of A/B tests variations to array of string
|
|
15
15
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DatesConfig } from './utils';
|
|
2
|
-
import { OffersClient } from './offers-client';
|
|
3
|
-
import { AppConfig, ProfileKey } from './app-config';
|
|
4
|
-
import { SearchResults, HotelId, ApiSearchParameters, HotelOfferEntity, Options as ClientOptions, FilterParameters } from './types';
|
|
1
|
+
import { type DatesConfig } from './utils';
|
|
2
|
+
import { type OffersClient } from './offers-client';
|
|
3
|
+
import { type AppConfig, type ProfileKey } from './app-config';
|
|
4
|
+
import { type SearchResults, type HotelId, type ApiSearchParameters, type HotelOfferEntity, type Options as ClientOptions, type FilterParameters } from './types';
|
|
5
5
|
declare type OnStart = (response: Pick<SearchResults, 'searchId' | 'searchParameters'>) => void;
|
|
6
6
|
declare type OnAnchorReceived = (response: Pick<SearchResults, 'searchId' | 'searchParameters' | 'anchor' | 'anchorHotelId' | 'anchorType'>) => void;
|
|
7
7
|
declare type OnHotelsReceived = (response: SearchResults) => void;
|
|
@@ -21,7 +21,7 @@ export declare type SearchHandler = (parameters: ApiSearchParameters, callbacks?
|
|
|
21
21
|
}) => Promise<HotelOfferEntity | undefined>;
|
|
22
22
|
loadMore: () => Promise<SearchResults>;
|
|
23
23
|
}>;
|
|
24
|
-
export declare function prepareSearchParameters(parameters: ApiSearchParameters, dates: DatesConfig
|
|
24
|
+
export declare function prepareSearchParameters(parameters: ApiSearchParameters, dates: DatesConfig): ApiSearchParameters;
|
|
25
25
|
export declare type AttributesToRetrieve = keyof SearchResults;
|
|
26
26
|
export interface SearchRequestParameters {
|
|
27
27
|
searchId: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Suggestion, SuggestType, Options as ClientOptions } from './types';
|
|
2
|
-
import { AppConfig } from './app-config';
|
|
1
|
+
import { type Suggestion, type SuggestType, type Options as ClientOptions } from './types';
|
|
2
|
+
import { type AppConfig } from './app-config';
|
|
3
3
|
interface Parameters {
|
|
4
4
|
appConfig: AppConfig;
|
|
5
5
|
options: ClientOptions;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HotelId, CugDeals, UserTier } from './types';
|
|
2
|
-
import { Offer, RateBreakdown } from './offers';
|
|
1
|
+
import { type HotelId, type CugDeals, type UserTier } from './types';
|
|
2
|
+
import { type Offer, type RateBreakdown } from './offers';
|
|
3
3
|
/**
|
|
4
4
|
* Availability search parameters
|
|
5
5
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Except } from 'type-fest';
|
|
2
|
-
import { AlgoliaSearchOptions } from 'algoliasearch';
|
|
3
|
-
import { AppConfig } from '../app-config';
|
|
4
|
-
import { Configs } from './config';
|
|
5
|
-
import { AnonymousId, Language, Currency, Country, DeviceType, Brand } from './types';
|
|
6
|
-
import { Logger } from './logger';
|
|
7
|
-
import { RateBreakdown } from './offers';
|
|
1
|
+
import { type Except } from 'type-fest';
|
|
2
|
+
import { type AlgoliaSearchOptions } from 'algoliasearch';
|
|
3
|
+
import { type AppConfig } from '../app-config';
|
|
4
|
+
import { type Configs } from './config';
|
|
5
|
+
import { type AnonymousId, type Language, type Currency, type Country, type DeviceType, type Brand } from './types';
|
|
6
|
+
import { type Logger } from './logger';
|
|
7
|
+
import { type RateBreakdown } from './offers';
|
|
8
8
|
export declare type GetTotalRate = (rate: RateBreakdown) => number;
|
|
9
9
|
/** Options for initializing the Search API client. Persistent within single SAPI instance but may vary for different users */
|
|
10
10
|
export interface ClientOptions {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RateBreakdown } from './offers';
|
|
2
|
-
import { HotelId, AnonymousId, Currency, RoomId, UserTier, CancellationPenalties } from './types';
|
|
1
|
+
import { type RateBreakdown } from './offers';
|
|
2
|
+
import { type HotelId, type AnonymousId, type Currency, type RoomId, type UserTier, type CancellationPenalties } from './types';
|
|
3
3
|
export interface RoomsRequestParameters {
|
|
4
4
|
hotelId: HotelId;
|
|
5
5
|
checkIn: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HotelId, Anchor, AnchorType, Hotel, Facets, ApiSearchParameters, SearchParameters } from './types';
|
|
2
|
-
import { HotelOfferEntity } from './offers';
|
|
1
|
+
import { type HotelId, type Anchor, type AnchorType, type Hotel, type Facets, type ApiSearchParameters, type SearchParameters } from './types';
|
|
2
|
+
import { type HotelOfferEntity } from './offers';
|
|
3
3
|
export interface SearchResults {
|
|
4
4
|
anchor: Anchor;
|
|
5
5
|
anchorHotelId?: HotelId;
|
|
@@ -93,21 +93,21 @@ export interface OptionalSearchParameters {
|
|
|
93
93
|
skipOffers?: boolean;
|
|
94
94
|
useLiveOfferDataHSO?: boolean;
|
|
95
95
|
}
|
|
96
|
-
export
|
|
96
|
+
export declare type PlaceSearchParameters = {
|
|
97
97
|
placeId: string;
|
|
98
|
-
}
|
|
99
|
-
export
|
|
98
|
+
} & OptionalSearchParameters;
|
|
99
|
+
export declare type HotelSearchParameters = {
|
|
100
100
|
hotelId: string;
|
|
101
|
-
}
|
|
102
|
-
export
|
|
101
|
+
} & OptionalSearchParameters;
|
|
102
|
+
export declare type LocationSearchParameters = {
|
|
103
103
|
geolocation: Nearby;
|
|
104
|
-
}
|
|
105
|
-
export
|
|
104
|
+
} & OptionalSearchParameters;
|
|
105
|
+
export declare type QuerySearchParameters = {
|
|
106
106
|
query: string;
|
|
107
|
-
}
|
|
108
|
-
export
|
|
107
|
+
} & OptionalSearchParameters;
|
|
108
|
+
export declare type AddressSearchParameters = {
|
|
109
109
|
address: string;
|
|
110
|
-
}
|
|
110
|
+
} & OptionalSearchParameters;
|
|
111
111
|
export declare type ApiSearchParameters = PlaceSearchParameters | HotelSearchParameters | LocationSearchParameters | QuerySearchParameters | AddressSearchParameters;
|
|
112
112
|
export declare type SearchParameters = ApiSearchParameters & {
|
|
113
113
|
checkIn: string;
|
|
@@ -155,18 +155,18 @@ interface BasicAnchorHit {
|
|
|
155
155
|
navPathInfo?: NavPathInfo;
|
|
156
156
|
}
|
|
157
157
|
export declare type AnchorType = 'hotel' | 'place';
|
|
158
|
-
export
|
|
158
|
+
export declare type HotelAnchorHit = {
|
|
159
159
|
hotelName: TranslatedString;
|
|
160
160
|
objectType: 'hotel';
|
|
161
|
-
}
|
|
162
|
-
export
|
|
161
|
+
} & BasicAnchorHit;
|
|
162
|
+
export declare type PlaceAnchorHit = {
|
|
163
163
|
objectType: 'place' | 'address' | 'area' | `point`;
|
|
164
164
|
polygon?: Polygon;
|
|
165
165
|
placeCategory: number;
|
|
166
166
|
placeName: TranslatedString;
|
|
167
167
|
placeType: number;
|
|
168
168
|
geoDetails?: GeoDetails;
|
|
169
|
-
}
|
|
169
|
+
} & BasicAnchorHit;
|
|
170
170
|
export declare type AnchorHit = HotelAnchorHit | PlaceAnchorHit;
|
|
171
171
|
/** Suggestion hit */
|
|
172
172
|
interface BasicSuggestHit {
|
|
@@ -175,46 +175,46 @@ interface BasicSuggestHit {
|
|
|
175
175
|
placeDN: TranslatedArray;
|
|
176
176
|
placeType: number;
|
|
177
177
|
}
|
|
178
|
-
export
|
|
178
|
+
export declare type PlaceSuggestHit = {
|
|
179
179
|
placeName: TranslatedString;
|
|
180
180
|
objectType: 'place';
|
|
181
181
|
iataCodes?: string[];
|
|
182
182
|
_highlightResult: {
|
|
183
183
|
placeName: TranslatedHighlightResult;
|
|
184
184
|
};
|
|
185
|
-
}
|
|
186
|
-
export
|
|
185
|
+
} & BasicSuggestHit;
|
|
186
|
+
export declare type HotelSuggestHit = {
|
|
187
187
|
hotelName: TranslatedString;
|
|
188
188
|
objectType: 'hotel';
|
|
189
189
|
_highlightResult: {
|
|
190
190
|
hotelName: TranslatedHighlightResult;
|
|
191
191
|
};
|
|
192
|
-
}
|
|
192
|
+
} & BasicSuggestHit;
|
|
193
193
|
interface SAPIBasicSuggestHit {
|
|
194
194
|
objectID: string;
|
|
195
195
|
placeADN: string[];
|
|
196
196
|
placeDN: string[];
|
|
197
197
|
placeType: number;
|
|
198
198
|
}
|
|
199
|
-
export
|
|
199
|
+
export declare type SAPIPlaceSuggestHit = {
|
|
200
200
|
placeName: string;
|
|
201
201
|
objectType: 'place';
|
|
202
202
|
iataCodes?: string[];
|
|
203
203
|
highlightValue: string;
|
|
204
|
-
}
|
|
205
|
-
export
|
|
204
|
+
} & SAPIBasicSuggestHit;
|
|
205
|
+
export declare type SAPIHotelSuggestHit = {
|
|
206
206
|
hotelName: string;
|
|
207
207
|
objectType: 'hotel';
|
|
208
208
|
highlightValue: string;
|
|
209
|
-
}
|
|
210
|
-
export
|
|
209
|
+
} & SAPIBasicSuggestHit;
|
|
210
|
+
export interface SuggestionsResponse {
|
|
211
211
|
suggestions: SuggestHit[];
|
|
212
|
-
}
|
|
212
|
+
}
|
|
213
213
|
export declare type SuggestHit = HotelSuggestHit | PlaceSuggestHit;
|
|
214
214
|
export declare type SAPISuggestHit = SAPIHotelSuggestHit | SAPIPlaceSuggestHit;
|
|
215
|
-
export
|
|
215
|
+
export interface SAPISuggestionsResponse {
|
|
216
216
|
suggestions: SAPISuggestHit[];
|
|
217
|
-
}
|
|
217
|
+
}
|
|
218
218
|
export interface Hit {
|
|
219
219
|
address: TranslatedString;
|
|
220
220
|
checkInTime: string;
|
|
@@ -270,7 +270,7 @@ export interface PlaceInfo {
|
|
|
270
270
|
id: string;
|
|
271
271
|
name?: string;
|
|
272
272
|
}
|
|
273
|
-
export
|
|
273
|
+
export declare type Hotel = {
|
|
274
274
|
displayAddress: string;
|
|
275
275
|
hotelName: string;
|
|
276
276
|
placeDisplayName: string;
|
|
@@ -280,7 +280,7 @@ export interface Hotel extends Omit<Hit, 'hotelName' | 'address' | 'placeDN' | '
|
|
|
280
280
|
isVr?: boolean;
|
|
281
281
|
navPathInfo?: NavPathInfo;
|
|
282
282
|
partiallyMatched: boolean;
|
|
283
|
-
}
|
|
283
|
+
} & Omit<Hit, 'hotelName' | 'address' | 'placeDN' | 'placeADName'>;
|
|
284
284
|
export interface ContentHotelDescriptions {
|
|
285
285
|
overall?: string;
|
|
286
286
|
headline?: string;
|
|
@@ -334,14 +334,14 @@ export interface Money {
|
|
|
334
334
|
amount: number;
|
|
335
335
|
currency: Currency;
|
|
336
336
|
}
|
|
337
|
-
export
|
|
337
|
+
export declare type HotelAnchor = {
|
|
338
338
|
placeDisplayName: string;
|
|
339
339
|
hotelName: string;
|
|
340
|
-
}
|
|
341
|
-
export
|
|
340
|
+
} & Omit<HotelAnchorHit, 'hotelName' | 'placeADN' | 'placeDN'>;
|
|
341
|
+
export declare type PlaceAnchor = {
|
|
342
342
|
placeName: string;
|
|
343
343
|
placeDisplayName: string;
|
|
344
|
-
}
|
|
344
|
+
} & Omit<PlaceAnchorHit, 'placeName' | 'placeADN' | 'placeDN'>;
|
|
345
345
|
export declare type Anchor = HotelAnchor | PlaceAnchor;
|
|
346
346
|
export declare type PlaceTypeName = 'property' | 'country' | 'city' | 'airport' | 'station' | 'area' | 'address';
|
|
347
347
|
export declare type SuggestType = 'hotel' | 'place' | 'address' | 'nearby';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AnchorHit, Hit, TranslatedString, TranslatedArray, TranslatedHighlightResult, Language, HotelSuggestHit, PlaceSuggestHit, SuggestHit, Suggestion, PlaceTypeName } from '../types';
|
|
2
|
-
declare type AnchorSuggestOrHit = AnchorHit | Hit | SuggestHit;
|
|
3
|
-
declare type TranslatedAttribute = TranslatedString | TranslatedArray;
|
|
1
|
+
import { type AnchorHit, type Hit, type TranslatedString, type TranslatedArray, type TranslatedHighlightResult, type Language, type HotelSuggestHit, type PlaceSuggestHit, type SuggestHit, type Suggestion, type PlaceTypeName } from '../types';
|
|
2
|
+
export declare type AnchorSuggestOrHit = AnchorHit | Hit | SuggestHit;
|
|
3
|
+
export declare type TranslatedAttribute = TranslatedString | TranslatedArray;
|
|
4
4
|
/**
|
|
5
5
|
* Returns whether input string is empty or consists of only whitespace
|
|
6
6
|
*
|
|
@@ -41,4 +41,3 @@ export declare function validateHit(hit: AnchorSuggestOrHit | undefined, require
|
|
|
41
41
|
export declare function placeTypeToPlaceTypeName(placeTypeId?: number): PlaceTypeName;
|
|
42
42
|
export declare function hitToHotelSuggest(suggestHit: HotelSuggestHit, languages: Language[]): Suggestion;
|
|
43
43
|
export declare function hitToPlaceSuggest(suggestHit: PlaceSuggestHit, languages: Language[]): Suggestion;
|
|
44
|
-
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Suggestion, SAPIHotelSuggestHit, SAPIPlaceSuggestHit } from '../types';
|
|
1
|
+
import { type Suggestion, type SAPIHotelSuggestHit, type SAPIPlaceSuggestHit } from '../types';
|
|
2
2
|
export declare function sapiHitToHotelSuggest(hit: SAPIHotelSuggestHit): Suggestion;
|
|
3
3
|
export declare function sapiHitToPlaceSuggest(hit: SAPIPlaceSuggestHit): Suggestion;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { OffersResponse } from '../offers-client';
|
|
2
|
-
import { HotelOfferEntity, GetTotalRate, HotelId } from '../types';
|
|
3
|
-
interface Parameters {
|
|
1
|
+
import { type OffersResponse } from '../offers-client';
|
|
2
|
+
import { type HotelOfferEntity, type GetTotalRate, type HotelId } from '../types';
|
|
3
|
+
export interface Parameters {
|
|
4
4
|
checkIn: string;
|
|
5
5
|
checkOut: string;
|
|
6
6
|
sortField?: string;
|
|
@@ -20,4 +20,3 @@ export declare function buildOffersResponse(offersResults: OffersResponse, param
|
|
|
20
20
|
hotelOfferEntities: Record<string, HotelOfferEntity>;
|
|
21
21
|
hotelIds: string[];
|
|
22
22
|
};
|
|
23
|
-
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApiSearchParameters
|
|
1
|
+
import { type ApiSearchParameters } from '../types';
|
|
2
2
|
export interface DatesConfig {
|
|
3
3
|
daysFromNow: number;
|
|
4
4
|
blockedDefaultDates: string[];
|
|
@@ -18,7 +18,7 @@ export declare function dateToMiddayUTC(date: string): UtcDate;
|
|
|
18
18
|
/**
|
|
19
19
|
* Check whether we should use dates/client defaults OR get better defaults from the backend
|
|
20
20
|
*/
|
|
21
|
-
export declare function shouldUseClientDates(parameters: ApiSearchParameters
|
|
21
|
+
export declare function shouldUseClientDates(parameters: ApiSearchParameters): boolean;
|
|
22
22
|
export declare function getCheckInCheckOutDates(parameters: GetDatesParameters, datesConfig: DatesConfig): {
|
|
23
23
|
checkIn: string;
|
|
24
24
|
checkOut: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApiSearchParameters, SearchParameters } from '../types';
|
|
1
|
+
import { type ApiSearchParameters, type SearchParameters } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Type guard for searchParameters, use this to enforce params to be set at a certain stage
|
|
4
4
|
* This helps TypeScript to narrow the type to required props
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@findhotel/sapi",
|
|
3
|
-
"version": "1.25.
|
|
3
|
+
"version": "1.25.3",
|
|
4
4
|
"description": "FindHotel Search API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/types/packages/core/src",
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
10
10
|
"engines": {
|
|
11
|
-
"node": ">=
|
|
12
|
-
"npm": ">=
|
|
11
|
+
"node": ">=20.10.0",
|
|
12
|
+
"npm": ">=10.2.3"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
15
|
"clean:dist": "rm -rf dist",
|
|
@@ -46,24 +46,24 @@
|
|
|
46
46
|
"@rollup/plugin-commonjs": "^16.0.0",
|
|
47
47
|
"@rollup/plugin-node-resolve": "^10.0.0",
|
|
48
48
|
"@rollup/plugin-typescript": "^6.1.0",
|
|
49
|
-
"@types/jest": "^
|
|
49
|
+
"@types/jest": "^29.5.14",
|
|
50
50
|
"eslint-config-xo-react": "^0.23.0",
|
|
51
51
|
"eslint-plugin-jest": "^26.6.0",
|
|
52
52
|
"eslint-plugin-react": "^7.30.1",
|
|
53
53
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
54
54
|
"husky": "^5.0.6",
|
|
55
|
-
"jest": "^
|
|
56
|
-
"lerna": "^
|
|
55
|
+
"jest": "^29.7.0",
|
|
56
|
+
"lerna": "^8.1.9",
|
|
57
57
|
"rollup": "^2.33.3",
|
|
58
58
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
59
59
|
"rollup-plugin-terser": "^7.0.2",
|
|
60
60
|
"rollup-plugin-visualizer": "^5.5.0",
|
|
61
|
-
"shipjs": "^0.
|
|
62
|
-
"ts-jest": "^
|
|
61
|
+
"shipjs": "^0.27.0",
|
|
62
|
+
"ts-jest": "^29.2.5",
|
|
63
63
|
"tslib": "^2.3.1",
|
|
64
64
|
"type-fest": "^0.20.2",
|
|
65
65
|
"typedoc": "^0.22.13",
|
|
66
66
|
"typescript": "^4.1.2",
|
|
67
|
-
"xo": "^0.
|
|
67
|
+
"xo": "^0.55.0"
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
export declare const hotelAnchorHit: {
|
|
2
|
-
_geoloc: {
|
|
3
|
-
lat: number;
|
|
4
|
-
lon: number;
|
|
5
|
-
precision: number;
|
|
6
|
-
radius: number;
|
|
7
|
-
};
|
|
8
|
-
hotelName: {
|
|
9
|
-
en: string;
|
|
10
|
-
};
|
|
11
|
-
objectType: string;
|
|
12
|
-
pageSize: number;
|
|
13
|
-
placeADN: {
|
|
14
|
-
en: string[];
|
|
15
|
-
pt: string[];
|
|
16
|
-
'pt-BR': string[];
|
|
17
|
-
};
|
|
18
|
-
placeDN: {
|
|
19
|
-
en: string[];
|
|
20
|
-
pt: string[];
|
|
21
|
-
'pt-BR': string[];
|
|
22
|
-
};
|
|
23
|
-
priceBucketWidth: number;
|
|
24
|
-
objectID: string;
|
|
25
|
-
};
|
|
26
|
-
export declare const hotelAnchor: {
|
|
27
|
-
hotelName: string;
|
|
28
|
-
placeDisplayName: string;
|
|
29
|
-
_geoloc: {
|
|
30
|
-
lat: number;
|
|
31
|
-
lon: number;
|
|
32
|
-
precision: number;
|
|
33
|
-
radius: number;
|
|
34
|
-
};
|
|
35
|
-
objectType: string;
|
|
36
|
-
pageSize: number;
|
|
37
|
-
priceBucketWidth: number;
|
|
38
|
-
objectID: string;
|
|
39
|
-
};
|
|
40
|
-
export declare const placeAnchorHit: {
|
|
41
|
-
_geoloc: {
|
|
42
|
-
lat: number;
|
|
43
|
-
lon: number;
|
|
44
|
-
precision: number;
|
|
45
|
-
radius: number;
|
|
46
|
-
};
|
|
47
|
-
objectType: string;
|
|
48
|
-
pageSize: number;
|
|
49
|
-
placeADN: {
|
|
50
|
-
en: string[];
|
|
51
|
-
pt: string[];
|
|
52
|
-
'pt-BR': string[];
|
|
53
|
-
};
|
|
54
|
-
placeCategory: number;
|
|
55
|
-
placeDN: {
|
|
56
|
-
en: string[];
|
|
57
|
-
pt: string[];
|
|
58
|
-
'pt-BR': string[];
|
|
59
|
-
};
|
|
60
|
-
placeName: {
|
|
61
|
-
en: string;
|
|
62
|
-
pt: string;
|
|
63
|
-
'pt-BR': string;
|
|
64
|
-
};
|
|
65
|
-
placeType: number;
|
|
66
|
-
polygon: number[][];
|
|
67
|
-
priceBucketWidth: number;
|
|
68
|
-
objectID: string;
|
|
69
|
-
};
|
|
70
|
-
export declare const placeAnchor: {
|
|
71
|
-
placeName: string;
|
|
72
|
-
placeDisplayName: string;
|
|
73
|
-
_geoloc: {
|
|
74
|
-
lat: number;
|
|
75
|
-
lon: number;
|
|
76
|
-
precision: number;
|
|
77
|
-
radius: number;
|
|
78
|
-
};
|
|
79
|
-
objectType: string;
|
|
80
|
-
pageSize: number;
|
|
81
|
-
placeCategory: number;
|
|
82
|
-
placeType: number;
|
|
83
|
-
polygon: number[][];
|
|
84
|
-
priceBucketWidth: number;
|
|
85
|
-
objectID: string;
|
|
86
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calculate discount based on regular historical price
|
|
3
|
-
*
|
|
4
|
-
* @param rate - price to calculate discount for
|
|
5
|
-
* @param lowerBound - regular historical price lower bound
|
|
6
|
-
* @param upperBound - regular historical price upper bound
|
|
7
|
-
*/
|
|
8
|
-
export declare function calculateDiscount(rate: number, lowerBound?: number, upperBound?: number): number;
|