@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.
- package/dist/objectUtils-CyIaVmog.js +10 -0
- package/dist/services/booking/BookingService.js +18 -20
- package/dist/services/hotel/HotelService.js +22 -24
- package/dist/services/wallet/WalletService.js +8 -10
- package/dist/utilities/pointsAsCashUtils.js +6 -9
- package/package.json +1 -1
- package/dist/awayzClient-Cu1oxd-l.js +0 -4770
|
@@ -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
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
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 {
|
|
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
|
-
|
|
13
|
+
c(this, "getAvailableRooms", async ({
|
|
16
14
|
checkinDate: e,
|
|
17
15
|
checkoutDate: a,
|
|
18
16
|
accommodationId: i,
|
|
19
|
-
rooms:
|
|
20
|
-
guests:
|
|
17
|
+
rooms: n,
|
|
18
|
+
guests: m
|
|
21
19
|
}) => {
|
|
22
20
|
try {
|
|
23
21
|
const { data: o } = await d.post(
|
|
24
|
-
|
|
22
|
+
h.AVAILABLE_ROOMS,
|
|
25
23
|
{
|
|
26
|
-
check_in_date: e.format(
|
|
27
|
-
check_out_date: a.format(
|
|
24
|
+
check_in_date: e.format(s.ServerDate),
|
|
25
|
+
check_out_date: a.format(s.ServerDate),
|
|
28
26
|
accommodation_ids: [i],
|
|
29
|
-
rooms:
|
|
30
|
-
guests:
|
|
27
|
+
rooms: n,
|
|
28
|
+
guests: m
|
|
31
29
|
}
|
|
32
30
|
), r = o.data.results.getFirst(), _ = r.accommodation.rooms.map(
|
|
33
|
-
(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
|
|
47
|
+
const D = new g();
|
|
50
48
|
export {
|
|
51
|
-
|
|
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 {
|
|
9
|
-
import { E as
|
|
10
|
-
import { EHotelEndpoints as
|
|
11
|
-
import "
|
|
12
|
-
import "
|
|
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
|
|
21
|
-
|
|
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:
|
|
39
|
-
searchId:
|
|
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
|
|
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
|
|
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
|
|
110
|
-
|
|
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(
|
|
127
|
-
check_out_date: a.checkoutDate.format(
|
|
128
|
-
}, { data: t } = await
|
|
129
|
-
|
|
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
|
|
137
|
-
|
|
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 ?
|
|
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
|
|
183
|
+
const G = new H();
|
|
186
184
|
export {
|
|
187
|
-
|
|
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 "
|
|
6
|
-
import "
|
|
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) =>
|
|
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
|
|
39
|
-
|
|
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
|
|
46
|
+
const A = new u();
|
|
49
47
|
export {
|
|
50
|
-
|
|
48
|
+
A as WalletService
|
|
51
49
|
};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import "
|
|
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
|
|
8
|
-
const e = await
|
|
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
|
-
},
|
|
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
|
-
|
|
59
|
-
|
|
55
|
+
A as calculatePointsAsCash,
|
|
56
|
+
f as getBestCard
|
|
60
57
|
};
|