@odynn/awayz-core 0.2.11 → 0.2.13
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-CKQ3VzVx.js → AccountService-Dt2-k7CN.js} +45 -47
- package/dist/components/CashValue/CashValue.js +1 -1
- package/dist/context/AwayzContext.js +0 -2
- package/dist/hooks/useAwayzAuth/useAwayzAuth.js +72 -80
- package/dist/hooks/useSearchLimit.js +22 -0
- package/dist/lib/context/AwayzContext.d.ts +1 -2
- package/dist/lib/hooks/useAwayzAuth/useAwayzAuth.d.ts +1 -2
- package/dist/lib/hooks/useSearchLimit.d.ts +22 -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/instance.js +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ var cb = Object.defineProperty;
|
|
|
2
2
|
var ob = (M, z, b) => z in M ? cb(M, z, { enumerable: !0, configurable: !0, writable: !0, value: b }) : M[z] = b;
|
|
3
3
|
var r0 = (M, z, b) => ob(M, typeof z != "symbol" ? z + "" : z, b);
|
|
4
4
|
import "react";
|
|
5
|
-
import { EAuthEndpoints as
|
|
5
|
+
import { EAuthEndpoints as M0 } from "./configs/endpoints.js";
|
|
6
6
|
import { awayzClient as N1 } from "./configs/awayzClient.js";
|
|
7
7
|
import { getBaseUrl as SM } from "./configs/baseUrl.js";
|
|
8
8
|
import { EAuthFlow as Ab } from "./types/EAuthFlow.js";
|
|
@@ -373,7 +373,7 @@ function hb(M) {
|
|
|
373
373
|
return p.priority - O.priority;
|
|
374
374
|
}), z;
|
|
375
375
|
}
|
|
376
|
-
var DM = /\d/,
|
|
376
|
+
var DM = /\d/, b0 = /\d\d/, PM = /\d{3}/, _2 = /\d{4}/, F1 = /[+-]?\d{6}/, k = /\d\d?/, kM = /\d\d\d\d?/, vM = /\d\d\d\d\d\d?/, x1 = /\d{1,3}/, w2 = /\d{1,4}/, H1 = /[+-]?\d{1,6}/, Z0 = /\d+/, G1 = /[+-]?\d+/, mb = /Z|[+-]\d\d:?\d\d/gi, Y1 = /Z|[+-]\d\d(?::?\d\d)?/gi, Tb = /[+-]?\d+(\.\d{1,3})?/, f1 = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, $0 = /^[1-9]\d?/, D2 = /^([1-9]\d|\d)/, _1;
|
|
377
377
|
_1 = {};
|
|
378
378
|
function u(M, z, b) {
|
|
379
379
|
_1[M] = L0(z) ? z : function(p, O) {
|
|
@@ -434,7 +434,7 @@ l(0, ["YYYY", 4], 0, "year");
|
|
|
434
434
|
l(0, ["YYYYY", 5], 0, "year");
|
|
435
435
|
l(0, ["YYYYYY", 6, !0], 0, "year");
|
|
436
436
|
u("Y", G1);
|
|
437
|
-
u("YY", k,
|
|
437
|
+
u("YY", k, b0);
|
|
438
438
|
u("YYYY", w2, _2);
|
|
439
439
|
u("YYYYY", H1, F1);
|
|
440
440
|
u("YYYYYY", H1, F1);
|
|
@@ -555,7 +555,7 @@ l("MMMM", 0, 0, function(M) {
|
|
|
555
555
|
return this.localeData().months(this, M);
|
|
556
556
|
});
|
|
557
557
|
u("M", k, $0);
|
|
558
|
-
u("MM", k,
|
|
558
|
+
u("MM", k, b0);
|
|
559
559
|
u("MMM", function(M, z) {
|
|
560
560
|
return z.monthsShortRegex(M);
|
|
561
561
|
});
|
|
@@ -679,9 +679,9 @@ function T0(M, z, b) {
|
|
|
679
679
|
l("w", ["ww", 2], "wo", "week");
|
|
680
680
|
l("W", ["WW", 2], "Wo", "isoWeek");
|
|
681
681
|
u("w", k, $0);
|
|
682
|
-
u("ww", k,
|
|
682
|
+
u("ww", k, b0);
|
|
683
683
|
u("W", k, $0);
|
|
684
|
-
u("WW", k,
|
|
684
|
+
u("WW", k, b0);
|
|
685
685
|
u1(
|
|
686
686
|
["w", "ww", "W", "WW"],
|
|
687
687
|
function(M, z, b, p) {
|
|
@@ -887,9 +887,9 @@ u("A", JM);
|
|
|
887
887
|
u("H", k, D2);
|
|
888
888
|
u("h", k, $0);
|
|
889
889
|
u("k", k, $0);
|
|
890
|
-
u("HH", k,
|
|
891
|
-
u("hh", k,
|
|
892
|
-
u("kk", k,
|
|
890
|
+
u("HH", k, b0);
|
|
891
|
+
u("hh", k, b0);
|
|
892
|
+
u("kk", k, b0);
|
|
893
893
|
u("hmm", kM);
|
|
894
894
|
u("hmmss", vM);
|
|
895
895
|
u("Hmm", kM);
|
|
@@ -2014,8 +2014,8 @@ J1("GGGG", "isoWeekYear");
|
|
|
2014
2014
|
J1("GGGGG", "isoWeekYear");
|
|
2015
2015
|
u("G", G1);
|
|
2016
2016
|
u("g", G1);
|
|
2017
|
-
u("GG", k,
|
|
2018
|
-
u("gg", k,
|
|
2017
|
+
u("GG", k, b0);
|
|
2018
|
+
u("gg", k, b0);
|
|
2019
2019
|
u("GGGG", w2, _2);
|
|
2020
2020
|
u("gggg", w2, _2);
|
|
2021
2021
|
u("GGGGG", H1, F1);
|
|
@@ -2081,7 +2081,7 @@ function uO(M) {
|
|
|
2081
2081
|
}
|
|
2082
2082
|
l("D", ["DD", 2], "Do", "date");
|
|
2083
2083
|
u("D", k, $0);
|
|
2084
|
-
u("DD", k,
|
|
2084
|
+
u("DD", k, b0);
|
|
2085
2085
|
u("Do", function(M, z) {
|
|
2086
2086
|
return M ? z._dayOfMonthOrdinalParse || z._ordinalParse : z._dayOfMonthOrdinalParseLenient;
|
|
2087
2087
|
});
|
|
@@ -2104,12 +2104,12 @@ function RO(M) {
|
|
|
2104
2104
|
}
|
|
2105
2105
|
l("m", ["mm", 2], 0, "minute");
|
|
2106
2106
|
u("m", k, D2);
|
|
2107
|
-
u("mm", k,
|
|
2107
|
+
u("mm", k, b0);
|
|
2108
2108
|
_(["m", "mm"], e0);
|
|
2109
2109
|
var LO = M1("Minutes", !1);
|
|
2110
2110
|
l("s", ["ss", 2], 0, "second");
|
|
2111
2111
|
u("s", k, D2);
|
|
2112
|
-
u("ss", k,
|
|
2112
|
+
u("ss", k, b0);
|
|
2113
2113
|
_(["s", "ss"], h0);
|
|
2114
2114
|
var lO = M1("Seconds", !1);
|
|
2115
2115
|
l("S", 0, 0, function() {
|
|
@@ -2138,7 +2138,7 @@ l(0, ["SSSSSSSSS", 9], 0, function() {
|
|
|
2138
2138
|
return this.millisecond() * 1e6;
|
|
2139
2139
|
});
|
|
2140
2140
|
u("S", x1, DM);
|
|
2141
|
-
u("SS", x1,
|
|
2141
|
+
u("SS", x1, b0);
|
|
2142
2142
|
u("SSS", x1, PM);
|
|
2143
2143
|
var _0, dz;
|
|
2144
2144
|
for (_0 = "SSSS"; _0.length <= 9; _0 += "S")
|
|
@@ -5708,7 +5708,7 @@ function Rc() {
|
|
|
5708
5708
|
return k0.countries = z, k0;
|
|
5709
5709
|
}
|
|
5710
5710
|
Rc();
|
|
5711
|
-
var e1 = /* @__PURE__ */ ((M) => (M.CHECK_USER = "CHECK_USER", M.USER_REGIONS = "USER_REGIONS", M.CONVERT_CURRENCY = "CONVERT_CURRENCY", M.CLIENT_COMPONENT_KEY = "CLIENT_COMPONENT_KEY", M))(e1 || {}), f0 = /* @__PURE__ */ ((M) => (M.TOKEN = "token", M.REFRESH_TOKEN = "refreshToken", M.CLIENT_ID = "clientId", M.AUTH_FLOW = "authFlow", M))(f0 || {});
|
|
5711
|
+
var e1 = /* @__PURE__ */ ((M) => (M.CHECK_USER = "CHECK_USER", M.USER_REGIONS = "USER_REGIONS", M.CONVERT_CURRENCY = "CONVERT_CURRENCY", M.CLIENT_COMPONENT_KEY = "CLIENT_COMPONENT_KEY", M.SEARCH_LIMIT = "SEARCH_LIMIT", M))(e1 || {}), f0 = /* @__PURE__ */ ((M) => (M.TOKEN = "token", M.REFRESH_TOKEN = "refreshToken", M.CLIENT_ID = "clientId", M.AUTH_FLOW = "authFlow", M))(f0 || {});
|
|
5712
5712
|
Array.prototype.getLast || (Array.prototype.getLast = function() {
|
|
5713
5713
|
return this[this.length - 1];
|
|
5714
5714
|
});
|
|
@@ -5725,22 +5725,22 @@ const { toString: Lc } = Object.prototype, { getPrototypeOf: J2 } = Object, Z1 =
|
|
|
5725
5725
|
return M[b] || (M[b] = b.slice(8, -1).toLowerCase());
|
|
5726
5726
|
})(/* @__PURE__ */ Object.create(null)), t0 = (M) => (M = M.toLowerCase(), (z) => Z1(z) === M), $1 = (M) => (z) => typeof z === M, { isArray: z1 } = Array, r1 = $1("undefined");
|
|
5727
5727
|
function lc(M) {
|
|
5728
|
-
return M !== null && !r1(M) && M.constructor !== null && !r1(M.constructor) &&
|
|
5728
|
+
return M !== null && !r1(M) && M.constructor !== null && !r1(M.constructor) && z0(M.constructor.isBuffer) && M.constructor.isBuffer(M);
|
|
5729
5729
|
}
|
|
5730
5730
|
const Nz = t0("ArrayBuffer");
|
|
5731
5731
|
function Nc(M) {
|
|
5732
5732
|
let z;
|
|
5733
5733
|
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? z = ArrayBuffer.isView(M) : z = M && M.buffer && Nz(M.buffer), z;
|
|
5734
5734
|
}
|
|
5735
|
-
const Bc = $1("string"),
|
|
5735
|
+
const Bc = $1("string"), z0 = $1("function"), Bz = $1("number"), M2 = (M) => M !== null && typeof M == "object", Xc = (M) => M === !0 || M === !1, y1 = (M) => {
|
|
5736
5736
|
if (Z1(M) !== "object")
|
|
5737
5737
|
return !1;
|
|
5738
5738
|
const z = J2(M);
|
|
5739
5739
|
return (z === null || z === Object.prototype || Object.getPrototypeOf(z) === null) && !(Symbol.toStringTag in M) && !(Symbol.iterator in M);
|
|
5740
|
-
}, hc = t0("Date"), mc = t0("File"), Tc = t0("Blob"), gc = t0("FileList"), Sc = (M) => M2(M) &&
|
|
5740
|
+
}, hc = t0("Date"), mc = t0("File"), Tc = t0("Blob"), gc = t0("FileList"), Sc = (M) => M2(M) && z0(M.pipe), yc = (M) => {
|
|
5741
5741
|
let z;
|
|
5742
|
-
return M && (typeof FormData == "function" && M instanceof FormData ||
|
|
5743
|
-
z === "object" &&
|
|
5742
|
+
return M && (typeof FormData == "function" && M instanceof FormData || z0(M.append) && ((z = Z1(M)) === "formdata" || // detect form-data instance
|
|
5743
|
+
z === "object" && z0(M.toString) && M.toString() === "[object FormData]"));
|
|
5744
5744
|
}, Ec = t0("URLSearchParams"), [Cc, _c, wc, Dc] = ["ReadableStream", "Request", "Response", "Headers"].map(t0), Pc = (M) => M.trim ? M.trim() : M.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
5745
5745
|
function R1(M, z, { allOwnKeys: b = !1 } = {}) {
|
|
5746
5746
|
if (M === null || typeof M > "u")
|
|
@@ -5776,7 +5776,7 @@ function l2() {
|
|
|
5776
5776
|
return z;
|
|
5777
5777
|
}
|
|
5778
5778
|
const kc = (M, z, b, { allOwnKeys: p } = {}) => (R1(z, (O, c) => {
|
|
5779
|
-
b &&
|
|
5779
|
+
b && z0(O) ? M[c] = lz(O, b) : M[c] = O;
|
|
5780
5780
|
}, { allOwnKeys: p }), M), vc = (M) => (M.charCodeAt(0) === 65279 && (M = M.slice(1)), M), Ic = (M, z, b, p) => {
|
|
5781
5781
|
M.prototype = Object.create(z.prototype, p), M.prototype.constructor = M, Object.defineProperty(M, "super", {
|
|
5782
5782
|
value: z.prototype
|
|
@@ -5830,10 +5830,10 @@ const kc = (M, z, b, { allOwnKeys: p } = {}) => (R1(z, (O, c) => {
|
|
|
5830
5830
|
}), Object.defineProperties(M, p);
|
|
5831
5831
|
}, Jc = (M) => {
|
|
5832
5832
|
mz(M, (z, b) => {
|
|
5833
|
-
if (
|
|
5833
|
+
if (z0(M) && ["arguments", "caller", "callee"].indexOf(b) !== -1)
|
|
5834
5834
|
return !1;
|
|
5835
5835
|
const p = M[b];
|
|
5836
|
-
if (
|
|
5836
|
+
if (z0(p)) {
|
|
5837
5837
|
if (z.enumerable = !1, "writable" in z) {
|
|
5838
5838
|
z.writable = !1;
|
|
5839
5839
|
return;
|
|
@@ -5863,7 +5863,7 @@ const kc = (M, z, b, { allOwnKeys: p } = {}) => (R1(z, (O, c) => {
|
|
|
5863
5863
|
return b;
|
|
5864
5864
|
};
|
|
5865
5865
|
function zo(M) {
|
|
5866
|
-
return !!(M &&
|
|
5866
|
+
return !!(M && z0(M.append) && M[Symbol.toStringTag] === "FormData" && M[Symbol.iterator]);
|
|
5867
5867
|
}
|
|
5868
5868
|
const bo = (M) => {
|
|
5869
5869
|
const z = new Array(10), b = (p, O) => {
|
|
@@ -5882,13 +5882,13 @@ const bo = (M) => {
|
|
|
5882
5882
|
return p;
|
|
5883
5883
|
};
|
|
5884
5884
|
return b(M, 0);
|
|
5885
|
-
}, po = t0("AsyncFunction"), Oo = (M) => M && (M2(M) ||
|
|
5885
|
+
}, po = t0("AsyncFunction"), Oo = (M) => M && (M2(M) || z0(M)) && z0(M.then) && z0(M.catch), gz = ((M, z) => M ? setImmediate : z ? ((b, p) => (I0.addEventListener("message", ({ source: O, data: c }) => {
|
|
5886
5886
|
O === I0 && c === b && p.length && p.shift()();
|
|
5887
5887
|
}, !1), (O) => {
|
|
5888
5888
|
p.push(O), I0.postMessage(b, "*");
|
|
5889
5889
|
}))(`axios@${Math.random()}`, []) : (b) => setTimeout(b))(
|
|
5890
5890
|
typeof setImmediate == "function",
|
|
5891
|
-
|
|
5891
|
+
z0(I0.postMessage)
|
|
5892
5892
|
), co = typeof queueMicrotask < "u" ? queueMicrotask.bind(I0) : typeof process < "u" && process.nextTick || gz, e = {
|
|
5893
5893
|
isArray: z1,
|
|
5894
5894
|
isArrayBuffer: Nz,
|
|
@@ -5909,7 +5909,7 @@ const bo = (M) => {
|
|
|
5909
5909
|
isFile: mc,
|
|
5910
5910
|
isBlob: Tc,
|
|
5911
5911
|
isRegExp: Vc,
|
|
5912
|
-
isFunction:
|
|
5912
|
+
isFunction: z0,
|
|
5913
5913
|
isStream: Sc,
|
|
5914
5914
|
isURLSearchParams: Ec,
|
|
5915
5915
|
isTypedArray: Hc,
|
|
@@ -7429,7 +7429,7 @@ Z.interceptors.response.use(null, async (M) => {
|
|
|
7429
7429
|
const z = M.config, b = localStorage.getItem(f0.REFRESH_TOKEN), p = (O = M.response) == null ? void 0 : O.status;
|
|
7430
7430
|
if (!z || z.__retries === mM)
|
|
7431
7431
|
throw M;
|
|
7432
|
-
if (p === q1.Unauthorized && z.url !==
|
|
7432
|
+
if (p === q1.Unauthorized && z.url !== M0.REFRESH_EMBED_TOKEN && z.url !== M0.REFRESH_TOKEN) {
|
|
7433
7433
|
if (!b)
|
|
7434
7434
|
throw TM(
|
|
7435
7435
|
"refresh_token",
|
|
@@ -7442,12 +7442,10 @@ Z.interceptors.response.use(null, async (M) => {
|
|
|
7442
7442
|
throw N;
|
|
7443
7443
|
});
|
|
7444
7444
|
h1 = !0;
|
|
7445
|
-
const a = localStorage.getItem(f0.AUTH_FLOW) === Ab.POST_MESSAGE ? gM.refreshEmbedToken : gM.refreshToken, { data: n, success: W, message: s } = await a(
|
|
7446
|
-
b
|
|
7447
|
-
);
|
|
7445
|
+
const a = localStorage.getItem(f0.AUTH_FLOW) === Ab.POST_MESSAGE ? gM.refreshEmbedToken : gM.refreshToken, { data: n, success: W, message: s } = await a(b);
|
|
7448
7446
|
if (!W)
|
|
7449
|
-
throw (c = z == null ? void 0 : z.url) != null && c.includes(
|
|
7450
|
-
return (o = z.url) != null && o.includes(
|
|
7447
|
+
throw (c = z == null ? void 0 : z.url) != null && c.includes(M0.EXCHANGE_TOKEN) || TM("refresh_token", s), h1 = !1, hM(M), M;
|
|
7448
|
+
return (o = z.url) != null && o.includes(M0.EXCHANGE_TOKEN) && "id_token" in n && (z.data = JSON.stringify({ idToken: n.id_token })), h1 = !1, z.headers && (z.headers.Authorization = `Bearer ${n.token}`), hM(null, n.token), Z(z);
|
|
7451
7449
|
}
|
|
7452
7450
|
if ([
|
|
7453
7451
|
q1.Unauthorized,
|
|
@@ -7488,7 +7486,7 @@ class bA {
|
|
|
7488
7486
|
r0(this, "login", async (z) => {
|
|
7489
7487
|
var b, p, O, c, o;
|
|
7490
7488
|
try {
|
|
7491
|
-
const { data: A } = await Z.post(
|
|
7489
|
+
const { data: A } = await Z.post(M0.SIGN_IN, {
|
|
7492
7490
|
email_address: z.email,
|
|
7493
7491
|
password: z.password
|
|
7494
7492
|
}), a = await N1.ensureQueryData({
|
|
@@ -7524,7 +7522,7 @@ class bA {
|
|
|
7524
7522
|
r0(this, "signUp", async (z) => {
|
|
7525
7523
|
var b, p, O, c, o, A;
|
|
7526
7524
|
try {
|
|
7527
|
-
const { data: a } = await Z.post(
|
|
7525
|
+
const { data: a } = await Z.post(M0.SIGN_UP, {
|
|
7528
7526
|
user: {
|
|
7529
7527
|
email_address: z.email,
|
|
7530
7528
|
password: z.password,
|
|
@@ -7561,7 +7559,7 @@ class bA {
|
|
|
7561
7559
|
var b, p, O;
|
|
7562
7560
|
try {
|
|
7563
7561
|
return (await Z.post(
|
|
7564
|
-
|
|
7562
|
+
M0.RESEND_VERIFICATION_EMAIL,
|
|
7565
7563
|
{
|
|
7566
7564
|
email_address: z.email,
|
|
7567
7565
|
success_url: z.successUrl,
|
|
@@ -7584,7 +7582,7 @@ class bA {
|
|
|
7584
7582
|
r0(this, "authenticateWithToken", async (z) => {
|
|
7585
7583
|
var b, p, O;
|
|
7586
7584
|
try {
|
|
7587
|
-
const { data: c } = await Z.post(
|
|
7585
|
+
const { data: c } = await Z.post(M0.EXCHANGE_TOKEN, {
|
|
7588
7586
|
idToken: z
|
|
7589
7587
|
}), o = await N1.ensureQueryData({
|
|
7590
7588
|
queryKey: [e1.USER_REGIONS],
|
|
@@ -7616,7 +7614,7 @@ class bA {
|
|
|
7616
7614
|
*/
|
|
7617
7615
|
r0(this, "checkUser", async () => {
|
|
7618
7616
|
try {
|
|
7619
|
-
const { data: z } = await Z.get(
|
|
7617
|
+
const { data: z } = await Z.get(M0.ME), b = await N1.ensureQueryData({
|
|
7620
7618
|
queryKey: [e1.USER_REGIONS],
|
|
7621
7619
|
queryFn: this.getRegions
|
|
7622
7620
|
}), p = {
|
|
@@ -7647,7 +7645,7 @@ class bA {
|
|
|
7647
7645
|
r0(this, "refreshEmbedToken", async (z) => {
|
|
7648
7646
|
try {
|
|
7649
7647
|
const { data: b } = await Z.post(
|
|
7650
|
-
|
|
7648
|
+
M0.REFRESH_EMBED_TOKEN,
|
|
7651
7649
|
{
|
|
7652
7650
|
refreshToken: z
|
|
7653
7651
|
}
|
|
@@ -7672,7 +7670,7 @@ class bA {
|
|
|
7672
7670
|
r0(this, "refreshToken", async (z) => {
|
|
7673
7671
|
try {
|
|
7674
7672
|
const { data: b } = await Z.post(
|
|
7675
|
-
|
|
7673
|
+
M0.REFRESH_TOKEN,
|
|
7676
7674
|
{
|
|
7677
7675
|
refreshToken: z
|
|
7678
7676
|
}
|
|
@@ -7697,7 +7695,7 @@ class bA {
|
|
|
7697
7695
|
*
|
|
7698
7696
|
* @returns A promise that resolves to a service response containing the request limit data.
|
|
7699
7697
|
*/
|
|
7700
|
-
r0(this, "getRequestLimit", async () => (await Z.get(
|
|
7698
|
+
r0(this, "getRequestLimit", async () => (await Z.get(M0.REQUEST_LIMIT)).data);
|
|
7701
7699
|
/**
|
|
7702
7700
|
* Retrieves the regions available for user registration.
|
|
7703
7701
|
*
|
|
@@ -7705,19 +7703,19 @@ class bA {
|
|
|
7705
7703
|
*/
|
|
7706
7704
|
r0(this, "getRegions", async () => {
|
|
7707
7705
|
var b;
|
|
7708
|
-
const z = await Z.get(
|
|
7706
|
+
const z = await Z.get(M0.REGIONS);
|
|
7709
7707
|
return E0((b = z.data) == null ? void 0 : b.data);
|
|
7710
7708
|
});
|
|
7711
7709
|
}
|
|
7712
7710
|
}
|
|
7713
7711
|
const gM = new bA();
|
|
7714
7712
|
export {
|
|
7715
|
-
|
|
7713
|
+
gM as A,
|
|
7716
7714
|
f0 as E,
|
|
7717
|
-
|
|
7718
|
-
|
|
7715
|
+
e1 as a,
|
|
7716
|
+
E0 as b,
|
|
7719
7717
|
Z as c,
|
|
7720
|
-
|
|
7718
|
+
Zo as d,
|
|
7721
7719
|
nA as g,
|
|
7722
7720
|
$o as i
|
|
7723
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, a as JO } from "../../AccountService-Dt2-k7CN.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,47 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useState as
|
|
1
|
+
import { d as _, E as r, A as o, a as U } from "../../AccountService-Dt2-k7CN.js";
|
|
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
|
|
6
|
-
var f,
|
|
7
|
-
let c = "",
|
|
8
|
-
typeof
|
|
9
|
-
message:
|
|
10
|
-
cause:
|
|
11
|
-
status:
|
|
12
|
-
data: (f =
|
|
13
|
-
}) : c =
|
|
4
|
+
import { awayzClient as H } from "../../configs/awayzClient.js";
|
|
5
|
+
const M = (s, t) => {
|
|
6
|
+
var f, m;
|
|
7
|
+
let c = "", d = t;
|
|
8
|
+
typeof t == "string" ? c = t : t instanceof _ ? (c = t.message, d = {
|
|
9
|
+
message: t.message,
|
|
10
|
+
cause: t.cause,
|
|
11
|
+
status: t.status,
|
|
12
|
+
data: (f = t == null ? void 0 : t.response) == null ? void 0 : f.data
|
|
13
|
+
}) : c = t.message, (m = window.parent) == null || m.postMessage(
|
|
14
14
|
{
|
|
15
15
|
type: "auth_error",
|
|
16
|
-
details: { message: c, action:
|
|
16
|
+
details: { message: c, action: s, info: d }
|
|
17
17
|
},
|
|
18
18
|
"*"
|
|
19
19
|
);
|
|
20
|
-
},
|
|
21
|
-
const [
|
|
22
|
-
async (
|
|
23
|
-
|
|
20
|
+
}, V = (s) => {
|
|
21
|
+
const [t, c] = E(!0), [d, f] = E(!1), [m, T] = E(), [A, k] = E(), [O, I] = E([]), w = R(
|
|
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);
|
|
24
24
|
},
|
|
25
|
-
[
|
|
25
|
+
[s]
|
|
26
26
|
), i = R(
|
|
27
|
-
async (
|
|
28
|
-
if (
|
|
29
|
-
return
|
|
30
|
-
|
|
27
|
+
async (a, e) => {
|
|
28
|
+
if (s.authFlow !== S.POST_MESSAGE)
|
|
29
|
+
return M(e ?? "exchange_token", a);
|
|
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
|
-
[
|
|
33
|
-
), h = async (
|
|
32
|
+
[s]
|
|
33
|
+
), h = async (a) => {
|
|
34
34
|
try {
|
|
35
|
-
const { success: e, data:
|
|
35
|
+
const { success: e, data: n, message: u } = await o.authenticateWithToken(a);
|
|
36
36
|
if (!e) {
|
|
37
37
|
i(u);
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
if (!(
|
|
40
|
+
if (!(n != null && n.token)) {
|
|
41
41
|
i("no awayz token returned after exchanging id token");
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
-
localStorage.setItem(
|
|
44
|
+
localStorage.setItem(r.TOKEN, n.token), await w(n);
|
|
45
45
|
const { data: l, ...g } = await o.getRequestLimit();
|
|
46
46
|
if (!g.success) {
|
|
47
47
|
console.error({ reqLimitError: g });
|
|
@@ -61,48 +61,48 @@ const v = (t, a) => {
|
|
|
61
61
|
} finally {
|
|
62
62
|
c(!1);
|
|
63
63
|
}
|
|
64
|
-
},
|
|
64
|
+
}, K = async () => {
|
|
65
65
|
try {
|
|
66
|
-
const { success:
|
|
67
|
-
queryKey: [
|
|
66
|
+
const { success: a, data: e } = await H.ensureQueryData({
|
|
67
|
+
queryKey: [U.CHECK_USER],
|
|
68
68
|
queryFn: o.checkUser
|
|
69
69
|
});
|
|
70
|
-
if (!
|
|
70
|
+
if (!a) {
|
|
71
71
|
i(e);
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
await
|
|
74
|
+
await w({
|
|
75
75
|
user: e,
|
|
76
|
-
token: localStorage.getItem(
|
|
76
|
+
token: localStorage.getItem(r.TOKEN)
|
|
77
77
|
});
|
|
78
|
-
} catch (
|
|
79
|
-
i(
|
|
78
|
+
} catch (a) {
|
|
79
|
+
i(a);
|
|
80
80
|
} finally {
|
|
81
81
|
c(!1);
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
-
|
|
85
|
-
if (
|
|
86
|
-
const
|
|
87
|
-
|
|
84
|
+
y(() => {
|
|
85
|
+
if (s.authFlow !== S.STANDARD) return;
|
|
86
|
+
const a = localStorage.getItem(r.TOKEN), e = localStorage.getItem(r.REFRESH_TOKEN);
|
|
87
|
+
a && e ? K() : c(!1);
|
|
88
88
|
}, []);
|
|
89
89
|
const N = async () => {
|
|
90
|
-
const
|
|
91
|
-
|
|
90
|
+
const a = await o.getRegions();
|
|
91
|
+
I(a);
|
|
92
92
|
};
|
|
93
|
-
return
|
|
93
|
+
return y(() => {
|
|
94
94
|
N();
|
|
95
|
-
}, []),
|
|
96
|
-
if (
|
|
97
|
-
const e = new URLSearchParams(window.location.search).get(
|
|
95
|
+
}, []), y(() => {
|
|
96
|
+
if (s.authFlow !== S.QUERY) return;
|
|
97
|
+
const e = new URLSearchParams(window.location.search).get(r.TOKEN);
|
|
98
98
|
e && h(e);
|
|
99
|
-
}, []),
|
|
100
|
-
if (
|
|
101
|
-
const
|
|
99
|
+
}, []), y(() => {
|
|
100
|
+
if (s.authFlow !== S.POST_MESSAGE) return;
|
|
101
|
+
const a = async (e) => {
|
|
102
102
|
var l;
|
|
103
103
|
if (e.data.type !== "auth") return;
|
|
104
|
-
const
|
|
105
|
-
if (!
|
|
104
|
+
const n = (l = e.data) == null ? void 0 : l.idToken, u = e.data.refreshToken;
|
|
105
|
+
if (!n) {
|
|
106
106
|
const g = `received message ${JSON.stringify(
|
|
107
107
|
e.data
|
|
108
108
|
)}
|
|
@@ -122,63 +122,55 @@ const v = (t, a) => {
|
|
|
122
122
|
);
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
|
-
localStorage.setItem(
|
|
125
|
+
localStorage.setItem(r.REFRESH_TOKEN, u), await h(n);
|
|
126
126
|
};
|
|
127
|
-
return window.addEventListener("message",
|
|
127
|
+
return window.addEventListener("message", a), window.parent && window.parent.postMessage(
|
|
128
128
|
{
|
|
129
129
|
type: "ready"
|
|
130
130
|
/* READY */
|
|
131
131
|
},
|
|
132
132
|
"*"
|
|
133
133
|
), () => {
|
|
134
|
-
window.removeEventListener("message",
|
|
134
|
+
window.removeEventListener("message", a);
|
|
135
135
|
};
|
|
136
136
|
}, []), {
|
|
137
|
-
isAuthenticating:
|
|
138
|
-
isAuthenticated:
|
|
139
|
-
token:
|
|
137
|
+
isAuthenticating: t,
|
|
138
|
+
isAuthenticated: d,
|
|
139
|
+
token: m,
|
|
140
140
|
user: A,
|
|
141
141
|
supportedRegions: O,
|
|
142
|
-
signIn: async (
|
|
143
|
-
var
|
|
144
|
-
const e = await o.login(
|
|
142
|
+
signIn: async (a) => {
|
|
143
|
+
var n;
|
|
144
|
+
const e = await o.login(a);
|
|
145
145
|
if (!e.success)
|
|
146
146
|
i(e.message);
|
|
147
147
|
else {
|
|
148
|
-
const u = (
|
|
149
|
-
localStorage.setItem(
|
|
148
|
+
const u = (n = e.data) == null ? void 0 : n.refreshToken;
|
|
149
|
+
localStorage.setItem(r.REFRESH_TOKEN, u), await w(e.data);
|
|
150
150
|
}
|
|
151
151
|
return e;
|
|
152
152
|
},
|
|
153
|
-
signUp: async (
|
|
154
|
-
var
|
|
155
|
-
const e = await o.signUp(
|
|
153
|
+
signUp: async (a) => {
|
|
154
|
+
var n;
|
|
155
|
+
const e = await o.signUp(a);
|
|
156
156
|
if (!e.success)
|
|
157
157
|
i(e.message);
|
|
158
158
|
else {
|
|
159
|
-
const u = (
|
|
160
|
-
localStorage.setItem(
|
|
159
|
+
const u = (n = e.data) == null ? void 0 : n.refreshToken;
|
|
160
|
+
localStorage.setItem(r.REFRESH_TOKEN, u), await w(e.data);
|
|
161
161
|
}
|
|
162
162
|
return e;
|
|
163
163
|
},
|
|
164
164
|
signOut: () => {
|
|
165
|
-
localStorage.removeItem(
|
|
165
|
+
localStorage.removeItem(r.TOKEN), localStorage.removeItem(r.REFRESH_TOKEN), f(!1), T(void 0), k(void 0);
|
|
166
166
|
},
|
|
167
|
-
resendVerificationEmail: async (
|
|
168
|
-
setTokens: (
|
|
169
|
-
localStorage.setItem(
|
|
170
|
-
},
|
|
171
|
-
getRequestLimits: async () => {
|
|
172
|
-
const { data: s, ...e } = await o.getRequestLimit();
|
|
173
|
-
if (!e.success) {
|
|
174
|
-
console.error({ reqLimitError: e });
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
return L(s);
|
|
167
|
+
resendVerificationEmail: async (a) => (await o.resendVerificationEmail(a)).success,
|
|
168
|
+
setTokens: (a, e) => {
|
|
169
|
+
localStorage.setItem(r.TOKEN, a), localStorage.setItem(r.REFRESH_TOKEN, e), h(a);
|
|
178
170
|
}
|
|
179
171
|
};
|
|
180
172
|
};
|
|
181
173
|
export {
|
|
182
|
-
|
|
183
|
-
|
|
174
|
+
M as authFailurePostMessage,
|
|
175
|
+
V as useAwayzAuth
|
|
184
176
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { a as s, A as a, b as i } from "../AccountService-Dt2-k7CN.js";
|
|
2
|
+
import { useQuery as o } from "@tanstack/react-query";
|
|
3
|
+
import "react";
|
|
4
|
+
const n = () => {
|
|
5
|
+
const { data: r } = o({
|
|
6
|
+
queryKey: [s.SEARCH_LIMIT],
|
|
7
|
+
queryFn: async () => {
|
|
8
|
+
const { data: t, ...e } = await a.getRequestLimit();
|
|
9
|
+
if (!e.success) {
|
|
10
|
+
console.error({ reqLimitError: e });
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
return i(t);
|
|
14
|
+
},
|
|
15
|
+
staleTime: 3e5
|
|
16
|
+
// 5 minutes
|
|
17
|
+
});
|
|
18
|
+
return r;
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
n as useSearchLimit
|
|
22
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IRegion, IResendVerificationEmailParams,
|
|
1
|
+
import { IRegion, IResendVerificationEmailParams, IUser } from '../services/account/AccountServices.types';
|
|
2
2
|
import { ISignInParams, ISignUpParams, TAuthResponse } from '../types/auth';
|
|
3
3
|
import { IAwayzConfig } from '../configs/awayzConfig';
|
|
4
4
|
export interface IAwayzContext {
|
|
@@ -13,6 +13,5 @@ export interface IAwayzContext {
|
|
|
13
13
|
signOut: () => void;
|
|
14
14
|
resendVerificationEmail: (params: IResendVerificationEmailParams) => Promise<boolean>;
|
|
15
15
|
setTokens: (accessToken: string, refreshToken: string) => void;
|
|
16
|
-
getRequestLimits: () => Promise<ISearchLimit[] | undefined>;
|
|
17
16
|
}
|
|
18
17
|
export declare const AwayzContext: import('react').Context<IAwayzContext>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TEmbeddedAuthOptions } from './useAwayzAuth.types';
|
|
2
|
-
import { IAuthData, IRegion, IResendVerificationEmailParams,
|
|
2
|
+
import { IAuthData, IRegion, IResendVerificationEmailParams, IUser } from '../../services/account/AccountServices.types';
|
|
3
3
|
import { ISignInParams, ISignUpParams } from '../../types/auth';
|
|
4
4
|
declare enum ETokenType {
|
|
5
5
|
EXCHANGE = "exchange_token",
|
|
@@ -33,6 +33,5 @@ export declare const useAwayzAuth: (options: TEmbeddedAuthOptions) => {
|
|
|
33
33
|
signOut: () => void;
|
|
34
34
|
resendVerificationEmail: (params: IResendVerificationEmailParams) => Promise<any>;
|
|
35
35
|
setTokens: (accessToken: string, refreshToken: string) => void;
|
|
36
|
-
getRequestLimits: () => Promise<ISearchLimit[] | undefined>;
|
|
37
36
|
};
|
|
38
37
|
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ISearchLimit } from '../services/account/AccountServices.types';
|
|
2
|
+
export declare const useSearchLimit: () => ISearchLimit[] | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* "data": [
|
|
5
|
+
{
|
|
6
|
+
"search_type": "Flight",
|
|
7
|
+
"subscription": "free",
|
|
8
|
+
"is_admin": false,
|
|
9
|
+
"search_limit": 5,
|
|
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
|
+
],
|
|
22
|
+
*/
|
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AwayzProvider as r } from "./providers/AwayzProvider.js";
|
|
2
2
|
import { useAwayzContext as a } from "./hooks/useAwayzContext.js";
|
|
3
3
|
import { EAuthFlow as n } from "./types/EAuthFlow.js";
|
|
4
|
-
import { c as s, i as x } from "./AccountService-
|
|
4
|
+
import { c as s, i as x } from "./AccountService-Dt2-k7CN.js";
|
|
5
5
|
import { awayzClient as m } from "./configs/awayzClient.js";
|
|
6
6
|
import { CashValue as c, EToolTipPosition as w } from "./components/CashValue/CashValue.js";
|
|
7
7
|
import { getBaseUrl as y } 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-Dt2-k7CN.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, a as y, c as p } from "../../AccountService-Dt2-k7CN.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import { ECurrencyEndpoints as m } from "../../configs/endpoints.js";
|
|
7
7
|
import "react/jsx-runtime";
|