@findhotel/sapi 1.0.0-beta.0 → 1.0.0

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/README.md CHANGED
@@ -258,7 +258,7 @@ const sapiClient = await sapi(profileKey, {
258
258
  log('Config received', config)
259
259
  }
260
260
  },
261
- totalRateFormula: (rate) => {
261
+ getTotalRate: (rate) => {
262
262
  let totalRate = rate.base
263
263
  if (includeTaxes) totalRate += rate.taxes
264
264
  if (includeHotelFees) totalRate += rate.hotelFees
@@ -271,19 +271,19 @@ const sapiClient = await sapi(profileKey, {
271
271
  ### Supported options
272
272
  <a id="client-options"></a>
273
273
 
274
- | name | required | type | default | description | example |
275
- | ---------------------- | -------- | ------------------------ | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
276
- | `anonymousId` | yes | `string` | | Unique ID identifying users | `2d360284-577b-4a53-8b91-68f72b9227fa` |
277
- | `language` | no | `string` | `en` | 2-char language code | `en` |
278
- | `currency` | no | `string` | `USD` | 3-char uppercased ISO currency code | `USD` |
279
- | `countryCode` | no | `string` | `US` | 2-char uppercased ISO country code | `US` |
280
- | `deviceType` | yes | `string` | | `desktop` or `mobile` | `desktop` |
281
- | `pageSize` | no | `number` | `20` | Displayed page size | `20` |
282
- | `initWithAppConfig` | no | `AppConfig` | | External app config to override internal one | |
283
- | `algoliaClientOptions` | no | `AlgoliaSearchOptions` | | Algolia client options used for debugging and setting additional options like timeouts etc. | |
284
- | `variations` | no | `Record<string, string>` | | A/B test variations | `{'pp000004-tags2': 'b', 'pp000004-tags3': '1'}` |
285
- | `callbacks` | no | `Record<string, fnc>` | | Client callbasks | |
286
- | `totalRateFormula` | no | `function` | Total rate including taxes and fees | Formula to calculate total display rate based on tax display logic. Used for price filter and sort by price functionalities. | |
274
+ | name | required | type | default | description | example |
275
+ | ---------------------- | -------- | ------------------------ | ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
276
+ | `anonymousId` | yes | `string` | | Unique ID identifying users | `2d360284-577b-4a53-8b91-68f72b9227fa` |
277
+ | `language` | no | `string` | `en` | 2-char language code | `en` |
278
+ | `currency` | no | `string` | `USD` | 3-char uppercased ISO currency code | `USD` |
279
+ | `countryCode` | no | `string` | `US` | 2-char uppercased ISO country code | `US` |
280
+ | `deviceType` | yes | `string` | | `desktop` or `mobile` | `desktop` |
281
+ | `pageSize` | no | `number` | `20` | Displayed page size | `20` |
282
+ | `initWithAppConfig` | no | `AppConfig` | | External app config to override internal one | |
283
+ | `algoliaClientOptions` | no | `AlgoliaSearchOptions` | | Algolia client options used for debugging and setting additional options like timeouts etc. | |
284
+ | `variations` | no | `Record<string, string>` | | A/B test variations | `{'pp000004-tags2': 'b', 'pp000004-tags3': '1'}` |
285
+ | `callbacks` | no | `Record<string, fnc>` | | Client callbasks | |
286
+ | `getTotalRate` | no | `function` | Total rate including taxes and fees | Function to calculate total display rate based on tax display logic. Used for price filter and sort by price functionalities. | |
287
287
 
288
288
  ### Available client callbacks
289
289
  <a id="client-callbacks"></a>
@@ -425,12 +425,14 @@ the state can be repeated between different callbacks.
425
425
  Returns hotel's offers (incomplete response) in
426
426
  `response.hotelOfferEntities` object as well as updated
427
427
  hotel sort order in `response.hotelIds` array (sorted
428
- according to HSO and taking into account the real offers data)
428
+ according to HSO and taking into account the real offers data)\
429
+ The offers response with the detailed description can be found in the [Offers Response](./docs/offers.md)
429
430
 
430
431
  5. ### onComplete()
431
432
 
432
433
  Runs when current search is complete and all offers are retrieved\
433
- Return complete SAPI seearch response.
434
+ Return complete SAPI seearch response.\
435
+ The offers response with the detailed description can be found in the [Offers Response](./docs/offers.md)
434
436
 
435
437
  ### Response
436
438
  <a id="search-response"></a>
@@ -496,7 +498,7 @@ so there is a simplified example:
496
498
  "hotelIds": ["1840170", "2766940", "3310443", "3035769"],
497
499
  "hotelOfferEntities": {
498
500
  "1041597": {
499
- "anchorPriceRateBreakdown": {
501
+ "anchorRate": {
500
502
  "base": 244.6021305,
501
503
  "hotelFees": 23.122149135,
502
504
  "taxes": 20.4147
@@ -508,7 +510,7 @@ so there is a simplified example:
508
510
  "id": "o5vFF4-wmvcc",
509
511
  "currency": "EUR",
510
512
  "availableRooms": 6,
511
- "url": "https://r.findhotel.net?...",
513
+ "url": "https://r.vio.com?...",
512
514
  "rate": {
513
515
  "base": 197.17,
514
516
  "taxes": 17.75,
@@ -899,50 +901,4 @@ const parameters = {
899
901
  }
900
902
  ```
901
903
 
902
- ```js
903
- {
904
- "anchorPriceRateBreakdown": {
905
- "base": 244.6021305,
906
- "hotelFees": 23.122149135,
907
- "taxes": 20.4147
908
- },
909
- "availableOffersCount": 23,
910
- "id": "1041597",
911
- "offers": [
912
- {
913
- "id": "o5vFF4-wmvcc",
914
- "currency": "EUR",
915
- "availableRooms": 6,
916
- "url": "https://r.findhotel.net?...",
917
- "rate": {
918
- "base": 197.17,
919
- "taxes": 17.75,
920
- "hotelFees": 31.8
921
- },
922
- "accessTier": "",
923
- "providerCode": "BKS",
924
- "intermediaryProvider": "BKS",
925
- "roomName": "Standard Twin Room",
926
- "package": {
927
- "amenities": [
928
- "breakfast"
929
- ],
930
- "canPayLater": false
931
- },
932
- "cancellationPenalties": [],
933
- "tags": [
934
- "top_offer"
935
- ],
936
- "metadata": {
937
- "feedID": ""
938
- }
939
- }
940
- ],
941
- "discount": {
942
- "discountProvider": "FHT",
943
- "hasDiscountProvider": true,
944
- "hasParityProvider": true,
945
- "modifier": "b"
946
- }
947
- }
948
- ```
904
+ The response with the detailed description can be found in the [Offers Response](./docs/offers.md)