@odynn/awayz-core 0.2.18 → 0.2.19
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--d4c37gO.js → AccountService-BodFPpxb.js} +1 -1
- package/dist/components/CashValue/CashValue.js +4578 -4581
- package/dist/hooks/useAwayzAuth/useAwayzAuth.js +15 -15
- package/dist/hooks/useSearchLimit.js +7 -7
- package/dist/lib/main.d.ts +1 -0
- package/dist/main.js +15 -13
- package/dist/providers/AwayzProvider.js +1 -1
- package/dist/services/account/AccountService.js +1 -1
- package/dist/services/currency/CurrencyService.js +3 -3
- package/dist/services/instance.js +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A as U, E as r, a as
|
|
1
|
+
import { A as U, E as r, a as l, b as H } from "../../AccountService-BodFPpxb.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";
|
|
5
|
-
const
|
|
5
|
+
const M = (s, t) => {
|
|
6
6
|
var f, m;
|
|
7
7
|
let c = "", d = t;
|
|
8
8
|
typeof t == "string" ? c = t : t instanceof U ? (c = t.message, d = {
|
|
@@ -26,13 +26,13 @@ const H = (s, t) => {
|
|
|
26
26
|
), i = R(
|
|
27
27
|
async (a, e) => {
|
|
28
28
|
if (s.authFlow !== S.POST_MESSAGE)
|
|
29
|
-
return
|
|
29
|
+
return M(e ?? "exchange_token", a);
|
|
30
30
|
s != null && s.onError && (s == null || s.onError(a)), s != null && s.onErrorAsync && await (s == null ? void 0 : s.onErrorAsync(a)), c(!1);
|
|
31
31
|
},
|
|
32
32
|
[s]
|
|
33
33
|
), h = async (a) => {
|
|
34
34
|
try {
|
|
35
|
-
const { success: e, data: n, message: u } = await
|
|
35
|
+
const { success: e, data: n, message: u } = await l.authenticateWithToken(a);
|
|
36
36
|
if (!e) {
|
|
37
37
|
i(u);
|
|
38
38
|
return;
|
|
@@ -42,12 +42,12 @@ const H = (s, t) => {
|
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
localStorage.setItem(r.TOKEN, n.token), await w(n);
|
|
45
|
-
const { data:
|
|
45
|
+
const { data: o, ...g } = await l.getRequestLimit();
|
|
46
46
|
if (!g.success) {
|
|
47
47
|
console.error({ reqLimitError: g });
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
o == null || o.forEach(
|
|
51
51
|
(_) => window.parent.postMessage(
|
|
52
52
|
{
|
|
53
53
|
type: "request_limit",
|
|
@@ -64,8 +64,8 @@ const H = (s, t) => {
|
|
|
64
64
|
}, N = async () => {
|
|
65
65
|
try {
|
|
66
66
|
const { success: a, data: e } = await A.ensureQueryData({
|
|
67
|
-
queryKey: [
|
|
68
|
-
queryFn:
|
|
67
|
+
queryKey: [H.CHECK_USER],
|
|
68
|
+
queryFn: l.checkUser
|
|
69
69
|
});
|
|
70
70
|
if (!a) {
|
|
71
71
|
i(e);
|
|
@@ -87,7 +87,7 @@ const H = (s, t) => {
|
|
|
87
87
|
a && e ? N() : c(!1);
|
|
88
88
|
}, []);
|
|
89
89
|
const F = async () => {
|
|
90
|
-
const a = await
|
|
90
|
+
const a = await l.getRegions();
|
|
91
91
|
K(a);
|
|
92
92
|
};
|
|
93
93
|
return y(() => {
|
|
@@ -99,9 +99,9 @@ const H = (s, t) => {
|
|
|
99
99
|
}, []), y(() => {
|
|
100
100
|
if (s.authFlow !== S.POST_MESSAGE) return;
|
|
101
101
|
const a = async (e) => {
|
|
102
|
-
var
|
|
102
|
+
var o;
|
|
103
103
|
if (e.data.type !== "auth") return;
|
|
104
|
-
const n = (
|
|
104
|
+
const n = (o = e.data) == null ? void 0 : o.idToken, u = e.data.refreshToken;
|
|
105
105
|
if (!n) {
|
|
106
106
|
const g = `received message ${JSON.stringify(
|
|
107
107
|
e.data
|
|
@@ -141,7 +141,7 @@ const H = (s, t) => {
|
|
|
141
141
|
supportedRegions: I,
|
|
142
142
|
signIn: async (a) => {
|
|
143
143
|
var n;
|
|
144
|
-
const e = await
|
|
144
|
+
const e = await l.login(a);
|
|
145
145
|
if (!e.success)
|
|
146
146
|
i(e.message);
|
|
147
147
|
else {
|
|
@@ -152,7 +152,7 @@ const H = (s, t) => {
|
|
|
152
152
|
},
|
|
153
153
|
signUp: async (a) => {
|
|
154
154
|
var n;
|
|
155
|
-
const e = await
|
|
155
|
+
const e = await l.signUp(a);
|
|
156
156
|
if (!e.success)
|
|
157
157
|
i(e.message);
|
|
158
158
|
else {
|
|
@@ -164,13 +164,13 @@ const H = (s, t) => {
|
|
|
164
164
|
signOut: () => {
|
|
165
165
|
localStorage.removeItem(r.TOKEN), localStorage.removeItem(r.REFRESH_TOKEN), f(!1), T(void 0), k(void 0);
|
|
166
166
|
},
|
|
167
|
-
resendVerificationEmail: async (a) => (await
|
|
167
|
+
resendVerificationEmail: async (a) => (await l.resendVerificationEmail(a)).success,
|
|
168
168
|
setTokens: (a, e) => {
|
|
169
169
|
localStorage.setItem(r.TOKEN, a), localStorage.setItem(r.REFRESH_TOKEN, e), h(a);
|
|
170
170
|
}
|
|
171
171
|
};
|
|
172
172
|
};
|
|
173
173
|
export {
|
|
174
|
-
|
|
174
|
+
M as authFailurePostMessage,
|
|
175
175
|
V as useAwayzAuth
|
|
176
176
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { b as
|
|
2
|
-
import { useQuery as
|
|
1
|
+
import { b as s, a as n, d as i } from "../AccountService-BodFPpxb.js";
|
|
2
|
+
import { useQuery as o } from "@tanstack/react-query";
|
|
3
3
|
import "react";
|
|
4
4
|
var a = /* @__PURE__ */ ((e) => (e.HOTEL = "Hotel", e.FLIGHT = "Flight", e))(a || {});
|
|
5
|
-
const
|
|
6
|
-
const { data: e } =
|
|
7
|
-
queryKey: [
|
|
5
|
+
const m = () => {
|
|
6
|
+
const { data: e } = o({
|
|
7
|
+
queryKey: [s.SEARCH_LIMIT],
|
|
8
8
|
queryFn: async () => {
|
|
9
|
-
const { data: t, ...r } = await
|
|
9
|
+
const { data: t, ...r } = await n.getRequestLimit();
|
|
10
10
|
if (!r.success) {
|
|
11
11
|
console.error({ reqLimitError: r });
|
|
12
12
|
return;
|
|
@@ -21,5 +21,5 @@ const d = () => {
|
|
|
21
21
|
) : [void 0, void 0];
|
|
22
22
|
};
|
|
23
23
|
export {
|
|
24
|
-
|
|
24
|
+
m as useSearchLimit
|
|
25
25
|
};
|
package/dist/lib/main.d.ts
CHANGED
package/dist/main.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import { AwayzProvider as
|
|
1
|
+
import { AwayzProvider as e } from "./providers/AwayzProvider.js";
|
|
2
2
|
import { useAwayzContext as a } from "./hooks/useAwayzContext.js";
|
|
3
3
|
import { useSearchLimit as m } from "./hooks/useSearchLimit.js";
|
|
4
|
-
import { EAuthFlow as
|
|
5
|
-
import { c as
|
|
6
|
-
import { awayzClient as
|
|
7
|
-
import { CashValue as w, EToolTipPosition as
|
|
8
|
-
import {
|
|
4
|
+
import { EAuthFlow as x } from "./types/EAuthFlow.js";
|
|
5
|
+
import { c as n, i as s } from "./AccountService-BodFPpxb.js";
|
|
6
|
+
import { awayzClient as l } from "./configs/awayzClient.js";
|
|
7
|
+
import { CashValue as w, EToolTipPosition as y } from "./components/CashValue/CashValue.js";
|
|
8
|
+
import { CurrencyService as h } from "./services/currency/CurrencyService.js";
|
|
9
|
+
import { getBaseUrl as A } from "./configs/baseUrl.js";
|
|
9
10
|
export {
|
|
10
|
-
|
|
11
|
+
e as AwayzProvider,
|
|
11
12
|
w as CashValue,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
h as CurrencyService,
|
|
14
|
+
x as EAuthFlow,
|
|
15
|
+
y as EToolTipPosition,
|
|
16
|
+
l as awayzClient,
|
|
17
|
+
n as clientInstance,
|
|
18
|
+
A as getBaseUrl,
|
|
19
|
+
s as instance,
|
|
18
20
|
a as useAwayzContext,
|
|
19
21
|
m as useSearchLimit
|
|
20
22
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect as i } from "react";
|
|
3
3
|
import { AwayzContext as m } from "../context/AwayzContext.js";
|
|
4
|
-
import { E as e } from "../AccountService
|
|
4
|
+
import { E as e } from "../AccountService-BodFPpxb.js";
|
|
5
5
|
import { useAwayzAuth as s } from "../hooks/useAwayzAuth/useAwayzAuth.js";
|
|
6
6
|
import { setBaseUrl as l } from "../configs/baseUrl.js";
|
|
7
7
|
import { QueryClientProvider as u } from "@tanstack/react-query";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../../assets/_styles.css';var i = Object.defineProperty;
|
|
2
2
|
var y = (t, r, e) => r in t ? i(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 {
|
|
4
|
+
import { b as p, a as C, c as a } from "../../AccountService-BodFPpxb.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import { ECurrencyEndpoints as s } from "../../configs/endpoints.js";
|
|
7
7
|
import "react/jsx-runtime";
|
|
@@ -16,8 +16,8 @@ class E {
|
|
|
16
16
|
}) => {
|
|
17
17
|
try {
|
|
18
18
|
const { success: e, data: n } = await m.ensureQueryData({
|
|
19
|
-
queryKey: [
|
|
20
|
-
queryFn:
|
|
19
|
+
queryKey: [p.CHECK_USER],
|
|
20
|
+
queryFn: C.checkUser
|
|
21
21
|
});
|
|
22
22
|
if (!e)
|
|
23
23
|
throw new Error("Failed to fetch user data");
|