@opexa/portal-sdk 0.0.32 → 0.0.34
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 +9 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +143 -127
- package/dist/index.mjs.map +1 -1
- package/dist/sdk/types.d.ts +2 -1
- package/dist/services/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var _e = Object.defineProperty;
|
|
2
2
|
var Te = (n, e, t) => e in n ? _e(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
3
|
var d = (n, e, t) => Te(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { ObjectId as
|
|
5
|
-
import { ObjectId as
|
|
6
|
-
const
|
|
4
|
+
import { ObjectId as b } from "@opexa/object-id";
|
|
5
|
+
import { ObjectId as Bt } from "@opexa/object-id";
|
|
6
|
+
const S = {
|
|
7
7
|
Account: 8,
|
|
8
8
|
Deposit: 9,
|
|
9
9
|
Withdrawal: 14,
|
|
@@ -16,8 +16,8 @@ const b = {
|
|
|
16
16
|
function o(n, ...e) {
|
|
17
17
|
let t = "";
|
|
18
18
|
for (const [a, r] of n.entries()) {
|
|
19
|
-
const
|
|
20
|
-
t = `${t}${r}${
|
|
19
|
+
const s = e.at(a) ?? "";
|
|
20
|
+
t = `${t}${r}${s}`;
|
|
21
21
|
}
|
|
22
22
|
return t.trim();
|
|
23
23
|
}
|
|
@@ -139,7 +139,7 @@ const x = o`
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
`,
|
|
142
|
+
`, be = o`
|
|
143
143
|
query GameSession($id: ObjectId!) {
|
|
144
144
|
node(id: $id) {
|
|
145
145
|
... on GameSession {
|
|
@@ -151,7 +151,7 @@ const x = o`
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
`,
|
|
154
|
+
`, Se = o`
|
|
155
155
|
mutation CreateGameSession($input: CreateGameSessionInput!) {
|
|
156
156
|
createGameSession(input: $input) {
|
|
157
157
|
... on GameDoesNotExistError {
|
|
@@ -203,7 +203,7 @@ const x = o`
|
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
`,
|
|
206
|
+
`, We = o`
|
|
207
207
|
query WithdrawalRecords($first: Int, $after: Cursor, $filter: WithdrawalRecordFilterInput) {
|
|
208
208
|
member {
|
|
209
209
|
withdrawalRecords(first: $first, after: $after, filter: $filter) {
|
|
@@ -270,7 +270,7 @@ const x = o`
|
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
`,
|
|
273
|
+
`, $e = o`
|
|
274
274
|
mutation CreateGCashWithdrawal($input: CreateGCashWithdrawalInput!) {
|
|
275
275
|
createGCashWithdrawal(input: $input) {
|
|
276
276
|
... on AccountNotVerifiedError {
|
|
@@ -316,7 +316,7 @@ const x = o`
|
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
|
-
`,
|
|
319
|
+
`, Oe = o`
|
|
320
320
|
mutation CreateMayaAppWithdrawal($input: CreateMayaAppWithdrawalInput!) {
|
|
321
321
|
createMayaAppWithdrawal(input: $input) {
|
|
322
322
|
... on AccountNotVerifiedError {
|
|
@@ -336,7 +336,7 @@ const x = o`
|
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
`,
|
|
339
|
+
`, Ue = o`
|
|
340
340
|
mutation CreateBankWithdrawal($input: CreateBankWithdrawalInput!) {
|
|
341
341
|
createBankWithdrawal(input: $input) {
|
|
342
342
|
... on MobileNumberNotVerifiedError {
|
|
@@ -602,7 +602,7 @@ const x = o`
|
|
|
602
602
|
}
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
|
-
`,
|
|
605
|
+
`, $ = o`
|
|
606
606
|
${x}
|
|
607
607
|
|
|
608
608
|
fragment PromoFragment on Promo {
|
|
@@ -622,7 +622,7 @@ const x = o`
|
|
|
622
622
|
dateTimeLastUpdated
|
|
623
623
|
}
|
|
624
624
|
`, Je = o`
|
|
625
|
-
${
|
|
625
|
+
${$}
|
|
626
626
|
|
|
627
627
|
query Promos {
|
|
628
628
|
promos {
|
|
@@ -630,7 +630,7 @@ const x = o`
|
|
|
630
630
|
}
|
|
631
631
|
}
|
|
632
632
|
`, Xe = o`
|
|
633
|
-
${
|
|
633
|
+
${$}
|
|
634
634
|
|
|
635
635
|
query AvailablePromos($filter: PromoFilterInput) {
|
|
636
636
|
availablePromos(filter: $filter) {
|
|
@@ -650,6 +650,7 @@ const x = o`
|
|
|
650
650
|
description
|
|
651
651
|
activationStartDateTime
|
|
652
652
|
activationEndDateTime
|
|
653
|
+
turnoverContributionPercentagePerGameProvider
|
|
653
654
|
dateTimeCreated
|
|
654
655
|
dateTimeLastUpdated
|
|
655
656
|
}
|
|
@@ -662,7 +663,7 @@ const x = o`
|
|
|
662
663
|
}
|
|
663
664
|
}
|
|
664
665
|
`, et = o`
|
|
665
|
-
${
|
|
666
|
+
${$}
|
|
666
667
|
|
|
667
668
|
query Bonus {
|
|
668
669
|
bonus {
|
|
@@ -1051,7 +1052,7 @@ function m(n) {
|
|
|
1051
1052
|
}[n]
|
|
1052
1053
|
};
|
|
1053
1054
|
}
|
|
1054
|
-
class
|
|
1055
|
+
class bt {
|
|
1055
1056
|
constructor(e) {
|
|
1056
1057
|
d(this, "client");
|
|
1057
1058
|
this.client = e;
|
|
@@ -1167,7 +1168,7 @@ class St {
|
|
|
1167
1168
|
} : t;
|
|
1168
1169
|
}
|
|
1169
1170
|
}
|
|
1170
|
-
function
|
|
1171
|
+
function h(n, e) {
|
|
1171
1172
|
const t = G[n] ? G[n] : G[500];
|
|
1172
1173
|
return {
|
|
1173
1174
|
name: t.name,
|
|
@@ -1183,7 +1184,7 @@ const G = {
|
|
|
1183
1184
|
429: { name: "HttpTooManyRequests", message: "Too Many Requests" },
|
|
1184
1185
|
500: { name: "HttpInternalServerError", message: "Internal Server Error" }
|
|
1185
1186
|
};
|
|
1186
|
-
class
|
|
1187
|
+
class St {
|
|
1187
1188
|
constructor(e) {
|
|
1188
1189
|
d(this, "url");
|
|
1189
1190
|
d(this, "platform");
|
|
@@ -1217,12 +1218,12 @@ class bt {
|
|
|
1217
1218
|
error: m("AccountBlacklisted")
|
|
1218
1219
|
} : {
|
|
1219
1220
|
ok: !1,
|
|
1220
|
-
error:
|
|
1221
|
+
error: h(a.status)
|
|
1221
1222
|
};
|
|
1222
1223
|
} catch {
|
|
1223
1224
|
return {
|
|
1224
1225
|
ok: !1,
|
|
1225
|
-
error:
|
|
1226
|
+
error: h(500)
|
|
1226
1227
|
};
|
|
1227
1228
|
}
|
|
1228
1229
|
}
|
|
@@ -1250,12 +1251,12 @@ class bt {
|
|
|
1250
1251
|
error: m("InvalidTokenOrSecretAnswer")
|
|
1251
1252
|
} : {
|
|
1252
1253
|
ok: !1,
|
|
1253
|
-
error:
|
|
1254
|
+
error: h(a.status)
|
|
1254
1255
|
};
|
|
1255
1256
|
} catch {
|
|
1256
1257
|
return {
|
|
1257
1258
|
ok: !1,
|
|
1258
|
-
error:
|
|
1259
|
+
error: h(500)
|
|
1259
1260
|
};
|
|
1260
1261
|
}
|
|
1261
1262
|
}
|
|
@@ -1283,12 +1284,12 @@ class bt {
|
|
|
1283
1284
|
error: m("InvalidToken")
|
|
1284
1285
|
} : {
|
|
1285
1286
|
ok: !1,
|
|
1286
|
-
error:
|
|
1287
|
+
error: h(t.status)
|
|
1287
1288
|
};
|
|
1288
1289
|
} catch {
|
|
1289
1290
|
return {
|
|
1290
1291
|
ok: !1,
|
|
1291
|
-
error:
|
|
1292
|
+
error: h(500)
|
|
1292
1293
|
};
|
|
1293
1294
|
}
|
|
1294
1295
|
}
|
|
@@ -1303,9 +1304,9 @@ class bt {
|
|
|
1303
1304
|
Authorization: `Bearer ${e}`
|
|
1304
1305
|
}
|
|
1305
1306
|
});
|
|
1306
|
-
return t.ok ? { ok: !0 } : { ok: !1, error:
|
|
1307
|
+
return t.ok ? { ok: !0 } : { ok: !1, error: h(t.status) };
|
|
1307
1308
|
} catch {
|
|
1308
|
-
return { ok: !1, error:
|
|
1309
|
+
return { ok: !1, error: h(500) };
|
|
1309
1310
|
}
|
|
1310
1311
|
}
|
|
1311
1312
|
async verifySession(e) {
|
|
@@ -1364,7 +1365,7 @@ class At {
|
|
|
1364
1365
|
}
|
|
1365
1366
|
async withdrawalRecords(e) {
|
|
1366
1367
|
const t = await this.client.request(
|
|
1367
|
-
|
|
1368
|
+
We,
|
|
1368
1369
|
e
|
|
1369
1370
|
);
|
|
1370
1371
|
return t.ok ? { ok: t.ok, data: t.data.member.withdrawalRecords } : t;
|
|
@@ -1487,7 +1488,7 @@ class Ae {
|
|
|
1487
1488
|
} : t;
|
|
1488
1489
|
}
|
|
1489
1490
|
async createGCashWithdrawal(e) {
|
|
1490
|
-
const t = await this.client.request(
|
|
1491
|
+
const t = await this.client.request($e, e);
|
|
1491
1492
|
return t.ok ? t.data.createGCashWithdrawal ? {
|
|
1492
1493
|
ok: !1,
|
|
1493
1494
|
error: m(t.data.createGCashWithdrawal.__typename)
|
|
@@ -1505,7 +1506,7 @@ class Ae {
|
|
|
1505
1506
|
} : t;
|
|
1506
1507
|
}
|
|
1507
1508
|
async createMayaAppWithdrawal(e) {
|
|
1508
|
-
const t = await this.client.request(
|
|
1509
|
+
const t = await this.client.request(Oe, e);
|
|
1509
1510
|
return t.ok ? t.data.createMayaAppWithdrawal ? {
|
|
1510
1511
|
ok: !1,
|
|
1511
1512
|
error: m(t.data.createMayaAppWithdrawal.__typename)
|
|
@@ -1514,7 +1515,7 @@ class Ae {
|
|
|
1514
1515
|
} : t;
|
|
1515
1516
|
}
|
|
1516
1517
|
async createBankWithdrawal(e) {
|
|
1517
|
-
const t = await this.client.request(
|
|
1518
|
+
const t = await this.client.request(Ue, e);
|
|
1518
1519
|
return t.ok ? t.data.createBankWithdrawal ? {
|
|
1519
1520
|
ok: !1,
|
|
1520
1521
|
error: m(t.data.createBankWithdrawal.__typename)
|
|
@@ -1563,13 +1564,13 @@ class Ae {
|
|
|
1563
1564
|
}
|
|
1564
1565
|
async gameSession(e) {
|
|
1565
1566
|
const t = await this.client.request(
|
|
1566
|
-
|
|
1567
|
+
be,
|
|
1567
1568
|
e
|
|
1568
1569
|
);
|
|
1569
1570
|
return t.ok ? { ok: !0, data: t.data.node } : t;
|
|
1570
1571
|
}
|
|
1571
1572
|
async createGameSession(e) {
|
|
1572
|
-
const t = await this.client.request(
|
|
1573
|
+
const t = await this.client.request(Se, e);
|
|
1573
1574
|
return t.ok ? t.data.createGameSession ? {
|
|
1574
1575
|
ok: !1,
|
|
1575
1576
|
error: m(t.data.createGameSession.__typename)
|
|
@@ -1622,9 +1623,9 @@ class Ct {
|
|
|
1622
1623
|
} : e;
|
|
1623
1624
|
}
|
|
1624
1625
|
async games(e) {
|
|
1625
|
-
var r,
|
|
1626
|
+
var r, s, c, p, u, f, w, l, A, k, C, _, T, v, N, M;
|
|
1626
1627
|
const t = new URLSearchParams();
|
|
1627
|
-
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), (
|
|
1628
|
+
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 = (u = e == null ? void 0 : e.filter) == null ? void 0 : u.type) != null && f.in && t.set("filter[type][in]", e.filter.type.in.join(",")), (l = (w = e == null ? void 0 : e.filter) == null ? void 0 : w.type) != null && l.notIn && t.set("filter[type][nin]", e.filter.type.notIn.join(",")), (k = (A = e == null ? void 0 : e.filter) == null ? void 0 : A.provider) != null && k.equal && t.set("filter[provider][eq]", e.filter.provider.equal), (_ = (C = e == null ? void 0 : e.filter) == null ? void 0 : C.provider) != null && _.notEqual && t.set("filter[provider][neq]", e.filter.provider.notEqual), (v = (T = e == null ? void 0 : e.filter) == null ? void 0 : T.provider) != null && v.in && t.set("filter[provider][in]", e.filter.provider.in.join(",")), (M = (N = e == null ? void 0 : e.filter) == null ? void 0 : N.provider) != null && M.notIn && t.set("filter[provider][nin]", e.filter.provider.notIn.join(","));
|
|
1628
1629
|
const a = await this.getJson("/games", t);
|
|
1629
1630
|
return a.ok ? {
|
|
1630
1631
|
ok: !0,
|
|
@@ -1669,12 +1670,12 @@ class Ct {
|
|
|
1669
1670
|
data: await r.json()
|
|
1670
1671
|
} : {
|
|
1671
1672
|
ok: !1,
|
|
1672
|
-
error:
|
|
1673
|
+
error: h(r.status)
|
|
1673
1674
|
};
|
|
1674
1675
|
} catch {
|
|
1675
1676
|
return {
|
|
1676
1677
|
ok: !1,
|
|
1677
|
-
error:
|
|
1678
|
+
error: h(500)
|
|
1678
1679
|
};
|
|
1679
1680
|
}
|
|
1680
1681
|
}
|
|
@@ -1699,13 +1700,13 @@ class _t {
|
|
|
1699
1700
|
}
|
|
1700
1701
|
async gameSession(e) {
|
|
1701
1702
|
const t = await this.client.request(
|
|
1702
|
-
|
|
1703
|
+
be,
|
|
1703
1704
|
e
|
|
1704
1705
|
);
|
|
1705
1706
|
return t.ok ? { ok: !0, data: t.data.node } : t;
|
|
1706
1707
|
}
|
|
1707
1708
|
async createGameSession(e) {
|
|
1708
|
-
const t = await this.client.request(
|
|
1709
|
+
const t = await this.client.request(Se, e);
|
|
1709
1710
|
return t.ok ? t.data.createGameSession ? {
|
|
1710
1711
|
ok: !1,
|
|
1711
1712
|
error: m(t.data.createGameSession.__typename)
|
|
@@ -1739,17 +1740,17 @@ class Tt {
|
|
|
1739
1740
|
function vt(n, e, t) {
|
|
1740
1741
|
return n < e ? e : n > t ? t : n;
|
|
1741
1742
|
}
|
|
1742
|
-
function
|
|
1743
|
+
function W(n) {
|
|
1743
1744
|
return Object.prototype.toString.call(n) === "[object Object]" && Object(n) === n;
|
|
1744
1745
|
}
|
|
1745
1746
|
function Nt(n) {
|
|
1746
1747
|
const e = [];
|
|
1747
1748
|
function t(a, r = []) {
|
|
1748
|
-
for (const
|
|
1749
|
-
const
|
|
1750
|
-
|
|
1751
|
-
key: [...r,
|
|
1752
|
-
value:
|
|
1749
|
+
for (const s in a) {
|
|
1750
|
+
const c = a[s];
|
|
1751
|
+
W(c) ? t(c, [...r, s]) : Array.isArray(c) ? t(Mt(c), [...r, s]) : e.push({
|
|
1752
|
+
key: [...r, s],
|
|
1753
|
+
value: c
|
|
1753
1754
|
});
|
|
1754
1755
|
}
|
|
1755
1756
|
}
|
|
@@ -1770,7 +1771,7 @@ class E {
|
|
|
1770
1771
|
async request(e, t) {
|
|
1771
1772
|
const a = JSON.stringify({ query: e, variables: t }), r = new Headers(this.options.headers);
|
|
1772
1773
|
r.set("Content-Type", "application/json"), r.set("Accept", "application/json");
|
|
1773
|
-
const
|
|
1774
|
+
const s = await this.runMiddlewares(
|
|
1774
1775
|
new Request(this.url, {
|
|
1775
1776
|
...this.options,
|
|
1776
1777
|
body: a,
|
|
@@ -1778,13 +1779,13 @@ class E {
|
|
|
1778
1779
|
method: "POST"
|
|
1779
1780
|
})
|
|
1780
1781
|
);
|
|
1781
|
-
return await this.exec(
|
|
1782
|
+
return await this.exec(s);
|
|
1782
1783
|
}
|
|
1783
1784
|
/** Single file upload */
|
|
1784
1785
|
async upload(e, t) {
|
|
1785
1786
|
const a = this.createUploadBody(e, t), r = new Headers(this.options.headers);
|
|
1786
1787
|
r.delete("Content-Type");
|
|
1787
|
-
const
|
|
1788
|
+
const s = await this.runMiddlewares(
|
|
1788
1789
|
new Request(this.url, {
|
|
1789
1790
|
...this.options,
|
|
1790
1791
|
body: a,
|
|
@@ -1792,18 +1793,18 @@ class E {
|
|
|
1792
1793
|
method: "POST"
|
|
1793
1794
|
})
|
|
1794
1795
|
);
|
|
1795
|
-
return await this.exec(
|
|
1796
|
+
return await this.exec(s);
|
|
1796
1797
|
}
|
|
1797
1798
|
async exec(e) {
|
|
1798
|
-
var t, a, r,
|
|
1799
|
+
var t, a, r, s, c, p;
|
|
1799
1800
|
try {
|
|
1800
1801
|
const u = await fetch(e);
|
|
1801
1802
|
if (!u.ok)
|
|
1802
|
-
return { ok: !1, error:
|
|
1803
|
-
const
|
|
1804
|
-
return l ? ((a = l.extensions) == null ? void 0 : a.code) === "FORBIDDEN" || ((r = l.extensions) == null ? void 0 : r.code) === "ACCESS_TOKEN_EXPIRED" ? { ok: !1, error:
|
|
1803
|
+
return { ok: !1, error: h(u.status) };
|
|
1804
|
+
const f = await u.json(), w = f.data, l = (t = f.errors) == null ? void 0 : t.at(0);
|
|
1805
|
+
return l ? ((a = l.extensions) == null ? void 0 : a.code) === "FORBIDDEN" || ((r = l.extensions) == null ? void 0 : r.code) === "ACCESS_TOKEN_EXPIRED" ? { ok: !1, error: h(403, l.message) } : ((s = l.extensions) == null ? void 0 : s.code) === "UNAUTHORIZED" ? { ok: !1, error: h(401, l.message) } : ((c = l.extensions) == null ? void 0 : c.code) === "BAD_USER_INPUT" || ((p = l.extensions) == null ? void 0 : p.code) === "BAD_REQUEST" ? { ok: !1, error: h(400, l.message) } : {
|
|
1805
1806
|
ok: !1,
|
|
1806
|
-
error:
|
|
1807
|
+
error: h(500, l.message)
|
|
1807
1808
|
} : {
|
|
1808
1809
|
ok: !0,
|
|
1809
1810
|
data: w
|
|
@@ -1811,7 +1812,7 @@ class E {
|
|
|
1811
1812
|
} catch {
|
|
1812
1813
|
return {
|
|
1813
1814
|
ok: !1,
|
|
1814
|
-
error:
|
|
1815
|
+
error: h(500)
|
|
1815
1816
|
};
|
|
1816
1817
|
}
|
|
1817
1818
|
}
|
|
@@ -1823,7 +1824,7 @@ class E {
|
|
|
1823
1824
|
}
|
|
1824
1825
|
createUploadBody(e, t) {
|
|
1825
1826
|
const a = Nt(t).filter(
|
|
1826
|
-
(
|
|
1827
|
+
(c) => c.value instanceof File || c.value instanceof Blob
|
|
1827
1828
|
), r = new FormData();
|
|
1828
1829
|
r.append(
|
|
1829
1830
|
"operations",
|
|
@@ -1832,17 +1833,17 @@ class E {
|
|
|
1832
1833
|
variables: t
|
|
1833
1834
|
})
|
|
1834
1835
|
);
|
|
1835
|
-
const
|
|
1836
|
-
return a.forEach((
|
|
1837
|
-
|
|
1838
|
-
}), r.append("map", JSON.stringify(
|
|
1839
|
-
r.append(p.toString(),
|
|
1836
|
+
const s = {};
|
|
1837
|
+
return a.forEach((c, p) => {
|
|
1838
|
+
s[p.toString()] = [`variables.${c.key.join(".")}`];
|
|
1839
|
+
}), r.append("map", JSON.stringify(s)), a.forEach((c, p) => {
|
|
1840
|
+
r.append(p.toString(), c.value);
|
|
1840
1841
|
}), r;
|
|
1841
1842
|
}
|
|
1842
1843
|
}
|
|
1843
1844
|
async function g(n) {
|
|
1844
1845
|
const e = new TextEncoder().encode(n), t = await crypto.subtle.digest("SHA-256", e);
|
|
1845
|
-
return Array.from(new Uint8Array(t)).map((
|
|
1846
|
+
return Array.from(new Uint8Array(t)).map((s) => s.toString(16).padStart(2, "0")).join("");
|
|
1846
1847
|
}
|
|
1847
1848
|
class ke {
|
|
1848
1849
|
constructor(e) {
|
|
@@ -1888,11 +1889,11 @@ function we(n, e) {
|
|
|
1888
1889
|
maxAttempt: r = 3
|
|
1889
1890
|
/**/
|
|
1890
1891
|
} = e;
|
|
1891
|
-
async function c
|
|
1892
|
-
const u = p ?? r,
|
|
1893
|
-
return t(
|
|
1892
|
+
async function s(c, p) {
|
|
1893
|
+
const u = p ?? r, f = await n(...c);
|
|
1894
|
+
return t(f) ? f : u > 1 ? (await Ce(a * ((r - u) / 2)), s(c, u - 1)) : f;
|
|
1894
1895
|
}
|
|
1895
|
-
return async (...
|
|
1896
|
+
return async (...c) => await s(c);
|
|
1896
1897
|
}
|
|
1897
1898
|
function P(n, e) {
|
|
1898
1899
|
const t = B(n);
|
|
@@ -1905,7 +1906,7 @@ class It {
|
|
|
1905
1906
|
d(this, "authService");
|
|
1906
1907
|
d(this, "walletService");
|
|
1907
1908
|
d(this, "_refreshing", !1);
|
|
1908
|
-
this.authService = new
|
|
1909
|
+
this.authService = new St({
|
|
1909
1910
|
url: e.authUrl,
|
|
1910
1911
|
platform: e.platform
|
|
1911
1912
|
}), this.walletService = new Ae(
|
|
@@ -1935,7 +1936,7 @@ class It {
|
|
|
1935
1936
|
}
|
|
1936
1937
|
};
|
|
1937
1938
|
if (e.type === "MAYA") {
|
|
1938
|
-
const
|
|
1939
|
+
const c = await we(() => this.walletService.mayaSession({ id: e.sessionId }), {
|
|
1939
1940
|
until: (w) => {
|
|
1940
1941
|
var l;
|
|
1941
1942
|
return w.ok && ((l = w.data) == null ? void 0 : l.member) != null;
|
|
@@ -1943,8 +1944,8 @@ class It {
|
|
|
1943
1944
|
interval: 1e3,
|
|
1944
1945
|
maxAttempt: 5
|
|
1945
1946
|
})();
|
|
1946
|
-
if (!
|
|
1947
|
-
if (!((r =
|
|
1947
|
+
if (!c.ok) return c;
|
|
1948
|
+
if (!((r = c.data) != null && r.member))
|
|
1948
1949
|
return {
|
|
1949
1950
|
ok: !1,
|
|
1950
1951
|
error: {
|
|
@@ -1958,13 +1959,13 @@ class It {
|
|
|
1958
1959
|
maxAttempt: 5
|
|
1959
1960
|
})();
|
|
1960
1961
|
if (!u.ok) return u;
|
|
1961
|
-
const
|
|
1962
|
+
const f = /* @__PURE__ */ new Date();
|
|
1962
1963
|
return window.localStorage.setItem(
|
|
1963
1964
|
this.storageKey,
|
|
1964
1965
|
JSON.stringify({
|
|
1965
1966
|
...u.data,
|
|
1966
|
-
accessTokenExpiresAt: R(
|
|
1967
|
-
refreshTokenExpiresAt: P(D(
|
|
1967
|
+
accessTokenExpiresAt: R(f, 8).getTime(),
|
|
1968
|
+
refreshTokenExpiresAt: P(D(f, 30), 2).getTime()
|
|
1968
1969
|
})
|
|
1969
1970
|
), {
|
|
1970
1971
|
ok: !0,
|
|
@@ -1972,22 +1973,22 @@ class It {
|
|
|
1972
1973
|
};
|
|
1973
1974
|
}
|
|
1974
1975
|
if (e.type === "MOBILE_NUMBER") {
|
|
1975
|
-
const
|
|
1976
|
-
if (
|
|
1977
|
-
const
|
|
1976
|
+
const s = await this.authService.createSession(e);
|
|
1977
|
+
if (s.ok) {
|
|
1978
|
+
const c = /* @__PURE__ */ new Date();
|
|
1978
1979
|
return window.localStorage.setItem(
|
|
1979
1980
|
this.storageKey,
|
|
1980
1981
|
JSON.stringify({
|
|
1981
|
-
...
|
|
1982
|
-
accessTokenExpiresAt: R(
|
|
1983
|
-
refreshTokenExpiresAt: P(D(
|
|
1982
|
+
...s.data,
|
|
1983
|
+
accessTokenExpiresAt: R(c, 8).getTime(),
|
|
1984
|
+
refreshTokenExpiresAt: P(D(c, 30), 2).getTime()
|
|
1984
1985
|
})
|
|
1985
1986
|
), {
|
|
1986
1987
|
ok: !0,
|
|
1987
1988
|
data: null
|
|
1988
1989
|
};
|
|
1989
1990
|
}
|
|
1990
|
-
return
|
|
1991
|
+
return s;
|
|
1991
1992
|
}
|
|
1992
1993
|
const t = await this.authService.createSession(e);
|
|
1993
1994
|
if (!t.ok) return t;
|
|
@@ -2042,8 +2043,8 @@ class It {
|
|
|
2042
2043
|
};
|
|
2043
2044
|
try {
|
|
2044
2045
|
let t = JSON.parse(e), a = /* @__PURE__ */ new Date();
|
|
2045
|
-
const r = new Date(t.accessTokenExpiresAt),
|
|
2046
|
-
if (he(a,
|
|
2046
|
+
const r = new Date(t.accessTokenExpiresAt), s = new Date(t.refreshTokenExpiresAt);
|
|
2047
|
+
if (he(a, s))
|
|
2047
2048
|
return this.logger.warn("Session expired. Logging out.."), window.localStorage.removeItem(this.storageKey), {
|
|
2048
2049
|
ok: !1,
|
|
2049
2050
|
error: {
|
|
@@ -2053,18 +2054,18 @@ class It {
|
|
|
2053
2054
|
};
|
|
2054
2055
|
if (he(a, r)) {
|
|
2055
2056
|
this.logger.info("Refreshing session..."), this.refreshing = !0;
|
|
2056
|
-
const
|
|
2057
|
-
if (this.refreshing = !1, !
|
|
2058
|
-
return this.logger.error(`Failed to refresh session: ${
|
|
2057
|
+
const c = await this.authService.refreshSession(t.refreshToken);
|
|
2058
|
+
if (this.refreshing = !1, !c.ok)
|
|
2059
|
+
return this.logger.error(`Failed to refresh session: ${c.error.message}`), c.error.name === "InvalidToken" || c.error.name === "AccountBlacklisted" ? (window.localStorage.removeItem(this.storageKey), {
|
|
2059
2060
|
ok: !1,
|
|
2060
|
-
error:
|
|
2061
|
+
error: c.error
|
|
2061
2062
|
}) : (this.logger.warn("Old session returned."), {
|
|
2062
2063
|
ok: !0,
|
|
2063
2064
|
data: t
|
|
2064
2065
|
});
|
|
2065
2066
|
this.logger.success("Session refreshed!"), a = /* @__PURE__ */ new Date(), t = {
|
|
2066
2067
|
...t,
|
|
2067
|
-
...
|
|
2068
|
+
...c.data,
|
|
2068
2069
|
accessTokenExpiresAt: R(a, 8).getTime(),
|
|
2069
2070
|
refreshTokenExpiresAt: P(D(a, 30), 2).getTime()
|
|
2070
2071
|
}, window.localStorage.setItem(this.storageKey, JSON.stringify(t));
|
|
@@ -2093,11 +2094,11 @@ class It {
|
|
|
2093
2094
|
(t = e.data) != null && t.accessToken && await this.authService.destroySession(e.data.accessToken), window.localStorage.removeItem(this.storageKey);
|
|
2094
2095
|
}
|
|
2095
2096
|
async verify() {
|
|
2096
|
-
var a, r,
|
|
2097
|
+
var a, r, s;
|
|
2097
2098
|
if (this.isServer)
|
|
2098
2099
|
return this.logger.warn("'localStorage' is not available on the server."), !0;
|
|
2099
2100
|
const e = await this.get();
|
|
2100
|
-
if (((a = e.error) == null ? void 0 : a.name) === "InvalidToken" || ((r = e.error) == null ? void 0 : r.name) === "SessionExpired" || ((
|
|
2101
|
+
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;
|
|
2101
2102
|
if (!e.data) return !0;
|
|
2102
2103
|
const t = await this.authService.verifySession(e.data.accessToken);
|
|
2103
2104
|
return t || window.localStorage.removeItem(this.storageKey), t;
|
|
@@ -2111,12 +2112,12 @@ function y(n) {
|
|
|
2111
2112
|
for (const t in n) {
|
|
2112
2113
|
const a = n[t];
|
|
2113
2114
|
if (a !== null && a !== void 0) {
|
|
2114
|
-
if (
|
|
2115
|
+
if (W(a)) {
|
|
2115
2116
|
e[t] = y(a);
|
|
2116
2117
|
continue;
|
|
2117
2118
|
}
|
|
2118
2119
|
if (Array.isArray(a)) {
|
|
2119
|
-
e[t] = a.map((r) =>
|
|
2120
|
+
e[t] = a.map((r) => W(r) ? y(r) : r);
|
|
2120
2121
|
continue;
|
|
2121
2122
|
}
|
|
2122
2123
|
e[t] = a;
|
|
@@ -2180,7 +2181,7 @@ class Dt {
|
|
|
2180
2181
|
return y(t);
|
|
2181
2182
|
}
|
|
2182
2183
|
platform(e) {
|
|
2183
|
-
var t, a, r,
|
|
2184
|
+
var t, a, r, s, c, p, u, f, w, l, A, k, C, _, T, v, N, M, I, O, U, q, F, L, V, Y, H, j, Q, K, z, J, X, Z, ee, te, ae, re, ne, oe, ie, se, ce, de, me, ue, le, pe, fe;
|
|
2184
2185
|
return {
|
|
2185
2186
|
paymentSettings: {
|
|
2186
2187
|
minimumFirstDepositAmount: i(e.minimumFirstDepositAmount),
|
|
@@ -2190,13 +2191,13 @@ class Dt {
|
|
|
2190
2191
|
androidEnabled: ((t = e.bankDepositGatewaySettings) == null ? void 0 : t.androidEnabled) ?? !1,
|
|
2191
2192
|
iosEnabled: ((a = e.bankDepositGatewaySettings) == null ? void 0 : a.iosEnabled) ?? !1,
|
|
2192
2193
|
webEnabled: ((r = e.bankDepositGatewaySettings) == null ? void 0 : r.webEnabled) ?? !1,
|
|
2193
|
-
mobileWebEnabled: ((
|
|
2194
|
-
minimumAmount: i((
|
|
2194
|
+
mobileWebEnabled: ((s = e.bankDepositGatewaySettings) == null ? void 0 : s.mobileWebEnabled) ?? !1,
|
|
2195
|
+
minimumAmount: i((c = e.bankDepositGatewaySettings) == null ? void 0 : c.minimumAmount),
|
|
2195
2196
|
maximumAmount: i((p = e.bankDepositGatewaySettings) == null ? void 0 : p.maximumAmount)
|
|
2196
2197
|
},
|
|
2197
2198
|
gcash: {
|
|
2198
2199
|
androidEnabled: ((u = e.gcashDepositGatewaySettings) == null ? void 0 : u.androidEnabled) ?? !1,
|
|
2199
|
-
iosEnabled: ((
|
|
2200
|
+
iosEnabled: ((f = e.gcashDepositGatewaySettings) == null ? void 0 : f.iosEnabled) ?? !1,
|
|
2200
2201
|
webEnabled: ((w = e.gcashDepositGatewaySettings) == null ? void 0 : w.webEnabled) ?? !1,
|
|
2201
2202
|
mobileWebEnabled: ((l = e.gcashDepositGatewaySettings) == null ? void 0 : l.mobileWebEnabled) ?? !1,
|
|
2202
2203
|
minimumAmount: i((A = e.gcashDepositGatewaySettings) == null ? void 0 : A.minimumAmount),
|
|
@@ -2212,8 +2213,8 @@ class Dt {
|
|
|
2212
2213
|
},
|
|
2213
2214
|
mayaApp: {
|
|
2214
2215
|
androidEnabled: ((I = e.mayaAppDepositGatewaySettings) == null ? void 0 : I.androidEnabled) ?? !1,
|
|
2215
|
-
iosEnabled: ((
|
|
2216
|
-
webEnabled: ((
|
|
2216
|
+
iosEnabled: ((O = e.mayaAppDepositGatewaySettings) == null ? void 0 : O.iosEnabled) ?? !1,
|
|
2217
|
+
webEnabled: ((U = e.mayaAppDepositGatewaySettings) == null ? void 0 : U.webEnabled) ?? !1,
|
|
2217
2218
|
mobileWebEnabled: ((q = e.mayaAppDepositGatewaySettings) == null ? void 0 : q.mobileWebEnabled) ?? !1,
|
|
2218
2219
|
minimumAmount: i((F = e.mayaAppDepositGatewaySettings) == null ? void 0 : F.minimumAmount),
|
|
2219
2220
|
maximumAmount: i((L = e.mayaAppDepositGatewaySettings) == null ? void 0 : L.maximumAmount)
|
|
@@ -2483,7 +2484,10 @@ class Dt {
|
|
|
2483
2484
|
activationEndDateTime: new Date(e.activationEndDateTime),
|
|
2484
2485
|
activationStartDateTime: new Date(e.activationStartDateTime),
|
|
2485
2486
|
dateTimeCreated: new Date(e.dateTimeCreated),
|
|
2486
|
-
dateTimeLastUpdated: new Date(e.dateTimeLastUpdated)
|
|
2487
|
+
dateTimeLastUpdated: new Date(e.dateTimeLastUpdated),
|
|
2488
|
+
turnoverContributionPercentagePerGameProvider: Object.entries(
|
|
2489
|
+
e.turnoverContributionPercentagePerGameProvider
|
|
2490
|
+
).reduce((a, [r, s]) => (a[r] = i(s, 0), a), {})
|
|
2487
2491
|
};
|
|
2488
2492
|
}
|
|
2489
2493
|
bonus(e) {
|
|
@@ -2561,7 +2565,7 @@ class Dt {
|
|
|
2561
2565
|
};
|
|
2562
2566
|
}
|
|
2563
2567
|
}
|
|
2564
|
-
class
|
|
2568
|
+
class Gt {
|
|
2565
2569
|
constructor(e) {
|
|
2566
2570
|
d(this, "gameService");
|
|
2567
2571
|
d(this, "fileService");
|
|
@@ -2613,7 +2617,7 @@ class xt {
|
|
|
2613
2617
|
t ? "https://report.development.opexa.io/graphql" : "https://report.opexa.io/graphql",
|
|
2614
2618
|
a
|
|
2615
2619
|
)
|
|
2616
|
-
), this.accountService = new
|
|
2620
|
+
), this.accountService = new bt(
|
|
2617
2621
|
new E(
|
|
2618
2622
|
t ? "https://account.development.opexa.io/graphql" : "https://account.opexa.io/graphql",
|
|
2619
2623
|
a
|
|
@@ -2825,7 +2829,7 @@ class xt {
|
|
|
2825
2829
|
* ```
|
|
2826
2830
|
*/
|
|
2827
2831
|
async createAccount(e) {
|
|
2828
|
-
const t = e.id ??
|
|
2832
|
+
const t = e.id ?? b.generate(S.Account).toString(), a = await this.accountService.registerMemberAccount({
|
|
2829
2833
|
input: {
|
|
2830
2834
|
id: t,
|
|
2831
2835
|
name: e.name,
|
|
@@ -2907,7 +2911,7 @@ class xt {
|
|
|
2907
2911
|
* ```
|
|
2908
2912
|
*/
|
|
2909
2913
|
async submitVerificationDetails(e) {
|
|
2910
|
-
const t = e.id ??
|
|
2914
|
+
const t = e.id ?? b.generate(S.Verification).toString(), a = await this.accountService.createMemberVerification({
|
|
2911
2915
|
input: {
|
|
2912
2916
|
id: t,
|
|
2913
2917
|
...e
|
|
@@ -3031,7 +3035,7 @@ class xt {
|
|
|
3031
3035
|
* ```
|
|
3032
3036
|
*/
|
|
3033
3037
|
async createWithdrawal(e) {
|
|
3034
|
-
const t = e.id ??
|
|
3038
|
+
const t = e.id ?? b.generate(S.Withdrawal).toString();
|
|
3035
3039
|
if (e.type === "BANK") {
|
|
3036
3040
|
const a = await this.walletService.createBankWithdrawal({
|
|
3037
3041
|
input: {
|
|
@@ -3117,7 +3121,7 @@ class xt {
|
|
|
3117
3121
|
* ```
|
|
3118
3122
|
*/
|
|
3119
3123
|
async createDeposit(e) {
|
|
3120
|
-
const t = e.id ??
|
|
3124
|
+
const t = e.id ?? b.generate(S.Deposit).toString();
|
|
3121
3125
|
if (e.type === "MAYA") {
|
|
3122
3126
|
const a = await this.walletService.createMayaDeposit({
|
|
3123
3127
|
input: {
|
|
@@ -3199,9 +3203,9 @@ class xt {
|
|
|
3199
3203
|
return t.ok ? {
|
|
3200
3204
|
ok: !0,
|
|
3201
3205
|
data: {
|
|
3202
|
-
betRecords: t.data.edges.map(({ cursor:
|
|
3203
|
-
...this.transformer.transform.betRecord(
|
|
3204
|
-
cursor:
|
|
3206
|
+
betRecords: t.data.edges.map(({ cursor: s, node: c }) => ({
|
|
3207
|
+
...this.transformer.transform.betRecord(c),
|
|
3208
|
+
cursor: s
|
|
3205
3209
|
})),
|
|
3206
3210
|
totalCount: t.data.totalCount,
|
|
3207
3211
|
endCursor: t.data.pageInfo.endCursor ?? void 0,
|
|
@@ -3405,17 +3409,29 @@ class xt {
|
|
|
3405
3409
|
* ```
|
|
3406
3410
|
*/
|
|
3407
3411
|
async createGameSession(e) {
|
|
3408
|
-
const t = e.id ??
|
|
3412
|
+
const t = e.id ?? b.generate(S.GameSession).toString(), a = await this.walletService.createGameSession({ input: { id: t, game: e.game } });
|
|
3409
3413
|
return a.ok ? { ok: !0, data: { id: t } } : a;
|
|
3410
3414
|
}
|
|
3411
3415
|
/** @deprecated use `createGameSession__next` */
|
|
3412
3416
|
async createGameSession__legacy(e) {
|
|
3413
|
-
const t = e.id ??
|
|
3417
|
+
const t = e.id ?? b.generate(S.GameSession).toString(), a = await this.gameService.createGameSession({ input: { id: t, game: e.game } });
|
|
3414
3418
|
return a.ok ? { ok: !0, data: { id: t } } : a;
|
|
3415
3419
|
}
|
|
3416
3420
|
async createGameSession__next(e) {
|
|
3417
|
-
const t =
|
|
3418
|
-
if (
|
|
3421
|
+
const t = e.id ?? b.generate(S.GameSession).toString();
|
|
3422
|
+
if (e.game.startsWith("SPORTS:")) {
|
|
3423
|
+
const p = await b.generateFromKey(S.Game, e.game).then(
|
|
3424
|
+
(f) => f.toString()
|
|
3425
|
+
), u = await this.gameService.createGameSession({
|
|
3426
|
+
input: {
|
|
3427
|
+
id: t,
|
|
3428
|
+
game: p
|
|
3429
|
+
}
|
|
3430
|
+
});
|
|
3431
|
+
return u.ok ? { ok: !0, data: { id: t } } : u;
|
|
3432
|
+
}
|
|
3433
|
+
const a = await this.game__next(e.game);
|
|
3434
|
+
if (!a.data)
|
|
3419
3435
|
return {
|
|
3420
3436
|
ok: !1,
|
|
3421
3437
|
error: {
|
|
@@ -3425,20 +3441,10 @@ class xt {
|
|
|
3425
3441
|
};
|
|
3426
3442
|
const {
|
|
3427
3443
|
/**/
|
|
3428
|
-
type: a,
|
|
3429
3444
|
provider: r,
|
|
3430
|
-
externalId:
|
|
3431
|
-
} =
|
|
3432
|
-
|
|
3433
|
-
"RTG",
|
|
3434
|
-
"DARWIN",
|
|
3435
|
-
"DRBINGO",
|
|
3436
|
-
"MEGABALL",
|
|
3437
|
-
"EVOLUTION",
|
|
3438
|
-
"EVOLUTION_NETENT",
|
|
3439
|
-
"EVOLUTION_REDTIGER"
|
|
3440
|
-
].includes(r) ? await this.walletService.createGameSession({ input: { id: s, game: c } }) : await this.gameService.createGameSession({ input: { id: s, game: c } });
|
|
3441
|
-
return u.ok ? { ok: !0, data: { id: s } } : u;
|
|
3445
|
+
externalId: s
|
|
3446
|
+
} = a.data, c = Rt.includes(r) ? await this.walletService.createGameSession({ input: { id: t, game: s } }) : await this.gameService.createGameSession({ input: { id: t, game: s } });
|
|
3447
|
+
return c.ok ? { ok: !0, data: { id: t } } : c;
|
|
3442
3448
|
}
|
|
3443
3449
|
/** @deprecated use `endGameSession__next` */
|
|
3444
3450
|
async endGameSession(e) {
|
|
@@ -3480,7 +3486,7 @@ class xt {
|
|
|
3480
3486
|
* ```
|
|
3481
3487
|
*/
|
|
3482
3488
|
async uploadImageFile(e) {
|
|
3483
|
-
const t = e.id ??
|
|
3489
|
+
const t = e.id ?? b.generate(S.File).toString(), a = await this.fileService.uploadPrivateImageFile({
|
|
3484
3490
|
input: {
|
|
3485
3491
|
id: t,
|
|
3486
3492
|
file: e.file
|
|
@@ -3546,9 +3552,19 @@ class xt {
|
|
|
3546
3552
|
return e.startsWith("+63") ? e : e.startsWith("63") ? `+${e}` : e.startsWith("0") ? `+63${e.substring(1)}` : `+63${e}`;
|
|
3547
3553
|
}
|
|
3548
3554
|
}
|
|
3555
|
+
const Rt = [
|
|
3556
|
+
/**/
|
|
3557
|
+
"RTG",
|
|
3558
|
+
"DARWIN",
|
|
3559
|
+
"DRBINGO",
|
|
3560
|
+
"MEGABALL",
|
|
3561
|
+
"EVOLUTION",
|
|
3562
|
+
"EVOLUTION_NETENT",
|
|
3563
|
+
"EVOLUTION_REDTIGER"
|
|
3564
|
+
];
|
|
3549
3565
|
export {
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3566
|
+
Bt as ObjectId,
|
|
3567
|
+
S as ObjectType,
|
|
3568
|
+
Gt as Sdk
|
|
3553
3569
|
};
|
|
3554
3570
|
//# sourceMappingURL=index.mjs.map
|