@odynn/awayz-hotels 0.1.11 → 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.
@@ -5,19 +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-Bs2isDLP.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 { 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";
14
13
  import { EBestValueType as S } from "../../enums/EBestValueType.js";
15
14
  class H {
16
15
  constructor() {
17
16
  r(this, "getLocations", async (a) => {
18
17
  try {
19
- const { data: e } = await i.get(
20
- u.GET_LOCATIONS,
18
+ const { data: e } = await u.get(
19
+ i.GET_LOCATIONS,
21
20
  {
22
21
  params: {
23
22
  search: T(a)
@@ -34,8 +33,8 @@ class H {
34
33
  success: !0,
35
34
  data: e.data.cities.map(
36
35
  (o) => {
37
- const { searchId: l, searchType: _, description: d, coordinates: g, city: y } = o, n = {
38
- searchId: l,
36
+ const { searchId: p, searchType: _, description: d, coordinates: g, city: y } = o, n = {
37
+ searchId: p,
39
38
  searchType: _,
40
39
  description: d,
41
40
  coordinates: g,
@@ -60,7 +59,7 @@ class H {
60
59
  r(this, "searchByCoords", async (a) => {
61
60
  var e, t;
62
61
  try {
63
- const { data: s } = await i.post(u.SEARCH_HOTELS, {
62
+ const { data: s } = await u.post(i.SEARCH_HOTELS, {
64
63
  ...a,
65
64
  use_duffel: !0
66
65
  });
@@ -83,7 +82,7 @@ class H {
83
82
  r(this, "searchByHotelId", async (a) => {
84
83
  var e, t;
85
84
  try {
86
- const { data: s } = await i.post(u.GET_HOTEL_DATA, {
85
+ const { data: s } = await u.post(i.GET_HOTEL_DATA, {
87
86
  ...a,
88
87
  use_duffel: !0
89
88
  });
@@ -105,8 +104,8 @@ class H {
105
104
  });
106
105
  r(this, "getTransferPartners", async (a) => {
107
106
  try {
108
- const { data: e } = await i.get(
109
- u.GET_TRANSFER_PARTNERS,
107
+ const { data: e } = await u.get(
108
+ i.GET_TRANSFER_PARTNERS,
110
109
  {
111
110
  params: {
112
111
  program: a
@@ -122,18 +121,18 @@ class H {
122
121
  const e = {
123
122
  hotel_group: a.hotelGroup,
124
123
  hotel_id: a.hotelId,
125
- check_in_date: a.checkinDate.format(m.ServerDate),
126
- check_out_date: a.checkoutDate.format(m.ServerDate)
127
- }, { data: t } = await i.post(
128
- 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,
129
128
  e
130
129
  );
131
130
  return t;
132
131
  });
133
132
  r(this, "getRecommendations", async (a) => {
134
133
  try {
135
- const { data: e } = await i.post(
136
- u.GET_BEST_CHECKOUT,
134
+ const { data: e } = await u.post(
135
+ i.GET_BEST_CHECKOUT,
137
136
  {
138
137
  hotels: a.hotels.map((o) => ({
139
138
  hotel_id: o.hotelId,
@@ -158,7 +157,7 @@ class H {
158
157
  sufficientPoints: t.user_has_sufficient_points,
159
158
  awardPoints: t.award_points,
160
159
  rewardsProgram: t.hotel_rewards_program,
161
- 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,
162
161
  optimalProgram: {
163
162
  remainingPointsBalance: t.optimal_user_program_checkout.primary_offer_remaining_points_balance,
164
163
  programs: t.optimal_user_program_checkout.programs.map(
@@ -181,7 +180,7 @@ class H {
181
180
  });
182
181
  }
183
182
  }
184
- const L = new H();
183
+ const G = new H();
185
184
  export {
186
- L as HotelService
185
+ G as HotelService
187
186
  };
@@ -2,12 +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 n, c as a } from "../../awayzClient-Bs2isDLP.js";
5
+ import { clientInstance as n } from "@odynn/awayz-auth";
8
6
  import { EWalletEndpoints as i } from "../../configs/endpoints.js";
9
7
  import "../../moment-BGjjqtLQ.js";
10
8
  import "../../arrayExtensions-cyilNkdJ.js";
9
+ import { c as a } from "../../objectUtils-CyIaVmog.js";
11
10
  class u {
12
11
  constructor() {
13
12
  s(this, "getAwards", async () => {
@@ -44,7 +43,7 @@ class u {
44
43
  });
45
44
  }
46
45
  }
47
- const W = new u();
46
+ const A = new u();
48
47
  export {
49
- W as WalletService
48
+ A as WalletService
50
49
  };
@@ -3,10 +3,10 @@ import d from "react";
3
3
  const p = (e) => {
4
4
  let t;
5
5
  const s = /* @__PURE__ */ new Set(), o = (n, i) => {
6
- const c = typeof n == "function" ? n(t) : n;
7
- if (!Object.is(c, t)) {
6
+ const a = typeof n == "function" ? n(t) : n;
7
+ if (!Object.is(a, t)) {
8
8
  const f = t;
9
- t = i ?? (typeof c != "object" || c === null) ? c : Object.assign({}, t, c), s.forEach((m) => m(t, f));
9
+ t = i ?? (typeof a != "object" || a === null) ? a : Object.assign({}, t, a), s.forEach((m) => m(t, f));
10
10
  }
11
11
  }, r = () => t, u = { setState: o, getState: r, getInitialState: () => b, subscribe: (n) => (s.add(n), () => s.delete(n)) }, b = t = e(o, r, u);
12
12
  return u;
@@ -25,7 +25,7 @@ const I = (e) => {
25
25
  }, H = (e) => I(e), x = H((e) => ({
26
26
  hotels: [],
27
27
  setHotels: (t) => e({ hotels: t }),
28
- updateHotel: (t, s, o) => e((r) => ({ hotels: r.hotels.map((a) => a.hotelId === t && a.hotelGroup === s ? { ...a, ...o } : a) })),
28
+ updateHotel: (t, s, o) => e((r) => ({ hotels: r.hotels.map((c) => c.hotelId === t && c.hotelGroup === s ? { ...c, ...o } : c) })),
29
29
  searchParams: {
30
30
  checkinDate: l().add(1, "day"),
31
31
  checkoutDate: l().add(2, "days"),
@@ -1,10 +1,8 @@
1
- import "react/jsx-runtime";
2
- import "react";
3
- import { i as u } from "../awayzClient-Bs2isDLP.js";
1
+ import { awayzClient as u } from "@odynn/awayz-auth";
4
2
  import { pointsAsCashCards as c } from "../definitions/PointsAsCashCards.js";
5
3
  import { WalletService as l } from "../services/wallet/WalletService.js";
6
- const p = async (n) => {
7
- const e = await m();
4
+ const A = async (n) => {
5
+ const e = await f();
8
6
  if (!e)
9
7
  return { pointsAsCash: 0, totalPointsUsed: 0, card: null, cashRequired: n };
10
8
  const { banks: s } = await u.ensureQueryData({
@@ -17,7 +15,7 @@ const p = async (n) => {
17
15
  return;
18
16
  let d = i.totalAccumulatedPoints, r = d * e.transferRatio;
19
17
  return r > n && (d = n / e.transferRatio, r = n), { pointsAsCash: r, totalPointsUsed: d, card: e, cashRequired: n };
20
- }, m = async () => {
18
+ }, f = async () => {
21
19
  const { banks: n } = await u.ensureQueryData({
22
20
  queryKey: ["walletAwards"],
23
21
  queryFn: l.getAwards
@@ -54,6 +52,6 @@ const p = async (n) => {
54
52
  )).card : r[0].card;
55
53
  };
56
54
  export {
57
- p as calculatePointsAsCash,
58
- m as getBestCard
55
+ A as calculatePointsAsCash,
56
+ f as getBestCard
59
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.11",
4
+ "version": "0.1.13",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"