@findhotel/sapi 0.22.10 → 0.22.14

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.
@@ -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;
@@ -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 {
@@ -12,6 +12,7 @@ export interface RoomsRequestOptions {
12
12
  language: Language;
13
13
  currency: Currency;
14
14
  anonymousId: AnonymousId;
15
+ variations: string[];
15
16
  }
16
17
  export declare type RoomId = string;
17
18
  export declare type RoomPackageId = string;
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@findhotel/sapi",
3
- "version": "0.22.10",
3
+ "version": "0.22.14",
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 {};