@odynn/awayz-hotels 0.13.2 → 0.13.3

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.
@@ -9,4 +9,5 @@ export * from './configs';
9
9
  export * from './enums';
10
10
  export * from './hooks';
11
11
  export { mapAccommodationResponse, mapRateResponse } from './services/booking/BookingService.mappers';
12
+ export { getHotelRatingInfo } from './utilities/hotelUtils/hotelUtils';
12
13
  export type { checkNthNightFree, IAirlineProgram, IHotelDetails, IPointsAsCash, IRate, IRoom };
@@ -6,6 +6,11 @@ export declare enum EBookingType {
6
6
  }
7
7
  declare class _BookingService {
8
8
  getAvailableRooms: ({ checkinDate, checkoutDate, accommodationId, rooms, guests }: IGetAvailableRoomsProps) => Promise<{
9
+ cheapestRate: number;
10
+ currency: string;
11
+ availableRooms: never[];
12
+ accommodation: null;
13
+ } | {
9
14
  cheapestRate: number;
10
15
  currency: string;
11
16
  availableRooms: IRoom[];
package/dist/main.js CHANGED
@@ -1,36 +1,38 @@
1
1
  import { ESearchType as t } from "./services/hotel/HotelService.types.js";
2
2
  import { HotelResult as l } from "./components/HotelResult/HotelResult.js";
3
3
  import { HotelResults as i } from "./components/HotelResults/HotelResults.js";
4
- import { Legend as f } from "./components/Legend/Legend.js";
4
+ import { Legend as p } from "./components/Legend/Legend.js";
5
5
  import { Ratings as s } from "./components/Banners/Ratings/Ratings.js";
6
- import { defaultLocationSortOrder as u, defaultSimilarityThreshold as n, duffelTestHotelLocation as c } from "./configs/defaults.js";
7
- import { EHotelSortOption as d, ESortingOrder as A } from "./enums/index.js";
6
+ import { defaultLocationSortOrder as n, defaultSimilarityThreshold as u, duffelTestHotelLocation as c } from "./configs/defaults.js";
7
+ import { EHotelSortOption as d, ESortingOrder as H } from "./enums/index.js";
8
8
  import { useAvailabilityAlertNotifications as R } from "./hooks/useAvailabilityAlertNotifications/useAvailabilityAlertNotifications.js";
9
- import { useAvailabilityAlerts as y } from "./hooks/useAvailabilityAlerts/useAvailabilityAlerts.js";
10
- import { useHotelDetails as L } from "./hooks/useHotelDetails/useHotelDetails.js";
11
- import { useHotelSearch as g } from "./hooks/useHotelSearch/useHotelSearch.js";
9
+ import { useAvailabilityAlerts as h } from "./hooks/useAvailabilityAlerts/useAvailabilityAlerts.js";
10
+ import { useHotelDetails as E } from "./hooks/useHotelDetails/useHotelDetails.js";
11
+ import { useHotelSearch as b } from "./hooks/useHotelSearch/useHotelSearch.js";
12
12
  import { useHotelSort as O } from "./hooks/useHotelSort/useHotelSort.js";
13
13
  import { useLocationSearch as D } from "./hooks/useLocationSearch/useLocationSearch.js";
14
- import { mapAccommodationResponse as j, mapRateResponse as k } from "./services/booking/BookingService.mappers.js";
15
- import { EAvailabilityAlertStatus as w } from "./enums/EAvailabilityAlert.js";
14
+ import { mapAccommodationResponse as N, mapRateResponse as j } from "./services/booking/BookingService.mappers.js";
15
+ import { getHotelRatingInfo as q } from "./utilities/hotelUtils/hotelUtils.js";
16
+ import { EAvailabilityAlertStatus as z } from "./enums/EAvailabilityAlert.js";
16
17
  export {
17
- w as EAvailabilityAlertStatus,
18
+ z as EAvailabilityAlertStatus,
18
19
  d as EHotelSortOption,
19
20
  t as ESearchType,
20
- A as ESortingOrder,
21
+ H as ESortingOrder,
21
22
  l as HotelResult,
22
23
  i as HotelResults,
23
- f as Legend,
24
+ p as Legend,
24
25
  s as Ratings,
25
- u as defaultLocationSortOrder,
26
- n as defaultSimilarityThreshold,
26
+ n as defaultLocationSortOrder,
27
+ u as defaultSimilarityThreshold,
27
28
  c as duffelTestHotelLocation,
28
- j as mapAccommodationResponse,
29
- k as mapRateResponse,
29
+ q as getHotelRatingInfo,
30
+ N as mapAccommodationResponse,
31
+ j as mapRateResponse,
30
32
  R as useAvailabilityAlertNotifications,
31
- y as useAvailabilityAlerts,
32
- L as useHotelDetails,
33
- g as useHotelSearch,
33
+ h as useAvailabilityAlerts,
34
+ E as useHotelDetails,
35
+ b as useHotelSearch,
34
36
  O as useHotelSort,
35
37
  D as useLocationSearch
36
38
  };
@@ -1,45 +1,54 @@
1
1
  var p = Object.defineProperty;
2
- var l = (o, t, a) => t in o ? p(o, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : o[t] = a;
3
- var r = (o, t, a) => l(o, typeof t != "symbol" ? t + "" : t, a);
4
- import { clientInstance as d } from "@odynn/awayz-core";
2
+ var d = (o, t, e) => t in o ? p(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
+ var c = (o, t, e) => d(o, typeof t != "symbol" ? t + "" : t, e);
4
+ import { clientInstance as f } from "@odynn/awayz-core";
5
5
  import "react/jsx-runtime";
6
6
  import "../../moment-BGjjqtLQ.js";
7
7
  import "../../arrayExtensions-CFEBYUok.js";
8
8
  import { E as m } from "../../DateFormats-DZD30Nea.js";
9
9
  import "react";
10
- import { EDuffelEndpoints as f } from "../../configs/endpoints.js";
11
- import { mapRoomResponse as h, mapAccommodationResponse as u } from "./BookingService.mappers.js";
12
- var g = /* @__PURE__ */ ((o) => (o.Hotel = "awayz_hotel_booking_id", o.Flight = "awayz_flight_booking_id", o.Offer = "flight_offer_id", o))(g || {});
13
- class v {
10
+ import { EDuffelEndpoints as u } from "../../configs/endpoints.js";
11
+ import { mapRoomResponse as h, mapAccommodationResponse as R } from "./BookingService.mappers.js";
12
+ var v = /* @__PURE__ */ ((o) => (o.Hotel = "awayz_hotel_booking_id", o.Flight = "awayz_flight_booking_id", o.Offer = "flight_offer_id", o))(v || {});
13
+ class g {
14
14
  constructor() {
15
- r(this, "getAvailableRooms", async ({
15
+ c(this, "getAvailableRooms", async ({
16
16
  checkinDate: t,
17
- checkoutDate: a,
18
- accommodationId: c,
19
- rooms: i,
17
+ checkoutDate: e,
18
+ accommodationId: i,
19
+ rooms: n,
20
20
  guests: s
21
21
  }) => {
22
- const { data: n } = await d.post(
23
- f.AVAILABLE_ROOMS,
22
+ var r;
23
+ const { data: _ } = await f.post(
24
+ u.AVAILABLE_ROOMS,
24
25
  {
25
26
  check_in_date: t.format(m.ServerDate),
26
- check_out_date: a.format(m.ServerDate),
27
- accommodation_ids: [c],
28
- rooms: i,
27
+ check_out_date: e.format(m.ServerDate),
28
+ accommodation_ids: [i],
29
+ rooms: n,
29
30
  guests: s
30
31
  }
31
- ), e = n.data.results.getFirst(), _ = e.accommodation.rooms.map(h);
32
+ ), a = _.data.results.getFirst();
33
+ if (!a)
34
+ return {
35
+ cheapestRate: 0,
36
+ currency: "",
37
+ availableRooms: [],
38
+ accommodation: null
39
+ };
40
+ const l = (r = a == null ? void 0 : a.accommodation) == null ? void 0 : r.rooms.map(h);
32
41
  return {
33
- cheapestRate: parseFloat(e.cheapest_rate_total_amount),
34
- currency: e.cheapest_rate_currency,
35
- availableRooms: _,
36
- accommodation: u(e.accommodation)
42
+ cheapestRate: parseFloat(a.cheapest_rate_total_amount),
43
+ currency: a.cheapest_rate_currency,
44
+ availableRooms: l,
45
+ accommodation: R(a.accommodation)
37
46
  };
38
47
  });
39
48
  }
40
49
  }
41
- const E = new v();
50
+ const O = new g();
42
51
  export {
43
- E as BookingService,
44
- g as EBookingType
52
+ O as BookingService,
53
+ v as EBookingType
45
54
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@odynn/awayz-hotels",
3
3
  "private": false,
4
- "version": "0.13.2",
4
+ "version": "0.13.3",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"