@findhotel/sapi
Advanced tools
Comparing version 0.18.2 to 0.19.1
@@ -0,1 +1,17 @@ | ||
## [0.19.1](https://github.com/FindHotel/sapi/compare/v0.18.2...v0.19.1) (2021-08-05) | ||
### Changed | ||
- Disabled docs generation temporary | ||
## [0.19.0](https://github.com/FindHotel/sapi/compare/v0.18.2...v0.19.0) (2021-08-05) | ||
### Added | ||
- Support for SAF (Search Application Frontend) init | ||
### Changed | ||
- Use internal profiles instead of external dependency | ||
- `initWithConfig` renamed to `initWithProfile` | ||
- Removed support of `variationIds` option | ||
## [0.18.2](https://github.com/FindHotel/sapi/compare/v0.18.1...v0.18.2) (2021-06-29) | ||
@@ -2,0 +18,0 @@ |
import { AlgoliaClient } from '..'; | ||
import { HsoFilter, IndexNameGetter } from '../configs'; | ||
import { OptionalSearchParameters, Hotel, Location } from '../types'; | ||
import { HsoFilter } from './configs'; | ||
import { OptionalSearchParameters, Hotel, Location, SapiClientConfig } from '../types'; | ||
interface Options { | ||
@@ -17,3 +17,3 @@ languages: string[]; | ||
} | ||
export declare function geoSearch({ search }: AlgoliaClient, { getIndexName }: IndexNameGetter, options: Options): (parameters: GeoSearchParameters) => Promise<{ | ||
export declare function geoSearch({ search }: AlgoliaClient, clientConfig: SapiClientConfig, options: Options): (parameters: GeoSearchParameters) => Promise<{ | ||
hotelIds: string[]; | ||
@@ -20,0 +20,0 @@ hotelEntities: Record<string, Hotel>; |
import { AlgoliaClient } from '..'; | ||
import { IndexNameGetter } from '../configs'; | ||
import { Anchor, Hotel, Location } from '../types'; | ||
import { SapiClientConfig, Anchor, Hotel, Location } from '../types'; | ||
interface GetAnchorParameters { | ||
@@ -16,3 +15,3 @@ hotelId?: string; | ||
}; | ||
export declare function getAnchor({ search }: AlgoliaClient, { getIndexName }: IndexNameGetter, { languages }: { | ||
export declare function getAnchor({ search }: AlgoliaClient, clientConfig: SapiClientConfig, { languages }: { | ||
languages: string[]; | ||
@@ -19,0 +18,0 @@ }): (parameters: GetAnchorParameters) => Promise<{ |
@@ -6,1 +6,2 @@ export * from './get-anchor'; | ||
export * from './load-suggests'; | ||
export * from './configs'; |
import { AlgoliaClient } from '..'; | ||
import { IndexNameGetter } from '../configs'; | ||
import { SapiClientConfig } from '../types'; | ||
interface Options { | ||
@@ -7,3 +7,3 @@ languages: string[]; | ||
} | ||
export declare function loadSuggests({ search }: AlgoliaClient, { getIndexName }: IndexNameGetter, { languages, suggestsCount }: Options): (query: string) => Promise<import("..").Suggestion[]>; | ||
export declare function loadSuggests({ search }: AlgoliaClient, clientConfig: SapiClientConfig, { languages, suggestsCount }: Options): (query: string) => Promise<import("..").Suggestion[]>; | ||
export {}; |
@@ -1,3 +0,3 @@ | ||
import { SapiConfig } from './types'; | ||
import { SapiProfile } from './types'; | ||
export declare const defaultProfile = "findhotel-website"; | ||
export declare const profiles: Record<string, SapiConfig>; | ||
export declare const profiles: Record<string, SapiProfile>; |
@@ -34,3 +34,3 @@ import { Base } from '.'; | ||
export declare function createRequestString(parameters: RoomsRequestParameters, options: RoomsRequestOptions): string; | ||
declare type RoomsFnParameters = Pick<Base, 'options' | 'sapiAppFrontendConfig'>; | ||
declare type RoomsFnParameters = Pick<Base, 'options' | 'safConfig'>; | ||
/** | ||
@@ -43,3 +43,3 @@ * Creates rooms search function with binded base configuration object | ||
*/ | ||
export declare function rooms({ options, sapiAppFrontendConfig }: RoomsFnParameters): RoomsFn; | ||
export declare function rooms({ options, safConfig }: RoomsFnParameters): RoomsFn; | ||
export {}; |
import { SearchClient } from 'algoliasearch'; | ||
import { SearchFn } from './search'; | ||
import { SuggestFn } from './suggest'; | ||
import { RoomsFn } from './rooms'; | ||
import { RaaClient } from './raa'; | ||
import { AppConfig, Configs, DatesConfig, ListOfValuesItem, ExchangeRates } from './configs'; | ||
import { SapiClientOptions } from './types'; | ||
import { Configs } from './algolia'; | ||
import { SapiClientOptions, SapiClientId, SapiClientKey, SapiClient, SapiClientConfig, SapiFeature, Language } from './types'; | ||
export declare type AlgoliaClient = Pick<SearchClient, 'search'>; | ||
export interface SapiClient { | ||
rooms: RoomsFn; | ||
search: SearchFn; | ||
suggest: SuggestFn; | ||
getConfig: () => { | ||
lov: ListOfValuesItem[]; | ||
exchangeRates: ExchangeRates; | ||
}; | ||
export interface SafConfig { | ||
baseUrl: string; | ||
endpoints: Record<string, string>; | ||
} | ||
export interface Base { | ||
/** SAPI application frontend config */ | ||
sapiAppFrontendConfig: { | ||
baseUrl: string; | ||
salt: string; | ||
endpoints: Record<string, string>; | ||
}; | ||
/** Application configuration, stored in Algolia */ | ||
appConfig: AppConfig; | ||
/** Instance of the Algolia Client */ | ||
/** Search application frontend config */ | ||
safConfig: SafConfig; | ||
/** Check if SAPI feature is enabled */ | ||
getFeatureEnabled: (feature: SapiFeature) => boolean; | ||
/** SAPI client configuration */ | ||
clientConfig: SapiClientConfig; | ||
/** Instance of Algolia Client */ | ||
algoliaClient: AlgoliaClient; | ||
/** Instance of the Rates and Availability Client */ | ||
/** Instance of Rates and Availability Client */ | ||
raaClient?: RaaClient; | ||
/** Options persistent within single SAPI instance */ | ||
options: SapiClientOptions & { | ||
requestSize: number; | ||
pageSize: number; | ||
priceBucketsCount: number; | ||
languages: string[]; | ||
languages: Language[]; | ||
}; | ||
configs?: Record<string, any>; | ||
/** Configs loaded from Algolia and local date configuration */ | ||
configs?: unknown; | ||
} | ||
export interface BaseWithConfig extends Base { | ||
/** Configs loaded from Algolia and local date configuration */ | ||
configs: Configs & { | ||
dates: DatesConfig; | ||
}; | ||
configs: Configs; | ||
} | ||
/** | ||
* Initializes SAPI client asynchronously, it first loads the app configuration from Algolia and sets up the client. | ||
* SAPI constructor | ||
* | ||
@@ -52,4 +41,4 @@ * @param clientId - SAPI client id | ||
* | ||
* @returns initialized SAPI client | ||
* @returns Promise which resolves to SAPI client | ||
*/ | ||
export declare function sapi(clientId: string, clientKey: string, clientOptions: SapiClientOptions): Promise<SapiClient>; | ||
export declare function sapi(clientId: SapiClientId, clientKey: SapiClientKey, clientOptions: SapiClientOptions): Promise<SapiClient>; |
import { Except } from 'type-fest'; | ||
import { BaseWithConfig } from '.'; | ||
import { DatesConfig } from './configs'; | ||
import { DealScores } from './utils'; | ||
import { AnchorType, Facets } from './algolia'; | ||
import { DealScores, DatesConfig } from './utils'; | ||
import { Anchor, ApiSearchParameters, Hotel, HotelOfferEntity, SearchParameters, HotelId } from './types'; | ||
@@ -39,4 +38,4 @@ interface SearchResults { | ||
export declare function prepareSearchParameters(parameters: ApiSearchParameters, dates: DatesConfig): SearchParameters; | ||
declare type SearchFnParameters = Pick<BaseWithConfig, 'options' | 'appConfig' | 'algoliaClient' | 'raaClient' | 'configs'>; | ||
export declare function search({ appConfig, algoliaClient, raaClient, options, configs }: SearchFnParameters): SearchFn; | ||
declare type SearchFnParameters = Pick<BaseWithConfig, 'options' | 'clientConfig' | 'algoliaClient' | 'raaClient' | 'configs' | 'getFeatureEnabled'>; | ||
export declare function search({ getFeatureEnabled, clientConfig, algoliaClient, raaClient, options, configs }: SearchFnParameters): SearchFn; | ||
export {}; |
export * from './types'; | ||
export * from './rooms'; | ||
export * from './sapi-config'; | ||
export * from './sapi-client-options'; | ||
export * from './sapi-client'; |
@@ -1,2 +0,2 @@ | ||
import { HotelId, AnonymousId } from '.'; | ||
import { HotelId, AnonymousId, Currency, Language, DeviceCategory } from '.'; | ||
export interface RoomsRequestParameters { | ||
@@ -9,5 +9,5 @@ hotelId: HotelId; | ||
export interface RoomsRequestOptions { | ||
deviceCategory: string; | ||
language: string; | ||
currency: string; | ||
deviceCategory: DeviceCategory; | ||
language: Language; | ||
currency: Currency; | ||
anonymousId: AnonymousId; | ||
@@ -36,3 +36,3 @@ } | ||
}; | ||
currencyCode: string; | ||
currencyCode: Currency; | ||
hotelFees: { | ||
@@ -39,0 +39,0 @@ breakdown: HotelFeesBreakDown[]; |
@@ -7,2 +7,7 @@ /** | ||
export declare type AnonymousId = string; | ||
export declare type Currency = string; | ||
export declare type Language = string; | ||
export declare type Country = string; | ||
export declare type DateString = string; | ||
export declare type DeviceCategory = string; | ||
/** | ||
@@ -89,3 +94,2 @@ * Search client types | ||
export declare type TranslatedHighlightResult = Record<Language, HighlightResult>; | ||
export declare type Language = string; | ||
export declare type TranslatedString = Record<Language, string>; | ||
@@ -141,3 +145,3 @@ export declare type TranslatedArray = Record<Language, string[]>; | ||
checkOutTime: string; | ||
country: string; | ||
country: Country; | ||
facilities: number[]; | ||
@@ -219,3 +223,3 @@ guestRating: GuestRating; | ||
cug: string[]; | ||
currency: string; | ||
currency: Currency; | ||
meals: string[]; | ||
@@ -222,0 +226,0 @@ tags: string[]; |
@@ -1,2 +0,5 @@ | ||
import { DatesConfig } from '../configs'; | ||
export interface DatesConfig { | ||
daysFromNow: number; | ||
blockedDefaultDates: string[]; | ||
} | ||
interface GetDatesParameters { | ||
@@ -3,0 +6,0 @@ checkIn?: string; |
{ | ||
"name": "@findhotel/sapi", | ||
"version": "0.18.2", | ||
"version": "0.19.1", | ||
"description": "FindHotel Search API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
252625
2212
769
53