@odynn/awayz-core 0.2.15 → 0.2.17
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-Dt2-k7CN.js → AccountService--d4c37gO.js} +4 -4
- package/dist/components/CashValue/CashValue.js +1 -1
- package/dist/hooks/useAwayzAuth/useAwayzAuth.js +19 -19
- package/dist/hooks/useSearchLimit.js +13 -10
- package/dist/lib/hooks/useSearchLimit.d.ts +7 -19
- 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/instance.js +1 -1
- package/package.json +1 -1
|
@@ -7710,12 +7710,12 @@ class bA {
|
|
|
7710
7710
|
}
|
|
7711
7711
|
const gM = new bA();
|
|
7712
7712
|
export {
|
|
7713
|
-
|
|
7713
|
+
Zo as A,
|
|
7714
7714
|
f0 as E,
|
|
7715
|
-
|
|
7716
|
-
|
|
7715
|
+
gM as a,
|
|
7716
|
+
e1 as b,
|
|
7717
7717
|
Z as c,
|
|
7718
|
-
|
|
7718
|
+
E0 as d,
|
|
7719
7719
|
nA as g,
|
|
7720
7720
|
$o as i
|
|
7721
7721
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as Fe, Fragment as GO, jsxs as Jo } from "react/jsx-runtime";
|
|
2
2
|
import * as Q from "react";
|
|
3
3
|
import Jl, { useLayoutEffect as XO, useEffect as qO, useMemo as KO } from "react";
|
|
4
|
-
import { g as ZO,
|
|
4
|
+
import { g as ZO, b as JO } from "../../AccountService--d4c37gO.js";
|
|
5
5
|
import { useQuery as e_ } from "@tanstack/react-query";
|
|
6
6
|
import { CurrencyService as t_ } from "../../services/currency/CurrencyService.js";
|
|
7
7
|
import '../../assets/_styles.css';/* empty css */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as U, E as r, a as o, b as v } from "../../AccountService--d4c37gO.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
|
-
import { awayzClient as
|
|
5
|
-
const
|
|
4
|
+
import { awayzClient as A } from "../../configs/awayzClient.js";
|
|
5
|
+
const H = (s, t) => {
|
|
6
6
|
var f, m;
|
|
7
7
|
let c = "", d = t;
|
|
8
|
-
typeof t == "string" ? c = t : t instanceof
|
|
8
|
+
typeof t == "string" ? c = t : t instanceof U ? (c = t.message, d = {
|
|
9
9
|
message: t.message,
|
|
10
10
|
cause: t.cause,
|
|
11
11
|
status: t.status,
|
|
@@ -18,15 +18,15 @@ const M = (s, t) => {
|
|
|
18
18
|
"*"
|
|
19
19
|
);
|
|
20
20
|
}, V = (s) => {
|
|
21
|
-
const [t, c] = E(!0), [d, f] = E(!1), [m, T] = E(), [
|
|
21
|
+
const [t, c] = E(!0), [d, f] = E(!1), [m, T] = E(), [O, k] = E(), [I, K] = E([]), w = R(
|
|
22
22
|
async (a) => {
|
|
23
|
-
s != null && s.onSuccess && (s == null || s.onSuccess(a)), s != null && s.onSuccessAsync && await (s == null ? void 0 : s.onSuccessAsync(a)), c(!1), f(!0), T(a.token), k(a.user);
|
|
23
|
+
s != null && s.onSuccess && (s == null || s.onSuccess(a)), s != null && s.onSuccessAsync && await (s == null ? void 0 : s.onSuccessAsync(a)), c(!1), f(!0), T(a.token), k(a.user), A.invalidateQueries();
|
|
24
24
|
},
|
|
25
25
|
[s]
|
|
26
26
|
), i = R(
|
|
27
27
|
async (a, e) => {
|
|
28
28
|
if (s.authFlow !== S.POST_MESSAGE)
|
|
29
|
-
return
|
|
29
|
+
return H(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]
|
|
@@ -48,10 +48,10 @@ const M = (s, t) => {
|
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
l == null || l.forEach(
|
|
51
|
-
(
|
|
51
|
+
(_) => window.parent.postMessage(
|
|
52
52
|
{
|
|
53
53
|
type: "request_limit",
|
|
54
|
-
limit:
|
|
54
|
+
limit: _
|
|
55
55
|
},
|
|
56
56
|
"*"
|
|
57
57
|
)
|
|
@@ -61,10 +61,10 @@ const M = (s, t) => {
|
|
|
61
61
|
} finally {
|
|
62
62
|
c(!1);
|
|
63
63
|
}
|
|
64
|
-
},
|
|
64
|
+
}, N = async () => {
|
|
65
65
|
try {
|
|
66
|
-
const { success: a, data: e } = await
|
|
67
|
-
queryKey: [
|
|
66
|
+
const { success: a, data: e } = await A.ensureQueryData({
|
|
67
|
+
queryKey: [v.CHECK_USER],
|
|
68
68
|
queryFn: o.checkUser
|
|
69
69
|
});
|
|
70
70
|
if (!a) {
|
|
@@ -84,14 +84,14 @@ const M = (s, t) => {
|
|
|
84
84
|
y(() => {
|
|
85
85
|
if (s.authFlow !== S.STANDARD) return;
|
|
86
86
|
const a = localStorage.getItem(r.TOKEN), e = localStorage.getItem(r.REFRESH_TOKEN);
|
|
87
|
-
a && e ?
|
|
87
|
+
a && e ? N() : c(!1);
|
|
88
88
|
}, []);
|
|
89
|
-
const
|
|
89
|
+
const F = async () => {
|
|
90
90
|
const a = await o.getRegions();
|
|
91
|
-
|
|
91
|
+
K(a);
|
|
92
92
|
};
|
|
93
93
|
return y(() => {
|
|
94
|
-
|
|
94
|
+
F();
|
|
95
95
|
}, []), y(() => {
|
|
96
96
|
if (s.authFlow !== S.QUERY) return;
|
|
97
97
|
const e = new URLSearchParams(window.location.search).get(r.TOKEN);
|
|
@@ -137,8 +137,8 @@ const M = (s, t) => {
|
|
|
137
137
|
isAuthenticating: t,
|
|
138
138
|
isAuthenticated: d,
|
|
139
139
|
token: m,
|
|
140
|
-
user:
|
|
141
|
-
supportedRegions:
|
|
140
|
+
user: O,
|
|
141
|
+
supportedRegions: I,
|
|
142
142
|
signIn: async (a) => {
|
|
143
143
|
var n;
|
|
144
144
|
const e = await o.login(a);
|
|
@@ -171,6 +171,6 @@ const M = (s, t) => {
|
|
|
171
171
|
};
|
|
172
172
|
};
|
|
173
173
|
export {
|
|
174
|
-
|
|
174
|
+
H as authFailurePostMessage,
|
|
175
175
|
V as useAwayzAuth
|
|
176
176
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useQuery as
|
|
1
|
+
import { b as o, a as s, d as i } from "../AccountService--d4c37gO.js";
|
|
2
|
+
import { useQuery as n } from "@tanstack/react-query";
|
|
3
3
|
import "react";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
var a = /* @__PURE__ */ ((e) => (e.HOTEL = "Hotel", e.FLIGHT = "Flight", e))(a || {});
|
|
5
|
+
const d = () => {
|
|
6
|
+
const { data: e } = n({
|
|
7
|
+
queryKey: [o.SEARCH_LIMIT],
|
|
7
8
|
queryFn: async () => {
|
|
8
|
-
const { data: t, ...
|
|
9
|
-
if (!
|
|
10
|
-
console.error({ reqLimitError:
|
|
9
|
+
const { data: t, ...r } = await s.getRequestLimit();
|
|
10
|
+
if (!r.success) {
|
|
11
|
+
console.error({ reqLimitError: r });
|
|
11
12
|
return;
|
|
12
13
|
}
|
|
13
14
|
return i(t);
|
|
@@ -15,8 +16,10 @@ const n = () => {
|
|
|
15
16
|
staleTime: 3e5
|
|
16
17
|
// 5 minutes
|
|
17
18
|
});
|
|
18
|
-
return
|
|
19
|
+
return e ? [a.FLIGHT, a.HOTEL].map(
|
|
20
|
+
(t) => e.find((r) => r.searchType === t)
|
|
21
|
+
) : [void 0, void 0];
|
|
19
22
|
};
|
|
20
23
|
export {
|
|
21
|
-
|
|
24
|
+
d as useSearchLimit
|
|
22
25
|
};
|
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
import { ISearchLimit } from '../services/account/AccountServices.types';
|
|
2
|
-
export declare const useSearchLimit: () => ISearchLimit[] | undefined;
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"number_of_calls": 1,
|
|
11
|
-
"remaining_calls": 4
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"search_type": "Hotel",
|
|
15
|
-
"subscription": "free",
|
|
16
|
-
"is_admin": false,
|
|
17
|
-
"search_limit": 5,
|
|
18
|
-
"number_of_calls": 1,
|
|
19
|
-
"remaining_calls": 4
|
|
20
|
-
}
|
|
21
|
-
],
|
|
3
|
+
* @description
|
|
4
|
+
* useSearchLimit is a custom hook that fetches the search limits for Flight and Hotel searches.
|
|
5
|
+
* The hook returns an array of two ISearchLimit objects, one for Flights and one for Hotels.
|
|
6
|
+
*
|
|
7
|
+
* @returns [FlightSearchLimit, HotelSearchLimit]
|
|
8
|
+
* @returns [undefined, undefined] if the data is not available
|
|
22
9
|
*/
|
|
10
|
+
export declare const useSearchLimit: () => [ISearchLimit, ISearchLimit] | [undefined, undefined];
|
package/dist/main.js
CHANGED
|
@@ -2,7 +2,7 @@ import { AwayzProvider as r } 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
4
|
import { EAuthFlow as s } from "./types/EAuthFlow.js";
|
|
5
|
-
import { c as f, i as n } from "./AccountService
|
|
5
|
+
import { c as f, i as n } from "./AccountService--d4c37gO.js";
|
|
6
6
|
import { awayzClient as c } from "./configs/awayzClient.js";
|
|
7
7
|
import { CashValue as w, EToolTipPosition as h } from "./components/CashValue/CashValue.js";
|
|
8
8
|
import { getBaseUrl as z } from "./configs/baseUrl.js";
|
|
@@ -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--d4c37gO.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 s = Object.defineProperty;
|
|
2
2
|
var i = (t, r, e) => r in t ? s(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
|
|
3
3
|
var c = (t, r, e) => i(t, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
-
import {
|
|
4
|
+
import { a as u, b as y, c as p } from "../../AccountService--d4c37gO.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import { ECurrencyEndpoints as m } from "../../configs/endpoints.js";
|
|
7
7
|
import "react/jsx-runtime";
|