@odynn/awayz-hotels 0.12.4 → 0.12.6

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.
Files changed (27) hide show
  1. package/dist/components/HotelResult/HotelResult.js +6 -6
  2. package/dist/definitions/HotelChains.js +2 -1
  3. package/dist/hooks/useAvailabilityAlertNotifications/useAvailabilityAlertNotifications.js +3 -2
  4. package/dist/hooks/useAvailabilityAlerts/useAvailabilityAlerts.js +20 -24
  5. package/dist/hooks/useHotelDetails/useHotelDetails.api.js +36 -35
  6. package/dist/hooks/useHotelDetails/useHotelDetails.js +7 -6
  7. package/dist/hooks/useHotelSearch/useHotelSearch.js +9 -8
  8. package/dist/hooks/useLocationSearch/useLocationSearch.js +15 -14
  9. package/dist/lib/hooks/useHotelDetails/useHotelDetails.api.d.ts +1 -1
  10. package/dist/lib/hooks/useHotelDetails/useHotelDetails.d.ts +1 -1
  11. package/dist/lib/services/availabilityAlerts/AvailabilityAlertsService.d.ts +3 -3
  12. package/dist/lib/services/booking/BookingService.d.ts +2 -2
  13. package/dist/lib/services/booking/BookingService.mappers.d.ts +14 -0
  14. package/dist/lib/services/booking/BookingService.types.d.ts +11 -6
  15. package/dist/lib/services/hotel/HotelService.d.ts +4 -4
  16. package/dist/lib/services/hotel/HotelService.mappers.d.ts +24 -0
  17. package/dist/lib/services/hotel/HotelService.types.d.ts +109 -0
  18. package/dist/lib/services/wallet/WalletService.mappers.d.ts +21 -0
  19. package/dist/services/availabilityAlerts/AvailabilityAlertsService.js +56 -27
  20. package/dist/services/booking/BookingService.js +26 -29
  21. package/dist/services/booking/BookingService.mappers.js +113 -0
  22. package/dist/services/hotel/HotelService.js +35 -44
  23. package/dist/services/hotel/HotelService.mappers.js +218 -0
  24. package/dist/services/wallet/WalletService.js +26 -29
  25. package/dist/services/wallet/WalletService.mappers.js +74 -0
  26. package/package.json +1 -1
  27. package/dist/objectUtils-Br6N9tQs.js +0 -15
@@ -1,8 +1,8 @@
1
1
  import { jsx as Q, jsxs as C, Fragment as D } from "react/jsx-runtime";
2
2
  import { useFeatureFlags as _, EAmountsDisplayFeature as E, CashValue as U, ClientPointsValue as F } from "@odynn/awayz-core";
3
- import { p as $, o as AA } from "../../stringUtils-BmTiWFHF.js";
4
- import { h as CA } from "../../moment-BGjjqtLQ.js";
3
+ import { h as $ } from "../../moment-BGjjqtLQ.js";
5
4
  import "../../arrayExtensions-CFEBYUok.js";
5
+ import { p as AA, o as CA } from "../../stringUtils-BmTiWFHF.js";
6
6
  import { useState as L, useRef as QA, useEffect as v } from "react";
7
7
  import { G as IA, d as gA, e as BA, f as EA, c as eA, g as tA, h as aA } from "../../index-dGpDC9bM.js";
8
8
  import { HotelChains as rA } from "../../definitions/HotelChains.js";
@@ -10,12 +10,12 @@ import { EHotelSortOption as nA } from "../../enums/index.js";
10
10
  import { getHotelImageUrls as oA, getBookingOptions as lA, isDuffelHotelId as sA, getHotelRatingInfo as cA, loadImageWithFallback as vA } from "../../utilities/hotelUtils/hotelUtils.js";
11
11
  import { Ratings as dA, ERatingColor as fA } from "../Banners/Ratings/Ratings.js";
12
12
  import '../../assets/_styles.css';/* empty css */
13
- const iA = (...A) => A.join(" ");
14
13
  function j(A, n = !0) {
15
14
  if ((!A || isNaN(A) || A < 0) && n) return "N/A";
16
15
  let I = A == null ? void 0 : A.toString().split(".")[0];
17
16
  return I == null ? void 0 : I.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
18
17
  }
18
+ const iA = (...A) => A.join(" ");
19
19
  function T(A) {
20
20
  return IA({ attr: { viewBox: "0 0 576 512" }, child: [{ tag: "path", attr: { d: "M316.9 18C311.6 7 300.4 0 288.1 0s-23.4 7-28.8 18L195 150.3 51.4 171.5c-12 1.8-22 10.2-25.7 21.7s-.7 24.2 7.9 32.7L137.8 329 113.2 474.7c-2 12 3 24.2 12.9 31.3s23 8 33.8 2.3l128.3-68.5 128.3 68.5c10.8 5.7 23.9 4.9 33.8-2.3s14.9-19.3 12.9-31.3L438.5 329 542.7 225.9c8.6-8.5 11.7-21.2 7.9-32.7s-13.7-19.9-25.7-21.7L381.2 150.3 316.9 18z" }, child: [] }] })(A);
21
21
  }
