@odynn/awayz-hotels 0.1.12 → 0.1.13

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.
@@ -0,0 +1,10 @@
1
+ function c(e) {
2
+ return e = e.replace(/^_+/, ""), e.replace(/_([a-z])/g, (r, a) => a.toUpperCase());
3
+ }
4
+ const t = (e) => Array.isArray(e) ? e.map((r) => t(r)) : typeof e == "object" && e !== null ? Object.keys(e).reduce((r, a) => {
5
+ const n = c(a);
6
+ return r[n] = t(e[a]), r;
7
+ }, {}) : e;
8
+ export {
9
+ t as c
10
+ };
@@ -1,36 +1,34 @@
1
- var p = Object.defineProperty;
2
- var f = (t, e, a) => e in t ? p(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
3
- var s = (t, e, a) => f(t, typeof e != "symbol" ? e + "" : e, a);
4
- import "react/jsx-runtime";
5
- import "react";
6
- import { N as d, c as h } from "../../awayzClient-Cu1oxd-l.js";
7
- import "@tanstack/react-query";
8
- import { EDuffelEndpoints as u } from "../../configs/endpoints.js";
1
+ var f = Object.defineProperty;
2
+ var p = (t, e, a) => e in t ? f(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
3
+ var c = (t, e, a) => p(t, typeof e != "symbol" ? e + "" : e, a);
4
+ import { clientInstance as d } from "@odynn/awayz-auth";
5
+ import { EDuffelEndpoints as h } from "../../configs/endpoints.js";
9
6
  import "../../moment-BGjjqtLQ.js";
10
7
  import "../../arrayExtensions-cyilNkdJ.js";
11
- import { E as c } from "../../DateFormats-DZD30Nea.js";
8
+ import { c as u } from "../../objectUtils-CyIaVmog.js";
9
+ import { E as s } from "../../DateFormats-DZD30Nea.js";
12
10
  var v = /* @__PURE__ */ ((t) => (t.Hotel = "awayz_hotel_booking_id", t.Flight = "awayz_flight_booking_id", t.Offer = "flight_offer_id", t))(v || {});
13
11
  class g {
14
12
  constructor() {
15
- s(this, "getAvailableRooms", async ({
13
+ c(this, "getAvailableRooms", async ({
16
14
  checkinDate: e,
17
15
  checkoutDate: a,
18
16
  accommodationId: i,
19
- rooms: m,
20
- guests: n
17
+ rooms: n,
18
+ guests: m
21
19
  }) => {
22
20
  try {
23
21
  const { data: o } = await d.post(
24
- u.AVAILABLE_ROOMS,
22
+ h.AVAILABLE_ROOMS,
25
23
  {
26
- check_in_date: e.format(c.ServerDate),
27
- check_out_date: a.format(c.ServerDate),
24
+ check_in_date: e.format(s.ServerDate),
25
+ check_out_date: a.format(s.ServerDate),
28
26
  accommodation_ids: [i],
29
- rooms: m,
30
- guests: n
27
+ rooms: n,
28
+ guests: m
31
29
  }
32
30
  ), r = o.data.results.getFirst(), _ = r.accommodation.rooms.map(
33
- (l) => h(l)
31
+ (l) => u(l)
34
32
  );
35
33
  return {
36
34
  cheapestRate: parseFloat(r.cheapest_rate_total_amount),
@@ -46,8 +44,8 @@ class g {
46
44
  });
47
45
  }
48
46
  }
49
- const E = new g();
47
+ const D = new g();
50
48
  export {
51
- E as BookingService,
49
+ D as BookingService,
52
50
  v as EBookingType
53
51
  };
@@ -5,20 +5,18 @@ import { ESearchType as C } from "./HotelService.types.js";
5
5
  import { s as T } from "../../stringUtils-CvWpky85.js";
6
6
  import "../../moment-BGjjqtLQ.js";
7
7
  import "../../arrayExtensions-cyilNkdJ.js";
8
- import { N as i, c as h } from "../../awayzClient-Cu1oxd-l.js";
9
- import { E as m } from "../../DateFormats-DZD30Nea.js";
10
- import { EHotelEndpoints as u } from "../../configs/endpoints.js";
11
- import "react/jsx-runtime";
12
- import "react";
13
- import "@tanstack/react-query";
14
- import { EBestCheckoutType as p } from "../../enums/EBestCheckoutType.js";
8
+ import { c as h } from "../../objectUtils-CyIaVmog.js";
9
+ import { E as l } from "../../DateFormats-DZD30Nea.js";
10
+ import { EHotelEndpoints as i } from "../../configs/endpoints.js";
11
+ import { clientInstance as u } from "@odynn/awayz-auth";
12
+ import { EBestCheckoutType as m } from "../../enums/EBestCheckoutType.js";
15
13
  import { EBestValueType as S } from "../../enums/EBestValueType.js";
16
14
  class H {
17
15
  constructor() {
18
16
  r(this, "getLocations", async (a) => {
19
17
  try {
20
- const { data: e } = await i.get(
21
- u.GET_LOCATIONS,
18
+ const { data: e } = await u.get(
19
+ i.GET_LOCATIONS,
22
20
  {
23
21
  params: {
24
22
  search: T(a)
@@ -35,8 +33,8 @@ class H {
35
33
  success: !0,
36
34
  data: e.data.cities.map(
37
35
  (o) => {
38
- const { searchId: l, searchType: _, description: d, coordinates: g, city: y } = o, n = {
39
- searchId: l,
36
+ const { searchId: p, searchType: _, description: d, coordinates: g, city: y } = o, n = {
37
+ searchId: p,
40
38
  searchType: _,
41
39
  description: d,
42
40
  coordinates: g,
@@ -61,7 +59,7 @@ class H {
61
59
  r(this, "searchByCoords", async (a) => {
62
60
  var e, t;
63
61
  try {
64
- const { data: s } = await i.post(u.SEARCH_HOTELS, {
62
+ const { data: s } = await u.post(i.SEARCH_HOTELS, {
65
63
  ...a,
66
64
  use_duffel: !0
67
65
  });
@@ -84,7 +82,7 @@ class H {
84
82
  r(this, "searchByHotelId", async (a) => {
85
83
  var e, t;
86
84
  try {
87
- const { data: s } = await i.post(u.GET_HOTEL_DATA, {
85
+ const { data: s } = await u.post(i.GET_HOTEL_DATA, {
88
86
  ...a,
89
87
  use_duffel: !0
90
88
  });
@@ -106,8 +104,8 @@ class H {
106
104
  });
107
105
  r(this, "getTransferPartners", async (a) => {
108
106
  try {
109
- const { data: e } = await i.get(
110
- u.GET_TRANSFER_PARTNERS,
107
+ const { data: e } = await u.get(
108
+ i.GET_TRANSFER_PARTNERS,
111
109
  {
112
110
  params: {
113
111
  program: a
@@ -123,18 +121,18 @@ class H {
123
121
  const e = {
124
122
  hotel_group: a.hotelGroup,
125
123
  hotel_id: a.hotelId,
126
- check_in_date: a.checkinDate.format(m.ServerDate),
127
- check_out_date: a.checkoutDate.format(m.ServerDate)
128
- }, { data: t } = await i.post(
129
- u.HOTEL_POINTS_CHECK,
124
+ check_in_date: a.checkinDate.format(l.ServerDate),
125
+ check_out_date: a.checkoutDate.format(l.ServerDate)
126
+ }, { data: t } = await u.post(
127
+ i.HOTEL_POINTS_CHECK,
130
128
  e
131
129
  );
132
130
  return t;
133
131
  });
134
132
  r(this, "getRecommendations", async (a) => {
135
133
  try {
136
- const { data: e } = await i.post(
137
- u.GET_BEST_CHECKOUT,
134
+ const { data: e } = await u.post(
135
+ i.GET_BEST_CHECKOUT,
138
136
  {
139
137
  hotels: a.hotels.map((o) => ({
140
138
  hotel_id: o.hotelId,
@@ -159,7 +157,7 @@ class H {
159
157
  sufficientPoints: t.user_has_sufficient_points,
160
158
  awardPoints: t.award_points,
161
159
  rewardsProgram: t.hotel_rewards_program,
162
- bestCheckoutMethod: t.best_user_checkout_method === S.CASH ? p.CASH : p.POINTS,
160
+ bestCheckoutMethod: t.best_user_checkout_method === S.CASH ? m.CASH : m.POINTS,
163
161
  optimalProgram: {
164
162
  remainingPointsBalance: t.optimal_user_program_checkout.primary_offer_remaining_points_balance,
165
163
  programs: t.optimal_user_program_checkout.programs.map(
@@ -182,7 +180,7 @@ class H {
182
180
  });
183
181
  }
184
182
  }
185
- const b = new H();
183
+ const G = new H();
186
184
  export {
187
- b as HotelService
185
+ G as HotelService
188
186
  };
@@ -2,13 +2,11 @@ var d = Object.defineProperty;
2
2
  var p = (e, r, t) => r in e ? d(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
3
  var s = (e, r, t) => p(e, typeof r != "symbol" ? r + "" : r, t);
4
4
  import { ERewardProgramCategories as o } from "./WalletService.types.js";
5
- import "react/jsx-runtime";
6
- import "react";
7
- import { N as i, c as a } from "../../awayzClient-Cu1oxd-l.js";
8
- import "@tanstack/react-query";
9
- import { EWalletEndpoints as n } from "../../configs/endpoints.js";
5
+ import { clientInstance as n } from "@odynn/awayz-auth";
6
+ import { EWalletEndpoints as i } from "../../configs/endpoints.js";
10
7
  import "../../moment-BGjjqtLQ.js";
11
8
  import "../../arrayExtensions-cyilNkdJ.js";
9
+ import { c as a } from "../../objectUtils-CyIaVmog.js";
12
10
  class u {
13
11
  constructor() {
14
12
  s(this, "getAwards", async () => {
@@ -22,7 +20,7 @@ class u {
22
20
  { data: c }
23
21
  ] = await Promise.all(
24
22
  r.map(
25
- (m) => i.get(n.GET_AWARDS, {
23
+ (m) => n.get(i.GET_AWARDS, {
26
24
  params: { category: m }
27
25
  })
28
26
  )
@@ -35,8 +33,8 @@ class u {
35
33
  });
36
34
  s(this, "getUserCards", async () => {
37
35
  try {
38
- const { data: r } = await i.get(
39
- n.GET_USER_CARDS
36
+ const { data: r } = await n.get(
37
+ i.GET_USER_CARDS
40
38
  );
41
39
  return a(r == null ? void 0 : r.data) ?? [];
42
40
  } catch (r) {
@@ -45,7 +43,7 @@ class u {
45
43
  });
46
44
  }
47
45
  }
48
- const _ = new u();
46
+ const A = new u();
49
47
  export {
50
- _ as WalletService
48
+ A as WalletService
51
49
  };
@@ -1,11 +1,8 @@
1
- import "react/jsx-runtime";
2
- import "react";
3
- import { i as u } from "../awayzClient-Cu1oxd-l.js";
4
- import "@tanstack/react-query";
1
+ import { awayzClient as u } from "@odynn/awayz-auth";
5
2
  import { pointsAsCashCards as c } from "../definitions/PointsAsCashCards.js";
6
3
  import { WalletService as l } from "../services/wallet/WalletService.js";
7
- const P = async (n) => {
8
- const e = await m();
4
+ const A = async (n) => {
5
+ const e = await f();
9
6
  if (!e)
10
7
  return { pointsAsCash: 0, totalPointsUsed: 0, card: null, cashRequired: n };
11
8
  const { banks: s } = await u.ensureQueryData({
@@ -18,7 +15,7 @@ const P = async (n) => {
18
15
  return;
19
16
  let d = i.totalAccumulatedPoints, r = d * e.transferRatio;
20
17
  return r > n && (d = n / e.transferRatio, r = n), { pointsAsCash: r, totalPointsUsed: d, card: e, cashRequired: n };
21
- }, m = async () => {
18
+ }, f = async () => {
22
19
  const { banks: n } = await u.ensureQueryData({
23
20
  queryKey: ["walletAwards"],
24
21
  queryFn: l.getAwards
@@ -55,6 +52,6 @@ const P = async (n) => {
55
52
  )).card : r[0].card;
56
53
  };
57
54
  export {
58
- P as calculatePointsAsCash,
59
- m as getBestCard
55
+ A as calculatePointsAsCash,
56
+ f as getBestCard
60
57
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@odynn/awayz-hotels",
3
3
  "private": false,
4
- "version": "0.1.12",
4
+ "version": "0.1.13",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"