@findhotel/sapi 0.22.7 → 0.22.11

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.
@@ -43,6 +43,7 @@ export declare const placeSuggestHit: {
43
43
  export declare const placeSuggest: {
44
44
  highlightValue: string;
45
45
  objectID: string;
46
+ objectType: string;
46
47
  placeDisplayName: string;
47
48
  placeTypeName: string;
48
49
  value: string;
@@ -77,6 +78,7 @@ export declare const hotelSuggestHit: {
77
78
  export declare const hotelSuggest: {
78
79
  highlightValue: string;
79
80
  objectID: string;
81
+ objectType: string;
80
82
  placeDisplayName: string;
81
83
  placeTypeName: string;
82
84
  value: string;
@@ -5,7 +5,6 @@ interface Options {
5
5
  languages: string[];
6
6
  requestSize: number;
7
7
  priceBucketWidth?: number;
8
- priceBucketsCount: number;
9
8
  exchangeRate: number;
10
9
  hsoFilter: HsoFilter;
11
10
  }
@@ -0,0 +1,14 @@
1
+ import { Base, ProfileKey } from '.';
2
+ import { SearchResults, SearchFn } from './search';
3
+ import { SearchParameters } from './types';
4
+ declare type AttributesToRetrieve = keyof SearchResults;
5
+ interface RequestParameters {
6
+ profileKey: ProfileKey;
7
+ searchParameters: SearchParameters;
8
+ options: Base['options'];
9
+ offset: number;
10
+ attributes?: AttributesToRetrieve[];
11
+ }
12
+ export declare function createRequestString({ profileKey, searchParameters, options, offset, attributes }: RequestParameters): string;
13
+ export declare function backendSearch({ getFeatureEnabled, profile, profileKey, backendConfig, raaClient, options }: Base): SearchFn;
14
+ export {};
@@ -1,3 +1,23 @@
1
- import { Profile, ProfileKey, SafConfig } from './types';
1
+ import { Profile, ProfileKey } from './types';
2
+ /**
3
+ * Fixed number of price bucket count
4
+ */
5
+ export declare const PRICE_BUCKET_COUNT = 31;
2
6
  export declare const profiles: Record<ProfileKey, Profile>;
3
- export declare const safConfigs: Record<ProfileKey, SafConfig>;
7
+ /**
8
+ * SAF (Search Application Frontend) configuration
9
+ */
10
+ export interface SafConfig {
11
+ baseUrl: string;
12
+ baseCloudFrontUrl: string;
13
+ endpoints: Record<string, string>;
14
+ }
15
+ export declare function getSafConfig(profileKey: ProfileKey): SafConfig;
16
+ /**
17
+ * SAPI backend configuration
18
+ */
19
+ export interface BackendConfig {
20
+ baseUrl: string;
21
+ endpoints: Record<string, string>;
22
+ }
23
+ export declare function getBackendConfig(profileKey: ProfileKey): BackendConfig;
@@ -14,6 +14,7 @@ interface RaaOptions {
14
14
  WebSocket?: any;
15
15
  sapiCliKey?: string;
16
16
  deviceCategory: string;
17
+ variations: string[];
17
18
  }
18
19
  export interface GetOffersParameters {
19
20
  anchorDestination?: string;
@@ -2,11 +2,14 @@ import { SearchClient } from 'algoliasearch';
2
2
  import { Except } from 'type-fest';
3
3
  import { RaaClient } from './raa';
4
4
  import { Configs } from './algolia';
5
- import { ProfileKey, ClientOptions, SapiClient, Profile, SafConfig, SapiFeature, Language, Logger } from './types';
5
+ import { SafConfig, BackendConfig } from './configs';
6
+ import { ProfileKey, ClientOptions, SapiClient, Profile, SapiFeature, Language, Logger } from './types';
6
7
  export declare type AlgoliaClient = Pick<SearchClient, 'search'>;
7
8
  export interface Base {
8
9
  /** Search application frontend config */
9
10
  safConfig: SafConfig;
11
+ /** SAPI backend config */
12
+ backendConfig: BackendConfig;
10
13
  /** Check if SAPI feature is enabled */
11
14
  getFeatureEnabled: (feature: SapiFeature) => boolean;
12
15
  /** Client profile */
@@ -15,15 +18,15 @@ export interface Base {
15
18
  algoliaClient: AlgoliaClient;
16
19
  /** Instance of Rates and Availability Client */
17
20
  raaClient?: RaaClient;
21
+ /** Profile key of specific client */
22
+ profileKey: ProfileKey;
18
23
  /** Options persistent within single SAPI instance */
19
24
  options: Except<ClientOptions, 'variations' | 'logger'> & {
20
25
  logger: Logger;
21
26
  variations: string[];
22
27
  pageSize: number;
23
- priceBucketsCount: number;
24
28
  languages: Language[];
25
29
  };
26
- /** Configs loaded from Algolia and local date configuration */
27
30
  configs?: unknown;
28
31
  }
29
32
  export interface BaseWithConfig extends Base {
@@ -44,8 +44,6 @@ export interface ClientOptions {
44
44
  sapiCliKey?: string;
45
45
  /** Algolia client options used for debugging and setting additional options like timeouts etc. */
46
46
  algoliaClientOptions?: AlgoliaSearchOptions;
47
- /** Use or not SAP for SAPI init */
48
- useSaf?: boolean;
49
47
  /** External profile to override internal client profile */
50
48
  initWithProfile?: Partial<Profile>;
51
49
  /** A/B test variations */
@@ -1,10 +1,5 @@
1
1
  import { DateString, Language } from './types';
2
2
  export declare type SapiFeature = 'offers' | 'search' | 'rooms' | 'suggests' | 'configs';
3
- export interface SafConfig {
4
- baseUrl: string;
5
- baseCloudFrontUrl: string;
6
- endpoints: Record<string, string>;
7
- }
8
3
  export interface IndexVariation {
9
4
  name: string;
10
5
  objectID?: string;
@@ -185,6 +185,7 @@ export declare type PlaceTypeName = 'property' | 'country' | 'city' | 'airport'
185
185
  export interface Suggestion {
186
186
  highlightValue: string;
187
187
  objectID: string;
188
+ objectType: string;
188
189
  placeDisplayName: string;
189
190
  placeTypeName: PlaceTypeName;
190
191
  value: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@findhotel/sapi",
3
- "version": "0.22.7",
3
+ "version": "0.22.11",
4
4
  "description": "FindHotel Search API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/types/packages/core/src",
@@ -1,10 +0,0 @@
1
- import { Except } from 'type-fest';
2
- import { BaseWithConfig, ClientOptions } from '.';
3
- import { SearchResults, SearchFn } from './search';
4
- import { SearchParameters } from './types';
5
- declare type AttributesToRetrieve = keyof SearchResults;
6
- export declare function createRequestString(parameters: SearchParameters, options: Except<ClientOptions, 'variations'> & {
7
- variations: string[];
8
- }, offset: number, attributes?: AttributesToRetrieve[]): string;
9
- export declare function safSearch({ getFeatureEnabled, profile, safConfig, raaClient, options }: BaseWithConfig): SearchFn;
10
- export {};