@odynn/awayz-core 0.2.30 → 0.2.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-BLoJ4G-f.js → AccountService-8OR0UkZ6.js} +117 -117
- package/dist/components/CashValue/CashValue.js +1 -1
- package/dist/components/CashValue/CashValue.stories.js +1 -1
- package/dist/configs/endpoints.js +2 -2
- package/dist/hooks/useAwayzAuth/useAwayzAuth.js +1 -1
- package/dist/hooks/useSearchLimit.js +1 -1
- package/dist/hooks/useWallet/useWallet.js +36 -31
- package/dist/hooks/useWallet/useWallet.test.js +3 -3
- package/dist/lib/configs/endpoints.d.ts +1 -0
- package/dist/lib/hooks/useWallet/useWallet.d.ts +2 -1
- package/dist/lib/services/wallet/WalletService.d.ts +1 -0
- package/dist/main.js +1 -1
- package/dist/providers/AwayzProvider.js +1 -1
- package/dist/services/account/AccountService.js +1 -1
- package/dist/services/currency/CurrencyService.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/wallet/WalletService.js +34 -28
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { jsx as x, Fragment as yn, jsxs as K } from "react/jsx-runtime";
|
|
|
2
2
|
import * as f from "react";
|
|
3
3
|
import ne, { useLayoutEffect as vn, useEffect as wn, useMemo as xn } from "react";
|
|
4
4
|
import { r as bt, R as bn } from "../../index-B7QVGqcx.js";
|
|
5
|
-
import { E as Cn } from "../../AccountService-
|
|
5
|
+
import { E as Cn } from "../../AccountService-8OR0UkZ6.js";
|
|
6
6
|
import { useQuery as En } from "@tanstack/react-query";
|
|
7
7
|
import { CurrencyService as Pn } from "../../services/currency/CurrencyService.js";
|
|
8
8
|
import '../../assets/_styles.css';/* empty css */
|
|
@@ -3,7 +3,7 @@ import { CashValue as r } from "./CashValue.js";
|
|
|
3
3
|
import { AwayzProvider as a } from "../../providers/AwayzProvider.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "../../context/AwayzContext.js";
|
|
6
|
-
import "../../AccountService-
|
|
6
|
+
import "../../AccountService-8OR0UkZ6.js";
|
|
7
7
|
import "../../configs/awayzClient.js";
|
|
8
8
|
import "@tanstack/react-query";
|
|
9
9
|
import { EAuthFlow as s } from "../../types/EAuthFlow.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var r = /* @__PURE__ */ ((e) => (e.SIGN_IN = "auth/user-login", e.SIGN_UP = "auth/sign-up", 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))(r || {}), a = /* @__PURE__ */ ((e) => (e.CURRENCY_CONVERSION = "currency/convert", e))(a || {}),
|
|
1
|
+
var r = /* @__PURE__ */ ((e) => (e.SIGN_IN = "auth/user-login", e.SIGN_UP = "auth/sign-up", 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))(r || {}), a = /* @__PURE__ */ ((e) => (e.CURRENCY_CONVERSION = "currency/convert", e))(a || {}), S = /* @__PURE__ */ ((e) => (e.USER_AWARDS = "user/rewards", e.USER_CARDS = "user/cards", e.BANKS = "banks", e.CARDS = "cards", e))(S || {});
|
|
2
2
|
export {
|
|
3
3
|
r as EAuthEndpoints,
|
|
4
4
|
a as ECurrencyEndpoints,
|
|
5
|
-
|
|
5
|
+
S as EWalletEndpoints
|
|
6
6
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as U, d as r, e as o, E as v } from "../../AccountService-
|
|
1
|
+
import { A as U, d as r, e as o, E as v } from "../../AccountService-8OR0UkZ6.js";
|
|
2
2
|
import { useState as E, useCallback as R, useEffect as y } from "react";
|
|
3
3
|
import { EAuthFlow as S } from "../../types/EAuthFlow.js";
|
|
4
4
|
import { awayzClient as A } from "../../configs/awayzClient.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as s, e as i, b as n } from "../AccountService-
|
|
1
|
+
import { E as s, e as i, b as n } from "../AccountService-8OR0UkZ6.js";
|
|
2
2
|
import { useQuery as u } from "@tanstack/react-query";
|
|
3
3
|
import "react";
|
|
4
4
|
import { useAwayzContext as c } from "./useAwayzContext.js";
|
|
@@ -1,58 +1,63 @@
|
|
|
1
|
-
import { useQuery as
|
|
2
|
-
import { E as
|
|
1
|
+
import { useQuery as a, useMutation as d } from "@tanstack/react-query";
|
|
2
|
+
import { E as o, a as m } from "../../AccountService-8OR0UkZ6.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { WalletService as
|
|
4
|
+
import { WalletService as t } from "../../services/wallet/WalletService.js";
|
|
5
5
|
import "react/jsx-runtime";
|
|
6
6
|
import "../../context/AwayzContext.js";
|
|
7
|
-
import { awayzClient as
|
|
7
|
+
import { awayzClient as f } from "../../configs/awayzClient.js";
|
|
8
8
|
import "../../services/noRetryInstance.js";
|
|
9
9
|
import '../../assets/_styles.css';/* empty css */
|
|
10
|
-
const
|
|
11
|
-
const { data: r } =
|
|
12
|
-
queryKey: [
|
|
13
|
-
queryFn:
|
|
10
|
+
const F = () => {
|
|
11
|
+
const { data: r } = a({
|
|
12
|
+
queryKey: [o.PROGRAMS],
|
|
13
|
+
queryFn: t.getAwards,
|
|
14
14
|
placeholderData: []
|
|
15
|
-
}), { data:
|
|
16
|
-
queryKey: [
|
|
17
|
-
queryFn:
|
|
15
|
+
}), { data: u } = a({
|
|
16
|
+
queryKey: [o.BANKS],
|
|
17
|
+
queryFn: t.getBanks,
|
|
18
18
|
placeholderData: []
|
|
19
|
-
}), { data: l } =
|
|
20
|
-
queryKey: [
|
|
21
|
-
queryFn:
|
|
19
|
+
}), { data: l } = a({
|
|
20
|
+
queryKey: [o.CARDS],
|
|
21
|
+
queryFn: t.getCards,
|
|
22
22
|
placeholderData: []
|
|
23
|
-
}), {
|
|
23
|
+
}), { data: y } = a({
|
|
24
|
+
queryKey: [o.USER_CARDS],
|
|
25
|
+
queryFn: t.getUserCards,
|
|
26
|
+
placeholderData: []
|
|
27
|
+
}), { mutate: c } = d({
|
|
24
28
|
mutationFn: async (e) => {
|
|
25
|
-
const { programId:
|
|
26
|
-
if (!
|
|
29
|
+
const { programId: n, awardsAmount: i } = e, s = r == null ? void 0 : r.find((p) => p.id === n);
|
|
30
|
+
if (!s)
|
|
27
31
|
throw new Error("Program not found");
|
|
28
|
-
await
|
|
32
|
+
await t.setAwardPoints(s.mainProgram, i);
|
|
29
33
|
},
|
|
30
34
|
onSuccess: () => {
|
|
31
|
-
|
|
32
|
-
queryKey: [
|
|
35
|
+
f.invalidateQueries({
|
|
36
|
+
queryKey: [o.PROGRAMS]
|
|
33
37
|
});
|
|
34
38
|
}
|
|
35
|
-
}),
|
|
36
|
-
const
|
|
37
|
-
return
|
|
39
|
+
}), g = (e) => {
|
|
40
|
+
const n = r == null ? void 0 : r.find((i) => i.id === e);
|
|
41
|
+
return n || null;
|
|
38
42
|
};
|
|
39
43
|
return {
|
|
40
44
|
allPrograms: r || [],
|
|
41
45
|
hotelPrograms: (r == null ? void 0 : r.filter(
|
|
42
|
-
(e) => e.category ===
|
|
46
|
+
(e) => e.category === m.HOTEL
|
|
43
47
|
)) || [],
|
|
44
48
|
airlinePrograms: (r == null ? void 0 : r.filter(
|
|
45
|
-
(e) => e.category ===
|
|
49
|
+
(e) => e.category === m.AIRLINE
|
|
46
50
|
)) || [],
|
|
47
51
|
bankPrograms: (r == null ? void 0 : r.filter(
|
|
48
|
-
(e) => e.category ===
|
|
52
|
+
(e) => e.category === m.BANK
|
|
49
53
|
)) || [],
|
|
50
|
-
updatePoints:
|
|
51
|
-
getProgramById:
|
|
52
|
-
banks:
|
|
53
|
-
|
|
54
|
+
updatePoints: c,
|
|
55
|
+
getProgramById: g,
|
|
56
|
+
banks: u,
|
|
57
|
+
allCards: l,
|
|
58
|
+
userCards: y
|
|
54
59
|
};
|
|
55
60
|
};
|
|
56
61
|
export {
|
|
57
|
-
|
|
62
|
+
F as useWallet
|
|
58
63
|
};
|
|
@@ -6,7 +6,7 @@ import { useWallet as mf } from "./useWallet.js";
|
|
|
6
6
|
import "react/jsx-runtime";
|
|
7
7
|
import "react";
|
|
8
8
|
import "../../context/AwayzContext.js";
|
|
9
|
-
import { c as gf } from "../../AccountService-
|
|
9
|
+
import { c as gf } from "../../AccountService-8OR0UkZ6.js";
|
|
10
10
|
import { EWalletEndpoints as yf } from "../../configs/endpoints.js";
|
|
11
11
|
import "../../configs/awayzClient.js";
|
|
12
12
|
import "@tanstack/react-query";
|
|
@@ -12850,11 +12850,11 @@ const TS = [{ _id: "682c5c6f91cb31217e4bf851", name: "IHG Rewards Club Premier",
|
|
|
12850
12850
|
success: vS
|
|
12851
12851
|
};
|
|
12852
12852
|
og("useWallet", () => {
|
|
12853
|
-
hn.mocked(gf.get).mockImplementation((e) => e === yf.
|
|
12853
|
+
hn.mocked(gf.get).mockImplementation((e) => e === yf.USER_CARDS ? Promise.resolve({ data: $S }) : Promise.resolve({ data: {} })), rg("Retrieves user cards", async () => {
|
|
12854
12854
|
const { result: e } = df(() => mf());
|
|
12855
12855
|
await pf(() => {
|
|
12856
12856
|
var t;
|
|
12857
|
-
Fo(e.current.
|
|
12857
|
+
Fo(e.current.userCards).toBeDefined(), Fo((t = e.current.userCards) == null ? void 0 : t.length).toBeGreaterThan(0);
|
|
12858
12858
|
});
|
|
12859
12859
|
});
|
|
12860
12860
|
});
|
|
@@ -10,6 +10,7 @@ export declare const useWallet: () => {
|
|
|
10
10
|
updatePoints: import('@tanstack/react-query').UseMutateFunction<void, Error, ISetAwardPointsRequest, unknown>;
|
|
11
11
|
getProgramById: (programId: string) => import('../../services').ILoyaltyProgram | null;
|
|
12
12
|
banks: import('../../services').IBank[] | undefined;
|
|
13
|
-
|
|
13
|
+
allCards: import('../../services').ICard[] | undefined;
|
|
14
|
+
userCards: import('../../services').ICard[] | undefined;
|
|
14
15
|
};
|
|
15
16
|
export {};
|
|
@@ -4,6 +4,7 @@ declare class _WalletService {
|
|
|
4
4
|
setAwardPoints: (main_program: string, amount: number) => Promise<any>;
|
|
5
5
|
getBanks: () => Promise<IBank[]>;
|
|
6
6
|
getCards: () => Promise<ICard[]>;
|
|
7
|
+
getUserCards: () => Promise<ICard[]>;
|
|
7
8
|
}
|
|
8
9
|
export declare const WalletService: _WalletService;
|
|
9
10
|
export {};
|
package/dist/main.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useAwayzContext as a } from "./hooks/useAwayzContext.js";
|
|
|
3
3
|
import { useSearchLimit as n } from "./hooks/useSearchLimit.js";
|
|
4
4
|
import { useWallet as m } from "./hooks/useWallet/useWallet.js";
|
|
5
5
|
import { EAuthFlow as f } from "./types/EAuthFlow.js";
|
|
6
|
-
import { c as l, i as c } from "./AccountService-
|
|
6
|
+
import { c as l, i as c } from "./AccountService-8OR0UkZ6.js";
|
|
7
7
|
import { clientNoRetryInstance as y } from "./services/noRetryInstance.js";
|
|
8
8
|
import { CurrencyService as A } from "./services/currency/CurrencyService.js";
|
|
9
9
|
import { awayzClient as h } from "./configs/awayzClient.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect as s } from "react";
|
|
3
3
|
import { AwayzContext as l } from "../context/AwayzContext.js";
|
|
4
|
-
import { d as t } from "../AccountService-
|
|
4
|
+
import { d as t } from "../AccountService-8OR0UkZ6.js";
|
|
5
5
|
import { useAwayzAuth as m } from "../hooks/useAwayzAuth/useAwayzAuth.js";
|
|
6
6
|
import { setBaseUrl as u } from "../configs/baseUrl.js";
|
|
7
7
|
import { QueryClientProvider as i } from "@tanstack/react-query";
|
|
@@ -1,7 +1,7 @@
|
|
|
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
3
|
var o = (t, r, e) => y(t, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
-
import { e as p, E as C, c as a } from "../../AccountService-
|
|
4
|
+
import { e as p, E as C, c as a } from "../../AccountService-8OR0UkZ6.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import { ECurrencyEndpoints as s } from "../../configs/endpoints.js";
|
|
7
7
|
import "react/jsx-runtime";
|
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-8OR0UkZ6.js";
|
|
2
2
|
import { clientNoRetryInstance as o } from "./noRetryInstance.js";
|
|
3
3
|
import { CurrencyService as i } from "./currency/CurrencyService.js";
|
|
4
4
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as i, j as l, k as p, g as m, h as g, p as h } from "../AccountService-
|
|
1
|
+
import { l as i, j as l, k as p, g as m, h as g, p as h } from "../AccountService-8OR0UkZ6.js";
|
|
2
2
|
import "../configs/baseUrl.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "../configs/endpoints.js";
|
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
import '../../assets/_styles.css';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
|
-
var
|
|
4
|
-
import { a as
|
|
3
|
+
var s = (e, a, t) => w(e, typeof a != "symbol" ? a + "" : a, t);
|
|
4
|
+
import { a as o, c, b as n } from "../../AccountService-8OR0UkZ6.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import "react/jsx-runtime";
|
|
7
7
|
import "../../context/AwayzContext.js";
|
|
8
|
-
import { EWalletEndpoints as
|
|
8
|
+
import { EWalletEndpoints as i } from "../../configs/endpoints.js";
|
|
9
9
|
import "../../configs/awayzClient.js";
|
|
10
10
|
import "@tanstack/react-query";
|
|
11
11
|
import "../noRetryInstance.js";
|
|
12
12
|
/* empty css */
|
|
13
13
|
class E {
|
|
14
14
|
constructor() {
|
|
15
|
-
|
|
16
|
-
var a, t,
|
|
15
|
+
s(this, "getAwards", async () => {
|
|
16
|
+
var a, t, m;
|
|
17
17
|
try {
|
|
18
18
|
const l = [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
o.HOTEL,
|
|
20
|
+
o.BANK,
|
|
21
|
+
o.AIRLINE
|
|
22
22
|
], [
|
|
23
|
-
{ data: p },
|
|
24
23
|
{ data: d },
|
|
24
|
+
{ data: p },
|
|
25
25
|
{ data: g }
|
|
26
26
|
] = await Promise.all(
|
|
27
27
|
l.map(
|
|
28
|
-
(r) =>
|
|
29
|
-
|
|
28
|
+
(r) => c.get(
|
|
29
|
+
i.USER_AWARDS,
|
|
30
30
|
{
|
|
31
31
|
params: { category: r }
|
|
32
32
|
}
|
|
33
33
|
)
|
|
34
34
|
)
|
|
35
|
-
), u = ((a =
|
|
35
|
+
), u = ((a = d.data) == null ? void 0 : a.map(
|
|
36
36
|
(r) => n({
|
|
37
37
|
...r,
|
|
38
|
-
ctegory:
|
|
38
|
+
ctegory: o.HOTEL
|
|
39
39
|
})
|
|
40
|
-
)) ?? [], A = ((t =
|
|
40
|
+
)) ?? [], A = ((t = p.data) == null ? void 0 : t.map(
|
|
41
41
|
(r) => n({
|
|
42
42
|
...r,
|
|
43
|
-
ctegory:
|
|
43
|
+
ctegory: o.BANK
|
|
44
44
|
})
|
|
45
|
-
)) ?? [], R = ((
|
|
45
|
+
)) ?? [], R = ((m = g.data) == null ? void 0 : m.map(
|
|
46
46
|
(r) => n({
|
|
47
47
|
...r,
|
|
48
|
-
ctegory:
|
|
48
|
+
ctegory: o.AIRLINE
|
|
49
49
|
})
|
|
50
50
|
)) ?? [];
|
|
51
51
|
return [
|
|
@@ -58,28 +58,34 @@ class E {
|
|
|
58
58
|
}
|
|
59
59
|
return [];
|
|
60
60
|
});
|
|
61
|
-
|
|
62
|
-
const { data:
|
|
61
|
+
s(this, "setAwardPoints", async (a, t) => {
|
|
62
|
+
const { data: m } = await c.put(i.USER_AWARDS, {
|
|
63
63
|
main_program: a,
|
|
64
64
|
amount: t
|
|
65
65
|
});
|
|
66
|
-
return
|
|
66
|
+
return m;
|
|
67
|
+
});
|
|
68
|
+
s(this, "getBanks", async () => {
|
|
69
|
+
const { data: a } = await c.get(
|
|
70
|
+
i.BANKS
|
|
71
|
+
);
|
|
72
|
+
return a.success ? a.data.map((t) => n(t)) : [];
|
|
67
73
|
});
|
|
68
|
-
|
|
69
|
-
const { data: a } = await
|
|
70
|
-
|
|
74
|
+
s(this, "getCards", async () => {
|
|
75
|
+
const { data: a } = await c.get(
|
|
76
|
+
i.CARDS
|
|
71
77
|
);
|
|
72
78
|
return a.success ? a.data.map((t) => n(t)) : [];
|
|
73
79
|
});
|
|
74
|
-
|
|
75
|
-
const { data: a } = await
|
|
76
|
-
|
|
80
|
+
s(this, "getUserCards", async () => {
|
|
81
|
+
const { data: a } = await c.get(
|
|
82
|
+
i.USER_CARDS
|
|
77
83
|
);
|
|
78
84
|
return a.success ? a.data.map((t) => n(t)) : [];
|
|
79
85
|
});
|
|
80
86
|
}
|
|
81
87
|
}
|
|
82
|
-
const
|
|
88
|
+
const U = new E();
|
|
83
89
|
export {
|
|
84
|
-
|
|
90
|
+
U as WalletService
|
|
85
91
|
};
|