@@ -63,7 +63,7 @@ const hA = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAyAAAAGiCAYAAAAfl6KSAA
63
63
  if (c.stopPropagation(), o) o(A);
64
64
  else
65
65
  throw new Error("Could not display availability calendar.");
66
- }, p = typeof A.nthNightFree == "number" && A.nthNightFree > 0, b = x && !sA(A.hotelId) && g.amountsDisplayFeature === E.CASH_AND_TRAVEL_PARTNER_POINTS, B = CA(G).diff(m, "days") || 1, H = a * B, S = p ? A.awardPoints : A.points, z = S * B, M = j(S), Z = j(z);
66
+ }, p = typeof A.nthNightFree == "number" && A.nthNightFree > 0, b = x && !sA(A.hotelId) && g.amountsDisplayFeature === E.CASH_AND_TRAVEL_PARTNER_POINTS, B = $(G).diff(m, "days") || 1, H = a * B, S = p ? A.awardPoints : A.points, z = S * B, M = j(S), Z = j(z);
67
67
  return /* @__PURE__ */ Q(
68
68
  "div",
69
69
  {
@@ -119,7 +119,7 @@ const hA = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAyAAAAGiCAYAAAAfl6KSAA
119
119
  /* @__PURE__ */ C("p", { children: [
120
120
  B,
121
121
  " ",
122
- $(B, "Night")
122
+ AA(B, "Night")
123
123
  ] })
124
124
  ] }),
