@odynn/awayz-core 0.10.13 → 0.10.14
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/{TripsService-BVsAk5Ky.js → TripsService-PQeXLB1p.js} +1 -1
- package/dist/components/CashValue/CashValue.js +1 -1
- package/dist/components/CashValue/CashValue.stories.js +1 -1
- package/dist/components/ClientPointsValue/ClientPointsValue.js +1 -1
- package/dist/components/Wallet/Card/Card.stories.js +1 -1
- package/dist/configs/endpoints.js +1 -1
- package/dist/context/AwayzContext.js +1 -0
- package/dist/hooks/useAwayzAuth/useAwayzAuth.js +110 -99
- package/dist/hooks/useBookingManagement/useBookingManagement.js +1 -1
- package/dist/hooks/useBookingManagement/useBookingManagement.test.js +1 -1
- package/dist/hooks/useFeatureFlags.js +1 -1
- package/dist/hooks/useSearchLimit.js +1 -1
- package/dist/hooks/useTripManagement/useTripManagement.js +2 -2
- package/dist/hooks/useTripManagement/useTripManagement.test.js +2 -2
- package/dist/hooks/useWallet/useWallet.js +1 -1
- package/dist/hooks/useWallet/useWallet.test.js +1 -1
- package/dist/lib/configs/endpoints.d.ts +1 -0
- package/dist/lib/context/AwayzContext.d.ts +1 -0
- package/dist/lib/hooks/useAwayzAuth/useAwayzAuth.d.ts +9 -5
- package/dist/lib/services/account/AccountService.d.ts +9 -0
- package/dist/main.js +1 -1
- package/dist/{noRetryInstance-C4bqpBc7.js → noRetryInstance-CbNDzU_c.js} +111 -96
- package/dist/providers/AwayzProvider.js +1 -1
- package/dist/services/account/AccountService.js +1 -1
- package/dist/services/bookings/BookingService.js +1 -1
- package/dist/services/currency/CurrencyService.js +1 -1
- package/dist/services/features/featureService.js +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/instance.js +1 -1
- package/dist/services/instanceConfig.js +1 -1
- package/dist/services/noRetryInstance.js +1 -1
- 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 +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ var v = Object.defineProperty;
|
|
|
2
2
|
var f = (r, e, a) => e in r ? v(r, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : r[e] = a;
|
|
3
3
|
var n = (r, e, a) => f(r, typeof e != "symbol" ? e + "" : e, a);
|
|
4
4
|
import "./arrayExtensions-DlcBOj5a.js";
|
|
5
|
-
import { c as i, f as u, b as d, r as D } from "./noRetryInstance-
|
|
5
|
+
import { c as i, f as u, b as d, r as D } from "./noRetryInstance-CbNDzU_c.js";
|
|
6
6
|
import "react";
|
|
7
7
|
import { DEFAULT_LOGO as S } from "./configs/defaultAwayzConfig.js";
|
|
8
8
|
import { EMyTripsEndpoints as o } from "./configs/endpoints.js";
|
|
@@ -2,7 +2,7 @@ import { jsx as r, jsxs as l } from "react/jsx-runtime";
|
|
|
2
2
|
import { useQuery as R } from "@tanstack/react-query";
|
|
3
3
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
4
4
|
import { g as m, a as _, b as N } from "../../cashUtils-DnCt66eB.js";
|
|
5
|
-
import { E as S } from "../../noRetryInstance-
|
|
5
|
+
import { E as S } from "../../noRetryInstance-CbNDzU_c.js";
|
|
6
6
|
import { useMemo as T } from "react";
|
|
7
7
|
import { a as f } from "../../index-C8p5kinH.js";
|
|
8
8
|
import "react-i18next";
|
|
@@ -9,7 +9,7 @@ import { CashValue as n } from "./CashValue.js";
|
|
|
9
9
|
import { EToolTipPosition as t, EInvalidAmountDisplayOption as o } from "./CashValueTypes.js";
|
|
10
10
|
import "@tanstack/react-query";
|
|
11
11
|
import "../../context/AwayzContext.js";
|
|
12
|
-
import "../../noRetryInstance-
|
|
12
|
+
import "../../noRetryInstance-CbNDzU_c.js";
|
|
13
13
|
import "../../configs/awayzClient.js";
|
|
14
14
|
/* empty css */
|
|
15
15
|
import { AwayzProvider as a } from "../../providers/AwayzProvider.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as c } from "react/jsx-runtime";
|
|
2
2
|
import { useQuery as p } from "@tanstack/react-query";
|
|
3
3
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
4
|
-
import { E as u } from "../../noRetryInstance-
|
|
4
|
+
import { E as u } from "../../noRetryInstance-CbNDzU_c.js";
|
|
5
5
|
import { useMemo as f } from "react";
|
|
6
6
|
import { useAwayzContext as l } from "../../hooks/useAwayzContext.js";
|
|
7
7
|
import "react-i18next";
|
|
@@ -7,7 +7,7 @@ import '../../../assets/_styles6.css';import '../../../assets/_styles5.css';impo
|
|
|
7
7
|
/* empty css */
|
|
8
8
|
import "@tanstack/react-query";
|
|
9
9
|
import "../../../configs/awayzClient.js";
|
|
10
|
-
import "../../../noRetryInstance-
|
|
10
|
+
import "../../../noRetryInstance-CbNDzU_c.js";
|
|
11
11
|
/* empty css */
|
|
12
12
|
/* empty css */
|
|
13
13
|
import "../../../index-Cv-wvFlM.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var r = /* @__PURE__ */ ((e) => (e.SIGN_IN = "auth/user-login", e.SIGN_UP = "auth/sign-up", e.GOOGLE_AUTH = "/auth/google-user", e.ME = "user", e.RESEND_VERIFICATION_EMAIL = "auth/resend-verification-email", e.UPDATE_USER_DETAILS = "account/update/user", e.CONFIRM_EMAIL = "account/verifyAccount", e.FORGOT_PASSWORD = "email/sendVeri", e.RESEND_OTP = "email/sendForgotPasswordVerification", e.RESET_PASSWORD = "account/updateUserPassword", e.REQUEST_LIMIT = "user/request-limit", e.APPLE_SOCIAL_SIGN_UP = "tp/apple/get/user", e.GOOGLE_SOCIAL_SIGN_UP = "tp/google/get/user", e.UPDATE_USER = "account/details/addUserDetails", e.ACKNOWLEDGEMENT = "account/update/userAcknowledgement", e.REGIONS = "user/region", e.UPDATE_USER_REGION = "/account/update/userRegion", e.UPDATE_PASSENGER_DETAILS = "/account/awayz", e.REFRESH_TOKEN = "auth/refresh-token", e.EXCHANGE_TOKEN = "user/exchange-token", e.REFRESH_EMBED_TOKEN = "user/refresh-token", e.OAUTH_INITIATE = "user/oauth2/initiate", e.OAUTH_CALLBACK = "user/oauth2/callback", e.FEATURES = "/user/features", e.CLIENT = "/clients/embed-data", e))(r || {}), a = /* @__PURE__ */ ((e) => (e.CURRENCY_CONVERSION = "currency/convert", e))(a || {}), _ = /* @__PURE__ */ ((e) => (e.USER_AWARDS = "user/rewards", e.LINKED_USER_AWARDS = "user/rewards/user-linked", e.USER_CARDS = "user/cards", e.ADD_USER_CARDS = "user/cards/add", e.REMOVE_USER_CARDS = "user/cards/remove", e.BANKS = "banks", e.CARDS = "cards", e.POINTS_AS_CASH = "/points-as-cash/available-points", e))(_ || {}), S = /* @__PURE__ */ ((e) => (e.TRIPS = "user/trips", e.ADD_BOOKING = "user/trips/add-booking-to-trip", e.REMOVE_BOOKING = "user/trips/remove-booking-from-trip", e.UNCATEGORISED_BOOKINGS = "/user/trips/get-uncategorized-bookings", e))(S || {}), O = /* @__PURE__ */ ((e) => (e.USER_HOTEL_BOOKINGS = "/user/bookings/hotels", e.USER_FLIGHT_BOOKINGS = "/user/bookings/flights", e.INITIATE_FLIGHT_CANCEL = "/duffel/flights/initiate-order-cancellation", e.CONFIRM_FLIGHT_CANCEL = "/duffel/flights/confirm-order-cancellation", e.CANCEL_HOTEL_BOOKING = "/duffel/hotels/cancel", e.ACTION_AIRLINE_CHANGES = "/user/bookings/flights/action-airline-initiated-changes", e.REFUND_POINTS_BOOKING = "/points-as-cash/refund-booking", e.BOOKING_POINTS_AS_CASH = "/points-as-cash", e))(O || {}), I = /* @__PURE__ */ ((e) => (e.POINTS_PER_CENT = "/user/rewards/points-per-cent", e))(I || {}), N = /* @__PURE__ */ ((e) => (e.USER_PREFERENCES = "/user/user-preferences", e))(N || {});
|
|
1
|
+
var r = /* @__PURE__ */ ((e) => (e.SIGN_IN = "auth/user-login", e.SIGN_UP = "auth/sign-up", e.GOOGLE_AUTH = "/auth/google-user", e.ME = "user", e.RESEND_VERIFICATION_EMAIL = "auth/resend-verification-email", e.UPDATE_USER_DETAILS = "account/update/user", e.CONFIRM_EMAIL = "account/verifyAccount", e.FORGOT_PASSWORD = "email/sendVeri", e.RESEND_OTP = "email/sendForgotPasswordVerification", e.RESET_PASSWORD = "account/updateUserPassword", e.REQUEST_LIMIT = "user/request-limit", e.APPLE_SOCIAL_SIGN_UP = "tp/apple/get/user", e.GOOGLE_SOCIAL_SIGN_UP = "tp/google/get/user", e.UPDATE_USER = "account/details/addUserDetails", e.ACKNOWLEDGEMENT = "account/update/userAcknowledgement", e.REGIONS = "user/region", e.UPDATE_USER_REGION = "/account/update/userRegion", e.UPDATE_PASSENGER_DETAILS = "/account/awayz", e.OTP = "auth/login/otp/verify", e.REFRESH_TOKEN = "auth/refresh-token", e.EXCHANGE_TOKEN = "user/exchange-token", e.REFRESH_EMBED_TOKEN = "user/refresh-token", e.OAUTH_INITIATE = "user/oauth2/initiate", e.OAUTH_CALLBACK = "user/oauth2/callback", e.FEATURES = "/user/features", e.CLIENT = "/clients/embed-data", e))(r || {}), a = /* @__PURE__ */ ((e) => (e.CURRENCY_CONVERSION = "currency/convert", e))(a || {}), _ = /* @__PURE__ */ ((e) => (e.USER_AWARDS = "user/rewards", e.LINKED_USER_AWARDS = "user/rewards/user-linked", e.USER_CARDS = "user/cards", e.ADD_USER_CARDS = "user/cards/add", e.REMOVE_USER_CARDS = "user/cards/remove", e.BANKS = "banks", e.CARDS = "cards", e.POINTS_AS_CASH = "/points-as-cash/available-points", e))(_ || {}), S = /* @__PURE__ */ ((e) => (e.TRIPS = "user/trips", e.ADD_BOOKING = "user/trips/add-booking-to-trip", e.REMOVE_BOOKING = "user/trips/remove-booking-from-trip", e.UNCATEGORISED_BOOKINGS = "/user/trips/get-uncategorized-bookings", e))(S || {}), O = /* @__PURE__ */ ((e) => (e.USER_HOTEL_BOOKINGS = "/user/bookings/hotels", e.USER_FLIGHT_BOOKINGS = "/user/bookings/flights", e.INITIATE_FLIGHT_CANCEL = "/duffel/flights/initiate-order-cancellation", e.CONFIRM_FLIGHT_CANCEL = "/duffel/flights/confirm-order-cancellation", e.CANCEL_HOTEL_BOOKING = "/duffel/hotels/cancel", e.ACTION_AIRLINE_CHANGES = "/user/bookings/flights/action-airline-initiated-changes", e.REFUND_POINTS_BOOKING = "/points-as-cash/refund-booking", e.BOOKING_POINTS_AS_CASH = "/points-as-cash", e))(O || {}), I = /* @__PURE__ */ ((e) => (e.POINTS_PER_CENT = "/user/rewards/points-per-cent", e))(I || {}), N = /* @__PURE__ */ ((e) => (e.USER_PREFERENCES = "/user/user-preferences", e))(N || {});
|
|
2
2
|
export {
|
|
3
3
|
r as EAuthEndpoints,
|
|
4
4
|
O as EBookingEndpoints,
|
|
@@ -8,6 +8,7 @@ const a = e({
|
|
|
8
8
|
featureFlagsLoaded: !1,
|
|
9
9
|
signIn: async () => ({ success: !1, message: "No Awayz Context" }),
|
|
10
10
|
signUp: async () => ({ success: !1, message: "No Awayz Context" }),
|
|
11
|
+
verify2FA: async () => ({ success: !1, message: "No Awayz Context" }),
|
|
11
12
|
signOut: () => {
|
|
12
13
|
},
|
|
13
14
|
continueWithGoogle: async () => ({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
2
|
-
import { c as
|
|
3
|
-
import { e as
|
|
4
|
-
import { a as
|
|
5
|
-
import { useState as f, useCallback as
|
|
6
|
-
import { awayzClient as
|
|
2
|
+
import { c as P } from "../../cashUtils-DnCt66eB.js";
|
|
3
|
+
import { e as M, A as m, E as N } from "../../noRetryInstance-CbNDzU_c.js";
|
|
4
|
+
import { a as i } from "../../keys-BcBfU51M.js";
|
|
5
|
+
import { useState as f, useCallback as F, useEffect as T } from "react";
|
|
6
|
+
import { awayzClient as R } from "../../configs/awayzClient.js";
|
|
7
7
|
import { PreferencesService as q } from "../../services/preferences/PreferencesService.js";
|
|
8
8
|
import "@tanstack/react-query";
|
|
9
9
|
import "react/jsx-runtime";
|
|
@@ -16,57 +16,57 @@ import '../../assets/_styles4.css';import '../../assets/_styles6.css';import '..
|
|
|
16
16
|
import "../../index-Cv-wvFlM.js";
|
|
17
17
|
import "../../context/AwayzContext.js";
|
|
18
18
|
/* empty css */
|
|
19
|
-
import { EAuthFlow as
|
|
20
|
-
const x = (
|
|
21
|
-
var
|
|
22
|
-
let
|
|
23
|
-
typeof c == "string" ?
|
|
19
|
+
import { EAuthFlow as k } from "../../types/EAuthFlow.js";
|
|
20
|
+
const x = (t, c) => {
|
|
21
|
+
var d, w;
|
|
22
|
+
let u = "", y = c;
|
|
23
|
+
typeof c == "string" ? u = c : c instanceof M ? (u = c.message, y = {
|
|
24
24
|
message: c.message,
|
|
25
25
|
cause: c.cause,
|
|
26
26
|
status: c.status,
|
|
27
|
-
data: (
|
|
28
|
-
}) :
|
|
27
|
+
data: (d = c == null ? void 0 : c.response) == null ? void 0 : d.data
|
|
28
|
+
}) : u = c.message, (w = window.parent) == null || w.postMessage(
|
|
29
29
|
{
|
|
30
30
|
type: "auth_error",
|
|
31
|
-
details: { message:
|
|
31
|
+
details: { message: u, action: t, info: y }
|
|
32
32
|
},
|
|
33
33
|
"*"
|
|
34
34
|
);
|
|
35
|
-
}, fe = (
|
|
36
|
-
const [c,
|
|
37
|
-
async (
|
|
38
|
-
|
|
35
|
+
}, fe = (t) => {
|
|
36
|
+
const [c, u] = f(!0), [y, d] = f(!1), [w, O] = f(), [o, S] = f(), [p, I] = f([]), [C, _] = f([]), g = F(
|
|
37
|
+
async (s) => {
|
|
38
|
+
t != null && t.onSuccess && (t == null || t.onSuccess(s)), t != null && t.onSuccessAsync && await (t == null ? void 0 : t.onSuccessAsync(s)), u(!1), d(!0), O(s.token), S(s.user), R.invalidateQueries();
|
|
39
39
|
},
|
|
40
|
-
[
|
|
41
|
-
),
|
|
42
|
-
async (
|
|
43
|
-
if (
|
|
44
|
-
return x(e ?? "exchange_token",
|
|
45
|
-
|
|
40
|
+
[t]
|
|
41
|
+
), l = F(
|
|
42
|
+
async (s, e) => {
|
|
43
|
+
if (t.authFlow !== k.POST_MESSAGE)
|
|
44
|
+
return x(e ?? "exchange_token", s);
|
|
45
|
+
t != null && t.onError && (t == null || t.onError(s)), t != null && t.onErrorAsync && await (t == null ? void 0 : t.onErrorAsync(s)), u(!1);
|
|
46
46
|
},
|
|
47
|
-
[
|
|
48
|
-
),
|
|
47
|
+
[t]
|
|
48
|
+
), A = async (s, e, r) => {
|
|
49
49
|
try {
|
|
50
|
-
const { success: a, data: n, message:
|
|
51
|
-
|
|
50
|
+
const { success: a, data: n, message: h } = await m.authenticateWithToken(
|
|
51
|
+
s,
|
|
52
52
|
e,
|
|
53
53
|
r
|
|
54
54
|
);
|
|
55
55
|
if (!a) {
|
|
56
|
-
|
|
56
|
+
l(h);
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
59
|
if (!(n != null && n.token)) {
|
|
60
|
-
|
|
60
|
+
l("no awayz token returned after exchanging id token");
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
|
-
localStorage.setItem(
|
|
64
|
-
const { data:
|
|
63
|
+
localStorage.setItem(i.TOKEN, n.token), await g(n);
|
|
64
|
+
const { data: E, ...K } = await m.getRequestLimit();
|
|
65
65
|
if (!K.success) {
|
|
66
66
|
console.error({ reqLimitError: K });
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
E == null || E.forEach(
|
|
70
70
|
(H) => window.parent.postMessage(
|
|
71
71
|
{
|
|
72
72
|
type: "request_limit",
|
|
@@ -78,140 +78,151 @@ const x = (s, c) => {
|
|
|
78
78
|
} catch (a) {
|
|
79
79
|
console.error("error handling message", a);
|
|
80
80
|
} finally {
|
|
81
|
-
|
|
81
|
+
u(!1);
|
|
82
82
|
}
|
|
83
83
|
}, v = async () => {
|
|
84
84
|
try {
|
|
85
|
-
const { success:
|
|
85
|
+
const { success: s, data: e } = await R.ensureQueryData({
|
|
86
86
|
queryKey: [N.CHECK_USER],
|
|
87
|
-
queryFn:
|
|
87
|
+
queryFn: m.checkUser
|
|
88
88
|
});
|
|
89
|
-
if (!
|
|
90
|
-
|
|
89
|
+
if (!s) {
|
|
90
|
+
l(e);
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
|
-
await
|
|
93
|
+
await g({
|
|
94
94
|
user: e,
|
|
95
|
-
token: localStorage.getItem(
|
|
95
|
+
token: localStorage.getItem(i.TOKEN)
|
|
96
96
|
});
|
|
97
|
-
} catch (
|
|
98
|
-
|
|
97
|
+
} catch (s) {
|
|
98
|
+
l(s);
|
|
99
99
|
} finally {
|
|
100
|
-
|
|
100
|
+
u(!1);
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
|
-
|
|
104
|
-
if (
|
|
105
|
-
localStorage.getItem(
|
|
103
|
+
T(() => {
|
|
104
|
+
if (t.authFlow !== k.STANDARD) return;
|
|
105
|
+
localStorage.getItem(i.TOKEN) ? v() : u(!1);
|
|
106
106
|
}, []);
|
|
107
107
|
const U = async () => {
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
const e =
|
|
108
|
+
const s = await m.getRegions();
|
|
109
|
+
I(s);
|
|
110
|
+
const e = s.map((n) => n.currency), a = Array.from(new Set(e)).map((n) => ({
|
|
111
111
|
code: n,
|
|
112
|
-
symbol:
|
|
112
|
+
symbol: P(n) || n
|
|
113
113
|
}));
|
|
114
|
-
|
|
114
|
+
_(a);
|
|
115
115
|
};
|
|
116
|
-
return
|
|
116
|
+
return T(() => {
|
|
117
117
|
U();
|
|
118
|
-
}, []),
|
|
119
|
-
if (
|
|
120
|
-
const
|
|
121
|
-
let a = (
|
|
122
|
-
e &&
|
|
123
|
-
}, []),
|
|
124
|
-
if (
|
|
125
|
-
const
|
|
126
|
-
var
|
|
118
|
+
}, []), T(() => {
|
|
119
|
+
if (t.authFlow !== k.QUERY) return;
|
|
120
|
+
const s = new URLSearchParams(window.location.search), e = s.get(i.TOKEN), r = s.get(i.REFRESH_TOKEN);
|
|
121
|
+
let a = (t.isTestMode ? s.get(i.OVERRIDE_TOKEN_EXCHANGE_ENDPOINT) : void 0) || void 0;
|
|
122
|
+
e && A(e, r ?? "", a);
|
|
123
|
+
}, []), T(() => {
|
|
124
|
+
if (t.authFlow !== k.POST_MESSAGE) return;
|
|
125
|
+
const s = async (e) => {
|
|
126
|
+
var h;
|
|
127
127
|
if (e.data.type !== "auth") return;
|
|
128
|
-
const r = (
|
|
128
|
+
const r = (h = e.data) == null ? void 0 : h.idToken, a = e.data.refreshToken, n = t.isTestMode ? e.data.overrideTokenExchangeEndpoint : void 0;
|
|
129
129
|
if (!r) {
|
|
130
|
-
const
|
|
130
|
+
const E = `received message ${JSON.stringify(
|
|
131
131
|
e.data
|
|
132
132
|
)}
|
|
133
133
|
no idToken in body`;
|
|
134
|
-
|
|
134
|
+
l(E);
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
|
-
localStorage.setItem(
|
|
137
|
+
localStorage.setItem(i.REFRESH_TOKEN, a), await A(r, a, n);
|
|
138
138
|
};
|
|
139
|
-
return window.addEventListener("message",
|
|
139
|
+
return window.addEventListener("message", s), window.parent && window.parent.postMessage(
|
|
140
140
|
{
|
|
141
141
|
type: "ready"
|
|
142
142
|
/* READY */
|
|
143
143
|
},
|
|
144
144
|
"*"
|
|
145
145
|
), () => {
|
|
146
|
-
window.removeEventListener("message",
|
|
146
|
+
window.removeEventListener("message", s);
|
|
147
147
|
};
|
|
148
148
|
}, []), {
|
|
149
149
|
isAuthenticating: c,
|
|
150
150
|
isAuthenticated: y,
|
|
151
|
-
token:
|
|
152
|
-
user:
|
|
151
|
+
token: w,
|
|
152
|
+
user: o,
|
|
153
153
|
supportedRegions: p,
|
|
154
|
-
supportedCurrencies:
|
|
155
|
-
signIn: async (
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if (!e.success)
|
|
159
|
-
u(e.message);
|
|
160
|
-
else {
|
|
161
|
-
const a = (r = e.data) == null ? void 0 : r.refreshToken;
|
|
162
|
-
localStorage.setItem(o.REFRESH_TOKEN, a), await E(e.data);
|
|
163
|
-
}
|
|
164
|
-
return e;
|
|
154
|
+
supportedCurrencies: C,
|
|
155
|
+
signIn: async (s) => {
|
|
156
|
+
const e = await m.login(s);
|
|
157
|
+
return e.success ? (S(e.data.user), { success: !0, message: "OTP sent to email" }) : (l(e.message), { success: !1, message: e.message });
|
|
165
158
|
},
|
|
166
|
-
signUp: async (
|
|
159
|
+
signUp: async (s) => {
|
|
167
160
|
var r;
|
|
168
|
-
const e = await
|
|
161
|
+
const e = await m.signUp(s);
|
|
169
162
|
if (!e.success)
|
|
170
|
-
|
|
163
|
+
l(e.message);
|
|
171
164
|
else {
|
|
172
165
|
const a = (r = e.data) == null ? void 0 : r.refreshToken;
|
|
173
|
-
localStorage.setItem(
|
|
166
|
+
localStorage.setItem(i.REFRESH_TOKEN, a), await g(e.data);
|
|
174
167
|
}
|
|
175
168
|
return e;
|
|
176
169
|
},
|
|
177
170
|
signOut: () => {
|
|
178
|
-
localStorage.removeItem(
|
|
171
|
+
localStorage.removeItem(i.TOKEN), localStorage.removeItem(i.REFRESH_TOKEN), d(!1), O(void 0), S(void 0);
|
|
179
172
|
},
|
|
180
|
-
continueWithGoogle: async (
|
|
173
|
+
continueWithGoogle: async (s, e) => {
|
|
181
174
|
var a;
|
|
182
|
-
const r = await
|
|
183
|
-
|
|
175
|
+
const r = await m.getOrCreateGoogleUser(
|
|
176
|
+
s,
|
|
184
177
|
e
|
|
185
178
|
);
|
|
186
179
|
if (!r.success)
|
|
187
|
-
|
|
180
|
+
l(r.message);
|
|
188
181
|
else {
|
|
189
182
|
const n = (a = r.data) == null ? void 0 : a.refreshToken;
|
|
190
|
-
localStorage.setItem(
|
|
183
|
+
localStorage.setItem(i.REFRESH_TOKEN, n), await g(r.data);
|
|
191
184
|
}
|
|
192
185
|
return r;
|
|
193
186
|
},
|
|
194
|
-
resendVerificationEmail: async (
|
|
195
|
-
setTokens: (
|
|
196
|
-
localStorage.setItem(
|
|
187
|
+
resendVerificationEmail: async (s) => (await m.resendVerificationEmail(s)).success,
|
|
188
|
+
setTokens: (s, e) => {
|
|
189
|
+
localStorage.setItem(i.TOKEN, s), localStorage.setItem(i.REFRESH_TOKEN, e), A(s, e);
|
|
197
190
|
},
|
|
198
|
-
setPreferredCurrency: async (
|
|
199
|
-
const e = await q.setCurrency(
|
|
191
|
+
setPreferredCurrency: async (s) => {
|
|
192
|
+
const e = await q.setCurrency(s);
|
|
200
193
|
if (!e.success || !e.data)
|
|
201
194
|
return console.error("Failed to set preferred currency:", e), !1;
|
|
202
|
-
if (
|
|
195
|
+
if (o) {
|
|
203
196
|
const r = {
|
|
204
|
-
...
|
|
197
|
+
...o,
|
|
205
198
|
preferences: {
|
|
206
|
-
...
|
|
207
|
-
currency: e.data.currency ||
|
|
199
|
+
...o.preferences,
|
|
200
|
+
currency: e.data.currency || o.preferences.currency
|
|
208
201
|
}
|
|
209
202
|
};
|
|
210
|
-
|
|
203
|
+
S(r), R.invalidateQueries({
|
|
211
204
|
queryKey: [N.CHECK_USER]
|
|
212
205
|
});
|
|
213
206
|
}
|
|
214
207
|
return !0;
|
|
208
|
+
},
|
|
209
|
+
verify2FA: async (s) => {
|
|
210
|
+
var r;
|
|
211
|
+
if (!(o != null && o.emailAddress)) {
|
|
212
|
+
const a = "No email address associated with user for 2FA verification";
|
|
213
|
+
return l(a), {
|
|
214
|
+
success: !1,
|
|
215
|
+
message: a
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
const e = await m.validate2FA(o == null ? void 0 : o.emailAddress, s);
|
|
219
|
+
if (!e.success)
|
|
220
|
+
l(e.message);
|
|
221
|
+
else {
|
|
222
|
+
const a = (r = e.data) == null ? void 0 : r.refreshToken;
|
|
223
|
+
localStorage.setItem(i.REFRESH_TOKEN, a), await g(e.data);
|
|
224
|
+
}
|
|
225
|
+
return e;
|
|
215
226
|
}
|
|
216
227
|
};
|
|
217
228
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useQuery as g, useMutation as u } from "@tanstack/react-query";
|
|
2
2
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
3
|
-
import { E as s } from "../../noRetryInstance-
|
|
3
|
+
import { E as s } from "../../noRetryInstance-CbNDzU_c.js";
|
|
4
4
|
import { useState as M } from "react";
|
|
5
5
|
import "react/jsx-runtime";
|
|
6
6
|
import "react-i18next";
|
|
@@ -10,7 +10,7 @@ import "@tanstack/react-query";
|
|
|
10
10
|
/* empty css */
|
|
11
11
|
/* empty css */
|
|
12
12
|
import "../../index-Cv-wvFlM.js";
|
|
13
|
-
import { c } from "../../noRetryInstance-
|
|
13
|
+
import { c } from "../../noRetryInstance-CbNDzU_c.js";
|
|
14
14
|
import "../../context/AwayzContext.js";
|
|
15
15
|
import { useBookingManagement as t } from "./useBookingManagement.js";
|
|
16
16
|
import "../../configs/awayzClient.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useQuery as O } from "@tanstack/react-query";
|
|
2
2
|
import "../arrayExtensions-DlcBOj5a.js";
|
|
3
|
-
import { E as r, t as F } from "../noRetryInstance-
|
|
3
|
+
import { E as r, t as F } from "../noRetryInstance-CbNDzU_c.js";
|
|
4
4
|
import { useMemo as N } from "react";
|
|
5
5
|
import { FeatureService as e } from "../services/features/featureService.js";
|
|
6
6
|
const L = [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useQuery as u } from "@tanstack/react-query";
|
|
2
2
|
import "../arrayExtensions-DlcBOj5a.js";
|
|
3
|
-
import { E as m, A as c, b as f } from "../noRetryInstance-
|
|
3
|
+
import { E as m, A as c, b as f } from "../noRetryInstance-CbNDzU_c.js";
|
|
4
4
|
import { useEffect as d } from "react";
|
|
5
5
|
import { useAwayzContext as y } from "./useAwayzContext.js";
|
|
6
6
|
var i = /* @__PURE__ */ ((r) => (r.HOTEL = "Hotel", r.FLIGHT = "Flight", r))(i || {});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useQuery as u, useMutation as p } from "@tanstack/react-query";
|
|
2
2
|
import { h as m } from "../../arrayExtensions-DlcBOj5a.js";
|
|
3
|
-
import { E as e } from "../../noRetryInstance-
|
|
3
|
+
import { E as e } from "../../noRetryInstance-CbNDzU_c.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "react/jsx-runtime";
|
|
6
6
|
import "react-i18next";
|
|
@@ -13,7 +13,7 @@ import { awayzClient as o } from "../../configs/awayzClient.js";
|
|
|
13
13
|
import "../../index-Cv-wvFlM.js";
|
|
14
14
|
import "../../context/AwayzContext.js";
|
|
15
15
|
/* empty css */
|
|
16
|
-
import { T as n } from "../../TripsService-
|
|
16
|
+
import { T as n } from "../../TripsService-PQeXLB1p.js";
|
|
17
17
|
const b = ({
|
|
18
18
|
tripId: t,
|
|
19
19
|
tripDetails: s
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h as p } from "../../arrayExtensions-DlcBOj5a.js";
|
|
2
|
-
import { D as f } from "../../TripsService-
|
|
2
|
+
import { D as f } from "../../TripsService-PQeXLB1p.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import { renderHook as o, waitFor as i } from "../../tests/TestWrapper.js";
|
|
5
5
|
import { EMyTripsEndpoints as c } from "../../configs/endpoints.js";
|
|
@@ -10,7 +10,7 @@ import '../../assets/_styles4.css';import '../../assets/_styles6.css';import '..
|
|
|
10
10
|
/* empty css */
|
|
11
11
|
import "@tanstack/react-query";
|
|
12
12
|
import "../../configs/awayzClient.js";
|
|
13
|
-
import { c as d } from "../../noRetryInstance-
|
|
13
|
+
import { c as d } from "../../noRetryInstance-CbNDzU_c.js";
|
|
14
14
|
/* empty css */
|
|
15
15
|
/* empty css */
|
|
16
16
|
import "../../index-Cv-wvFlM.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useQuery as n, useMutation as s } from "@tanstack/react-query";
|
|
2
2
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
3
|
-
import { E as a, d as u } from "../../noRetryInstance-
|
|
3
|
+
import { E as a, d as u } from "../../noRetryInstance-CbNDzU_c.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "react/jsx-runtime";
|
|
6
6
|
import "react-i18next";
|
|
@@ -8,7 +8,7 @@ import '../../assets/_styles4.css';import '../../assets/_styles6.css';import '..
|
|
|
8
8
|
/* empty css */
|
|
9
9
|
import "@tanstack/react-query";
|
|
10
10
|
import "../../configs/awayzClient.js";
|
|
11
|
-
import { c as l } from "../../noRetryInstance-
|
|
11
|
+
import { c as l } from "../../noRetryInstance-CbNDzU_c.js";
|
|
12
12
|
/* empty css */
|
|
13
13
|
/* empty css */
|
|
14
14
|
import "../../index-Cv-wvFlM.js";
|
|
@@ -17,6 +17,7 @@ export declare enum EAuthEndpoints {
|
|
|
17
17
|
REGIONS = "user/region",
|
|
18
18
|
UPDATE_USER_REGION = "/account/update/userRegion",
|
|
19
19
|
UPDATE_PASSENGER_DETAILS = "/account/awayz",
|
|
20
|
+
OTP = "auth/login/otp/verify",
|
|
20
21
|
REFRESH_TOKEN = "auth/refresh-token",
|
|
21
22
|
EXCHANGE_TOKEN = "user/exchange-token",
|
|
22
23
|
REFRESH_EMBED_TOKEN = "user/refresh-token",
|
|
@@ -15,6 +15,7 @@ export interface IAwayzContext {
|
|
|
15
15
|
supportedCurrencies: ISupportedCurrency[];
|
|
16
16
|
signIn: (params: ISignInParams) => Promise<TAuthResponse>;
|
|
17
17
|
signUp: (params: ISignUpParams) => Promise<TAuthResponse>;
|
|
18
|
+
verify2FA: (otp: string) => Promise<TAuthResponse>;
|
|
18
19
|
signOut: () => void;
|
|
19
20
|
continueWithGoogle: (googleAccessToken: string, region: string) => Promise<TAuthResponse>;
|
|
20
21
|
resendVerificationEmail: (params: IResendVerificationEmailParams) => Promise<boolean>;
|
|
@@ -15,13 +15,8 @@ export declare const useAwayzAuth: (options: TEmbeddedAuthOptions) => {
|
|
|
15
15
|
supportedRegions: IRegion[];
|
|
16
16
|
supportedCurrencies: ISupportedCurrency[];
|
|
17
17
|
signIn: (params: ISignInParams) => Promise<{
|
|
18
|
-
success: boolean;
|
|
19
|
-
data: IAuthData;
|
|
20
|
-
message?: undefined;
|
|
21
|
-
} | {
|
|
22
18
|
success: boolean;
|
|
23
19
|
message: any;
|
|
24
|
-
data?: undefined;
|
|
25
20
|
}>;
|
|
26
21
|
signUp: (params: ISignUpParams) => Promise<{
|
|
27
22
|
success: boolean;
|
|
@@ -45,5 +40,14 @@ export declare const useAwayzAuth: (options: TEmbeddedAuthOptions) => {
|
|
|
45
40
|
resendVerificationEmail: (params: IResendVerificationEmailParams) => Promise<any>;
|
|
46
41
|
setTokens: (accessToken: string, refreshToken: string) => void;
|
|
47
42
|
setPreferredCurrency: (currency: string) => Promise<boolean>;
|
|
43
|
+
verify2FA: (code: string) => Promise<{
|
|
44
|
+
success: boolean;
|
|
45
|
+
data: IAuthData;
|
|
46
|
+
message?: undefined;
|
|
47
|
+
} | {
|
|
48
|
+
success: boolean;
|
|
49
|
+
message: any;
|
|
50
|
+
data?: undefined;
|
|
51
|
+
}>;
|
|
48
52
|
};
|
|
49
53
|
export {};
|
|
@@ -99,6 +99,15 @@ declare class _AccountService {
|
|
|
99
99
|
*/
|
|
100
100
|
getRegions: () => Promise<IRegion[]>;
|
|
101
101
|
getClientDetails: () => Promise<IClientDetails>;
|
|
102
|
+
validate2FA: (email: string, code: string) => Promise<{
|
|
103
|
+
success: boolean;
|
|
104
|
+
data: IAuthData;
|
|
105
|
+
message?: undefined;
|
|
106
|
+
} | {
|
|
107
|
+
success: boolean;
|
|
108
|
+
message: any;
|
|
109
|
+
data?: undefined;
|
|
110
|
+
}>;
|
|
102
111
|
}
|
|
103
112
|
export declare const AccountService: _AccountService;
|
|
104
113
|
export {};
|
package/dist/main.js
CHANGED
|
@@ -14,7 +14,7 @@ import { useWallet as P } from "./hooks/useWallet/useWallet.js";
|
|
|
14
14
|
import { ECancelStatus as z } from "./hooks/useBookingManagement/useBookingManagement.types.js";
|
|
15
15
|
import { AwayzProvider as D } from "./providers/AwayzProvider.js";
|
|
16
16
|
import { CurrencyService as O } from "./services/currency/CurrencyService.js";
|
|
17
|
-
import { c as V, a as H, g as L, i as N } from "./noRetryInstance-
|
|
17
|
+
import { c as V, a as H, g as L, i as N } from "./noRetryInstance-CbNDzU_c.js";
|
|
18
18
|
import { RewardsService as W } from "./services/rewards/RewardsService.js";
|
|
19
19
|
import { EBookingType as j } from "./services/trips/TripService.types.js";
|
|
20
20
|
import { EAuthFlow as G } from "./types/EAuthFlow.js";
|