@opexa/portal-sdk 0.0.53 → 0.0.55
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/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +182 -185
- package/dist/index.mjs.map +1 -1
- package/dist/services/types.d.ts +9 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -15,9 +15,9 @@ const S = {
|
|
|
15
15
|
};
|
|
16
16
|
function o(n, ...e) {
|
|
17
17
|
let t = "";
|
|
18
|
-
for (const [
|
|
19
|
-
const s = e.at(
|
|
20
|
-
t = `${t}${
|
|
18
|
+
for (const [a, r] of n.entries()) {
|
|
19
|
+
const s = e.at(a) ?? "";
|
|
20
|
+
t = `${t}${r}${s}`;
|
|
21
21
|
}
|
|
22
22
|
return t.trim();
|
|
23
23
|
}
|
|
@@ -705,7 +705,7 @@ const L = o`
|
|
|
705
705
|
dateTimeCreated
|
|
706
706
|
dateTimeLastUpdated
|
|
707
707
|
}
|
|
708
|
-
`,
|
|
708
|
+
`, at = o`
|
|
709
709
|
${be}
|
|
710
710
|
|
|
711
711
|
query Cashbacks {
|
|
@@ -713,7 +713,7 @@ const L = o`
|
|
|
713
713
|
...CashbackFragment
|
|
714
714
|
}
|
|
715
715
|
}
|
|
716
|
-
`,
|
|
716
|
+
`, rt = o`
|
|
717
717
|
${H}
|
|
718
718
|
|
|
719
719
|
query Bonus {
|
|
@@ -1267,28 +1267,28 @@ class _t {
|
|
|
1267
1267
|
Role: "MEMBER"
|
|
1268
1268
|
});
|
|
1269
1269
|
if (e.name) {
|
|
1270
|
-
const
|
|
1271
|
-
t.set("Authorization", `Basic ${
|
|
1270
|
+
const a = `${e.name}:${e.password}`, r = Buffer.from(a).toString("base64");
|
|
1271
|
+
t.set("Authorization", `Basic ${r}`);
|
|
1272
1272
|
}
|
|
1273
1273
|
if (e.mobileNumber) {
|
|
1274
|
-
const
|
|
1275
|
-
t.set("Authorization", `MobileNumberOTP ${
|
|
1274
|
+
const a = `${e.mobileNumber}:${e.verificationCode}`, r = Buffer.from(a).toString("base64");
|
|
1275
|
+
t.set("Authorization", `MobileNumberOTP ${r}`);
|
|
1276
1276
|
}
|
|
1277
1277
|
e.sessionId && t.set("Authorization", `mayasession ${e.sessionId}`);
|
|
1278
1278
|
try {
|
|
1279
|
-
const
|
|
1279
|
+
const a = await fetch(`${this.url}/sessions`, {
|
|
1280
1280
|
method: "POST",
|
|
1281
1281
|
headers: t
|
|
1282
|
-
}),
|
|
1283
|
-
return
|
|
1282
|
+
}), r = await a.json();
|
|
1283
|
+
return a.ok ? {
|
|
1284
1284
|
ok: !0,
|
|
1285
|
-
data:
|
|
1286
|
-
} :
|
|
1285
|
+
data: r
|
|
1286
|
+
} : r.code === "ACCOUNT_BLACKLISTED" ? {
|
|
1287
1287
|
ok: !1,
|
|
1288
1288
|
error: d("AccountBlacklisted")
|
|
1289
1289
|
} : {
|
|
1290
1290
|
ok: !1,
|
|
1291
|
-
error: h(
|
|
1291
|
+
error: h(a.status)
|
|
1292
1292
|
};
|
|
1293
1293
|
} catch {
|
|
1294
1294
|
return {
|
|
@@ -1306,22 +1306,22 @@ class _t {
|
|
|
1306
1306
|
if (e.type === "SECURITY_QUESTION") {
|
|
1307
1307
|
t.set("Authorization", `Bearer ${e.token}`);
|
|
1308
1308
|
try {
|
|
1309
|
-
const
|
|
1309
|
+
const a = await fetch(`${this.url}/session/${e.token}/authenticate`, {
|
|
1310
1310
|
method: "POST",
|
|
1311
1311
|
headers: t,
|
|
1312
1312
|
body: JSON.stringify({
|
|
1313
1313
|
secretAnswer: e.secretAnswer
|
|
1314
1314
|
})
|
|
1315
|
-
}),
|
|
1316
|
-
return
|
|
1315
|
+
}), r = await a.json();
|
|
1316
|
+
return a.ok ? {
|
|
1317
1317
|
ok: !0,
|
|
1318
|
-
data:
|
|
1319
|
-
} :
|
|
1318
|
+
data: r
|
|
1319
|
+
} : a.status === 401 || a.status === 403 ? {
|
|
1320
1320
|
ok: !1,
|
|
1321
1321
|
error: d("InvalidTokenOrSecretAnswer")
|
|
1322
1322
|
} : {
|
|
1323
1323
|
ok: !1,
|
|
1324
|
-
error: h(
|
|
1324
|
+
error: h(a.status)
|
|
1325
1325
|
};
|
|
1326
1326
|
} catch {
|
|
1327
1327
|
return {
|
|
@@ -1342,11 +1342,11 @@ class _t {
|
|
|
1342
1342
|
Role: "MEMBER",
|
|
1343
1343
|
Authorization: `Bearer ${e}`
|
|
1344
1344
|
}
|
|
1345
|
-
}),
|
|
1345
|
+
}), a = await t.json();
|
|
1346
1346
|
return t.ok ? {
|
|
1347
1347
|
ok: !0,
|
|
1348
|
-
data:
|
|
1349
|
-
} :
|
|
1348
|
+
data: a
|
|
1349
|
+
} : a.code === "ACCOUNT_BLACKLISTED" ? {
|
|
1350
1350
|
ok: !1,
|
|
1351
1351
|
error: d("AccountBlacklisted")
|
|
1352
1352
|
} : t.status === 403 || t.status === 401 ? {
|
|
@@ -1410,35 +1410,35 @@ class Ct {
|
|
|
1410
1410
|
} : e;
|
|
1411
1411
|
}
|
|
1412
1412
|
async games(e) {
|
|
1413
|
-
var
|
|
1413
|
+
var r, s, c, p, l, f, y, u, _, C, T, v, M, N, I, D, R, P, x, G, W, $, U, B;
|
|
1414
1414
|
const t = new URLSearchParams();
|
|
1415
|
-
e != null && e.first && t.set("first", e.first.toString()), e != null && e.after && t.set("after", e.after), e != null && e.search && t.set("search", e.search), (s = (
|
|
1415
|
+
e != null && e.first && t.set("first", e.first.toString()), e != null && e.after && t.set("after", e.after), e != null && e.search && t.set("search", e.search), (s = (r = e == null ? void 0 : e.filter) == null ? void 0 : r.type) != null && s.equal && t.set("filter[type][eq]", e.filter.type.equal), (p = (c = e == null ? void 0 : e.filter) == null ? void 0 : c.type) != null && p.notEqual && t.set("filter[type][neq]", e.filter.type.notEqual), (f = (l = e == null ? void 0 : e.filter) == null ? void 0 : l.type) != null && f.in && t.set("filter[type][in]", e.filter.type.in.join(",")), (u = (y = e == null ? void 0 : e.filter) == null ? void 0 : y.type) != null && u.notIn && t.set("filter[type][nin]", e.filter.type.notIn.join(",")), (C = (_ = e == null ? void 0 : e.filter) == null ? void 0 : _.provider) != null && C.equal && t.set("filter[provider][eq]", e.filter.provider.equal), (v = (T = e == null ? void 0 : e.filter) == null ? void 0 : T.provider) != null && v.notEqual && t.set("filter[provider][neq]", e.filter.provider.notEqual), (N = (M = e == null ? void 0 : e.filter) == null ? void 0 : M.provider) != null && N.in && t.set("filter[provider][in]", e.filter.provider.in.join(",")), (D = (I = e == null ? void 0 : e.filter) == null ? void 0 : I.provider) != null && D.notIn && t.set("filter[provider][nin]", e.filter.provider.notIn.join(",")), (P = (R = e == null ? void 0 : e.filter) == null ? void 0 : R.tags) != null && P.equal && t.set("filter[tags][eq]", e.filter.tags.equal.toLowerCase()), (G = (x = e == null ? void 0 : e.filter) == null ? void 0 : x.tags) != null && G.notEqual && t.set("filter[tags][neq]", e.filter.tags.notEqual.toLowerCase()), ($ = (W = e == null ? void 0 : e.filter) == null ? void 0 : W.tags) != null && $.in && t.set(
|
|
1416
1416
|
"filter[tags][in]",
|
|
1417
1417
|
e.filter.tags.in.map((E) => E.toLowerCase()).join(",")
|
|
1418
1418
|
), (B = (U = e == null ? void 0 : e.filter) == null ? void 0 : U.tags) != null && B.notIn && t.set(
|
|
1419
1419
|
"filter[tags][nin]",
|
|
1420
1420
|
e.filter.tags.notIn.map((E) => E.toLowerCase()).join(",")
|
|
1421
1421
|
);
|
|
1422
|
-
const
|
|
1423
|
-
return
|
|
1422
|
+
const a = await this.getJson("/games", t);
|
|
1423
|
+
return a.ok ? {
|
|
1424
1424
|
ok: !0,
|
|
1425
1425
|
data: {
|
|
1426
|
-
edges:
|
|
1426
|
+
edges: a.data.data.map((E) => ({
|
|
1427
1427
|
node: E,
|
|
1428
1428
|
cursor: E.cursor
|
|
1429
1429
|
})),
|
|
1430
|
-
totalCount:
|
|
1430
|
+
totalCount: a.data.totalCount ?? 0,
|
|
1431
1431
|
pageInfo: {
|
|
1432
|
-
hasNextPage: !!
|
|
1433
|
-
endCursor:
|
|
1432
|
+
hasNextPage: !!a.data.next,
|
|
1433
|
+
endCursor: a.data.next
|
|
1434
1434
|
}
|
|
1435
1435
|
}
|
|
1436
|
-
} :
|
|
1436
|
+
} : a;
|
|
1437
1437
|
}
|
|
1438
1438
|
async game(e) {
|
|
1439
|
-
var
|
|
1439
|
+
var a;
|
|
1440
1440
|
const t = await this.getJson(`/games/${e}`);
|
|
1441
|
-
return ((
|
|
1441
|
+
return ((a = t.error) == null ? void 0 : a.name) === "HttpNotFound" ? {
|
|
1442
1442
|
ok: !0,
|
|
1443
1443
|
data: null
|
|
1444
1444
|
} : t.ok ? {
|
|
@@ -1447,7 +1447,7 @@ class Ct {
|
|
|
1447
1447
|
} : t;
|
|
1448
1448
|
}
|
|
1449
1449
|
async getJson(e, t) {
|
|
1450
|
-
const
|
|
1450
|
+
const a = new Request(`${this.url}${e}?${(t == null ? void 0 : t.toString()) ?? ""}`, {
|
|
1451
1451
|
method: "GET",
|
|
1452
1452
|
headers: {
|
|
1453
1453
|
Accept: "application/json",
|
|
@@ -1457,13 +1457,13 @@ class Ct {
|
|
|
1457
1457
|
}
|
|
1458
1458
|
});
|
|
1459
1459
|
try {
|
|
1460
|
-
const
|
|
1461
|
-
return
|
|
1460
|
+
const r = await fetch(a);
|
|
1461
|
+
return r.ok ? {
|
|
1462
1462
|
ok: !0,
|
|
1463
|
-
data: await
|
|
1463
|
+
data: await r.json()
|
|
1464
1464
|
} : {
|
|
1465
1465
|
ok: !1,
|
|
1466
|
-
error: h(
|
|
1466
|
+
error: h(r.status)
|
|
1467
1467
|
};
|
|
1468
1468
|
} catch {
|
|
1469
1469
|
return {
|
|
@@ -1624,7 +1624,7 @@ class ke {
|
|
|
1624
1624
|
return e.ok ? { ok: e.ok, data: e.data.promos } : e;
|
|
1625
1625
|
}
|
|
1626
1626
|
async cashbacks() {
|
|
1627
|
-
const e = await this.client.request(
|
|
1627
|
+
const e = await this.client.request(at);
|
|
1628
1628
|
return e.ok ? { ok: e.ok, data: e.data.cashbacks } : e;
|
|
1629
1629
|
}
|
|
1630
1630
|
async availablePromos(e) {
|
|
@@ -1651,7 +1651,7 @@ class ke {
|
|
|
1651
1651
|
};
|
|
1652
1652
|
}
|
|
1653
1653
|
async bonus() {
|
|
1654
|
-
const e = await this.client.request(
|
|
1654
|
+
const e = await this.client.request(rt);
|
|
1655
1655
|
return e.ok ? { ok: e.ok, data: e.data.bonus } : e;
|
|
1656
1656
|
}
|
|
1657
1657
|
async wallet() {
|
|
@@ -1839,11 +1839,11 @@ function Y(n) {
|
|
|
1839
1839
|
}
|
|
1840
1840
|
function Rt(n) {
|
|
1841
1841
|
const e = [];
|
|
1842
|
-
function t(
|
|
1843
|
-
for (const s in
|
|
1844
|
-
const c =
|
|
1845
|
-
Y(c) ? t(c, [...
|
|
1846
|
-
key: [...
|
|
1842
|
+
function t(a, r = []) {
|
|
1843
|
+
for (const s in a) {
|
|
1844
|
+
const c = a[s];
|
|
1845
|
+
Y(c) ? t(c, [...r, s]) : Array.isArray(c) ? t(Pt(c), [...r, s]) : e.push({
|
|
1846
|
+
key: [...r, s],
|
|
1847
1847
|
value: c
|
|
1848
1848
|
});
|
|
1849
1849
|
}
|
|
@@ -1851,25 +1851,25 @@ function Rt(n) {
|
|
|
1851
1851
|
return t(n), e;
|
|
1852
1852
|
}
|
|
1853
1853
|
function Pt(n) {
|
|
1854
|
-
return n.reduce((e, t,
|
|
1854
|
+
return n.reduce((e, t, a) => (e[a] = t, e), {});
|
|
1855
1855
|
}
|
|
1856
1856
|
class b {
|
|
1857
1857
|
constructor(e, t) {
|
|
1858
1858
|
m(this, "url");
|
|
1859
1859
|
m(this, "options");
|
|
1860
1860
|
m(this, "middlewares");
|
|
1861
|
-
var
|
|
1862
|
-
const
|
|
1863
|
-
this.url = e, this.options = { ...t == null ? void 0 : t.fetchOptions, headers:
|
|
1861
|
+
var r;
|
|
1862
|
+
const a = new Headers((r = t == null ? void 0 : t.fetchOptions) == null ? void 0 : r.headers);
|
|
1863
|
+
this.url = e, this.options = { ...t == null ? void 0 : t.fetchOptions, headers: a }, this.middlewares = (t == null ? void 0 : t.middlewares) ?? [];
|
|
1864
1864
|
}
|
|
1865
1865
|
async request(e, t) {
|
|
1866
|
-
const
|
|
1867
|
-
|
|
1866
|
+
const a = JSON.stringify({ query: e, variables: t }), r = new Headers(this.options.headers);
|
|
1867
|
+
r.set("Content-Type", "application/json"), r.set("Accept", "application/json");
|
|
1868
1868
|
const s = await this.runMiddlewares(
|
|
1869
1869
|
new Request(this.url, {
|
|
1870
1870
|
...this.options,
|
|
1871
|
-
body:
|
|
1872
|
-
headers:
|
|
1871
|
+
body: a,
|
|
1872
|
+
headers: r,
|
|
1873
1873
|
method: "POST"
|
|
1874
1874
|
})
|
|
1875
1875
|
);
|
|
@@ -1877,26 +1877,26 @@ class b {
|
|
|
1877
1877
|
}
|
|
1878
1878
|
/** Single file upload */
|
|
1879
1879
|
async upload(e, t) {
|
|
1880
|
-
const
|
|
1881
|
-
|
|
1880
|
+
const a = this.createUploadBody(e, t), r = new Headers(this.options.headers);
|
|
1881
|
+
r.delete("Content-Type");
|
|
1882
1882
|
const s = await this.runMiddlewares(
|
|
1883
1883
|
new Request(this.url, {
|
|
1884
1884
|
...this.options,
|
|
1885
|
-
body:
|
|
1886
|
-
headers:
|
|
1885
|
+
body: a,
|
|
1886
|
+
headers: r,
|
|
1887
1887
|
method: "POST"
|
|
1888
1888
|
})
|
|
1889
1889
|
);
|
|
1890
1890
|
return await this.exec(s);
|
|
1891
1891
|
}
|
|
1892
1892
|
async exec(e) {
|
|
1893
|
-
var t,
|
|
1893
|
+
var t, a, r, s, c, p;
|
|
1894
1894
|
try {
|
|
1895
1895
|
const l = await fetch(e);
|
|
1896
1896
|
if (!l.ok)
|
|
1897
1897
|
return { ok: !1, error: h(l.status) };
|
|
1898
1898
|
const f = await l.json(), y = f.data, u = (t = f.errors) == null ? void 0 : t.at(0);
|
|
1899
|
-
return u ? ((
|
|
1899
|
+
return u ? ((a = u.extensions) == null ? void 0 : a.code) === "FORBIDDEN" || ((r = u.extensions) == null ? void 0 : r.code) === "ACCESS_TOKEN_EXPIRED" ? { ok: !1, error: h(403, u.message) } : ((s = u.extensions) == null ? void 0 : s.code) === "UNAUTHORIZED" ? { ok: !1, error: h(401, u.message) } : ((c = u.extensions) == null ? void 0 : c.code) === "BAD_USER_INPUT" || ((p = u.extensions) == null ? void 0 : p.code) === "BAD_REQUEST" ? { ok: !1, error: h(400, u.message) } : {
|
|
1900
1900
|
ok: !1,
|
|
1901
1901
|
error: h(500, u.message)
|
|
1902
1902
|
} : {
|
|
@@ -1912,15 +1912,15 @@ class b {
|
|
|
1912
1912
|
}
|
|
1913
1913
|
async runMiddlewares(e) {
|
|
1914
1914
|
let t = e.clone();
|
|
1915
|
-
for (const
|
|
1916
|
-
t = await
|
|
1915
|
+
for (const a of this.middlewares)
|
|
1916
|
+
t = await a(t);
|
|
1917
1917
|
return t;
|
|
1918
1918
|
}
|
|
1919
1919
|
createUploadBody(e, t) {
|
|
1920
|
-
const
|
|
1920
|
+
const a = Rt(t).filter(
|
|
1921
1921
|
(c) => c.value instanceof File || c.value instanceof Blob
|
|
1922
|
-
),
|
|
1923
|
-
|
|
1922
|
+
), r = new FormData();
|
|
1923
|
+
r.append(
|
|
1924
1924
|
"operations",
|
|
1925
1925
|
JSON.stringify({
|
|
1926
1926
|
query: e,
|
|
@@ -1928,11 +1928,11 @@ class b {
|
|
|
1928
1928
|
})
|
|
1929
1929
|
);
|
|
1930
1930
|
const s = {};
|
|
1931
|
-
return
|
|
1931
|
+
return a.forEach((c, p) => {
|
|
1932
1932
|
s[p.toString()] = [`variables.${c.key.join(".")}`];
|
|
1933
|
-
}),
|
|
1934
|
-
|
|
1935
|
-
}),
|
|
1933
|
+
}), r.append("map", JSON.stringify(s)), a.forEach((c, p) => {
|
|
1934
|
+
r.append(p.toString(), c.value);
|
|
1935
|
+
}), r;
|
|
1936
1936
|
}
|
|
1937
1937
|
}
|
|
1938
1938
|
function k(n) {
|
|
@@ -1982,13 +1982,13 @@ function Ce(n) {
|
|
|
1982
1982
|
function we(n, e) {
|
|
1983
1983
|
const {
|
|
1984
1984
|
until: t,
|
|
1985
|
-
interval:
|
|
1986
|
-
maxAttempt:
|
|
1985
|
+
interval: a = 1e3,
|
|
1986
|
+
maxAttempt: r = 3
|
|
1987
1987
|
/**/
|
|
1988
1988
|
} = e;
|
|
1989
1989
|
async function s(c, p) {
|
|
1990
|
-
const l = p ??
|
|
1991
|
-
return t(f) ? f : l > 1 ? (await Ce(
|
|
1990
|
+
const l = p ?? r, f = await n(...c);
|
|
1991
|
+
return t(f) ? f : l > 1 ? (await Ce(a * ((r - l) / 2)), s(c, l - 1)) : f;
|
|
1992
1992
|
}
|
|
1993
1993
|
return async (...c) => await s(c);
|
|
1994
1994
|
}
|
|
@@ -2023,7 +2023,7 @@ class xt {
|
|
|
2023
2023
|
this._refreshing = e;
|
|
2024
2024
|
}
|
|
2025
2025
|
async create(e) {
|
|
2026
|
-
var
|
|
2026
|
+
var r;
|
|
2027
2027
|
if (this.isServer)
|
|
2028
2028
|
return this.logger.warn("'localStorage' is not available on the server."), {
|
|
2029
2029
|
ok: !1,
|
|
@@ -2042,7 +2042,7 @@ class xt {
|
|
|
2042
2042
|
maxAttempt: 5
|
|
2043
2043
|
})();
|
|
2044
2044
|
if (!c.ok) return c;
|
|
2045
|
-
if (!((
|
|
2045
|
+
if (!((r = c.data) != null && r.member))
|
|
2046
2046
|
return {
|
|
2047
2047
|
ok: !1,
|
|
2048
2048
|
error: {
|
|
@@ -2096,13 +2096,13 @@ class xt {
|
|
|
2096
2096
|
authenticator: t.data.authenticator
|
|
2097
2097
|
}
|
|
2098
2098
|
};
|
|
2099
|
-
const
|
|
2099
|
+
const a = /* @__PURE__ */ new Date();
|
|
2100
2100
|
return window.localStorage.setItem(
|
|
2101
2101
|
this.storageKey,
|
|
2102
2102
|
JSON.stringify({
|
|
2103
2103
|
...t.data,
|
|
2104
|
-
accessTokenExpiresAt: q(
|
|
2105
|
-
refreshTokenExpiresAt: F(O(
|
|
2104
|
+
accessTokenExpiresAt: q(a, 8).getTime(),
|
|
2105
|
+
refreshTokenExpiresAt: F(O(a, 30), 2).getTime()
|
|
2106
2106
|
})
|
|
2107
2107
|
), {
|
|
2108
2108
|
ok: !0,
|
|
@@ -2112,13 +2112,13 @@ class xt {
|
|
|
2112
2112
|
async createFromAuthenticator(e) {
|
|
2113
2113
|
const t = await this.authService.authenticate(e);
|
|
2114
2114
|
if (t.ok) {
|
|
2115
|
-
const
|
|
2115
|
+
const a = /* @__PURE__ */ new Date();
|
|
2116
2116
|
return this.isServer ? this.logger.warn("'localStorage' is not available on the server.") : window.localStorage.setItem(
|
|
2117
2117
|
this.storageKey,
|
|
2118
2118
|
JSON.stringify({
|
|
2119
2119
|
...t.data,
|
|
2120
|
-
accessTokenExpiresAt: q(
|
|
2121
|
-
refreshTokenExpiresAt: F(O(
|
|
2120
|
+
accessTokenExpiresAt: q(a, 8).getTime(),
|
|
2121
|
+
refreshTokenExpiresAt: F(O(a, 30), 2).getTime()
|
|
2122
2122
|
})
|
|
2123
2123
|
), { ok: !0 };
|
|
2124
2124
|
} else
|
|
@@ -2139,9 +2139,9 @@ class xt {
|
|
|
2139
2139
|
data: null
|
|
2140
2140
|
};
|
|
2141
2141
|
try {
|
|
2142
|
-
let t = JSON.parse(e),
|
|
2143
|
-
const
|
|
2144
|
-
if (ye(
|
|
2142
|
+
let t = JSON.parse(e), a = /* @__PURE__ */ new Date();
|
|
2143
|
+
const r = new Date(t.accessTokenExpiresAt), s = new Date(t.refreshTokenExpiresAt);
|
|
2144
|
+
if (ye(a, s))
|
|
2145
2145
|
return this.logger.warn("Session expired. Logging out.."), window.localStorage.removeItem(this.storageKey), {
|
|
2146
2146
|
ok: !1,
|
|
2147
2147
|
error: {
|
|
@@ -2149,7 +2149,7 @@ class xt {
|
|
|
2149
2149
|
message: "Session expired."
|
|
2150
2150
|
}
|
|
2151
2151
|
};
|
|
2152
|
-
if (ye(
|
|
2152
|
+
if (ye(a, r)) {
|
|
2153
2153
|
this.logger.info("Refreshing session..."), this.refreshing = !0;
|
|
2154
2154
|
const c = await this.authService.refreshSession(t.refreshToken);
|
|
2155
2155
|
if (this.refreshing = !1, !c.ok)
|
|
@@ -2160,11 +2160,11 @@ class xt {
|
|
|
2160
2160
|
ok: !0,
|
|
2161
2161
|
data: t
|
|
2162
2162
|
});
|
|
2163
|
-
this.logger.success("Session refreshed!"),
|
|
2163
|
+
this.logger.success("Session refreshed!"), a = /* @__PURE__ */ new Date(), t = {
|
|
2164
2164
|
...t,
|
|
2165
2165
|
...c.data,
|
|
2166
|
-
accessTokenExpiresAt: q(
|
|
2167
|
-
refreshTokenExpiresAt: F(O(
|
|
2166
|
+
accessTokenExpiresAt: q(a, 8).getTime(),
|
|
2167
|
+
refreshTokenExpiresAt: F(O(a, 30), 2).getTime()
|
|
2168
2168
|
}, window.localStorage.setItem(this.storageKey, JSON.stringify(t));
|
|
2169
2169
|
}
|
|
2170
2170
|
return {
|
|
@@ -2191,11 +2191,11 @@ class xt {
|
|
|
2191
2191
|
(t = e.data) != null && t.accessToken && await this.authService.destroySession(e.data.accessToken), window.localStorage.removeItem(this.storageKey);
|
|
2192
2192
|
}
|
|
2193
2193
|
async verify() {
|
|
2194
|
-
var
|
|
2194
|
+
var a, r, s;
|
|
2195
2195
|
if (this.isServer)
|
|
2196
2196
|
return this.logger.warn("'localStorage' is not available on the server."), !0;
|
|
2197
2197
|
const e = await this.get();
|
|
2198
|
-
if (((
|
|
2198
|
+
if (((a = e.error) == null ? void 0 : a.name) === "InvalidToken" || ((r = e.error) == null ? void 0 : r.name) === "SessionExpired" || ((s = e.error) == null ? void 0 : s.name) === "AccountBlacklisted") return !1;
|
|
2199
2199
|
if (!e.data) return !0;
|
|
2200
2200
|
const t = await this.authService.verifySession(e.data.accessToken);
|
|
2201
2201
|
return t || window.localStorage.removeItem(this.storageKey), t;
|
|
@@ -2207,17 +2207,17 @@ class xt {
|
|
|
2207
2207
|
function g(n) {
|
|
2208
2208
|
const e = {};
|
|
2209
2209
|
for (const t in n) {
|
|
2210
|
-
const
|
|
2211
|
-
if (
|
|
2212
|
-
if (Y(
|
|
2213
|
-
e[t] = g(
|
|
2210
|
+
const a = n[t];
|
|
2211
|
+
if (a !== null && a !== void 0) {
|
|
2212
|
+
if (Y(a)) {
|
|
2213
|
+
e[t] = g(a);
|
|
2214
2214
|
continue;
|
|
2215
2215
|
}
|
|
2216
|
-
if (Array.isArray(
|
|
2217
|
-
e[t] =
|
|
2216
|
+
if (Array.isArray(a)) {
|
|
2217
|
+
e[t] = a.map((r) => Y(r) ? g(r) : r);
|
|
2218
2218
|
continue;
|
|
2219
2219
|
}
|
|
2220
|
-
e[t] =
|
|
2220
|
+
e[t] = a;
|
|
2221
2221
|
}
|
|
2222
2222
|
}
|
|
2223
2223
|
return e;
|
|
@@ -2279,7 +2279,7 @@ class Gt {
|
|
|
2279
2279
|
return g(t);
|
|
2280
2280
|
}
|
|
2281
2281
|
platform(e) {
|
|
2282
|
-
var t,
|
|
2282
|
+
var t, a, r, s, c, p, l, f, y, u, _, C, T, v, M, N, I, D, R, P, x, G, W, $, U, B, E, Q, K, z, J, X, Z, ee, te, ae, re, ne, oe, ie, se, ce, me, de, ue, le, pe, fe, he;
|
|
2283
2283
|
return {
|
|
2284
2284
|
paymentSettings: {
|
|
2285
2285
|
minimumFirstDepositAmount: i(e.minimumFirstDepositAmount),
|
|
@@ -2287,8 +2287,8 @@ class Gt {
|
|
|
2287
2287
|
depositGateway: {
|
|
2288
2288
|
bank: {
|
|
2289
2289
|
androidEnabled: ((t = e.bankDepositGatewaySettings) == null ? void 0 : t.androidEnabled) ?? !1,
|
|
2290
|
-
iosEnabled: ((
|
|
2291
|
-
webEnabled: ((
|
|
2290
|
+
iosEnabled: ((a = e.bankDepositGatewaySettings) == null ? void 0 : a.iosEnabled) ?? !1,
|
|
2291
|
+
webEnabled: ((r = e.bankDepositGatewaySettings) == null ? void 0 : r.webEnabled) ?? !1,
|
|
2292
2292
|
mobileWebEnabled: ((s = e.bankDepositGatewaySettings) == null ? void 0 : s.mobileWebEnabled) ?? !1,
|
|
2293
2293
|
minimumAmount: i((c = e.bankDepositGatewaySettings) == null ? void 0 : c.minimumAmount),
|
|
2294
2294
|
maximumAmount: i((p = e.bankDepositGatewaySettings) == null ? void 0 : p.maximumAmount)
|
|
@@ -2334,12 +2334,12 @@ class Gt {
|
|
|
2334
2334
|
mobileWebEnabled: ((ee = e.gcashWithdrawalGatewaySettings) == null ? void 0 : ee.mobileWebEnabled) ?? !1,
|
|
2335
2335
|
minimumAmount: i((te = e.gcashWithdrawalGatewaySettings) == null ? void 0 : te.minimumAmount),
|
|
2336
2336
|
maximumAmount: i(
|
|
2337
|
-
(
|
|
2337
|
+
(ae = e.gcashWithdrawalGatewaySettings) == null ? void 0 : ae.maximumAmount,
|
|
2338
2338
|
1e6
|
|
2339
2339
|
)
|
|
2340
2340
|
},
|
|
2341
2341
|
maya: {
|
|
2342
|
-
androidEnabled: ((
|
|
2342
|
+
androidEnabled: ((re = e.mayaWithdrawalGatewaySettings) == null ? void 0 : re.androidEnabled) ?? !1,
|
|
2343
2343
|
iosEnabled: ((ne = e.mayaWithdrawalGatewaySettings) == null ? void 0 : ne.iosEnabled) ?? !1,
|
|
2344
2344
|
webEnabled: ((oe = e.mayaWithdrawalGatewaySettings) == null ? void 0 : oe.webEnabled) ?? !1,
|
|
2345
2345
|
mobileWebEnabled: ((ie = e.mayaWithdrawalGatewaySettings) == null ? void 0 : ie.mobileWebEnabled) ?? !1,
|
|
@@ -2475,7 +2475,7 @@ class Gt {
|
|
|
2475
2475
|
return g(t);
|
|
2476
2476
|
}
|
|
2477
2477
|
betRecord(e) {
|
|
2478
|
-
var
|
|
2478
|
+
var a;
|
|
2479
2479
|
const t = {
|
|
2480
2480
|
id: e.id,
|
|
2481
2481
|
bet: i(e.bet, 0),
|
|
@@ -2500,7 +2500,7 @@ class Gt {
|
|
|
2500
2500
|
contestName: e.contestName ?? void 0,
|
|
2501
2501
|
externalCategory: e.externalCategory ?? void 0,
|
|
2502
2502
|
metadata: {
|
|
2503
|
-
odds: ((
|
|
2503
|
+
odds: ((a = e.metadata) == null ? void 0 : a.odds) ?? void 0
|
|
2504
2504
|
}
|
|
2505
2505
|
};
|
|
2506
2506
|
return g(t);
|
|
@@ -2552,10 +2552,7 @@ class Gt {
|
|
|
2552
2552
|
type: e.type,
|
|
2553
2553
|
tags: e.tags ?? [],
|
|
2554
2554
|
name: e.name,
|
|
2555
|
-
images:
|
|
2556
|
-
id: e.reference,
|
|
2557
|
-
provider: e.provider
|
|
2558
|
-
}),
|
|
2555
|
+
images: [e.customImage, e.image].filter(Boolean),
|
|
2559
2556
|
provider: e.provider,
|
|
2560
2557
|
reference: e.reference,
|
|
2561
2558
|
externalId: e.externalId
|
|
@@ -2600,7 +2597,7 @@ class Gt {
|
|
|
2600
2597
|
dateTimeLastUpdated: new Date(e.dateTimeLastUpdated),
|
|
2601
2598
|
turnoverContributionPercentagePerGameProvider: Object.entries(
|
|
2602
2599
|
e.turnoverContributionPercentagePerGameProvider
|
|
2603
|
-
).reduce((
|
|
2600
|
+
).reduce((a, [r, s]) => (a[r] = i(s, 0), a), {})
|
|
2604
2601
|
};
|
|
2605
2602
|
}
|
|
2606
2603
|
bonus(e) {
|
|
@@ -2697,14 +2694,14 @@ class Ot {
|
|
|
2697
2694
|
this.transformer = new Gt(e), this.logger = new _e({
|
|
2698
2695
|
enabled: e.logs ?? !1
|
|
2699
2696
|
});
|
|
2700
|
-
const
|
|
2697
|
+
const a = t ? "https://auth.opexa.io" : "https://auth.development.opexa.io", r = t ? "https://wallet.opexa.io/graphql" : "https://wallet.development.opexa.io/graphql", s = t ? "https://report.opexa.io/graphql" : "https://report.development.opexa.io/graphql", c = t ? "https://account.opexa.io/graphql" : "https://account.development.opexa.io/graphql", p = t ? "https://portal.opexa.io/graphql" : "https://portal.development.opexa.io/graphql", l = t ? "https://file.opexa.io/graphql" : "https://file.development.opexa.io/graphql", f = t ? "https://game.opexa.io/graphql" : "https://game.development.opexa.io/graphql", y = t ? "https://portal-api.opexacms.io/v1" : "https://portal-api.development.opexacms.io/v1";
|
|
2701
2698
|
this.cmsPortalService = new Ct({
|
|
2702
2699
|
url: y,
|
|
2703
2700
|
site: e.site,
|
|
2704
2701
|
platform: e.sitePlatform
|
|
2705
2702
|
}), this.sessionManager = new xt({
|
|
2706
|
-
authUrl:
|
|
2707
|
-
walletUrl:
|
|
2703
|
+
authUrl: a,
|
|
2704
|
+
walletUrl: r,
|
|
2708
2705
|
platform: e.platform,
|
|
2709
2706
|
logs: e.logs
|
|
2710
2707
|
});
|
|
@@ -2717,7 +2714,7 @@ class Ot {
|
|
|
2717
2714
|
}
|
|
2718
2715
|
}
|
|
2719
2716
|
};
|
|
2720
|
-
this.gameService = new vt(new b(f, u)), this.fileService = new Tt(new b(l, u)), this.walletService = new ke(new b(
|
|
2717
|
+
this.gameService = new vt(new b(f, u)), this.fileService = new Tt(new b(l, u)), this.walletService = new ke(new b(r, u)), this.accountService = new kt(new b(c, u)), this.reportService = new Nt(new b(s, u)), this.portalService = new Mt(new b(p, u));
|
|
2721
2718
|
}
|
|
2722
2719
|
get authMiddleware() {
|
|
2723
2720
|
return async (e) => {
|
|
@@ -2832,12 +2829,12 @@ class Ot {
|
|
|
2832
2829
|
*/
|
|
2833
2830
|
watchSession(e) {
|
|
2834
2831
|
const t = Dt(e.interval ?? 3e4, 3e4, 6e4);
|
|
2835
|
-
let
|
|
2836
|
-
const
|
|
2837
|
-
await this.sessionManager.verify() || await e.onInvalid(),
|
|
2832
|
+
let a = null;
|
|
2833
|
+
const r = () => setTimeout(async () => {
|
|
2834
|
+
await this.sessionManager.verify() || await e.onInvalid(), a = r();
|
|
2838
2835
|
}, t);
|
|
2839
|
-
return
|
|
2840
|
-
|
|
2836
|
+
return a = r(), function() {
|
|
2837
|
+
a && clearTimeout(a);
|
|
2841
2838
|
};
|
|
2842
2839
|
}
|
|
2843
2840
|
async session() {
|
|
@@ -2917,7 +2914,7 @@ class Ot {
|
|
|
2917
2914
|
* ```
|
|
2918
2915
|
*/
|
|
2919
2916
|
async createAccount(e) {
|
|
2920
|
-
const t = e.id ?? A.generate(S.Account).toString(),
|
|
2917
|
+
const t = e.id ?? A.generate(S.Account).toString(), a = await this.accountService.registerMemberAccount({
|
|
2921
2918
|
input: {
|
|
2922
2919
|
id: t,
|
|
2923
2920
|
name: e.name,
|
|
@@ -2930,7 +2927,7 @@ class Ot {
|
|
|
2930
2927
|
verificationCode: e.verificationCode,
|
|
2931
2928
|
reCAPTCHAResponse: e.reCAPTCHAResponse
|
|
2932
2929
|
});
|
|
2933
|
-
return
|
|
2930
|
+
return a.ok ? { ok: !0, data: { id: t } } : a;
|
|
2934
2931
|
}
|
|
2935
2932
|
async registerMayaAccount(e) {
|
|
2936
2933
|
return await this.accountService.registerMayaMemberAccount({
|
|
@@ -3008,13 +3005,13 @@ class Ot {
|
|
|
3008
3005
|
* ```
|
|
3009
3006
|
*/
|
|
3010
3007
|
async submitVerificationDetails(e) {
|
|
3011
|
-
const t = e.id ?? A.generate(S.Verification).toString(),
|
|
3008
|
+
const t = e.id ?? A.generate(S.Verification).toString(), a = await this.accountService.createMemberVerification({
|
|
3012
3009
|
input: {
|
|
3013
3010
|
id: t,
|
|
3014
3011
|
...e
|
|
3015
3012
|
}
|
|
3016
3013
|
});
|
|
3017
|
-
return
|
|
3014
|
+
return a.ok ? { ok: !0, data: { id: t } } : a;
|
|
3018
3015
|
}
|
|
3019
3016
|
/**
|
|
3020
3017
|
* @example
|
|
@@ -3099,9 +3096,9 @@ class Ot {
|
|
|
3099
3096
|
return t.ok ? {
|
|
3100
3097
|
ok: !0,
|
|
3101
3098
|
data: {
|
|
3102
|
-
announcements: t.data.edges.map(({ cursor:
|
|
3103
|
-
...this.transformer.transform.announcement(
|
|
3104
|
-
cursor:
|
|
3099
|
+
announcements: t.data.edges.map(({ cursor: a, node: r }) => ({
|
|
3100
|
+
...this.transformer.transform.announcement(r),
|
|
3101
|
+
cursor: a
|
|
3105
3102
|
})),
|
|
3106
3103
|
totalCount: t.data.totalCount,
|
|
3107
3104
|
endCursor: t.data.pageInfo.endCursor ?? void 0,
|
|
@@ -3134,17 +3131,17 @@ class Ot {
|
|
|
3134
3131
|
async createWithdrawal(e) {
|
|
3135
3132
|
const t = e.id ?? A.generate(S.Withdrawal).toString();
|
|
3136
3133
|
if (e.type === "BANK") {
|
|
3137
|
-
const
|
|
3134
|
+
const a = await this.walletService.createBankWithdrawal({
|
|
3138
3135
|
input: {
|
|
3139
3136
|
id: t,
|
|
3140
3137
|
amount: e.amount.toString(),
|
|
3141
3138
|
transactionPassword: await w(e.transactionPassword)
|
|
3142
3139
|
}
|
|
3143
3140
|
});
|
|
3144
|
-
if (!
|
|
3141
|
+
if (!a.ok) return a;
|
|
3145
3142
|
}
|
|
3146
3143
|
if (e.type === "GCASH") {
|
|
3147
|
-
const
|
|
3144
|
+
const a = await this.walletService.createGCashWithdrawal({
|
|
3148
3145
|
input: {
|
|
3149
3146
|
id: t,
|
|
3150
3147
|
amount: e.amount.toString(),
|
|
@@ -3152,10 +3149,10 @@ class Ot {
|
|
|
3152
3149
|
recipientMobileNumber: k(e.recipientMobileNumber)
|
|
3153
3150
|
}
|
|
3154
3151
|
});
|
|
3155
|
-
if (!
|
|
3152
|
+
if (!a.ok) return a;
|
|
3156
3153
|
}
|
|
3157
3154
|
if (e.type === "MAYA") {
|
|
3158
|
-
const
|
|
3155
|
+
const a = await this.walletService.createMayaWithdrawal({
|
|
3159
3156
|
input: {
|
|
3160
3157
|
id: t,
|
|
3161
3158
|
amount: e.amount.toString(),
|
|
@@ -3163,27 +3160,27 @@ class Ot {
|
|
|
3163
3160
|
recipientMobileNumber: k(e.recipientMobileNumber)
|
|
3164
3161
|
}
|
|
3165
3162
|
});
|
|
3166
|
-
if (!
|
|
3163
|
+
if (!a.ok) return a;
|
|
3167
3164
|
}
|
|
3168
3165
|
if (e.type === "MAYA_APP") {
|
|
3169
|
-
const
|
|
3166
|
+
const a = await this.walletService.createMayaAppWithdrawal({
|
|
3170
3167
|
input: {
|
|
3171
3168
|
id: t,
|
|
3172
3169
|
amount: e.amount.toString(),
|
|
3173
3170
|
transactionPassword: await w(e.transactionPassword)
|
|
3174
3171
|
}
|
|
3175
3172
|
});
|
|
3176
|
-
if (!
|
|
3173
|
+
if (!a.ok) return a;
|
|
3177
3174
|
}
|
|
3178
3175
|
if (e.type === "MAYA_APP [NEXT]") {
|
|
3179
|
-
const
|
|
3176
|
+
const a = await this.walletService.createMayaAppWithdrawal__next({
|
|
3180
3177
|
input: {
|
|
3181
3178
|
id: t,
|
|
3182
3179
|
amount: e.amount.toString(),
|
|
3183
3180
|
transactionPassword: await w(e.transactionPassword)
|
|
3184
3181
|
}
|
|
3185
3182
|
});
|
|
3186
|
-
if (!
|
|
3183
|
+
if (!a.ok) return a;
|
|
3187
3184
|
}
|
|
3188
3185
|
return { ok: !0, data: { id: t } };
|
|
3189
3186
|
}
|
|
@@ -3192,9 +3189,9 @@ class Ot {
|
|
|
3192
3189
|
return t.ok ? {
|
|
3193
3190
|
ok: !0,
|
|
3194
3191
|
data: {
|
|
3195
|
-
withdrawalRecords: t.data.edges.map(({ cursor:
|
|
3196
|
-
...this.transformer.transform.withdrawalRecord(
|
|
3197
|
-
cursor:
|
|
3192
|
+
withdrawalRecords: t.data.edges.map(({ cursor: a, node: r }) => ({
|
|
3193
|
+
...this.transformer.transform.withdrawalRecord(r),
|
|
3194
|
+
cursor: a
|
|
3198
3195
|
})),
|
|
3199
3196
|
totalCount: t.data.totalCount,
|
|
3200
3197
|
endCursor: t.data.pageInfo.endCursor ?? void 0,
|
|
@@ -3230,44 +3227,44 @@ class Ot {
|
|
|
3230
3227
|
async createDeposit(e) {
|
|
3231
3228
|
const t = e.id ?? A.generate(S.Deposit).toString();
|
|
3232
3229
|
if (e.type === "MAYA") {
|
|
3233
|
-
const
|
|
3230
|
+
const a = await this.walletService.createMayaDeposit({
|
|
3234
3231
|
input: {
|
|
3235
3232
|
id: t,
|
|
3236
3233
|
amount: e.amount.toString(),
|
|
3237
3234
|
promo: e.promo
|
|
3238
3235
|
}
|
|
3239
3236
|
});
|
|
3240
|
-
if (!
|
|
3237
|
+
if (!a.ok) return a;
|
|
3241
3238
|
}
|
|
3242
3239
|
if (e.type === "MAYA_APP") {
|
|
3243
|
-
const
|
|
3240
|
+
const a = await this.walletService.createMayaAppDeposit({
|
|
3244
3241
|
input: {
|
|
3245
3242
|
id: t,
|
|
3246
3243
|
amount: e.amount.toString(),
|
|
3247
3244
|
promo: e.promo
|
|
3248
3245
|
}
|
|
3249
3246
|
});
|
|
3250
|
-
if (!
|
|
3247
|
+
if (!a.ok) return a;
|
|
3251
3248
|
}
|
|
3252
3249
|
if (e.type === "MAYA_APP [NEXT]") {
|
|
3253
|
-
const
|
|
3250
|
+
const a = await this.walletService.createMayaAppDeposit__next({
|
|
3254
3251
|
input: {
|
|
3255
3252
|
id: t,
|
|
3256
3253
|
amount: e.amount.toString(),
|
|
3257
3254
|
promo: e.promo
|
|
3258
3255
|
}
|
|
3259
3256
|
});
|
|
3260
|
-
if (!
|
|
3257
|
+
if (!a.ok) return a;
|
|
3261
3258
|
}
|
|
3262
3259
|
if (e.type === "GCASH") {
|
|
3263
|
-
const
|
|
3260
|
+
const a = await this.walletService.createGCashDeposit({
|
|
3264
3261
|
input: {
|
|
3265
3262
|
id: t,
|
|
3266
3263
|
amount: e.amount.toString(),
|
|
3267
3264
|
promo: e.promo
|
|
3268
3265
|
}
|
|
3269
3266
|
});
|
|
3270
|
-
if (!
|
|
3267
|
+
if (!a.ok) return a;
|
|
3271
3268
|
}
|
|
3272
3269
|
return { ok: !0, data: { id: t } };
|
|
3273
3270
|
}
|
|
@@ -3283,9 +3280,9 @@ class Ot {
|
|
|
3283
3280
|
return t.ok ? {
|
|
3284
3281
|
ok: !0,
|
|
3285
3282
|
data: {
|
|
3286
|
-
depositRecords: t.data.edges.map(({ cursor:
|
|
3287
|
-
...this.transformer.transform.depositRecord(
|
|
3288
|
-
cursor:
|
|
3283
|
+
depositRecords: t.data.edges.map(({ cursor: a, node: r }) => ({
|
|
3284
|
+
...this.transformer.transform.depositRecord(r),
|
|
3285
|
+
cursor: a
|
|
3289
3286
|
})),
|
|
3290
3287
|
totalCount: t.data.totalCount,
|
|
3291
3288
|
endCursor: t.data.pageInfo.endCursor ?? void 0,
|
|
@@ -3318,9 +3315,9 @@ class Ot {
|
|
|
3318
3315
|
return t.ok ? {
|
|
3319
3316
|
ok: !0,
|
|
3320
3317
|
data: {
|
|
3321
|
-
betRecords: t.data.edges.map(({ cursor:
|
|
3322
|
-
...this.transformer.transform.betRecord(
|
|
3323
|
-
cursor:
|
|
3318
|
+
betRecords: t.data.edges.map(({ cursor: a, node: r }) => ({
|
|
3319
|
+
...this.transformer.transform.betRecord(r),
|
|
3320
|
+
cursor: a
|
|
3324
3321
|
})),
|
|
3325
3322
|
totalCount: t.data.totalCount,
|
|
3326
3323
|
endCursor: t.data.pageInfo.endCursor ?? void 0,
|
|
@@ -3345,9 +3342,9 @@ class Ot {
|
|
|
3345
3342
|
return t.ok ? {
|
|
3346
3343
|
ok: !0,
|
|
3347
3344
|
data: {
|
|
3348
|
-
transactionRecords: t.data.edges.map(({ cursor:
|
|
3349
|
-
...this.transformer.transform.transactionRecord(
|
|
3350
|
-
cursor:
|
|
3345
|
+
transactionRecords: t.data.edges.map(({ cursor: a, node: r }) => ({
|
|
3346
|
+
...this.transformer.transform.transactionRecord(r),
|
|
3347
|
+
cursor: a
|
|
3351
3348
|
})),
|
|
3352
3349
|
totalCount: t.data.totalCount,
|
|
3353
3350
|
endCursor: t.data.pageInfo.endCursor ?? void 0,
|
|
@@ -3420,9 +3417,9 @@ class Ot {
|
|
|
3420
3417
|
return t.ok ? {
|
|
3421
3418
|
ok: !0,
|
|
3422
3419
|
data: {
|
|
3423
|
-
games: t.data.edges.map(({ cursor:
|
|
3424
|
-
...this.transformer.transform.game(
|
|
3425
|
-
cursor:
|
|
3420
|
+
games: t.data.edges.map(({ cursor: a, node: r }) => ({
|
|
3421
|
+
...this.transformer.transform.game(r),
|
|
3422
|
+
cursor: a
|
|
3426
3423
|
})),
|
|
3427
3424
|
totalCount: t.data.totalCount,
|
|
3428
3425
|
hasNextPage: t.data.pageInfo.hasNextPage,
|
|
@@ -3435,9 +3432,9 @@ class Ot {
|
|
|
3435
3432
|
return t.ok ? {
|
|
3436
3433
|
ok: !0,
|
|
3437
3434
|
data: {
|
|
3438
|
-
games: t.data.edges.map(({ cursor:
|
|
3439
|
-
...this.transformer.transform.game__next(
|
|
3440
|
-
cursor:
|
|
3435
|
+
games: t.data.edges.map(({ cursor: a, node: r }) => ({
|
|
3436
|
+
...this.transformer.transform.game__next(r),
|
|
3437
|
+
cursor: a
|
|
3441
3438
|
})),
|
|
3442
3439
|
totalCount: t.data.totalCount,
|
|
3443
3440
|
hasNextPage: t.data.pageInfo.hasNextPage,
|
|
@@ -3451,9 +3448,9 @@ class Ot {
|
|
|
3451
3448
|
return t.ok ? {
|
|
3452
3449
|
ok: !0,
|
|
3453
3450
|
data: {
|
|
3454
|
-
games: t.data.edges.map(({ cursor:
|
|
3455
|
-
...this.transformer.transform.game(
|
|
3456
|
-
cursor:
|
|
3451
|
+
games: t.data.edges.map(({ cursor: a, node: r }) => ({
|
|
3452
|
+
...this.transformer.transform.game(r),
|
|
3453
|
+
cursor: a
|
|
3457
3454
|
})),
|
|
3458
3455
|
totalCount: t.data.totalCount,
|
|
3459
3456
|
hasNextPage: t.data.pageInfo.hasNextPage,
|
|
@@ -3501,11 +3498,11 @@ class Ot {
|
|
|
3501
3498
|
ok: !0,
|
|
3502
3499
|
data: this.transformer.transform.gameSession(t.data)
|
|
3503
3500
|
};
|
|
3504
|
-
const
|
|
3505
|
-
return
|
|
3501
|
+
const a = await this.gameService.gameSession({ id: e });
|
|
3502
|
+
return a.ok ? {
|
|
3506
3503
|
ok: !0,
|
|
3507
|
-
data:
|
|
3508
|
-
} :
|
|
3504
|
+
data: a.data ? this.transformer.transform.gameSession(a.data) : null
|
|
3505
|
+
} : a;
|
|
3509
3506
|
}
|
|
3510
3507
|
/**
|
|
3511
3508
|
* @deprecated use `createGameSession__next`
|
|
@@ -3524,13 +3521,13 @@ class Ot {
|
|
|
3524
3521
|
* ```
|
|
3525
3522
|
*/
|
|
3526
3523
|
async createGameSession(e) {
|
|
3527
|
-
const t = e.id ?? A.generate(S.GameSession).toString(),
|
|
3528
|
-
return
|
|
3524
|
+
const t = e.id ?? A.generate(S.GameSession).toString(), a = await this.walletService.createGameSession({ input: { id: t, game: e.game } });
|
|
3525
|
+
return a.ok ? { ok: !0, data: { id: t } } : a;
|
|
3529
3526
|
}
|
|
3530
3527
|
/** @deprecated use `createGameSession__next` */
|
|
3531
3528
|
async createGameSession__legacy(e) {
|
|
3532
|
-
const t = e.id ?? A.generate(S.GameSession).toString(),
|
|
3533
|
-
return
|
|
3529
|
+
const t = e.id ?? A.generate(S.GameSession).toString(), a = await this.gameService.createGameSession({ input: { id: t, game: e.game } });
|
|
3530
|
+
return a.ok ? { ok: !0, data: { id: t } } : a;
|
|
3534
3531
|
}
|
|
3535
3532
|
async createGameSession__next(e) {
|
|
3536
3533
|
const t = e.id ?? A.generate(S.GameSession).toString();
|
|
@@ -3545,8 +3542,8 @@ class Ot {
|
|
|
3545
3542
|
});
|
|
3546
3543
|
return l.ok ? { ok: !0, data: { id: t } } : l;
|
|
3547
3544
|
}
|
|
3548
|
-
const
|
|
3549
|
-
if (!
|
|
3545
|
+
const a = await this.game__next(e.game);
|
|
3546
|
+
if (!a.data)
|
|
3550
3547
|
return {
|
|
3551
3548
|
ok: !1,
|
|
3552
3549
|
error: {
|
|
@@ -3556,9 +3553,9 @@ class Ot {
|
|
|
3556
3553
|
};
|
|
3557
3554
|
const {
|
|
3558
3555
|
/**/
|
|
3559
|
-
provider:
|
|
3556
|
+
provider: r,
|
|
3560
3557
|
reference: s
|
|
3561
|
-
} =
|
|
3558
|
+
} = a.data, c = $t(r) ? await this.walletService.createGameSession({ input: { id: t, game: s } }) : await this.gameService.createGameSession({ input: { id: t, game: s } });
|
|
3562
3559
|
return c.ok ? { ok: !0, data: { id: t } } : c;
|
|
3563
3560
|
}
|
|
3564
3561
|
/** @deprecated use `endGameSession__next` */
|
|
@@ -3601,13 +3598,13 @@ class Ot {
|
|
|
3601
3598
|
* ```
|
|
3602
3599
|
*/
|
|
3603
3600
|
async uploadImageFile(e) {
|
|
3604
|
-
const t = e.id ?? A.generate(S.File).toString(),
|
|
3601
|
+
const t = e.id ?? A.generate(S.File).toString(), a = await this.fileService.uploadPrivateImageFile({
|
|
3605
3602
|
input: {
|
|
3606
3603
|
id: t,
|
|
3607
3604
|
file: e.file
|
|
3608
3605
|
}
|
|
3609
3606
|
});
|
|
3610
|
-
return
|
|
3607
|
+
return a.ok ? { ok: !0, data: { id: t } } : a;
|
|
3611
3608
|
}
|
|
3612
3609
|
/**/
|
|
3613
3610
|
/*+----------------------------------------+*/
|
|
@@ -3633,9 +3630,9 @@ class Ot {
|
|
|
3633
3630
|
return t.ok ? {
|
|
3634
3631
|
ok: !0,
|
|
3635
3632
|
data: {
|
|
3636
|
-
pointsWalletTransactions: t.data.edges.map(({ cursor:
|
|
3637
|
-
...this.transformer.transform.pointsWalletTransaction(
|
|
3638
|
-
cursor:
|
|
3633
|
+
pointsWalletTransactions: t.data.edges.map(({ cursor: a, node: r }) => ({
|
|
3634
|
+
...this.transformer.transform.pointsWalletTransaction(r),
|
|
3635
|
+
cursor: a
|
|
3639
3636
|
})),
|
|
3640
3637
|
totalCount: t.data.totalCount,
|
|
3641
3638
|
hasNextPage: t.data.pageInfo.hasNextPage,
|
|
@@ -3653,9 +3650,9 @@ class Ot {
|
|
|
3653
3650
|
return t.ok ? {
|
|
3654
3651
|
ok: !0,
|
|
3655
3652
|
data: {
|
|
3656
|
-
activityRecords: t.data.edges.map(({ cursor:
|
|
3657
|
-
...this.transformer.transform.activityRecord(
|
|
3658
|
-
cursor:
|
|
3653
|
+
activityRecords: t.data.edges.map(({ cursor: a, node: r }) => ({
|
|
3654
|
+
...this.transformer.transform.activityRecord(r),
|
|
3655
|
+
cursor: a
|
|
3659
3656
|
})),
|
|
3660
3657
|
totalCount: t.data.totalCount,
|
|
3661
3658
|
hasNextPage: t.data.pageInfo.hasNextPage,
|