125
125
  A.freeNight && /* @__PURE__ */ C("div", { children: [
@@ -129,7 +129,7 @@ const hA = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAyAAAAGiCAYAAAAfl6KSAA
129
129
  W && p && /* @__PURE__ */ C("div", { children: [
130
130
  /* @__PURE__ */ Q(tA, {}),
131
131
  /* @__PURE__ */ C("p", { children: [
132
- AA(A.nthNightFree),
132
+ CA(A.nthNightFree),
133
133
  " Night Free"
134
134
  ] })
135
135
  ] }),
@@ -1,6 +1,7 @@
1
- import { c as o } from "../stringUtils-BmTiWFHF.js";
1
+ import "react/jsx-runtime";
2
2
  import "../moment-BGjjqtLQ.js";
3
3
  import "../arrayExtensions-CFEBYUok.js";
4
+ import { c as o } from "../stringUtils-BmTiWFHF.js";
4
5
  import "react";
5
6
  const t = {
6
7
  Marriott: "marriott",
@@ -1,11 +1,12 @@
1
1
  import { awayzClient as i } from "@odynn/awayz-core";
2
2
  import { useQuery as m, useMutation as y } from "@tanstack/react-query";
3
+ import "react/jsx-runtime";
3
4
  import "../../moment-BGjjqtLQ.js";
4
5
  import "../../arrayExtensions-CFEBYUok.js";
5
6
  import { E as e } from "../../enums-DPFgYLjY.js";
6
7
  import "react";
7
8
  import { AvailabilityAlertsService as r } from "../../services/availabilityAlerts/AvailabilityAlertsService.js";
8
- const E = () => {
9
+ const N = () => {
9
10
  const {
10
11
  data: a = [],
11
12
  error: o,
@@ -39,5 +40,5 @@ const E = () => {
39
40
  };
40
41
  };
41
42
  export {
42
- E as useAvailabilityAlertNotifications
43
+ N as useAvailabilityAlertNotifications
43
44
  };
@@ -1,12 +1,12 @@
1
1
  import { awayzClient as v } from "@odynn/awayz-core";
2
2
  import { useQuery as f, useMutation as p } from "@tanstack/react-query";
3
+ import "react/jsx-runtime";
3
4
  import "../../moment-BGjjqtLQ.js";
4
5
  import "../../arrayExtensions-CFEBYUok.js";
5
- import { c as b } from "../../objectUtils-Br6N9tQs.js";
6
6
  import { E as u } from "../../enums-DPFgYLjY.js";
7
7
  import "react";
8
- import { AvailabilityAlertsService as w } from "../../services/availabilityAlerts/AvailabilityAlertsService.js";
9
- const h = ({
8
+ import { AvailabilityAlertsService as d } from "../../services/availabilityAlerts/AvailabilityAlertsService.js";
9
+ const b = ({
10
10
  checkin: r,
11
11
  checkout: t,
12
12
  hotelGroup: a,
@@ -41,7 +41,7 @@ const h = ({
41
41
  throw new Error("Hotel description is required");
42
42
  if (!A)
43
43
  throw new Error("Hotel program name is required");
44
- }, q = ({
44
+ }, h = ({
45
45
  alertId: r,
46
46
  checkin: t,
47
47
  checkout: a,
@@ -51,8 +51,8 @@ const h = ({
51
51
  hotelImage: i,
52
52
  hotelAddress: s,
53
53
  hotelDescription: A,
54
- hotelProgramName: y,
55
- archived: c,
54
+ hotelProgramName: w,
55
+ archived: y,
56
56
  acknowledged: E
57
57
  }) => {
58
58
  if (!r)
@@ -66,27 +66,27 @@ const h = ({
66
66
  i,
67
67
  s,
68
68
  A,
69
+ w,
69
70
  y,
70
- c,
71
71
  E
72
72
  ].some(
73
73
  (m) => m != null && m !== ""
74
74
  ))
75
75
  throw new Error("At least one field must be provided for update");
76
- }, K = () => {
76
+ }, H = () => {
77
77
  const { data: r = [] } = f({
78
78
  queryKey: [u.AVAILABILITY_ALERTS],
79
- queryFn: () => w.getMyActiveAlerts()
79
+ queryFn: () => d.getMyActiveAlerts()
80
80
  }), { data: t = [] } = f({
81
81
  queryKey: [u.ALERT_NOTIFICATIONS],
82
- queryFn: () => w.getAlertNotifications()
82
+ queryFn: () => d.getAlertNotifications()
83
83
  }), {
84
84
  mutate: a,
85
85
  isPending: o,
86
86
  isError: n,
87
87
  error: l
88
88
  } = p({
89
- mutationFn: async (e) => (h(e), await w.createAvailabilityAlert(e)),
89
+ mutationFn: async (e) => (b(e), await d.createAvailabilityAlert(e)),
90
90
  onSuccess: () => {
91
91
  v.invalidateQueries({
92
92
  queryKey: [u.AVAILABILITY_ALERTS]
@@ -96,14 +96,10 @@ const h = ({
96
96
  mutate: i,
97
97
  isPending: s,
98
98
  isError: A,
99
- error: y,
100
- data: c
99
+ error: w,
100
+ data: y
101
101
  } = p({
102
- mutationFn: async (e) => {
103
- q(e);
104
- const d = await w.updateAvailabilityAlert(e);
105
- return b(d);
106
- },
102
+ mutationFn: async (e) => (h(e), d.updateAvailabilityAlert(e)),
107
103
  onSuccess: () => {
108
104
  v.invalidateQueries({
109
105
  queryKey: [u.AVAILABILITY_ALERTS]
@@ -124,14 +120,14 @@ const h = ({
124
120
  updateAvailabilityAlert: i,
125
121
  isUpdateAvailabilityAlertPending: s,
126
122
  isUpdateAvailabilityAlertError: A,
127
- updateAvailabilityAlertError: y,
128
- updatedAvailabilityAlert: c,
123
+ updateAvailabilityAlertError: w,
124
+ updatedAvailabilityAlert: y,
129
125
  // convenience function to update acknowledgment
130
- updateAcknowledgement: (e, d = !0) => i({ alertId: e, acknowledged: d })
126
+ updateAcknowledgement: (e, c = !0) => i({ alertId: e, acknowledged: c })
131
127
  };
132
128
  };
133
129
  export {
134
- K as useAvailabilityAlerts,
135
- h as validateCreateAvailabilityAlert,
136
- q as validateUpdateAvailabilityAlert
130
+ H as useAvailabilityAlerts,
131
+ b as validateCreateAvailabilityAlert,
132
+ h as validateUpdateAvailabilityAlert
137
133
  };
@@ -1,20 +1,21 @@
1
+ import "react/jsx-runtime";
2
+ import { b as C } from "../../index-CJj9N0Xq.js";
1
3
  import "../../moment-BGjjqtLQ.js";
2
4
  import "../../arrayExtensions-CFEBYUok.js";
3
- import { b as C } from "../../index-CJj9N0Xq.js";
4
5
  import "react";
5
6
  import { HotelChains as p } from "../../definitions/HotelChains.js";
6
7
  import { EBestCheckoutType as f } from "../../enums/EBestCheckoutType.js";
7
8
  import { BookingService as y } from "../../services/booking/BookingService.js";
8
9
  import { EGuestType as d } from "../../services/booking/BookingService.enums.js";
9
10
  import { HotelService as h } from "../../services/hotel/HotelService.js";
10
- const G = async (t) => await h.getTransferPartners(
11
+ const I = async (t) => await h.getTransferPartners(
11
12
  p.toProgram(t)
12
- ), I = (t) => !!t.hotelGroup && !!t.hotelId && !!t.checkinDate && !!t.checkoutDate && !!t.rooms && !!t.guests, v = async ({
13
+ ), v = (t) => !!t.hotelGroup && !!t.hotelId && !!t.checkinDate && !!t.checkoutDate && !!t.rooms && !!t.guests, E = async ({
13
14
  hotel: t,
14
15
  checkinDate: o,
15
16
  checkoutDate: n,
16
17
  updateHotel: s,
17
- signal: e
18
+ signal: i
18
19
  }) => {
19
20
  let r = t, c = t.rooms ?? [];
20
21
  if (!t.liveScrapingCheckNeeded || t.hotelGroup === p.Marriott)
@@ -22,7 +23,7 @@ const G = async (t) => await h.getTransferPartners(
22
23
  pointsHotelDetails: t,
23
24
  pointsRooms: c
24
25
  };
25
- let u = !1, i = null;
26
+ let u = !1, e = null;
26
27
  try {
27
28
  const a = await h.hotelPointsCheck(
28
29
  {
@@ -31,78 +32,78 @@ const G = async (t) => await h.getTransferPartners(
31
32
  checkinDate: o,
32
33
  checkoutDate: n
33
34
  },
34
- e
35
+ i
35
36
  );
36
- u = a.success, i = a.data;
37
+ u = a.success, e = a.data;
37
38
  } catch {
38
- u = !1, i = null;
39
+ u = !1, e = null;
39
40
  }
40
41
  if (u) {
41
- const a = i, m = !(a.points.pointsValue > 0) && t.bestValue === f.POINTS;
42
+ const a = e, l = !(a.points.pointsValue > 0) && t.bestValue === f.POINTS;
42
43
  r = {
43
44
  ...t,
44
45
  awardPoints: a.points.awardPointsValue ?? a.points.pointsValue,
45
46
  points: a.points.pointsValue,
46
47
  pointsType: a.points.pointsType,
47
- bestValue: m ? f.NONE : t.bestValue
48
+ bestValue: l ? f.NONE : t.bestValue
48
49
  }, c = a.rooms ?? t.rooms ?? [], s(t.hotelId, t.hotelGroup, r);
49
50
  }
50
51
  return {
51
52
  pointsHotelDetails: r,
52
53
  pointsRooms: c
53
54
  };
54
- }, E = async ({
55
+ }, U = async ({
55
56
  hotel: t,
56
57
  checkinDate: o,
57
58
  checkoutDate: n,
58
59
  guests: s,
59
- rooms: e,
60
+ rooms: i,
60
61
  updateHotel: r,
61
62
  numberOfNights: c
62
63
  }) => {
63
- var l;
64
- if (!((l = t == null ? void 0 : t.cashBookingOffers) != null && l.accommodationId))
64
+ var m;
65
+ if (!((m = t == null ? void 0 : t.cashBookingOffers) != null && m.accommodationId))
65
66
  return {
66
67
  cashHotelDetails: t,
67
68
  cashRooms: []
68
69
  };
69
- const u = (m) => Array.from({ length: m }, () => ({ type: d.ADULT })), i = await y.getAvailableRooms({
70
+ const u = (l) => Array.from({ length: l }, () => ({ type: d.ADULT })), e = await y.getAvailableRooms({
70
71
  checkinDate: o,
71
72
  checkoutDate: n,
72
73
  accommodationId: t.cashBookingOffers.accommodationId,
73
74
  guests: u(s),
74
- rooms: e
75
+ rooms: i
75
76
  }), a = {
76
77
  ...t,
77
78
  cashValue: {
78
79
  ...t.cashValue,
79
- amount: i.cheapestRate / c || t.cashValue.amount || 0,
80
- currency: i.currency ?? t.cashValue.currency
80
+ amount: e.cheapestRate / c || t.cashValue.amount || 0,
81
+ currency: e.currency ?? t.cashValue.currency
81
82
  },
82
- ...i.accommodation
83
+ ...e.accommodation
83
84
  };
84
85
  return r(t.hotelId, t.hotelGroup, a), {
85
86
  cashHotelDetails: a,
86
- cashRooms: i.availableRooms
87
+ cashRooms: e.availableRooms
87
88
  };
88
- }, U = async (t, o, n) => {
89
- const { success: s, data: e } = await h.getRecommendations({
89
+ }, O = async (t, o, n) => {
90
+ const { success: s, data: i } = await h.getRecommendations({
90
91
  days: o,
91
92
  hotel: t
92
93
  });
93
- return s && e ? {
94
+ return s && i ? {
94
95
  bestCheckout: {
95
- ...e,
96
- nightlyPointsCost: n ? e.awardPoints : e.nightlyPointsCost
96
+ ...i,
97
+ nightlyPointsCost: n ? i.awardPoints : i.nightlyPointsCost
97
98
  },
98
- isAvailable: e.nightlyPointsCost > 0 || e.nightlyCashCost > 0
99
+ isAvailable: i.nightlyPointsCost > 0 || i.nightlyCashCost > 0
99
100
  } : {
100
101
  bestCheckout: P(t, o),
101
102
  isAvailable: !1
102
103
  };
103
104
  }, P = (t, o) => {
104
- var r, c, u, i;
105
- const n = ((r = t.cashBookingOffers) == null ? void 0 : r.cheapestRateTotalAmount) ?? ((c = t.cashValue) == null ? void 0 : c.amount) ?? 0, s = ((u = t.cashBookingOffers) == null ? void 0 : u.cheapestRateCurrency) ?? ((i = t.cashValue) == null ? void 0 : i.currency) ?? C;
105
+ var r, c, u, e;
106
+ const n = ((r = t.cashBookingOffers) == null ? void 0 : r.cheapestRateTotalAmount) ?? ((c = t.cashValue) == null ? void 0 : c.amount) ?? 0, s = ((u = t.cashBookingOffers) == null ? void 0 : u.cheapestRateCurrency) ?? ((e = t.cashValue) == null ? void 0 : e.currency) ?? C;
106
107
  return {
107
108
  bestCheckoutMethod: p.isHotelChain(t.hotelGroup) ? t.bestValue : f.CASH,
108
109
  nightlyCashCost: n,
@@ -119,7 +120,7 @@ const G = async (t) => await h.getTransferPartners(
119
120
  totalProgramPointsValuation: 0
120
121
  }
121
122
  };
122
- }, O = (t, o, n) => {
123
+ }, H = (t, o, n) => {
123
124
  let s = t;
124
125
  return o && (s = {
125
126
  ...t,
@@ -133,11 +134,11 @@ const G = async (t) => await h.getTransferPartners(
133
134
  }), s;
134
135
  };
135
136
  export {
136
- O as combineUpdatedHotelData,
137
+ H as combineUpdatedHotelData,
137
138
  P as fallbackBestCheckout,
138
- E as fetchAvailableRooms,
139
- U as fetchBestCheckout,
140
- v as fetchPointsCheck,
141
- G as fetchTransferPartners,
142
- I as isPartialHotelDetails
139
+ U as fetchAvailableRooms,
140
+ O as fetchBestCheckout,
141
+ E as fetchPointsCheck,
142
+ I as fetchTransferPartners,
143
+ v as isPartialHotelDetails
143
144
  };
@@ -1,5 +1,6 @@
1
- import { g as oe } from "../../dateUtils-C1hKW8MF.js";
2
- import { b as ae } from "../../index-CJj9N0Xq.js";
1
+ import "react/jsx-runtime";
2
+ import { b as oe } from "../../index-CJj9N0Xq.js";
3
+ import { g as ae } from "../../dateUtils-C1hKW8MF.js";
3
4
  import { E as N } from "../../DateFormats-DZD30Nea.js";
4
5
  import "../../arrayExtensions-CFEBYUok.js";
5
6
  import { useState as ce, useMemo as D } from "react";
@@ -14,7 +15,7 @@ import { IhgFreeNightCards as de } from "../../definitions/IhgFreeNightCards.js"
14
15
  import { HotelService as pe } from "../../services/hotel/HotelService.js";
15
16
  import { calculatePointsAsCash as ge } from "../../utilities/pointsAsCashUtils.js";
16
17
  import { isDuffelHotelId as ye } from "../../utilities/hotelUtils/hotelUtils.js";
17
- const Ee = (a) => {
18
+ const Ne = (a) => {
18
19
  var H, R, O, q, A, S, G, _, B, w, K, P, E;
19
20
  if (!a)
20
21
  throw new Error(
@@ -48,7 +49,7 @@ const Ee = (a) => {
48
49
  ),
49
50
  guests: a.guests,
50
51
  rooms: a.rooms,
51
- currency: ((c = f == null ? void 0 : f.userRegion) == null ? void 0 : c.currency) || ae,
52
+ currency: ((c = f == null ? void 0 : f.userRegion) == null ? void 0 : c.currency) || oe,
52
53
  cash_or_points: ["cash", "points"],
53
54
  use_duffel: m == null ? void 0 : m.supportsDuffel
54
55
  });
@@ -58,7 +59,7 @@ const Ee = (a) => {
58
59
  }), t = D(() => {
59
60
  var c;
60
61
  return s ? i != null && i.success && ((c = i.data) != null && c[0]) ? i.data[0] : {} : a;
61
- }, [s, i, a]), h = D(() => oe(e.checkinDate, e.checkoutDate), [e]), I = (c, l) => {
62
+ }, [s, i, a]), h = D(() => ae(e.checkinDate, e.checkoutDate), [e]), I = (c, l) => {
62
63
  U({
63
64
  checkinDate: n(c),
64
65
  checkoutDate: n(l)
@@ -203,5 +204,5 @@ const Ee = (a) => {
203
204
  };
204
205
  };
205
206
  export {
206
- Ee as useHotelDetails
207
+ Ne as useHotelDetails
207
208
  };
@@ -1,7 +1,8 @@
1
1
  import { useAwayzContext as x, useWallet as P, awayzClient as f } from "@odynn/awayz-core";
2
2
  import { useMutation as k } from "@tanstack/react-query";
3
- import { g as D } from "../../dateUtils-C1hKW8MF.js";
4
- import { D as R, a as y } from "../../index-CJj9N0Xq.js";
3
+ import "react/jsx-runtime";
4
+ import { D as R, a as D } from "../../index-CJj9N0Xq.js";
5
+ import { g as y } from "../../dateUtils-C1hKW8MF.js";
5
6
  import { E as _ } from "../../enums-DPFgYLjY.js";
6
7
  import "../../arrayExtensions-CFEBYUok.js";
7
8
  import { useEffect as K } from "react";
@@ -36,7 +37,7 @@ const O = (t) => {
36
37
  throw new Error(
37
38
  `Invalid hotel group: ${t.hotelGroup}. Please use one of the following: ${a.toList().join(", ")}`
38
39
  );
39
- }, oe = () => {
40
+ }, re = () => {
40
41
  const { setHotels: t, hotels: s, setSearchParams: p } = S(), { config: c, featureFlags: m } = x(), { userCards: h } = P(), {
41
42
  mutate: H,
42
43
  isPending: v,
@@ -57,7 +58,7 @@ const O = (t) => {
57
58
  guests: e.guests || 2,
58
59
  rooms: e.rooms || 1,
59
60
  cash_or_points: e.cashOrPoints || ["cash", "points"],
60
- region_code: e.userRegion || y,
61
+ region_code: e.userRegion || D,
61
62
  lat: e.coordinates.latitude,
62
63
  lon: e.coordinates.longitude,
63
64
  search_range: e.searchRange || 10,
@@ -76,7 +77,7 @@ const O = (t) => {
76
77
  },
77
78
  onSuccess: (e) => {
78
79
  if (e.success) {
79
- const { checkinDate: o, checkoutDate: r, searchCoordinates: i } = e, u = D(o, r), n = e.data.map((l) => ({
80
+ const { checkinDate: o, checkoutDate: r, searchCoordinates: i } = e, u = y(o, r), n = e.data.map((l) => ({
80
81
  ...l,
81
82
  distance: I(
82
83
  i.latitude,
@@ -126,7 +127,7 @@ const O = (t) => {
126
127
  guests: e.guests || 2,
127
128
  rooms: e.rooms || 1,
128
129
  cash_or_points: e.cashOrPoints || ["cash", "points"],
129
- region_code: e.userRegion || y,
130
+ region_code: e.userRegion || D,
130
131
  lat: e.coordinates.latitude,
131
132
  lon: e.coordinates.longitude,
132
133
  search_range: 0.5,
@@ -162,7 +163,7 @@ const O = (t) => {
162
163
  if (!s.length || !h) return;
163
164
  const { searchParams: e } = S.getState();
164
165
  if (!(e != null && e.checkinDate) || !(e != null && e.checkoutDate)) return;
165
- const o = D(
166
+ const o = y(
166
167
  e.checkinDate,
167
168
  e.checkoutDate
168
169
  ), r = s.map((i) => ({
@@ -186,7 +187,7 @@ const O = (t) => {
186
187
  };
187
188
  };
188
189
  export {
189
- oe as useHotelSearch,
190
+ re as useHotelSearch,
190
191
  O as validateSearchByCoordsArgs,
191
192
  $ as validateSearchByHotelIdArgs
192
193
  };
@@ -1,36 +1,37 @@
1
1
  import { useQuery as u } from "@tanstack/react-query";
2
2
  import { HotelService as l } from "../../services/hotel/HotelService.js";
3
+ import "react/jsx-runtime";
3
4
  import "../../moment-BGjjqtLQ.js";
4
5
  import "../../arrayExtensions-CFEBYUok.js";
5
6
  import { E as d } from "../../enums-DPFgYLjY.js";
6
- import { useState as f, useEffect as L } from "react";
7
- import { defaultSimilarityThreshold as p, defaultLocationSortOrder as y, duffelTestHotelLocation as T } from "../../configs/defaults.js";
7
+ import { useState as f, useEffect as p } from "react";
8
+ import { defaultSimilarityThreshold as L, defaultLocationSortOrder as y, duffelTestHotelLocation as T } from "../../configs/defaults.js";
8
9
  import { sortLocationResults as E } from "../../utilities/hotelUtils/hotelUtils.js";
9
10
  import { useAwayzContext as S } from "@odynn/awayz-core";
10
11
  const D = 500, O = (t, e = D) => {
11
- const [s, r] = f(t);
12
- return L(() => {
12
+ const [r, s] = f(t);
13
+ return p(() => {
13
14
  const o = setTimeout(() => {
14
- r(t);
15
+ s(t);
15
16
  }, e);
16
17
  return () => {
17
18
  clearTimeout(o);
18
19
  };
19
- }, [t, e]), s;
20
- }, _ = (t, e = p, s = y) => {
21
- const r = O(t), { config: o } = S(), { data: i, isLoading: n } = u({
22
- queryKey: [d.LOCATIONS, r],
20
+ }, [t, e]), r;
21
+ }, b = (t, e = L, r = y) => {
22
+ const s = O(t), { config: o } = S(), { data: i, isLoading: n } = u({
23
+ queryKey: [d.LOCATIONS, s],
23
24
  queryFn: () => l.getLocations(t),
24
25
  enabled: !!t
25
26
  // Only run the query if searchInput is not empty
26
- }), c = (i == null ? void 0 : i.data) || [];
27
+ }), m = (i == null ? void 0 : i.data) || [];
27
28
  let a = E(
28
29
  t,
29
30
  e,
30
- s,
31
- c
31
+ r,
32
+ m
32
33
  ).map(
33
- ({ score: x, startsWithText: A, ...m }) => m
34
+ ({ score: x, startsWithText: A, ...c }) => c
34
35
  );
35
36
  return o != null && o.testMode && (o != null && o.supportsDuffel) && (a = [
36
37
  T,
@@ -41,5 +42,5 @@ const D = 500, O = (t, e = D) => {
41
42
  };
42
43
  };
43
44
  export {
44
- _ as useLocationSearch
45
+ b as useLocationSearch
45
46
  };
@@ -3,7 +3,7 @@ import { IHotelDetails } from '../../components/HotelResult/HotelResult.types';
3
3
  import { IRoom } from '../../services/booking/BookingService.types';
4
4
  import { IPointsAsCash } from '../../utilities/pointsAsCashUtils';
5
5
  import { IBestCheckout } from './useHotelDetails.types';
6
- export declare const fetchTransferPartners: (hotelGroup: string) => Promise<import('@type-op/shared').ITransferPartner[]>;
6
+ export declare const fetchTransferPartners: (hotelGroup: string) => Promise<any>;
7
7
  interface IPointsCheckResult {
8
8
  pointsHotelDetails: IHotelDetails;
9
9
  pointsRooms: IRoom[];
@@ -1,7 +1,7 @@
1
1
  import { IPartialHotelDetails } from './useHotelDetails.api';
2
2
  import { IHotelDetails } from '../../components/HotelResult/HotelResult.types';
3
3
  export declare const useHotelDetails: (hotelInput: IHotelDetails | IPartialHotelDetails) => {
4
- transferPartners: import('@type-op/shared').ITransferPartner[];
4
+ transferPartners: any;
5
5
  loadingTransferPartners: boolean;
6
6
  loadingHotelDetails: boolean;
7
7
  pointsRooms: import('../../main').IRoom[];
@@ -1,9 +1,9 @@
1
- import { IAvailabilityAlert, IAvailabilityAlertNotification, ICreateAvailabilityAlertRequest, IUpdateAvailabilityAlertRequest } from '../../hooks/useAvailabilityAlerts/useAvailabilityAlerts.types';
2
- import { IAvailabilityAlertResponse, ICreateAlertResponse } from './AvailabilityAlertsService.types';
1
+ import { IAvailabilityAlert, IAvailabilityAlertNotification, ICreateAvailabilityAlertRequest, IUpdateAvailabilityAlertRequest, IUpdateAvailabilityAlertResponse } from '../../hooks/useAvailabilityAlerts/useAvailabilityAlerts.types';
2
+ import { ICreateAlertResponse } from './AvailabilityAlertsService.types';
3
3
  declare class _AvailabilityAlertsService {
4
4
  getMyActiveAlerts: () => Promise<IAvailabilityAlert[]>;
5
5
  createAvailabilityAlert: (request: ICreateAvailabilityAlertRequest) => Promise<ICreateAlertResponse>;
6
- updateAvailabilityAlert: (request: IUpdateAvailabilityAlertRequest) => Promise<IAvailabilityAlertResponse>;
6
+ updateAvailabilityAlert: (request: IUpdateAvailabilityAlertRequest) => Promise<IUpdateAvailabilityAlertResponse>;
7
7
  getAlertNotifications: () => Promise<IAvailabilityAlertNotification[]>;
8
8
  }
9
9
  export declare const AvailabilityAlertsService: _AvailabilityAlertsService;
@@ -1,4 +1,4 @@
1
- import { IAccommodation, IGetAvailableRoomsProps, IRoom } from './BookingService.types';
1
+ import { IGetAvailableRoomsProps, IRoom } from './BookingService.types';
2
2
  export declare enum EBookingType {
3
3
  Hotel = "awayz_hotel_booking_id",
4
4
  Flight = "awayz_flight_booking_id",
@@ -9,7 +9,7 @@ declare class _BookingService {
9
9
  cheapestRate: number;
10
10
  currency: string;
11
11
  availableRooms: IRoom[];
12
- accommodation: IAccommodation;
12
+ accommodation: import('./BookingService.types').IAccommodation;
13
13
  }>;
14
14
  }
15
15
  export declare const BookingService: _BookingService;
@@ -0,0 +1,14 @@
1
+ import { IAccommodation, IAccommodationResponse, IRate, IRateResponse, IRoom, IRoomResponse } from './BookingService.types';
2
+ /**
3
+ * Map Duffel API rate response to IRate.
4
+ */
5
+ export declare const mapRateResponse: (rate: IRateResponse) => IRate;
6
+ /**
7
+ * Map Duffel API room response to IRoom.
8
+ * Note: Duffel rooms have a simpler structure than hotel search rooms.
9
+ */
10
+ export declare const mapRoomResponse: (room: IRoomResponse) => IRoom;
11
+ /**
12
+ * Map Duffel API accommodation response to IAccommodation.
13
+ */
14
+ export declare const mapAccommodationResponse: (acc: IAccommodationResponse) => IAccommodation;
@@ -19,7 +19,7 @@ export interface IAccommodationSearchResponse {
19
19
  check_in_date: string;
20
20
  id: string;
21
21
  }
22
- interface IAccommodationResponse {
22
+ export interface IAccommodationResponse {
23
23
  check_in_information: ICheckInInformationResponse;
24
24
  supported_loyalty_programme: string;
25
25
  review_score: number;
@@ -43,20 +43,20 @@ interface ICheckInInformationResponse {
43
43
  check_in_before_time: string;
44
44
  check_in_after_time: string;
45
45
  }
46
- interface IRoomResponse {
46
+ export interface IRoomResponse {
47
47
  beds: IBed[];
48
48
  photos: IPhoto[];
49
49
  rates: IRateResponse[];
50
50
  name: string;
51
51
  }
52
- interface IRateResponse {
52
+ export interface IRateResponse {
53
53
  public_currency: string;
54
54
  due_at_accommodation_currency: string;
55
55
  due_at_accommodation_amount: number | null;
56
56
  quantity_available: number;
57
57
  public_amount: number | null;
58
58
  deal_types: string | null;
59
- cancellation_timeline: string[];
59
+ cancellation_timeline: ICancellationTimelineResponse[];
60
60
  board_type: ERoomBoardType;
61
61
  supported_loyalty_programme: string | null;
62
62
  available_payment_methods: string[];
@@ -73,7 +73,12 @@ interface IRateResponse {
73
73
  source: string;
74
74
  id: string;
75
75
  }
76
- interface ILocationResponse {
76
+ interface ICancellationTimelineResponse {
77
+ before: string;
78
+ currency: string;
79
+ refund_amount: string | number;
80
+ }
81
+ export interface ILocationResponse {
77
82
  geographic_coordinates: ICoordinates;
78
83
  address: IAddressResponse;
79
84
  }
@@ -204,6 +209,6 @@ interface IAddress {
204
209
  interface ICancellationTimeline {
205
210
  before: string;
206
211
  currency: string;
207
- refundAmount: string;
212
+ refundAmount: number;
208
213
  }
209
214
  export {};
@@ -1,15 +1,15 @@
1
- import { ITransferPartner, TServiceResponse } from '@type-op/shared';
2
- import { IHotelDetails, ILiveHotelCheck } from '../../components/HotelResult/HotelResult.types';
1
+ import { TServiceResponse } from '@type-op/shared';
2
+ import { IHotelDetails } from '../../components/HotelResult/HotelResult.types';
3
3
  import { IBestCheckout } from '../../hooks/useHotelDetails/useHotelDetails.types';
4
4
  import { IHotelPointsCheckArgs, ISearchByHotelIdRequest, ISearchHotelsParams, ISearchLocation } from './HotelService.types';
5
5
  declare class _HotelService {
6
6
  getLocations: (searchInputQuery: string) => Promise<TServiceResponse<ISearchLocation[]>>;
7
7
  searchByCoords: (request: ISearchHotelsParams) => Promise<TServiceResponse<IHotelDetails[]>>;
8
8
  searchByHotelId: (request: ISearchByHotelIdRequest) => Promise<TServiceResponse<IHotelDetails[]>>;
9
- getTransferPartners: (program: string) => Promise<ITransferPartner[]>;
9
+ getTransferPartners: (program: string) => Promise<any>;
10
10
  hotelPointsCheck: (args: IHotelPointsCheckArgs, signal?: AbortSignal) => Promise<{
11
11
  success: any;
12
- data: ILiveHotelCheck | null;
12
+ data: import('../../components/HotelResult/HotelResult.types').ILiveHotelCheck | null;
13
13
  message?: undefined;
14
14
  } | {
15
15
  success: boolean;