@odynn/awayz-core 0.10.30 → 0.10.31
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-B582vLTc.js +2149 -0
- package/dist/{TripsService-B2m7Yy9W.js → TripsService-BwBvXdDC.js} +6 -6
- package/dist/assets/_styles5.css +1 -1
- package/dist/assets/_styles6.css +1 -1
- package/dist/assets/_styles7.css +1 -0
- package/dist/components/CashValue/CashValue.js +15 -13
- package/dist/components/CashValue/CashValue.stories.js +22 -21
- package/dist/components/ClientPointsValue/ClientPointsValue.js +20 -18
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/Tooltip/Tooltip.js +1 -1
- package/dist/components/Wallet/Card/Card.stories.js +16 -14
- package/dist/hooks/useAwayzAuth/useAwayzAuth.js +15 -13
- package/dist/hooks/useBookingManagement/useBookingManagement.js +6 -4
- package/dist/hooks/useBookingManagement/useBookingManagement.test.js +5 -3
- package/dist/hooks/useFeatureFlags.js +1 -1
- package/dist/hooks/useSearchLimit.js +1 -1
- package/dist/hooks/useTripManagement/useTripManagement.js +7 -5
- package/dist/hooks/useTripManagement/useTripManagement.test.js +5 -3
- package/dist/hooks/useWallet/useWallet.js +31 -29
- package/dist/hooks/useWallet/useWallet.test.js +4 -2
- package/dist/lib/services/account/AccountService.d.ts +12 -2
- package/dist/lib/services/account/AccountServices.types.d.ts +13 -0
- package/dist/lib/services/index.d.ts +2 -0
- package/dist/lib/services/instanceConfig.d.ts +1 -1
- package/dist/main.js +43 -39
- package/dist/providers/AwayzProvider.js +10 -8
- package/dist/services/account/AccountService.js +3 -2
- package/dist/services/bookings/BookingService.js +3 -3
- package/dist/services/currency/CurrencyService.js +16 -14
- package/dist/services/features/featureService.js +1 -1
- package/dist/services/index.js +13 -9
- package/dist/services/instance.js +1 -1
- package/dist/services/instanceConfig.js +8 -20
- package/dist/services/noRetryInstance.js +9 -2
- package/dist/services/preferences/PreferencesService.js +1 -1
- package/dist/services/rewards/RewardsService.js +1 -1
- package/dist/services/trips/TripsService.js +2 -2
- package/dist/services/wallet/WalletService.js +1 -1
- package/dist/utils/clientPoints.js +6 -4
- package/package.json +1 -1
- package/dist/assets/noRetryInstance.css +0 -1
- package/dist/noRetryInstance-DNLgOg0E.js +0 -2134
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { useQuery as u, useMutation as p } from "@tanstack/react-query";
|
|
2
2
|
import "react/jsx-runtime";
|
|
3
3
|
import { h as m } from "../../arrayExtensions-DlcBOj5a.js";
|
|
4
|
-
import { E as e } from "../../
|
|
4
|
+
import { E as e } from "../../AccountService-B582vLTc.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import "react-i18next";
|
|
7
|
-
import '../../assets/_styles4.css';import '../../assets/
|
|
7
|
+
import '../../assets/_styles4.css';import '../../assets/_styles5.css';import '../../assets/_styles7.css';import '../../assets/_styles6.css';import '../../assets/_styles2.css';import '../../assets/_styles.css';import '../../assets/_styles3.css';/* empty css */
|
|
8
8
|
/* empty css */
|
|
9
9
|
/* empty css */
|
|
10
10
|
import { awayzClient as o } from "../../configs/awayzClient.js";
|
|
11
11
|
/* empty css */
|
|
12
12
|
/* empty css */
|
|
13
13
|
import "../../index-Cv-wvFlM.js";
|
|
14
|
+
/* empty css */
|
|
14
15
|
import "../../context/AwayzContext.js";
|
|
15
16
|
/* empty css */
|
|
16
|
-
import
|
|
17
|
+
import "../../services/noRetryInstance.js";
|
|
18
|
+
import { T as n } from "../../TripsService-BwBvXdDC.js";
|
|
17
19
|
const b = ({
|
|
18
20
|
tripId: t,
|
|
19
21
|
tripDetails: s
|
|
@@ -24,7 +26,7 @@ const b = ({
|
|
|
24
26
|
throw new Error("Trip details must be provided for update");
|
|
25
27
|
};
|
|
26
28
|
var _ = /* @__PURE__ */ ((t) => (t.PAST = "past", t.UPCOMING = "upcoming", t))(_ || {});
|
|
27
|
-
const
|
|
29
|
+
const nr = () => {
|
|
28
30
|
const { data: t = [] } = u({
|
|
29
31
|
queryKey: [
|
|
30
32
|
e.TRIPS,
|
|
@@ -245,6 +247,6 @@ const or = () => {
|
|
|
245
247
|
};
|
|
246
248
|
export {
|
|
247
249
|
_ as ETripStatus,
|
|
248
|
-
|
|
250
|
+
nr as useTripManagement,
|
|
249
251
|
b as validateUpdateTripArgs
|
|
250
252
|
};
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import { h as p } from "../../arrayExtensions-DlcBOj5a.js";
|
|
3
|
-
import { D as f } from "../../TripsService-
|
|
3
|
+
import { D as f } from "../../TripsService-BwBvXdDC.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import { renderHook as o, waitFor as i } from "../../tests/TestWrapper.js";
|
|
6
6
|
import { EMyTripsEndpoints as c } from "../../configs/endpoints.js";
|
|
7
7
|
import "react-i18next";
|
|
8
|
-
import '../../assets/_styles4.css';import '../../assets/
|
|
8
|
+
import '../../assets/_styles4.css';import '../../assets/_styles5.css';import '../../assets/_styles7.css';import '../../assets/_styles6.css';import '../../assets/_styles2.css';import '../../assets/_styles.css';import '../../assets/_styles3.css';/* empty css */
|
|
9
9
|
/* empty css */
|
|
10
10
|
/* empty css */
|
|
11
11
|
import "@tanstack/react-query";
|
|
12
12
|
import "../../configs/awayzClient.js";
|
|
13
|
-
import { c as d } from "../../
|
|
13
|
+
import { c as d } from "../../AccountService-B582vLTc.js";
|
|
14
14
|
/* empty css */
|
|
15
15
|
/* empty css */
|
|
16
16
|
import "../../index-Cv-wvFlM.js";
|
|
17
|
+
/* empty css */
|
|
17
18
|
import "../../context/AwayzContext.js";
|
|
18
19
|
import { EBookingType as g } from "../../services/trips/TripService.types.js";
|
|
19
20
|
import { useTripManagement as n } from "./useTripManagement.js";
|
|
20
21
|
/* empty css */
|
|
22
|
+
import "../../services/noRetryInstance.js";
|
|
21
23
|
import { UncategorisedBookings200 as T, PastTrip200 as y, UpcomingTrip200 as B, UpdatedTrip200 as b } from "./mocks/index.js";
|
|
22
24
|
import { d as u, v as k, b as D, t as s, g as e } from "../../vi.2VT5v0um-lKoi8TEt.js";
|
|
23
25
|
let l = {
|
|
@@ -1,67 +1,69 @@
|
|
|
1
1
|
import { useQuery as s, useMutation as i } from "@tanstack/react-query";
|
|
2
2
|
import "react/jsx-runtime";
|
|
3
3
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
4
|
-
import { E as a,
|
|
4
|
+
import { E as a, b as l } from "../../AccountService-B582vLTc.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import "react-i18next";
|
|
7
|
-
import '../../assets/_styles4.css';import '../../assets/
|
|
7
|
+
import '../../assets/_styles4.css';import '../../assets/_styles5.css';import '../../assets/_styles7.css';import '../../assets/_styles6.css';import '../../assets/_styles2.css';import '../../assets/_styles.css';import '../../assets/_styles3.css';/* empty css */
|
|
8
8
|
/* empty css */
|
|
9
9
|
/* empty css */
|
|
10
10
|
import { awayzClient as d } from "../../configs/awayzClient.js";
|
|
11
11
|
/* empty css */
|
|
12
12
|
/* empty css */
|
|
13
13
|
import "../../index-Cv-wvFlM.js";
|
|
14
|
+
/* empty css */
|
|
14
15
|
import { useAwayzContext as h } from "../useAwayzContext.js";
|
|
15
16
|
/* empty css */
|
|
16
17
|
import "../../context/AwayzContext.js";
|
|
17
|
-
import
|
|
18
|
+
import "../../services/noRetryInstance.js";
|
|
19
|
+
import { WalletService as o } from "../../services/wallet/WalletService.js";
|
|
18
20
|
const U = {
|
|
19
21
|
availablePoints: 0,
|
|
20
22
|
valuePerPoint: 0,
|
|
21
23
|
currency: ""
|
|
22
|
-
},
|
|
23
|
-
const { user: r, featureFlags: c, featureFlagsLoaded: y, isAuthenticated:
|
|
24
|
+
}, J = () => {
|
|
25
|
+
const { user: r, featureFlags: c, featureFlagsLoaded: y, isAuthenticated: n } = h(), { data: t = [] } = s({
|
|
24
26
|
queryKey: [a.PROGRAMS],
|
|
25
|
-
queryFn:
|
|
27
|
+
queryFn: o.getAwards,
|
|
26
28
|
placeholderData: [],
|
|
27
|
-
enabled:
|
|
29
|
+
enabled: n
|
|
28
30
|
}), { data: A = [] } = s({
|
|
29
31
|
queryKey: [a.USER_PROGRAMS, r == null ? void 0 : r.id],
|
|
30
|
-
queryFn: () => r != null && r.id ?
|
|
32
|
+
queryFn: () => r != null && r.id ? o.getUserAwards(r.id) : [],
|
|
31
33
|
placeholderData: [],
|
|
32
|
-
enabled:
|
|
34
|
+
enabled: n
|
|
33
35
|
}), { data: S = [] } = s({
|
|
34
36
|
queryKey: [a.LINKED_USER_PROGRAMS, r == null ? void 0 : r.id],
|
|
35
|
-
queryFn: () => r != null && r.id ?
|
|
37
|
+
queryFn: () => r != null && r.id ? o.getLinkedUserAwards(r.id) : [],
|
|
36
38
|
placeholderData: [],
|
|
37
|
-
enabled:
|
|
39
|
+
enabled: n
|
|
38
40
|
}), { data: g = [] } = s({
|
|
39
41
|
queryKey: [a.BANKS],
|
|
40
|
-
queryFn:
|
|
42
|
+
queryFn: o.getBanks,
|
|
41
43
|
placeholderData: [],
|
|
42
|
-
enabled:
|
|
44
|
+
enabled: n
|
|
43
45
|
}), { data: P = [] } = s({
|
|
44
46
|
queryKey: [a.CARDS],
|
|
45
|
-
queryFn:
|
|
47
|
+
queryFn: o.getCards,
|
|
46
48
|
placeholderData: [],
|
|
47
|
-
enabled:
|
|
48
|
-
}), { data:
|
|
49
|
+
enabled: n
|
|
50
|
+
}), { data: p = [] } = s({
|
|
49
51
|
queryKey: [a.USER_CARDS],
|
|
50
|
-
queryFn:
|
|
52
|
+
queryFn: o.getUserCards,
|
|
51
53
|
placeholderData: [],
|
|
52
|
-
enabled:
|
|
54
|
+
enabled: n
|
|
53
55
|
}), {
|
|
54
|
-
data:
|
|
56
|
+
data: R = U,
|
|
55
57
|
isFetching: C
|
|
56
58
|
} = s({
|
|
57
59
|
queryKey: [a.POINTS_AS_CASH],
|
|
58
|
-
queryFn:
|
|
59
|
-
enabled: y && c.usePointsAsCashFeature &&
|
|
60
|
+
queryFn: o.getPointsAsCash,
|
|
61
|
+
enabled: y && c.usePointsAsCashFeature && n,
|
|
60
62
|
retry: !1
|
|
61
63
|
}), { mutate: E } = i({
|
|
62
64
|
mutationFn: async (e) => {
|
|
63
65
|
const { mainProgram: m, awardsAmount: u } = typeof e == "string" ? { mainProgram: e, awardsAmount: 0 } : e;
|
|
64
|
-
await
|
|
66
|
+
await o.addAwardProgram(m, u);
|
|
65
67
|
},
|
|
66
68
|
onSuccess: () => {
|
|
67
69
|
d.invalidateQueries({
|
|
@@ -70,7 +72,7 @@ const U = {
|
|
|
70
72
|
}
|
|
71
73
|
}), { mutate: K } = i({
|
|
72
74
|
mutationFn: async (e) => {
|
|
73
|
-
await
|
|
75
|
+
await o.removeAwardProgram(e);
|
|
74
76
|
},
|
|
75
77
|
onSuccess: () => {
|
|
76
78
|
d.invalidateQueries({
|
|
@@ -82,7 +84,7 @@ const U = {
|
|
|
82
84
|
const u = t == null ? void 0 : t.find((q) => q.mainProgram === e);
|
|
83
85
|
if (!u)
|
|
84
86
|
throw new Error("Program not found");
|
|
85
|
-
return
|
|
87
|
+
return o.setAwardPoints(u.mainProgram, m);
|
|
86
88
|
},
|
|
87
89
|
onSuccess: () => {
|
|
88
90
|
[
|
|
@@ -94,14 +96,14 @@ const U = {
|
|
|
94
96
|
});
|
|
95
97
|
}
|
|
96
98
|
}), { mutateAsync: F } = i({
|
|
97
|
-
mutationFn: async (e) =>
|
|
99
|
+
mutationFn: async (e) => o.addCardsToWallet(e),
|
|
98
100
|
onSuccess: () => {
|
|
99
101
|
d.invalidateQueries({
|
|
100
102
|
queryKey: [a.USER_CARDS]
|
|
101
103
|
});
|
|
102
104
|
}
|
|
103
105
|
}), { mutateAsync: _ } = i({
|
|
104
|
-
mutationFn: async (e) =>
|
|
106
|
+
mutationFn: async (e) => o.removeCardsFromWallet(e),
|
|
105
107
|
onSuccess: () => {
|
|
106
108
|
d.invalidateQueries({
|
|
107
109
|
queryKey: [a.USER_CARDS]
|
|
@@ -128,13 +130,13 @@ const U = {
|
|
|
128
130
|
// Card Management
|
|
129
131
|
banks: g || [],
|
|
130
132
|
allCards: P || [],
|
|
131
|
-
userCards:
|
|
133
|
+
userCards: p || [],
|
|
132
134
|
addCards: F,
|
|
133
135
|
removeCards: _,
|
|
134
|
-
pointsAsCash:
|
|
136
|
+
pointsAsCash: R,
|
|
135
137
|
pointsAsCashLoading: C
|
|
136
138
|
};
|
|
137
139
|
};
|
|
138
140
|
export {
|
|
139
|
-
|
|
141
|
+
J as useWallet
|
|
140
142
|
};
|
|
@@ -3,18 +3,20 @@ import "react/jsx-runtime";
|
|
|
3
3
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "react-i18next";
|
|
6
|
-
import '../../assets/_styles4.css';import '../../assets/
|
|
6
|
+
import '../../assets/_styles4.css';import '../../assets/_styles5.css';import '../../assets/_styles7.css';import '../../assets/_styles6.css';import '../../assets/_styles2.css';import '../../assets/_styles.css';import '../../assets/_styles3.css';/* empty css */
|
|
7
7
|
/* empty css */
|
|
8
8
|
/* empty css */
|
|
9
9
|
import "@tanstack/react-query";
|
|
10
10
|
import "../../configs/awayzClient.js";
|
|
11
|
-
import { c as l } from "../../
|
|
11
|
+
import { c as l } from "../../AccountService-B582vLTc.js";
|
|
12
12
|
/* empty css */
|
|
13
13
|
/* empty css */
|
|
14
14
|
import "../../index-Cv-wvFlM.js";
|
|
15
|
+
/* empty css */
|
|
15
16
|
import "../../context/AwayzContext.js";
|
|
16
17
|
import { useWallet as t } from "./useWallet.js";
|
|
17
18
|
/* empty css */
|
|
19
|
+
import "../../services/noRetryInstance.js";
|
|
18
20
|
import { renderHook as s, waitFor as i } from "../../tests/TestWrapper.js";
|
|
19
21
|
import { d as m, v as c, b as p, t as n, g as o } from "../../vi.2VT5v0um-lKoi8TEt.js";
|
|
20
22
|
const _ = !0, v = [{ _id: "AAAviatorBis", name: "AAdvantage Aviator Business", signupBonus: 7e4, cashBonus: 0, minimumSpend: 2e3, daysToSpend: 90, annual_fee: 95, annualFeeWaived: !1, cashPerks: 0, bank: { name: "Barclays" }, rewards_currency: "American Airlines Miles", bisCard: !0, chargeCard: !1, cardFamily: 0, websiteUrl: "https://frequentmiler.com/AviatorBiz/#Goto", network: { name: "Mastercard" }, _modified: "2022-08-30T00:24:55.568Z", colour: "#1A3251", region: "US", faredrop_card_id: "", alternateRegions: [], logoUrl: "https://s3.us-east-1.amazonaws.com/awayz/card_logos/barclays-white.svg" }, { _id: "AARed", name: "AAdvantage Aviator Red", signupBonus: 6e4, cashBonus: 0, minimumSpend: 0, daysToSpend: 30, annual_fee: 99, annualFeeWaived: !0, cashPerks: 0, bank: { name: "Barclays" }, rewards_currency: "American Airlines Miles", bisCard: !1, chargeCard: !1, cardFamily: 1, websiteUrl: "https://frequentmiler.com/AviatorRed/#Goto", network: { name: "Mastercard" }, colour: "#1A3251", region: "US", faredrop_card_id: "", alternateRegions: [], logoUrl: "https://s3.us-east-1.amazonaws.com/awayz/card_logos/barclays-white.svg" }, { _id: "AASilver", name: "AAdvantage Aviator Silver", signupBonus: 0, cashBonus: 0, minimumSpend: 0, daysToSpend: 0, annual_fee: 195, annualFeeWaived: !1, cashPerks: 75, bank: { name: "Barclays" }, rewards_currency: "American Airlines Miles", bisCard: !1, chargeCard: !1, cardFamily: 1, websiteUrl: "https://frequentmiler.boardingarea.com/AviatorSilver/#Goto", network: { name: "Mastercard" }, _modified: "2022-08-30T00:27:10.347Z", updatedAt: "2022-10-26T06:55:01.187Z", colour: "#C8C8C8", region: "US", faredrop_card_id: "", alternateRegions: [], logoUrl: "https://s3.us-east-1.amazonaws.com/awayz/card_logos/barclays-black.svg" }, { _id: "AFKLMcard", name: "Air France KLM Card", signupBonus: 7e4, cashBonus: 0, minimumSpend: 2e3, daysToSpend: 90, annual_fee: 89, annualFeeWaived: !1, cashPerks: 150, bank: { name: "BofA" }, rewards_currency: "Flying Blue Miles", bisCard: !1, chargeCard: !1, cardFamily: 6, websiteUrl: "https://frequentmiler.com/AFKLM/#Goto", network: { name: "Mastercard" }, _modified: "2022-08-30T00:41:10.038Z", colour: "#1A3251", region: "US", faredrop_card_id: "", alternateRegions: [], logoUrl: "https://s3.us-east-1.amazonaws.com/awayz/card_logos/bofa-white.svg" }, { _id: "ASBis", name: "Alaska Airlines Visa Business", signupBonus: 7e4, cashBonus: 0, minimumSpend: 4e3, daysToSpend: 90, annual_fee: 75, annualFeeWaived: !1, cashPerks: 0, bank: { name: "BofA" }, rewards_currency: "Alaska MileagePlan", bisCard: !0, chargeCard: !1, cardFamily: 10, websiteUrl: "https://frequentmiler.com/ASbiz/#Goto", network: { name: "Visa" }, _modified: "2022-08-30T00:41:42.408Z", colour: "#1A3251", region: "US", faredrop_card_id: "", alternateRegions: [], logoUrl: "https://s3.us-east-1.amazonaws.com/awayz/card_logos/bofa-white.svg" }, { _id: "AltReserve", name: "Altitude Reserve", signupBonus: 5e4, cashBonus: 0, minimumSpend: 4500, daysToSpend: 90, annual_fee: 400, annualFeeWaived: !1, cashPerks: 0, bank: { name: "US Bank" }, rewards_currency: "Altitude Reserve Points", bisCard: !1, chargeCard: !1, cardFamily: 28, websiteUrl: "https://frequentmiler.com/USBAR/#Goto", network: { name: "Visa" }, colour: "#3767A2", region: "US", faredrop_card_id: "", points_as_cash_conversion_ratio: 0.015, updatedAt: "2024-10-18T14:47:25.187Z", alternateRegions: [], logoUrl: "https://s3.us-east-1.amazonaws.com/awayz/card_logos/us-bank-white.svg" }], y = {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TServiceResponse } from '@type-op/shared';
|
|
2
2
|
import { ISignInParams, ISignUpParams } from '../../types/auth';
|
|
3
|
-
import { IAuthData, IClientDetails, IRegion, IResendVerificationEmailParams, ISearchLimitResponse, IUser } from './AccountServices.types';
|
|
3
|
+
import { IAuthData, IClientDetails, IRefreshAccessTokenResponse, IRegion, IResendVerificationEmailParams, ISearchLimitResponse, IUser } from './AccountServices.types';
|
|
4
|
+
export type { IRefreshAccessTokenQueueItem, IRefreshAccessTokenResponse } from './AccountServices.types';
|
|
4
5
|
export interface IClientUser {
|
|
5
6
|
_id: string;
|
|
6
7
|
email_address: string;
|
|
@@ -13,6 +14,9 @@ export interface IClientUser {
|
|
|
13
14
|
* AccountService provides methods for user authentication and account management.
|
|
14
15
|
*/
|
|
15
16
|
declare class _AccountService {
|
|
17
|
+
private isRefreshingAccessToken;
|
|
18
|
+
private refreshAccessTokenQueue;
|
|
19
|
+
private processRefreshAccessTokenQueue;
|
|
16
20
|
/**
|
|
17
21
|
* Logs in a user with the provided email and password.
|
|
18
22
|
*
|
|
@@ -67,6 +71,13 @@ declare class _AccountService {
|
|
|
67
71
|
* @returns A promise that resolves to a service response containing the user details.
|
|
68
72
|
*/
|
|
69
73
|
checkUser: () => Promise<TServiceResponse<IUser>>;
|
|
74
|
+
/**
|
|
75
|
+
* @description Shared queued access-token refresh for all auth consumers.
|
|
76
|
+
* This is the single place that coordinates concurrent refresh attempts so
|
|
77
|
+
* Axios requests and non-Axios consumers, like FlightStream SSE, do not run
|
|
78
|
+
* parallel refresh-token exchanges or race localStorage token writes.
|
|
79
|
+
*/
|
|
80
|
+
refreshAccessToken: () => Promise<IRefreshAccessTokenResponse>;
|
|
70
81
|
/**
|
|
71
82
|
* @description In the case of a 401 error, the refresh token is used to get a new access token and user details, by exchanging the
|
|
72
83
|
* refresh token for a new id_token and in turn exchanging that for a new awayz token
|
|
@@ -110,4 +121,3 @@ declare class _AccountService {
|
|
|
110
121
|
}>;
|
|
111
122
|
}
|
|
112
123
|
export declare const AccountService: _AccountService;
|
|
113
|
-
export {};
|
|
@@ -198,4 +198,17 @@ export interface IClientDetails {
|
|
|
198
198
|
exchangeRateBuffer: number;
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
|
+
export interface IRefreshAccessTokenResponse {
|
|
202
|
+
token: string;
|
|
203
|
+
data: {
|
|
204
|
+
token?: string;
|
|
205
|
+
accessToken?: string;
|
|
206
|
+
id_token?: string;
|
|
207
|
+
[key: string]: any;
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
export interface IRefreshAccessTokenQueueItem {
|
|
211
|
+
resolve: (response: IRefreshAccessTokenResponse) => void;
|
|
212
|
+
reject: (error: Error) => void;
|
|
213
|
+
}
|
|
201
214
|
export {};
|
|
@@ -114,4 +114,4 @@ export declare const processFailedRequests: (failedRequestsQueue: IFailedRequest
|
|
|
114
114
|
export declare const delay: (timeInMs: number) => Promise<unknown>;
|
|
115
115
|
export declare const executeWithDelay: <T>(fn: () => T | Promise<T>, timeInMs: number) => Promise<T>;
|
|
116
116
|
export declare const authFailurePostMessage: (action: "refresh_token" | "exchange_token", error: any) => void;
|
|
117
|
-
export declare const handleAxiosError: (
|
|
117
|
+
export declare const handleAxiosError: (error: AxiosError, clientRetryLimit: number, instance: any) => Promise<any>;
|
package/dist/main.js
CHANGED
|
@@ -1,58 +1,62 @@
|
|
|
1
1
|
import { FlightBooking as r } from "./components/Bookings/FlightBooking/FlightBooking.js";
|
|
2
2
|
import { HotelBooking as a } from "./components/Bookings/HotelBooking/HotelBooking.js";
|
|
3
3
|
import { CashValue as m } from "./components/CashValue/CashValue.js";
|
|
4
|
-
import { EInvalidAmountDisplayOption as i, EToolTipPosition as
|
|
4
|
+
import { EInvalidAmountDisplayOption as i, EToolTipPosition as f } from "./components/CashValue/CashValueTypes.js";
|
|
5
5
|
import { ClientPointsValue as x } from "./components/ClientPointsValue/ClientPointsValue.js";
|
|
6
6
|
import { Card as u } from "./components/Wallet/Card/Card.js";
|
|
7
|
-
import { awayzClient as
|
|
7
|
+
import { awayzClient as g } from "./configs/awayzClient.js";
|
|
8
8
|
import { defaultAwayzConfig as C } from "./configs/defaultAwayzConfig.js";
|
|
9
|
-
import { useAwayzContext as
|
|
10
|
-
import { useBookingManagement as
|
|
11
|
-
import { useSearchLimit as
|
|
12
|
-
import { ETripStatus as
|
|
13
|
-
import { useWallet as
|
|
9
|
+
import { useAwayzContext as A } from "./hooks/useAwayzContext.js";
|
|
10
|
+
import { useBookingManagement as w } from "./hooks/useBookingManagement/useBookingManagement.js";
|
|
11
|
+
import { useSearchLimit as S } from "./hooks/useSearchLimit.js";
|
|
12
|
+
import { ETripStatus as d, useTripManagement as v } from "./hooks/useTripManagement/useTripManagement.js";
|
|
13
|
+
import { useWallet as k } from "./hooks/useWallet/useWallet.js";
|
|
14
14
|
import { ECancelStatus as z } from "./hooks/useBookingManagement/useBookingManagement.types.js";
|
|
15
15
|
import { AwayzProvider as M } from "./providers/AwayzProvider.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
16
|
+
import { A as R, c as V, g as H, i as L } from "./AccountService-B582vLTc.js";
|
|
17
|
+
import { ESource as O } from "./services/account/AccountServices.types.js";
|
|
18
|
+
import { CurrencyService as W } from "./services/currency/CurrencyService.js";
|
|
19
|
+
import { clientNoRetryInstance as j } from "./services/noRetryInstance.js";
|
|
20
|
+
import { RewardsService as G } from "./services/rewards/RewardsService.js";
|
|
21
|
+
import { EBookingType as K } from "./services/trips/TripService.types.js";
|
|
22
|
+
import { EAuthFlow as X } from "./types/EAuthFlow.js";
|
|
23
|
+
import { convertCashToClientPoints as Z } from "./utils/clientPoints.js";
|
|
24
|
+
import { getCurrency as $ } from "./utils/currency.js";
|
|
25
|
+
import { EAmountsDisplayFeature as eo, EBookingPaymentMethod as ro, EThemeFeatureFlag as to, useFeatureFlags as ao } from "./hooks/useFeatureFlags.js";
|
|
26
|
+
import { getBaseUrl as mo } from "./configs/baseUrl.js";
|
|
25
27
|
export {
|
|
28
|
+
R as AccountService,
|
|
26
29
|
M as AwayzProvider,
|
|
27
30
|
u as Card,
|
|
28
31
|
m as CashValue,
|
|
29
32
|
x as ClientPointsValue,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
W as CurrencyService,
|
|
34
|
+
eo as EAmountsDisplayFeature,
|
|
35
|
+
X as EAuthFlow,
|
|
36
|
+
ro as EBookingPaymentMethod,
|
|
37
|
+
K as EBookingType,
|
|
35
38
|
z as ECancelStatus,
|
|
36
39
|
i as EInvalidAmountDisplayOption,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
O as ESource,
|
|
41
|
+
to as EThemeFeatureFlag,
|
|
42
|
+
f as EToolTipPosition,
|
|
43
|
+
d as ETripStatus,
|
|
40
44
|
r as FlightBooking,
|
|
41
45
|
a as HotelBooking,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
G as RewardsService,
|
|
47
|
+
g as awayzClient,
|
|
48
|
+
V as clientInstance,
|
|
49
|
+
j as clientNoRetryInstance,
|
|
50
|
+
Z as convertCashToClientPoints,
|
|
47
51
|
C as defaultAwayzConfig,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
H as gatewayInstance,
|
|
53
|
+
mo as getBaseUrl,
|
|
54
|
+
$ as getCurrency,
|
|
55
|
+
L as instance,
|
|
56
|
+
A as useAwayzContext,
|
|
57
|
+
w as useBookingManagement,
|
|
58
|
+
ao as useFeatureFlags,
|
|
59
|
+
S as useSearchLimit,
|
|
60
|
+
v as useTripManagement,
|
|
61
|
+
k as useWallet
|
|
58
62
|
};
|
|
@@ -3,23 +3,25 @@ import { QueryClientProvider as l } from "@tanstack/react-query";
|
|
|
3
3
|
import "../arrayExtensions-DlcBOj5a.js";
|
|
4
4
|
import { a as r } from "../keys-BcBfU51M.js";
|
|
5
5
|
import { useEffect as i } from "react";
|
|
6
|
-
import { setCustomBaseUrl as u, setBaseUrl as
|
|
7
|
-
import { defaultAwayzConfig as
|
|
6
|
+
import { setCustomBaseUrl as u, setBaseUrl as p } from "../configs/baseUrl.js";
|
|
7
|
+
import { defaultAwayzConfig as d } from "../configs/defaultAwayzConfig.js";
|
|
8
8
|
import { setGatewayBaseUrl as h } from "../configs/gatewayBaseUrl.js";
|
|
9
9
|
import { AwayzContext as w } from "../context/AwayzContext.js";
|
|
10
10
|
import { useAwayzAuth as n } from "../hooks/useAwayzAuth/useAwayzAuth.js";
|
|
11
11
|
import "react-i18next";
|
|
12
|
-
import '../assets/_styles4.css';import '../assets/
|
|
12
|
+
import '../assets/_styles4.css';import '../assets/_styles5.css';import '../assets/_styles7.css';import '../assets/_styles6.css';import '../assets/_styles2.css';import '../assets/_styles.css';import '../assets/_styles3.css';/* empty css */
|
|
13
13
|
/* empty css */
|
|
14
14
|
/* empty css */
|
|
15
15
|
import { awayzClient as y } from "../configs/awayzClient.js";
|
|
16
|
-
import "../
|
|
16
|
+
import "../AccountService-B582vLTc.js";
|
|
17
17
|
/* empty css */
|
|
18
18
|
/* empty css */
|
|
19
19
|
import "../index-Cv-wvFlM.js";
|
|
20
|
+
/* empty css */
|
|
20
21
|
/* empty css */
|
|
22
|
+
import "../services/noRetryInstance.js";
|
|
21
23
|
import { useFeatureFlags as A } from "../hooks/useFeatureFlags.js";
|
|
22
|
-
const
|
|
24
|
+
const H = ({ children: t, config: e }) => /* @__PURE__ */ o(l, { client: y, children: /* @__PURE__ */ o(F, { config: e, children: t }) }), F = ({ children: t, config: e }) => {
|
|
23
25
|
const a = n({
|
|
24
26
|
authFlow: e.authFlow,
|
|
25
27
|
onSuccess: e.onAuthSuccess,
|
|
@@ -32,14 +34,14 @@ const _ = ({ children: t, config: e }) => /* @__PURE__ */ o(l, { client: y, chil
|
|
|
32
34
|
console.error("You need to provide a client ID to the AwayzProvider");
|
|
33
35
|
return;
|
|
34
36
|
}
|
|
35
|
-
localStorage.setItem(r.CLIENT_ID, e.clientId), localStorage.setItem(r.AUTH_FLOW, e.authFlow), e.debugRefreshToken && e.testMode && (localStorage.setItem(r.REFRESH_TOKEN, e.debugRefreshToken), localStorage.setItem(r.TOKEN, e.debugRefreshToken)), e.overrideBaseUrl ? u(e.overrideBaseUrl) :
|
|
37
|
+
localStorage.setItem(r.CLIENT_ID, e.clientId), localStorage.setItem(r.AUTH_FLOW, e.authFlow), e.debugRefreshToken && e.testMode && (localStorage.setItem(r.REFRESH_TOKEN, e.debugRefreshToken), localStorage.setItem(r.TOKEN, e.debugRefreshToken)), e.overrideBaseUrl ? u(e.overrideBaseUrl) : p(e.testMode ?? !1), h(e.gatewayBaseUrl);
|
|
36
38
|
}, [e]), /* @__PURE__ */ o(
|
|
37
39
|
w.Provider,
|
|
38
40
|
{
|
|
39
41
|
value: {
|
|
40
42
|
...a,
|
|
41
43
|
config: {
|
|
42
|
-
...
|
|
44
|
+
...d,
|
|
43
45
|
...e
|
|
44
46
|
},
|
|
45
47
|
featureFlags: s,
|
|
@@ -50,5 +52,5 @@ const _ = ({ children: t, config: e }) => /* @__PURE__ */ o(l, { client: y, chil
|
|
|
50
52
|
);
|
|
51
53
|
};
|
|
52
54
|
export {
|
|
53
|
-
|
|
55
|
+
H as AwayzProvider
|
|
54
56
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
3
|
-
import { A } from "../../
|
|
3
|
+
import { A as a } from "../../AccountService-B582vLTc.js";
|
|
4
4
|
import "../../keys-BcBfU51M.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import "../../configs/awayzClient.js";
|
|
7
7
|
import "../../configs/endpoints.js";
|
|
8
|
+
import "../../types/EAuthFlow.js";
|
|
8
9
|
export {
|
|
9
|
-
|
|
10
|
+
a as AccountService
|
|
10
11
|
};
|
|
@@ -4,7 +4,7 @@ var c = (r, t, a) => f(r, typeof t != "symbol" ? t + "" : t, a);
|
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
5
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
6
6
|
import { t as y } from "../../numberUtils-B4wd-SGR.js";
|
|
7
|
-
import { c as l,
|
|
7
|
+
import { c as l, a as u, g as p } from "../../AccountService-B582vLTc.js";
|
|
8
8
|
import "react";
|
|
9
9
|
import { EBookingEndpoints as i } from "../../configs/endpoints.js";
|
|
10
10
|
const h = (r) => {
|
|
@@ -15,7 +15,7 @@ const h = (r) => {
|
|
|
15
15
|
} else
|
|
16
16
|
return r;
|
|
17
17
|
};
|
|
18
|
-
class
|
|
18
|
+
class A {
|
|
19
19
|
constructor() {
|
|
20
20
|
c(this, "getHotelBooking", async (t) => {
|
|
21
21
|
var s, e;
|
|
@@ -217,7 +217,7 @@ class b {
|
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
const $ = new
|
|
220
|
+
const $ = new A();
|
|
221
221
|
export {
|
|
222
222
|
$ as BookingService
|
|
223
223
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import '../../assets/_styles4.css';import '../../assets/
|
|
1
|
+
import '../../assets/_styles4.css';import '../../assets/_styles5.css';import '../../assets/_styles7.css';import '../../assets/_styles6.css';import '../../assets/_styles2.css';import '../../assets/_styles.css';import '../../assets/_styles3.css';var f = Object.defineProperty;
|
|
2
2
|
var l = (c, r, t) => r in c ? f(c, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[r] = t;
|
|
3
|
-
var
|
|
3
|
+
var n = (c, r, t) => l(c, typeof r != "symbol" ? r + "" : r, t);
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
5
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
6
|
-
import { A as i, E as u, c as
|
|
6
|
+
import { A as i, E as u, c as p } from "../../AccountService-B582vLTc.js";
|
|
7
7
|
import "react";
|
|
8
|
-
import { ECurrencyEndpoints as
|
|
8
|
+
import { ECurrencyEndpoints as y } from "../../configs/endpoints.js";
|
|
9
9
|
import "react-i18next";
|
|
10
10
|
/* empty css */
|
|
11
11
|
/* empty css */
|
|
@@ -14,16 +14,18 @@ import "@tanstack/react-query";
|
|
|
14
14
|
/* empty css */
|
|
15
15
|
/* empty css */
|
|
16
16
|
import "../../index-Cv-wvFlM.js";
|
|
17
|
+
/* empty css */
|
|
17
18
|
import "../../context/AwayzContext.js";
|
|
18
19
|
/* empty css */
|
|
19
20
|
import { awayzClient as m } from "../../configs/awayzClient.js";
|
|
21
|
+
import "../noRetryInstance.js";
|
|
20
22
|
class d {
|
|
21
23
|
constructor() {
|
|
22
|
-
|
|
24
|
+
n(this, "convertCurrency", async ({
|
|
23
25
|
baseCurrency: r,
|
|
24
26
|
targetCurrency: t
|
|
25
27
|
}) => {
|
|
26
|
-
var
|
|
28
|
+
var o;
|
|
27
29
|
try {
|
|
28
30
|
const { success: e, data: C } = await m.ensureQueryData({
|
|
29
31
|
queryKey: [u.CHECK_USER],
|
|
@@ -34,12 +36,12 @@ class d {
|
|
|
34
36
|
});
|
|
35
37
|
if (!e || !a)
|
|
36
38
|
throw new Error("Failed to fetch user data");
|
|
37
|
-
const { userRegion: E, preferences: _ } = C, { data: s } = await
|
|
39
|
+
const { userRegion: E, preferences: _ } = C, { data: s } = await p.post(y.CURRENCY_CONVERSION, {
|
|
38
40
|
target_currency: t ?? _.currency ?? E.currency,
|
|
39
41
|
base_currency: r
|
|
40
42
|
});
|
|
41
43
|
if (e && s.data)
|
|
42
|
-
return s.data.conversion_rate * (1 + (((
|
|
44
|
+
return s.data.conversion_rate * (1 + (((o = a.pointsAsCash) == null ? void 0 : o.exchangeRateBuffer) ?? 0));
|
|
43
45
|
} catch (e) {
|
|
44
46
|
console.error(e);
|
|
45
47
|
}
|
|
@@ -53,16 +55,16 @@ class d {
|
|
|
53
55
|
* @parm amount the amount to be converted from the base to the target currency
|
|
54
56
|
* @returns the converted amount
|
|
55
57
|
*/
|
|
56
|
-
|
|
58
|
+
n(this, "convertToCurrency", async ({
|
|
57
59
|
baseCurrency: r,
|
|
58
60
|
targetCurrency: t,
|
|
59
|
-
amount:
|
|
61
|
+
amount: o
|
|
60
62
|
}) => {
|
|
61
63
|
try {
|
|
62
|
-
const { data: e } = await
|
|
64
|
+
const { data: e } = await p.post(y.CURRENCY_CONVERSION, {
|
|
63
65
|
target_currency: t,
|
|
64
66
|
base_currency: r,
|
|
65
|
-
amount:
|
|
67
|
+
amount: o
|
|
66
68
|
});
|
|
67
69
|
if (e.success)
|
|
68
70
|
return e.data.conversion_result;
|
|
@@ -73,7 +75,7 @@ class d {
|
|
|
73
75
|
});
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
|
-
const
|
|
78
|
+
const L = new d();
|
|
77
79
|
export {
|
|
78
|
-
|
|
80
|
+
L as CurrencyService
|
|
79
81
|
};
|
package/dist/services/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { A as o, c as t, g as c, i as n } from "../AccountService-B582vLTc.js";
|
|
2
|
+
import { ESource as s } from "./account/AccountServices.types.js";
|
|
3
|
+
import { CurrencyService as p } from "./currency/CurrencyService.js";
|
|
4
|
+
import { clientNoRetryInstance as m } from "./noRetryInstance.js";
|
|
5
|
+
import { RewardsService as y } from "./rewards/RewardsService.js";
|
|
6
|
+
import { EBookingType as g } from "./trips/TripService.types.js";
|
|
5
7
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
o as AccountService,
|
|
9
|
+
p as CurrencyService,
|
|
10
|
+
g as EBookingType,
|
|
11
|
+
s as ESource,
|
|
12
|
+
y as RewardsService,
|
|
9
13
|
t as clientInstance,
|
|
10
|
-
|
|
14
|
+
m as clientNoRetryInstance,
|
|
11
15
|
c as gatewayInstance,
|
|
12
|
-
|
|
16
|
+
n as instance
|
|
13
17
|
};
|