Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@findhotel/sapi

Package Overview
Dependencies
Maintainers
3
Versions
194
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@findhotel/sapi - npm Package Compare versions

Comparing version 0.22.16 to 0.23.1

dist/types/packages/core/src/app-config.d.ts

10

CHANGELOG.md

@@ -0,1 +1,11 @@

# [0.23.1](https://github.com/FindHotel/sapi/compare/v0.23.0...v0.23.1) (2022-02-09)
### Added
- SAPI backend offers support.
## [0.23.0](https://github.com/FindHotel/sapi/compare/v0.22.16...v0.23.0) (2022-02-09)
### Changed
- Skipped
## [0.22.16](https://github.com/FindHotel/sapi/compare/v0.22.15...v0.22.16) (2022-01-04)

@@ -2,0 +12,0 @@ ### Added

9

dist/types/packages/core/src/algolia/configs.d.ts
import { AlgoliaClient } from '..';
import { Profile } from '../types';
import { IndexVariation } from '../types';
declare type HsoConfigContext = Record<string, unknown>;

@@ -64,3 +64,8 @@ export declare type HsoConfigType = 'place_search' | 'hotel_search';

export declare function getLovAttributesToRetrieve(languages: string[]): string[];
export declare function loadConfigs({ search }: AlgoliaClient, profile: Profile, options: LoadConfigOptions): Promise<Configs>;
interface IndicesConfiguration {
hsoIndex: IndexVariation[];
lovIndex: string;
currencyIndex: string;
}
export declare function loadConfigs({ search }: AlgoliaClient, { hsoIndex, lovIndex, currencyIndex }: IndicesConfiguration, options: LoadConfigOptions): Promise<Configs>;
export {};
import { AlgoliaClient } from '..';
import { HsoFilter } from './configs';
import { OptionalSearchParameters, Hotel, Location, Profile } from '../types';
import { OptionalSearchParameters, Hotel, Location } from '../types';
interface Options {

@@ -16,3 +16,6 @@ languages: string[];

}
export declare function geoSearch({ search }: AlgoliaClient, profile: Profile, options: Options): (parameters: GeoSearchParameters) => Promise<{
interface IndicesConfiguration {
hotelIndex: string;
}
export declare function geoSearch({ search }: AlgoliaClient, { hotelIndex }: IndicesConfiguration, options: Options): (parameters: GeoSearchParameters) => Promise<{
hotelIds: string[];

@@ -19,0 +22,0 @@ hotelEntities: Record<string, Hotel>;

import { AlgoliaClient } from '..';
import { Profile, Anchor, Hotel, Location } from '../types';
import { Anchor, Hotel, Location } from '../types';
interface GetAnchorParameters {

@@ -15,3 +15,7 @@ hotelId?: string;

};
export declare function getAnchor({ search }: AlgoliaClient, profile: Profile, { languages }: {
interface IndicesConfiguration {
autocompleteIndex: string;
hotelIndex: string;
}
export declare function getAnchor({ search }: AlgoliaClient, { autocompleteIndex, hotelIndex }: IndicesConfiguration, { languages }: {
languages: string[];

@@ -18,0 +22,0 @@ }): (parameters: GetAnchorParameters) => Promise<{

import { AlgoliaClient } from '..';
import { Profile } from '../types';
interface Options {

@@ -7,3 +6,6 @@ languages: string[];

}
export declare function loadSuggests({ search }: AlgoliaClient, profile: Profile, { languages, suggestsCount }: Options): (query: string) => Promise<import("..").Suggestion[]>;
interface IndicesConfiguration {
autocompleteIndex: string;
}
export declare function loadSuggests({ search }: AlgoliaClient, { autocompleteIndex }: IndicesConfiguration, { languages, suggestsCount }: Options): (query: string) => Promise<import("..").Suggestion[]>;
export {};
import { Base, ProfileKey } from '.';
import { SearchResults, SearchFn } from './search';
import { SearchResults, SearchFn, SearchFnParameters } from './search';
import { SearchParameters } from './types';

@@ -13,3 +13,3 @@ declare type AttributesToRetrieve = keyof SearchResults;

export declare function createRequestString({ profileKey, searchParameters, options, offset, attributes }: RequestParameters): string;
export declare function backendSearch({ getFeatureEnabled, profile, profileKey, backendConfig, raaClient, options }: Base): SearchFn;
export declare function backendSearch({ getFeatureEnabled, profileKey, appConfig, offersClient, options }: SearchFnParameters): SearchFn;
export {};

@@ -1,3 +0,3 @@

import { HotelOfferEntity } from '../types';
export interface RaaClient {
import { CugDeals, HotelId, HotelOfferEntity } from '../types';
export interface OffersClient {
getOffers: GetOffers;

@@ -8,3 +8,3 @@ }

currency: string;
userCountry: string;
countryCode: string;
language: string;

@@ -17,12 +17,12 @@ includeLocalTaxes?: boolean;

sapiCliKey?: string;
deviceCategory: string;
deviceType: string;
variations: string[];
}
export interface GetOffersParameters {
anchorDestination?: string;
cugDeals?: string;
anchorHotelId?: HotelId;
hotelIds?: HotelId[];
cugDeals?: CugDeals;
getAllOffers?: boolean;
profileId?: string;
originId?: string;
useAlternativeRaaKeys?: boolean;
destination?: string;
checkIn: string;

@@ -39,4 +39,4 @@ checkOut: string;

export interface OffersResponse {
anchorHotel?: HotelOfferEntity;
hotels?: HotelOfferEntity[];
anchorHotelOfferEntity?: HotelOfferEntity;
hotelOfferEntities?: HotelOfferEntity[];
}

@@ -43,0 +43,0 @@ declare type GetOffers = (parameters: GetOffersParameters, onOffersReceived?: (response: OffersResponse) => void) => Promise<OffersResponse>;

@@ -13,2 +13,3 @@ import { OffersResponse } from './raa';

exchangeRate: number;
variations?: string[];
}

@@ -34,5 +35,4 @@ interface SortingBoostParameters {

hotelIds: string[];
anchorHotelId: string | undefined;
hotelOfferEntities: Record<string, HotelOfferEntity>;
};
export {};

@@ -1,2 +0,2 @@

import { Base } from '.';
import { BaseWithConfig } from '.';
import { RoomsRequestParameters, RoomsRequestOptions, RoomsResults } from './types';

@@ -34,3 +34,2 @@ export declare type RoomsFn = (parameters: RoomsRequestParameters) => Promise<RoomsResults>;

export declare function createRequestString(parameters: RoomsRequestParameters, options: RoomsRequestOptions): string;
declare type RoomsFnParameters = Pick<Base, 'options' | 'safConfig'>;
/**

@@ -43,3 +42,2 @@ * Creates rooms search function with binded base configuration object

*/
export declare function rooms({ options, safConfig }: RoomsFnParameters): RoomsFn;
export {};
export declare function rooms({ appConfig, options }: Pick<BaseWithConfig, 'options' | 'appConfig'>): RoomsFn;
import { SearchClient } from 'algoliasearch';
import { Except } from 'type-fest';
import { RaaClient } from './raa';
import { OffersClient } from './raa';
import { Configs } from './algolia';
import { SafConfig, BackendConfig } from './configs';
import { ProfileKey, ClientOptions, SapiClient, Profile, SapiFeature, Language, Logger } from './types';
import { AppConfig } from './app-config';
import { ProfileKey, ClientOptions, SapiClient, SapiFeature, Language, Logger } from './types';
export declare type AlgoliaClient = Pick<SearchClient, 'search'>;
export interface Base {
/** Search application frontend config */
safConfig: SafConfig;
/** SAPI backend config */
backendConfig: BackendConfig;
/** SAPI client application config */
appConfig: AppConfig;
/** Check if SAPI feature is enabled */
getFeatureEnabled: (feature: SapiFeature) => boolean;
/** Client profile */
profile: Profile;
/** Instance of Algolia Client */
algoliaClient: AlgoliaClient;
/** Instance of Rates and Availability Client */
raaClient?: RaaClient;
/** Instance of Offers Client */
offersClient?: OffersClient;
/** Profile key of specific client */

@@ -39,4 +35,4 @@ profileKey: ProfileKey;

*
* @param profileKey - Profile key
* @param clientOptions - Options for initializing SAPI
* @param profileKey - Profile key for customer identification
* @param clientOptions - Options for initializing SAPI client
*

@@ -43,0 +39,0 @@ * @returns Promise which resolves to SAPI client

@@ -31,3 +31,3 @@ import { Except } from 'type-fest';

currency: string;
userCountry: string;
countryCode: string;
pageSize: number;

@@ -47,4 +47,4 @@ }

export declare function getRequestSize(anchorObject: AnchorObject, parameters: SearchParameters, options: Options): number;
declare type SearchFnParameters = Pick<BaseWithConfig, 'options' | 'profile' | 'algoliaClient' | 'raaClient' | 'configs' | 'getFeatureEnabled'>;
export declare function search({ getFeatureEnabled, profile, algoliaClient, raaClient, options, configs }: SearchFnParameters): SearchFn;
export declare type SearchFnParameters = Pick<BaseWithConfig, 'profileKey' | 'options' | 'appConfig' | 'algoliaClient' | 'offersClient' | 'configs' | 'getFeatureEnabled'>;
export declare function search({ getFeatureEnabled, appConfig, algoliaClient, offersClient, options, configs }: SearchFnParameters): SearchFn;
export {};

@@ -1,2 +0,2 @@

import { HotelId, AnonymousId, Currency, Language, DeviceCategory } from './types';
import { HotelId, AnonymousId, Currency, Language, DeviceType, RoomId } from './types';
export interface RoomsRequestParameters {

@@ -11,3 +11,3 @@ hotelId: HotelId;

export interface RoomsRequestOptions {
deviceCategory: DeviceCategory;
deviceType: DeviceType;
language: Language;

@@ -18,3 +18,2 @@ currency: Currency;

}
export declare type RoomId = string;
export declare type RoomPackageId = string;

@@ -21,0 +20,0 @@ export interface RoomCancellationPenalties {

import { AlgoliaSearchOptions } from 'algoliasearch';
import { AnonymousId, Language, Currency, Country, DeviceCategory } from './types';
import { Profile } from './sapi-configs';
import { AnonymousId, Language, Currency, Country, DeviceType, Brand } from './types';
import { AppConfig } from '../app-config';
import { SearchFn } from '../search';

@@ -8,3 +8,3 @@ import { RoomsFn } from '../rooms';

import { Configs } from '../algolia';
export declare type ProfileKey = string;
export declare type ProfileKey = 'findhotel-website' | 'findhotel-website-e2e' | 'findhotel-website-stg' | 'findhotel-website-ci' | 'findhotel-website-dev' | 'findhotel-checkout' | 'findhotel-checkout-e2e';
interface Event {

@@ -30,4 +30,6 @@ name: string;

currency: Currency;
/** @deprecated since 0.23.0 use countryCode instead */
userCountry?: Country;
/** Country code for selected user origin userCountry */
userCountry: Country;
countryCode: Country;
/** Displayed page size */

@@ -39,8 +41,6 @@ pageSize?: number;

includeTaxes?: boolean;
/** User's device category */
deviceCategory: DeviceCategory;
/** Skip backend offers augmentation */
skipBackendAugmentation?: boolean;
/** Enable raa faceting */
facetsEnabled?: boolean;
/** @deprecated since 0.23.0 use deviceType instead */
deviceCategory?: DeviceType;
/** User's device type */
deviceType: DeviceType;
/** Used to identify SAPI Cli interface on the RAA backend */

@@ -50,6 +50,8 @@ sapiCliKey?: string;

algoliaClientOptions?: AlgoliaSearchOptions;
/** External profile to override internal client profile */
initWithProfile?: Partial<Profile>;
/** External app config to override internal sapi sdk app config */
initWithAppConfig?: Partial<AppConfig>;
/** A/B test variations */
variations?: Record<string, string>;
/** Brand name of the client */
brand?: Brand;
/** External logger to log sapi events */

@@ -56,0 +58,0 @@ logger?: Logger;

@@ -21,2 +21,5 @@ import { DateString, Language } from './types';

};
offers: {
endpoint: string;
};
algolia: {

@@ -23,0 +26,0 @@ apiKey: string;

@@ -11,3 +11,5 @@ /**

export declare type DateString = string;
export declare type DeviceCategory = string;
export declare type DeviceType = 'desktop' | 'mobile' | 'tablet';
export declare type CugDeals = string[];
export declare type Brand = string;
/**

@@ -41,6 +43,2 @@ * Search client types

sortOrder?: string;
/**
* @deprecated Should set this as SAPI client option
*/
offers?: boolean;
filters?: FilterParameters;

@@ -51,5 +49,4 @@ offset?: number;

polygon?: Polygon;
getAllOffers?: boolean;
cugDeals?: string;
profileId?: string;
cugDeals?: CugDeals;
originId?: string;
searchId?: string;

@@ -197,2 +194,3 @@ useAlternativeRaaKeys?: boolean;

export declare type HotelId = Hotel['objectID'];
export declare type RoomId = string;
/**

@@ -219,3 +217,7 @@ * RAA types

}
export declare type Meals = 'allInclusive' | 'breakfast' | 'partialBreakfast' | 'lunch' | 'dinner' | 'fullBoard' | 'halfBoard' | 'meals';
export interface Offer {
additionalProviderParams: {
feedId: string;
};
id: string;

@@ -229,5 +231,5 @@ bookURI: string;

availableRooms: number;
cug: string[];
cug: string[] | null;
currency: Currency;
meals: string[];
meals: Meals[];
tags: string[];

@@ -248,3 +250,3 @@ canPayLater?: boolean;

rateBasedOnNumberOfRooms?: number;
feedId: string;
feedId?: string;
providerOfferId?: string;

@@ -254,2 +256,3 @@ rateType?: string;

export interface RaaResponseOffer {
availableOffersCount: number;
anchorPriceRateBreakdown?: AnchorPriceRateBreakdown;

@@ -264,3 +267,11 @@ cheapestPriceRateBreakdown?: RateBreakdown;

}
export interface HotelOfferEntity extends Omit<RaaResponseOffer, 'errors'> {
export interface HotelOfferEntity {
availableOffersCount: number;
anchorPriceRateBreakdown?: AnchorPriceRateBreakdown;
cheapestPriceRateBreakdown?: RateBreakdown;
fetchedAllOffers: boolean;
hasMoreOffers: boolean;
id: string;
offers: Offer[];
topOfferData?: TopOfferData;
}

@@ -267,0 +278,0 @@ export interface RaaResponse {

@@ -6,3 +6,3 @@ import { AnonymousId, ApiSearchParameters } from '../types';

currency: string;
userCountry: string;
countryCode: string;
}

@@ -9,0 +9,0 @@ /**

{
"name": "@findhotel/sapi",
"version": "0.22.16",
"version": "0.23.1",
"description": "FindHotel Search API",

@@ -19,3 +19,3 @@ "main": "dist/index.js",

"rollup": "rollup -c",
"rollup:watch": "npm run clean:dist && rollup -c --watch",
"rollup:watch": "npm run clean:dist && tsc --outDir dist/lib --declarationDir dist/types --declaration true --emitDeclarationOnly && rollup -c --watch",
"typedoc": "lerna run typedoc",

@@ -27,2 +27,4 @@ "typedoc:publish": " aws s3 cp packages/core/docs/ s3://fh-search/metrics/sapi/typedoc --recursive",

"playground": "cd packages/playground && npm run dev",
"webclient:start": "cd packages/webclient && npm start",
"webclient:build": "cd packages/core && npm install && cd ../../ npm run build && cd packages/webclient && npm run build",
"release": "shipjs prepare"

@@ -44,14 +46,13 @@ },

"@rollup/plugin-typescript": "^6.1.0",
"rollup": "^2.33.3",
"rollup-plugin-terser": "^7.0.2",
"typescript": "^4.1.2",
"eslint-config-xo-react": "^0.23.0",
"eslint-plugin-jest": "^24.1.3",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.2.0",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-visualizer": "^5.5.0",
"husky": "^5.0.6",
"jest": "^26.6.3",
"lerna": "^3.15.0",
"rollup": "^2.33.3",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-visualizer": "^5.5.0",
"shipjs": "0.23.3",

@@ -62,4 +63,5 @@ "ts-jest": "^26.4.4",

"typedoc": "^0.19.2",
"typescript": "^4.1.2",
"xo": "^0.35.0"
}
}

@@ -64,3 +64,3 @@

currency: 'USD',
userCountry: 'US'
countryCode: 'US'
})

@@ -147,8 +147,8 @@

currency: 'USD',
userCountry: 'US',
deviceCategory: 'mobile',
countryCode: 'US',
deviceType: 'mobile',
includeLocalTaxes: true,
includeTaxes: false,
pageSize: 20,
initWithProfile: {
initWithAppConfig: {
features: ['search', 'configs'],

@@ -234,3 +234,3 @@ },

<tr>
<td class="org-left">`userCountry`</td>
<td class="org-left">`countryCode`</td>
<td class="org-left">no</td>

@@ -245,3 +245,3 @@ <td class="org-left">`string`</td>

<tr>
<td class="org-left">`deviceCategory`</td>
<td class="org-left">`deviceType`</td>
<td class="org-left">yes</td>

@@ -286,7 +286,7 @@ <td class="org-left">`string`</td>

<tr>
<td class="org-left">`initWithProfile`</td>
<td class="org-left">`initWithAppConfig`</td>
<td class="org-left">no</td>
<td class="org-left">`Record<string, any>`</td>
<td class="org-left">`AppConfig`</td>
<td class="org-left">&#xa0;</td>
<td class="org-left">External profile to override internal client profile</td>
<td class="org-left">External app config to override internal one</td>
<td class="org-left">&#xa0;</td>

@@ -408,2 +408,10 @@ </tr>

<tr>
<td class="org-left">`boundingBox`</td>
<td class="org-left">`[p1Lat, p1Lng, p2Lat, p2Lng]`</td>
<td class="org-left">`topLeft` and `bottomRight` coordinates of bounding box to perform search inside it</td>
<td class="org-left">`[46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625]`</td>
</tr>
<tr>
<td class="org-left">`checkIn`</td>

@@ -430,2 +438,74 @@ <td class="org-left">`string`</td>

</tr>
<tr>
<td class="org-left">`dayDistance`</td>
<td class="org-left">`number`</td>
<td class="org-left">Amount of full days from now to desired check in date (works in combination with `nights` parameter)</td>
<td class="org-left">`15`</td>
</tr>
<tr>
<td class="org-left">`nights`</td>
<td class="org-left">`number`</td>
<td class="org-left">Number of nights of stay</td>
<td class="org-left">`3`</td>
</tr>
<tr>
<td class="org-left">`sortField`</td>
<td class="org-left">`string`</td>
<td class="org-left">Defines the sort by criteria</td>
<td class="org-left">`popularity, price`</td>
</tr>
<tr>
<td class="org-left">`sortOrder`</td>
<td class="org-left">`string`</td>
<td class="org-left">Defines the sort order</td>
<td class="org-left">`ascending, descending`</td>
</tr>
<tr>
<td class="org-left">`filters`</td>
<td class="org-left">`Object`</td>
<td class="org-left">Object with filters</td>
<td class="org-left">`{starRatings: 5}`</td>
</tr>
<tr>
<td class="org-left">`cugDeals`</td>
<td class="org-left">`string[]`</td>
<td class="org-left">Codes of closed user group deals to retrieve offers</td>
<td class="org-left">`['signed_in', 'offline']`</td>
</tr>
<tr>
<td class="org-left">`originId`</td>
<td class="org-left">`string`</td>
<td class="org-left">Identifier of origin where the request was originated</td>
<td class="org-left">`c3po6twr70`</td>
</tr>
<tr>
<td class="org-left">`preferredRate`</td>
<td class="org-left">`number`</td>
<td class="org-left">Offer's price user saw on a CA (meta) platform</td>
<td class="org-left">`196`</td>
</tr>
<tr>
<td class="org-left">`trafficSource`</td>
<td class="org-left">`string`</td>
<td class="org-left">Visitor's traffic source. Opaque value that will be passed to tracking systems</td>
<td class="org-left">`gha-vr`</td>
</tr>
</tbody>

@@ -432,0 +512,0 @@ </table>

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc