@odynn/awayz-core 0.2.33 → 0.3.0
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/AccountService-Ct4hShV-.js +2037 -0
- package/dist/DateFormats-DZD30Nea.js +4 -0
- package/dist/{_commonjsHelpers-B52_cu2H.js → _commonjsHelpers-MdHo5S7N.js} +2 -2
- package/dist/{AccountService-8OR0UkZ6.js → arrayExtensions-DlcBOj5a.js} +1338 -3360
- package/dist/assets/FlightBooking.css +1 -0
- package/dist/assets/HotelBooking.css +1 -0
- package/dist/assets/Menu.css +1 -0
- package/dist/components/Bookings/FlightBooking/FlightBooking.js +88 -0
- package/dist/components/Bookings/HotelBooking/HotelBooking.js +75 -0
- package/dist/components/CashValue/CashValue.js +519 -2173
- package/dist/components/CashValue/CashValue.stories.js +18 -17
- package/dist/components/Menu/Menu.js +2491 -0
- package/dist/configs/endpoints.js +4 -2
- package/dist/hooks/useAwayzAuth/useAwayzAuth.js +12 -11
- package/dist/hooks/useBookingManagement/useBookingManagement.js +79 -0
- package/dist/hooks/useBookingManagement/useBookingManagement.test.js +79 -0
- package/dist/hooks/useBookingManagement/useBookingManagement.types.js +1 -0
- package/dist/hooks/useSearchLimit.js +2 -1
- package/dist/hooks/useTripManagement/mocks/index.js +19 -0
- package/dist/hooks/useTripManagement/useTripManagement.js +190 -0
- package/dist/hooks/useTripManagement/useTripManagement.test.js +205 -0
- package/dist/hooks/useTripManagement/useTripManagement.types.js +1 -0
- package/dist/hooks/useWallet/useWallet.js +7 -6
- package/dist/hooks/useWallet/useWallet.test.js +17 -12851
- package/dist/index-COgXcb6p.js +1696 -0
- package/dist/{index-B7QVGqcx.js → index-Cv-wvFlM.js} +1 -1
- package/dist/lib/components/Bookings/FlightBooking/FlightBooking.d.ts +59 -0
- package/dist/lib/components/Bookings/HotelBooking/HotelBooking.d.ts +52 -0
- package/dist/lib/components/Menu/Menu.d.ts +13 -0
- package/dist/lib/configs/endpoints.d.ts +12 -0
- package/dist/lib/hooks/useBookingManagement/mocks/FlightBooking200.json.d.ts +312 -0
- package/dist/lib/hooks/useBookingManagement/mocks/HotelBooking200.json.d.ts +92 -0
- package/dist/lib/hooks/useBookingManagement/useBookingManagement.d.ts +11 -0
- package/dist/lib/hooks/useBookingManagement/useBookingManagement.test.d.ts +1 -0
- package/dist/lib/hooks/useBookingManagement/useBookingManagement.types.d.ts +49 -0
- package/dist/lib/hooks/useTripManagement/mocks/PastTrip200.json.d.ts +20 -0
- package/dist/lib/hooks/useTripManagement/mocks/UncategorisedBookings200.json.d.ts +123 -0
- package/dist/lib/hooks/useTripManagement/mocks/UpcomingTrip200.json.d.ts +20 -0
- package/dist/lib/hooks/useTripManagement/mocks/UpdatedTrip200.json.d.ts +18 -0
- package/dist/lib/hooks/useTripManagement/mocks/index.d.ts +5 -0
- package/dist/lib/hooks/useTripManagement/useTripManagement.d.ts +9 -0
- package/dist/lib/hooks/useTripManagement/useTripManagement.test.d.ts +1 -0
- package/dist/lib/hooks/useTripManagement/useTripManagement.types.d.ts +109 -0
- package/dist/lib/main.d.ts +1 -0
- package/dist/lib/services/bookings/BookingService.d.ts +10 -0
- package/dist/lib/services/bookings/BookingService.types.d.ts +110 -0
- package/dist/lib/services/trips/TripService.types.d.ts +124 -0
- package/dist/lib/services/trips/TripsService.d.ts +19 -0
- package/dist/main.js +23 -20
- package/dist/providers/AwayzProvider.js +8 -7
- package/dist/services/account/AccountService.js +3 -2
- package/dist/services/bookings/BookingService.js +51 -0
- package/dist/services/bookings/BookingService.types.js +1 -0
- package/dist/services/currency/CurrencyService.js +11 -10
- package/dist/services/index.js +1 -1
- package/dist/services/instance.js +4 -3
- package/dist/services/instanceConfig.js +7 -6
- package/dist/services/noRetryInstance.js +1 -1
- package/dist/services/trips/TripService.types.js +9 -0
- package/dist/services/trips/TripsService.js +81 -0
- package/dist/services/wallet/WalletService.js +18 -23
- package/dist/tests/TestWrapper.js +2 -2
- package/dist/vi.ClIskdbk-k6t29WRA.js +12860 -0
- package/package.json +2 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var c = Object.defineProperty;
|
|
2
|
+
var r = (o, t, a) => t in o ? c(o, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : o[t] = a;
|
|
3
|
+
var n = (o, t, a) => r(o, typeof t != "symbol" ? t + "" : t, a);
|
|
4
|
+
import "../../arrayExtensions-DlcBOj5a.js";
|
|
5
|
+
import { c as e, b as i } from "../../AccountService-Ct4hShV-.js";
|
|
6
|
+
import "react";
|
|
7
|
+
import { EBookingEndpoints as s } from "../../configs/endpoints.js";
|
|
8
|
+
class l {
|
|
9
|
+
constructor() {
|
|
10
|
+
n(this, "getHotelBooking", async (t) => {
|
|
11
|
+
const { data: a } = await e.get(
|
|
12
|
+
`${s.USER_HOTEL_BOOKINGS}/${t}`
|
|
13
|
+
);
|
|
14
|
+
return i({
|
|
15
|
+
...a.data,
|
|
16
|
+
total_amount: parseFloat(a.data.total_amount),
|
|
17
|
+
fee_amount: parseFloat(a.data.fee_amount),
|
|
18
|
+
tax_amount: parseFloat(a.data.tax_amount),
|
|
19
|
+
base_amount: parseFloat(a.data.base_amount)
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
n(this, "getFlightBooking", async (t) => {
|
|
23
|
+
const { data: a } = await e.get(
|
|
24
|
+
`${s.USER_FLIGHT_BOOKINGS}/${t}`
|
|
25
|
+
);
|
|
26
|
+
return i(a.data);
|
|
27
|
+
});
|
|
28
|
+
n(this, "initiateCancelFlightBooking", async (t) => {
|
|
29
|
+
const { data: a } = await e.put(
|
|
30
|
+
`${s.INITIATE_FLIGHT_CANCEL}/${t}`
|
|
31
|
+
);
|
|
32
|
+
return a.success;
|
|
33
|
+
});
|
|
34
|
+
n(this, "confirmCancelFlightBooking", async (t) => {
|
|
35
|
+
const { data: a } = await e.put(
|
|
36
|
+
`${s.CONFIRM_FLIGHT_CANCEL}/${t}`
|
|
37
|
+
);
|
|
38
|
+
return a.success;
|
|
39
|
+
});
|
|
40
|
+
n(this, "cancelHotelBooking", async (t) => {
|
|
41
|
+
const { data: a } = await e.post(
|
|
42
|
+
`${s.CANCEL_HOTEL_BOOKING}/${t}`
|
|
43
|
+
);
|
|
44
|
+
return a.success;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const B = new l();
|
|
49
|
+
export {
|
|
50
|
+
B as BookingService
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import '../../assets/_styles.css';var u = Object.defineProperty;
|
|
2
2
|
var y = (t, r, e) => r in t ? u(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
|
|
3
|
-
var
|
|
4
|
-
import
|
|
3
|
+
var n = (t, r, e) => y(t, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
+
import "../../arrayExtensions-DlcBOj5a.js";
|
|
5
|
+
import { A as p, E as C, c as a } from "../../AccountService-Ct4hShV-.js";
|
|
5
6
|
import "react";
|
|
6
7
|
import { ECurrencyEndpoints as s } from "../../configs/endpoints.js";
|
|
7
8
|
import "react/jsx-runtime";
|
|
@@ -12,17 +13,17 @@ import "../noRetryInstance.js";
|
|
|
12
13
|
/* empty css */
|
|
13
14
|
class E {
|
|
14
15
|
constructor() {
|
|
15
|
-
|
|
16
|
+
n(this, "convertCurrency", async ({
|
|
16
17
|
baseCurrency: r
|
|
17
18
|
}) => {
|
|
18
19
|
try {
|
|
19
|
-
const { success: e, data:
|
|
20
|
+
const { success: e, data: o } = await m.ensureQueryData({
|
|
20
21
|
queryKey: [C.CHECK_USER],
|
|
21
22
|
queryFn: p.checkUser
|
|
22
23
|
});
|
|
23
24
|
if (!e)
|
|
24
25
|
throw new Error("Failed to fetch user data");
|
|
25
|
-
const { userRegion: c } =
|
|
26
|
+
const { userRegion: c } = o, { data: i } = await a.post(s.CURRENCY_CONVERSION, {
|
|
26
27
|
target_currency: c.currency,
|
|
27
28
|
base_currency: r
|
|
28
29
|
});
|
|
@@ -41,16 +42,16 @@ class E {
|
|
|
41
42
|
* @parm amount the amount to be converted from the base to the target currency
|
|
42
43
|
* @returns the converted amount
|
|
43
44
|
*/
|
|
44
|
-
|
|
45
|
+
n(this, "convertToCurrency", async ({
|
|
45
46
|
baseCurrency: r,
|
|
46
47
|
targetCurrency: e,
|
|
47
|
-
amount:
|
|
48
|
+
amount: o
|
|
48
49
|
}) => {
|
|
49
50
|
try {
|
|
50
51
|
const { data: c } = await a.post(s.CURRENCY_CONVERSION, {
|
|
51
52
|
target_currency: e,
|
|
52
53
|
base_currency: r,
|
|
53
|
-
amount:
|
|
54
|
+
amount: o
|
|
54
55
|
});
|
|
55
56
|
if (c.success)
|
|
56
57
|
return c.data.conversion_result;
|
|
@@ -61,7 +62,7 @@ class E {
|
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
|
-
const
|
|
65
|
+
const U = new E();
|
|
65
66
|
export {
|
|
66
|
-
|
|
67
|
+
U as CurrencyService
|
|
67
68
|
};
|
package/dist/services/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as n, i as t } from "../AccountService-
|
|
1
|
+
import { c as n, i as t } from "../AccountService-Ct4hShV-.js";
|
|
2
2
|
import { clientNoRetryInstance as o } from "./noRetryInstance.js";
|
|
3
3
|
import { CurrencyService as i } from "./currency/CurrencyService.js";
|
|
4
4
|
export {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../arrayExtensions-DlcBOj5a.js";
|
|
2
|
+
import { c as a, i as c } from "../AccountService-Ct4hShV-.js";
|
|
2
3
|
import "react";
|
|
3
4
|
import "../configs/baseUrl.js";
|
|
4
5
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
a as clientInstance,
|
|
7
|
+
c as instance
|
|
7
8
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { m as p, k as l, l as m, g, h, p as u } from "../AccountService-Ct4hShV-.js";
|
|
2
2
|
import "../configs/baseUrl.js";
|
|
3
|
+
import "../arrayExtensions-DlcBOj5a.js";
|
|
3
4
|
import "react";
|
|
4
5
|
import "../configs/endpoints.js";
|
|
5
6
|
import "../types/EAuthFlow.js";
|
|
6
7
|
export {
|
|
7
|
-
|
|
8
|
+
p as authFailurePostMessage,
|
|
8
9
|
l as delay,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
m as executeWithDelay,
|
|
11
|
+
g as getClientConfig,
|
|
12
|
+
h as handleAxiosError,
|
|
13
|
+
u as processFailedRequests
|
|
13
14
|
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
var g = Object.defineProperty;
|
|
2
|
+
var d = (a, t, s) => t in a ? g(a, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[t] = s;
|
|
3
|
+
var o = (a, t, s) => d(a, typeof t != "symbol" ? t + "" : t, s);
|
|
4
|
+
import { c as r, d as p, b as n, r as T } from "../../AccountService-Ct4hShV-.js";
|
|
5
|
+
import { EBookingType as u } from "./TripService.types.js";
|
|
6
|
+
import { EMyTripsEndpoints as i } from "../../configs/endpoints.js";
|
|
7
|
+
import "../../arrayExtensions-DlcBOj5a.js";
|
|
8
|
+
import "react";
|
|
9
|
+
class l {
|
|
10
|
+
constructor() {
|
|
11
|
+
o(this, "createTrip", async (t) => {
|
|
12
|
+
const { data: s } = await r.post(
|
|
13
|
+
i.TRIPS,
|
|
14
|
+
p(t)
|
|
15
|
+
);
|
|
16
|
+
return s;
|
|
17
|
+
});
|
|
18
|
+
o(this, "getTripsByStatus", async (t) => {
|
|
19
|
+
const { data: s } = await r.get(
|
|
20
|
+
i.TRIPS,
|
|
21
|
+
{
|
|
22
|
+
params: { status: t }
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
return s != null && s.success ? n(s.data) : [];
|
|
26
|
+
});
|
|
27
|
+
o(this, "updateTrip", async (t, s) => {
|
|
28
|
+
const { data: e } = await r.put(
|
|
29
|
+
`${i.TRIPS}/${t}`,
|
|
30
|
+
T(p(s))
|
|
31
|
+
);
|
|
32
|
+
return e != null && e.success ? {
|
|
33
|
+
success: !0,
|
|
34
|
+
data: n(e.data),
|
|
35
|
+
message: "Trip updated successfully."
|
|
36
|
+
} : {
|
|
37
|
+
success: !1,
|
|
38
|
+
message: "An error occurred while trying to update the trip."
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
o(this, "deleteTrip", async (t) => {
|
|
42
|
+
const { data: s } = await r.delete(
|
|
43
|
+
`${i.TRIPS}/${t}`
|
|
44
|
+
);
|
|
45
|
+
return s;
|
|
46
|
+
});
|
|
47
|
+
o(this, "getUncategorisedBookings", async () => {
|
|
48
|
+
const { data: t } = await r.get(
|
|
49
|
+
i.UNCATEGORISED_BOOKINGS
|
|
50
|
+
);
|
|
51
|
+
if (!(t != null && t.success))
|
|
52
|
+
return {
|
|
53
|
+
flightBookings: [],
|
|
54
|
+
hotelBookings: []
|
|
55
|
+
};
|
|
56
|
+
const s = n(t.data);
|
|
57
|
+
return {
|
|
58
|
+
flightBookings: s.flightBookings.map((e) => ({
|
|
59
|
+
...e,
|
|
60
|
+
bookingType: u.FLIGHT
|
|
61
|
+
})) ?? [],
|
|
62
|
+
hotelBookings: s.hotelBookings.map((e) => ({
|
|
63
|
+
...e,
|
|
64
|
+
bookingType: u.HOTEL
|
|
65
|
+
})) ?? []
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
o(this, "addBookingToTrip", async (t, s, e) => {
|
|
69
|
+
const { data: c } = await r.put(i.ADD_BOOKING, {
|
|
70
|
+
trip_id: t,
|
|
71
|
+
booking_id: s,
|
|
72
|
+
booking_type: e
|
|
73
|
+
});
|
|
74
|
+
return c.success;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const I = new l();
|
|
79
|
+
export {
|
|
80
|
+
I as TripsService
|
|
81
|
+
};
|
|
@@ -1,30 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
var y = Object.defineProperty;
|
|
2
2
|
var w = (e, a, t) => a in e ? y(e, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[a] = t;
|
|
3
3
|
var s = (e, a, t) => w(e, typeof a != "symbol" ? a + "" : a, t);
|
|
4
|
-
import
|
|
4
|
+
import "../../arrayExtensions-DlcBOj5a.js";
|
|
5
|
+
import { a as o, c, b as n } from "../../AccountService-Ct4hShV-.js";
|
|
5
6
|
import "react";
|
|
6
|
-
import "react/jsx-runtime";
|
|
7
|
-
import "../../context/AwayzContext.js";
|
|
8
7
|
import { EWalletEndpoints as i } from "../../configs/endpoints.js";
|
|
9
|
-
import "../../configs/awayzClient.js";
|
|
10
|
-
import "@tanstack/react-query";
|
|
11
|
-
import "../noRetryInstance.js";
|
|
12
|
-
/* empty css */
|
|
13
8
|
class E {
|
|
14
9
|
constructor() {
|
|
15
10
|
s(this, "getAwards", async () => {
|
|
16
|
-
var a, t,
|
|
11
|
+
var a, t, l;
|
|
17
12
|
try {
|
|
18
|
-
const
|
|
13
|
+
const m = [
|
|
19
14
|
o.HOTEL,
|
|
20
15
|
o.BANK,
|
|
21
16
|
o.AIRLINE
|
|
22
17
|
], [
|
|
23
18
|
{ data: d },
|
|
24
|
-
{ data:
|
|
25
|
-
{ data:
|
|
19
|
+
{ data: g },
|
|
20
|
+
{ data: u }
|
|
26
21
|
] = await Promise.all(
|
|
27
|
-
|
|
22
|
+
m.map(
|
|
28
23
|
(r) => c.get(
|
|
29
24
|
i.USER_AWARDS,
|
|
30
25
|
{
|
|
@@ -32,38 +27,38 @@ class E {
|
|
|
32
27
|
}
|
|
33
28
|
)
|
|
34
29
|
)
|
|
35
|
-
),
|
|
30
|
+
), p = ((a = d.data) == null ? void 0 : a.map(
|
|
36
31
|
(r) => n({
|
|
37
32
|
...r,
|
|
38
33
|
ctegory: o.HOTEL
|
|
39
34
|
})
|
|
40
|
-
)) ?? [], A = ((t =
|
|
35
|
+
)) ?? [], A = ((t = g.data) == null ? void 0 : t.map(
|
|
41
36
|
(r) => n({
|
|
42
37
|
...r,
|
|
43
38
|
ctegory: o.BANK
|
|
44
39
|
})
|
|
45
|
-
)) ?? [], R = ((
|
|
40
|
+
)) ?? [], R = ((l = u.data) == null ? void 0 : l.map(
|
|
46
41
|
(r) => n({
|
|
47
42
|
...r,
|
|
48
43
|
ctegory: o.AIRLINE
|
|
49
44
|
})
|
|
50
45
|
)) ?? [];
|
|
51
46
|
return [
|
|
52
|
-
...
|
|
47
|
+
...p,
|
|
53
48
|
...A,
|
|
54
49
|
...R
|
|
55
50
|
];
|
|
56
|
-
} catch (
|
|
57
|
-
console.error(
|
|
51
|
+
} catch (m) {
|
|
52
|
+
console.error(m);
|
|
58
53
|
}
|
|
59
54
|
return [];
|
|
60
55
|
});
|
|
61
56
|
s(this, "setAwardPoints", async (a, t) => {
|
|
62
|
-
const { data:
|
|
57
|
+
const { data: l } = await c.put(i.USER_AWARDS, {
|
|
63
58
|
main_program: a,
|
|
64
59
|
amount: t
|
|
65
60
|
});
|
|
66
|
-
return
|
|
61
|
+
return l;
|
|
67
62
|
});
|
|
68
63
|
s(this, "getBanks", async () => {
|
|
69
64
|
const { data: a } = await c.get(
|
|
@@ -85,7 +80,7 @@ class E {
|
|
|
85
80
|
});
|
|
86
81
|
}
|
|
87
82
|
}
|
|
88
|
-
const
|
|
83
|
+
const W = new E();
|
|
89
84
|
export {
|
|
90
|
-
|
|
85
|
+
W as WalletService
|
|
91
86
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as dc } from "react/jsx-runtime";
|
|
2
2
|
import * as ze from "react";
|
|
3
3
|
import ts from "react";
|
|
4
|
-
import { a as io, R as da } from "../index-
|
|
5
|
-
import {
|
|
4
|
+
import { a as io, R as da } from "../index-Cv-wvFlM.js";
|
|
5
|
+
import { a as ns } from "../_commonjsHelpers-MdHo5S7N.js";
|
|
6
6
|
import { QueryClient as fc, QueryClientProvider as pc } from "@tanstack/react-query";
|
|
7
7
|
function mc(e, r) {
|
|
8
8
|
for (var t = 0; t < r.length; t++) {
|