@opexa/portal-sdk 0.0.38 → 0.0.40
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 +23 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +357 -285
- package/dist/index.mjs.map +1 -1
- package/dist/sdk/sdk.d.ts +24 -15
- package/dist/sdk/session-manager.d.ts +1 -1
- package/dist/sdk/types.d.ts +2 -0
- package/dist/services/types.d.ts +4 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Ce = Object.defineProperty;
|
|
2
2
|
var Te = (n, e, t) => e in n ? Ce(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
3
|
var m = (n, e, t) => Te(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { ObjectId as
|
|
4
|
+
import { ObjectId as E } from "@opexa/object-id";
|
|
5
5
|
import { ObjectId as Ot } from "@opexa/object-id";
|
|
6
6
|
const S = {
|
|
7
7
|
Account: 8,
|
|
@@ -15,13 +15,13 @@ 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 [r, a] of n.entries()) {
|
|
19
|
+
const s = e.at(r) ?? "";
|
|
20
|
+
t = `${t}${a}${s}`;
|
|
21
21
|
}
|
|
22
22
|
return t.trim();
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const F = o`
|
|
25
25
|
fragment FileFragment on File {
|
|
26
26
|
id
|
|
27
27
|
url
|
|
@@ -29,7 +29,7 @@ const G = o`
|
|
|
29
29
|
dateTimeCreated
|
|
30
30
|
}
|
|
31
31
|
`, ve = o`
|
|
32
|
-
${
|
|
32
|
+
${F}
|
|
33
33
|
|
|
34
34
|
query File($id: ObjectId!) {
|
|
35
35
|
node(id: $id) {
|
|
@@ -139,7 +139,7 @@ const G = o`
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
`,
|
|
142
|
+
`, Ee = o`
|
|
143
143
|
query GameSession($id: ObjectId!) {
|
|
144
144
|
node(id: $id) {
|
|
145
145
|
... on GameSession {
|
|
@@ -602,8 +602,8 @@ const G = o`
|
|
|
602
602
|
}
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
|
-
`,
|
|
606
|
-
${
|
|
605
|
+
`, Y = o`
|
|
606
|
+
${F}
|
|
607
607
|
|
|
608
608
|
fragment PromoFragment on Promo {
|
|
609
609
|
id
|
|
@@ -622,7 +622,7 @@ const G = o`
|
|
|
622
622
|
dateTimeLastUpdated
|
|
623
623
|
}
|
|
624
624
|
`, Je = o`
|
|
625
|
-
${
|
|
625
|
+
${Y}
|
|
626
626
|
|
|
627
627
|
query Promos {
|
|
628
628
|
promos {
|
|
@@ -630,15 +630,15 @@ const G = o`
|
|
|
630
630
|
}
|
|
631
631
|
}
|
|
632
632
|
`, Xe = o`
|
|
633
|
-
${
|
|
633
|
+
${Y}
|
|
634
634
|
|
|
635
635
|
query AvailablePromos($filter: PromoFilterInput) {
|
|
636
636
|
availablePromos(filter: $filter) {
|
|
637
637
|
...PromoFragment
|
|
638
638
|
}
|
|
639
639
|
}
|
|
640
|
-
`,
|
|
641
|
-
${
|
|
640
|
+
`, be = o`
|
|
641
|
+
${F}
|
|
642
642
|
|
|
643
643
|
fragment CashbackFragment on Cashback {
|
|
644
644
|
id
|
|
@@ -655,7 +655,7 @@ const G = o`
|
|
|
655
655
|
dateTimeLastUpdated
|
|
656
656
|
}
|
|
657
657
|
`, Ze = o`
|
|
658
|
-
${
|
|
658
|
+
${be}
|
|
659
659
|
|
|
660
660
|
query Cashbacks {
|
|
661
661
|
cashbacks {
|
|
@@ -663,7 +663,7 @@ const G = o`
|
|
|
663
663
|
}
|
|
664
664
|
}
|
|
665
665
|
`, et = o`
|
|
666
|
-
${
|
|
666
|
+
${Y}
|
|
667
667
|
|
|
668
668
|
query Bonus {
|
|
669
669
|
bonus {
|
|
@@ -692,7 +692,7 @@ const G = o`
|
|
|
692
692
|
}
|
|
693
693
|
}
|
|
694
694
|
`, tt = o`
|
|
695
|
-
${
|
|
695
|
+
${be}
|
|
696
696
|
|
|
697
697
|
query CashbackBonuses {
|
|
698
698
|
cashbackBonuses {
|
|
@@ -705,7 +705,7 @@ const G = o`
|
|
|
705
705
|
dateTimeLastUpdated
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
|
-
`,
|
|
708
|
+
`, rt = o`
|
|
709
709
|
mutation ClaimCashbackBonus($input: ClaimCashbackBonusInput!) {
|
|
710
710
|
claimCashbackBonus(input: $input) {
|
|
711
711
|
... on CashbackBonusDoesNotExistError {
|
|
@@ -713,7 +713,7 @@ const G = o`
|
|
|
713
713
|
}
|
|
714
714
|
}
|
|
715
715
|
}
|
|
716
|
-
`,
|
|
716
|
+
`, at = o`
|
|
717
717
|
query Member {
|
|
718
718
|
member {
|
|
719
719
|
dateTimeLastActive
|
|
@@ -744,7 +744,7 @@ const G = o`
|
|
|
744
744
|
}
|
|
745
745
|
}
|
|
746
746
|
`, ot = o`
|
|
747
|
-
${
|
|
747
|
+
${F}
|
|
748
748
|
|
|
749
749
|
query MemberVerification {
|
|
750
750
|
memberAccount: self {
|
|
@@ -837,7 +837,7 @@ const G = o`
|
|
|
837
837
|
}
|
|
838
838
|
}
|
|
839
839
|
}
|
|
840
|
-
`,
|
|
840
|
+
`, dt = o`
|
|
841
841
|
mutation ResetPassword($input: ResetPasswordInput!, $verificationCode: String) {
|
|
842
842
|
resetPassword(input: $input, verificationCode: $verificationCode) {
|
|
843
843
|
... on AccountNotFoundError {
|
|
@@ -848,7 +848,7 @@ const G = o`
|
|
|
848
848
|
}
|
|
849
849
|
}
|
|
850
850
|
}
|
|
851
|
-
`,
|
|
851
|
+
`, mt = o`
|
|
852
852
|
mutation DeleteMemberAccount($input: DeleteMemberAccountInput!) {
|
|
853
853
|
deleteMemberAccount(input: $input)
|
|
854
854
|
}
|
|
@@ -982,7 +982,7 @@ const G = o`
|
|
|
982
982
|
mutation ValidateMayaSession {
|
|
983
983
|
validateMayaSession: validMayaSession
|
|
984
984
|
}
|
|
985
|
-
`,
|
|
985
|
+
`, Et = o`
|
|
986
986
|
query ActivityRecords($after: Cursor, $first: Int, $filter: ActivityRecordsFilterInput) {
|
|
987
987
|
member {
|
|
988
988
|
activityRecords(after: $after, first: $first, filter: $filter) {
|
|
@@ -1094,7 +1094,7 @@ class St {
|
|
|
1094
1094
|
} : t;
|
|
1095
1095
|
}
|
|
1096
1096
|
async deleteMemberAccount(e) {
|
|
1097
|
-
const t = await this.client.request(
|
|
1097
|
+
const t = await this.client.request(mt, e);
|
|
1098
1098
|
return t.ok ? t.data.deleteMemberAccount ? {
|
|
1099
1099
|
ok: !0
|
|
1100
1100
|
} : {
|
|
@@ -1107,7 +1107,7 @@ class St {
|
|
|
1107
1107
|
}
|
|
1108
1108
|
async resetPassword(e) {
|
|
1109
1109
|
const t = await this.client.request(
|
|
1110
|
-
|
|
1110
|
+
dt,
|
|
1111
1111
|
e
|
|
1112
1112
|
);
|
|
1113
1113
|
return t.ok ? t.data.resetPassword ? {
|
|
@@ -1188,13 +1188,13 @@ class St {
|
|
|
1188
1188
|
}
|
|
1189
1189
|
}
|
|
1190
1190
|
function h(n, e) {
|
|
1191
|
-
const t =
|
|
1191
|
+
const t = L[n] ? L[n] : L[500];
|
|
1192
1192
|
return {
|
|
1193
1193
|
name: t.name,
|
|
1194
1194
|
message: e ?? t.message
|
|
1195
1195
|
};
|
|
1196
1196
|
}
|
|
1197
|
-
const
|
|
1197
|
+
const L = {
|
|
1198
1198
|
400: { name: "HttpBadRequest", message: "Bad Request" },
|
|
1199
1199
|
401: { name: "HttpUnauthorized", message: "Unauthorized" },
|
|
1200
1200
|
403: { name: "HttpForbidden", message: "Forbidden" },
|
|
@@ -1203,7 +1203,7 @@ const x = {
|
|
|
1203
1203
|
429: { name: "HttpTooManyRequests", message: "Too Many Requests" },
|
|
1204
1204
|
500: { name: "HttpInternalServerError", message: "Internal Server Error" }
|
|
1205
1205
|
};
|
|
1206
|
-
class
|
|
1206
|
+
class bt {
|
|
1207
1207
|
constructor(e) {
|
|
1208
1208
|
m(this, "url");
|
|
1209
1209
|
m(this, "platform");
|
|
@@ -1216,28 +1216,28 @@ class Et {
|
|
|
1216
1216
|
Role: "MEMBER"
|
|
1217
1217
|
});
|
|
1218
1218
|
if (e.name) {
|
|
1219
|
-
const
|
|
1220
|
-
t.set("Authorization", `Basic ${
|
|
1219
|
+
const r = `${e.name}:${e.password}`, a = Buffer.from(r).toString("base64");
|
|
1220
|
+
t.set("Authorization", `Basic ${a}`);
|
|
1221
1221
|
}
|
|
1222
1222
|
if (e.mobileNumber) {
|
|
1223
|
-
const
|
|
1224
|
-
t.set("Authorization", `MobileNumberOTP ${
|
|
1223
|
+
const r = `${e.mobileNumber}:${e.verificationCode}`, a = Buffer.from(r).toString("base64");
|
|
1224
|
+
t.set("Authorization", `MobileNumberOTP ${a}`);
|
|
1225
1225
|
}
|
|
1226
1226
|
e.sessionId && t.set("Authorization", `Maya ${e.sessionId}`);
|
|
1227
1227
|
try {
|
|
1228
|
-
const
|
|
1228
|
+
const r = await fetch(`${this.url}/sessions`, {
|
|
1229
1229
|
method: "POST",
|
|
1230
1230
|
headers: t
|
|
1231
|
-
}),
|
|
1232
|
-
return
|
|
1231
|
+
}), a = await r.json();
|
|
1232
|
+
return r.ok ? {
|
|
1233
1233
|
ok: !0,
|
|
1234
|
-
data:
|
|
1235
|
-
} :
|
|
1234
|
+
data: a
|
|
1235
|
+
} : a.code === "ACCOUNT_BLACKLISTED" ? {
|
|
1236
1236
|
ok: !1,
|
|
1237
1237
|
error: d("AccountBlacklisted")
|
|
1238
1238
|
} : {
|
|
1239
1239
|
ok: !1,
|
|
1240
|
-
error: h(
|
|
1240
|
+
error: h(r.status)
|
|
1241
1241
|
};
|
|
1242
1242
|
} catch {
|
|
1243
1243
|
return {
|
|
@@ -1255,22 +1255,22 @@ class Et {
|
|
|
1255
1255
|
if (e.type === "SECURITY_QUESTION") {
|
|
1256
1256
|
t.set("Authorization", `Bearer ${e.token}`);
|
|
1257
1257
|
try {
|
|
1258
|
-
const
|
|
1258
|
+
const r = await fetch(`${this.url}/session/${e.token}/authenticate`, {
|
|
1259
1259
|
method: "POST",
|
|
1260
1260
|
headers: t,
|
|
1261
1261
|
body: JSON.stringify({
|
|
1262
1262
|
secretAnswer: e.secretAnswer
|
|
1263
1263
|
})
|
|
1264
|
-
}),
|
|
1265
|
-
return
|
|
1264
|
+
}), a = await r.json();
|
|
1265
|
+
return r.ok ? {
|
|
1266
1266
|
ok: !0,
|
|
1267
|
-
data:
|
|
1268
|
-
} :
|
|
1267
|
+
data: a
|
|
1268
|
+
} : r.status === 401 || r.status === 403 ? {
|
|
1269
1269
|
ok: !1,
|
|
1270
1270
|
error: d("InvalidTokenOrSecretAnswer")
|
|
1271
1271
|
} : {
|
|
1272
1272
|
ok: !1,
|
|
1273
|
-
error: h(
|
|
1273
|
+
error: h(r.status)
|
|
1274
1274
|
};
|
|
1275
1275
|
} catch {
|
|
1276
1276
|
return {
|
|
@@ -1291,11 +1291,11 @@ class Et {
|
|
|
1291
1291
|
Role: "MEMBER",
|
|
1292
1292
|
Authorization: `Bearer ${e}`
|
|
1293
1293
|
}
|
|
1294
|
-
}),
|
|
1294
|
+
}), r = await t.json();
|
|
1295
1295
|
return t.ok ? {
|
|
1296
1296
|
ok: !0,
|
|
1297
|
-
data:
|
|
1298
|
-
} :
|
|
1297
|
+
data: r
|
|
1298
|
+
} : r.code === "ACCOUNT_BLACKLISTED" ? {
|
|
1299
1299
|
ok: !1,
|
|
1300
1300
|
error: d("AccountBlacklisted")
|
|
1301
1301
|
} : t.status === 403 || t.status === 401 ? {
|
|
@@ -1401,7 +1401,7 @@ class kt {
|
|
|
1401
1401
|
return e.ok ? { ok: e.ok, data: e.data.member.depositsCount } : e;
|
|
1402
1402
|
}
|
|
1403
1403
|
async member() {
|
|
1404
|
-
const e = await this.client.request(
|
|
1404
|
+
const e = await this.client.request(at);
|
|
1405
1405
|
return e.ok ? { ok: e.ok, data: e.data.member } : e;
|
|
1406
1406
|
}
|
|
1407
1407
|
async pointsWalletTransactions(e) {
|
|
@@ -1410,7 +1410,7 @@ class kt {
|
|
|
1410
1410
|
}
|
|
1411
1411
|
async activityRecords(e) {
|
|
1412
1412
|
const t = await this.client.request(
|
|
1413
|
-
|
|
1413
|
+
Et,
|
|
1414
1414
|
e
|
|
1415
1415
|
);
|
|
1416
1416
|
return t.ok ? { ok: t.ok, data: t.data.member.activityRecords } : t;
|
|
@@ -1453,7 +1453,7 @@ class Ae {
|
|
|
1453
1453
|
return e.ok ? { ok: e.ok, data: e.data.cashbackBonuses } : e;
|
|
1454
1454
|
}
|
|
1455
1455
|
async claimCashbackBonus(e) {
|
|
1456
|
-
const t = await this.client.request(
|
|
1456
|
+
const t = await this.client.request(rt, e);
|
|
1457
1457
|
return t.ok ? t.data.claimCashbackBonus ? {
|
|
1458
1458
|
ok: !1,
|
|
1459
1459
|
error: d(t.data.claimCashbackBonus.__typename)
|
|
@@ -1583,7 +1583,7 @@ class Ae {
|
|
|
1583
1583
|
}
|
|
1584
1584
|
async gameSession(e) {
|
|
1585
1585
|
const t = await this.client.request(
|
|
1586
|
-
|
|
1586
|
+
Ee,
|
|
1587
1587
|
e
|
|
1588
1588
|
);
|
|
1589
1589
|
return t.ok ? { ok: !0, data: t.data.node } : t;
|
|
@@ -1642,29 +1642,29 @@ class Ct {
|
|
|
1642
1642
|
} : e;
|
|
1643
1643
|
}
|
|
1644
1644
|
async games(e) {
|
|
1645
|
-
var
|
|
1645
|
+
var a, s, c, p, u, f, w, l, A, k, _, C, T, v, M, N, I, D, R, P, G, x, $, W;
|
|
1646
1646
|
const t = new URLSearchParams();
|
|
1647
|
-
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 = (
|
|
1648
|
-
const
|
|
1649
|
-
return
|
|
1647
|
+
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 = (a = e == null ? void 0 : e.filter) == null ? void 0 : a.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 : _.provider) != null && C.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(",")), (N = (M = e == null ? void 0 : e.filter) == null ? void 0 : M.provider) != null && N.notIn && t.set("filter[provider][nin]", e.filter.provider.notIn.join(",")), (D = (I = e == null ? void 0 : e.filter) == null ? void 0 : I.tags) != null && D.equal && t.set("filter[tags][eq]", e.filter.tags.equal), (P = (R = e == null ? void 0 : e.filter) == null ? void 0 : R.tags) != null && P.notEqual && t.set("filter[tags][neq]", e.filter.tags.notEqual), (x = (G = e == null ? void 0 : e.filter) == null ? void 0 : G.tags) != null && x.in && t.set("filter[tags][in]", e.filter.tags.in.join(",")), (W = ($ = e == null ? void 0 : e.filter) == null ? void 0 : $.tags) != null && W.notIn && t.set("filter[tags][nin]", e.filter.tags.notIn.join(","));
|
|
1648
|
+
const r = await this.getJson("/games", t);
|
|
1649
|
+
return r.ok ? {
|
|
1650
1650
|
ok: !0,
|
|
1651
1651
|
data: {
|
|
1652
|
-
edges:
|
|
1653
|
-
node:
|
|
1654
|
-
cursor:
|
|
1652
|
+
edges: r.data.data.map((B) => ({
|
|
1653
|
+
node: B,
|
|
1654
|
+
cursor: B.cursor
|
|
1655
1655
|
})),
|
|
1656
|
-
totalCount:
|
|
1656
|
+
totalCount: r.data.totalCount ?? 0,
|
|
1657
1657
|
pageInfo: {
|
|
1658
|
-
hasNextPage: !!
|
|
1659
|
-
endCursor:
|
|
1658
|
+
hasNextPage: !!r.data.next,
|
|
1659
|
+
endCursor: r.data.next
|
|
1660
1660
|
}
|
|
1661
1661
|
}
|
|
1662
|
-
} :
|
|
1662
|
+
} : r;
|
|
1663
1663
|
}
|
|
1664
1664
|
async game(e) {
|
|
1665
|
-
var
|
|
1665
|
+
var r;
|
|
1666
1666
|
const t = await this.getJson(`/games/${e}`);
|
|
1667
|
-
return ((
|
|
1667
|
+
return ((r = t.error) == null ? void 0 : r.name) === "HttpNotFound" ? {
|
|
1668
1668
|
ok: !0,
|
|
1669
1669
|
data: null
|
|
1670
1670
|
} : t.ok ? {
|
|
@@ -1673,7 +1673,7 @@ class Ct {
|
|
|
1673
1673
|
} : t;
|
|
1674
1674
|
}
|
|
1675
1675
|
async getJson(e, t) {
|
|
1676
|
-
const
|
|
1676
|
+
const r = new Request(`${this.url}${e}?${(t == null ? void 0 : t.toString()) ?? ""}`, {
|
|
1677
1677
|
method: "GET",
|
|
1678
1678
|
headers: {
|
|
1679
1679
|
Accept: "application/json",
|
|
@@ -1683,13 +1683,13 @@ class Ct {
|
|
|
1683
1683
|
}
|
|
1684
1684
|
});
|
|
1685
1685
|
try {
|
|
1686
|
-
const
|
|
1687
|
-
return
|
|
1686
|
+
const a = await fetch(r);
|
|
1687
|
+
return a.ok ? {
|
|
1688
1688
|
ok: !0,
|
|
1689
|
-
data: await
|
|
1689
|
+
data: await a.json()
|
|
1690
1690
|
} : {
|
|
1691
1691
|
ok: !1,
|
|
1692
|
-
error: h(
|
|
1692
|
+
error: h(a.status)
|
|
1693
1693
|
};
|
|
1694
1694
|
} catch {
|
|
1695
1695
|
return {
|
|
@@ -1719,7 +1719,7 @@ class Tt {
|
|
|
1719
1719
|
}
|
|
1720
1720
|
async gameSession(e) {
|
|
1721
1721
|
const t = await this.client.request(
|
|
1722
|
-
|
|
1722
|
+
Ee,
|
|
1723
1723
|
e
|
|
1724
1724
|
);
|
|
1725
1725
|
return t.ok ? { ok: !0, data: t.data.node } : t;
|
|
@@ -1759,16 +1759,16 @@ class vt {
|
|
|
1759
1759
|
function Mt(n, e, t) {
|
|
1760
1760
|
return n < e ? e : n > t ? t : n;
|
|
1761
1761
|
}
|
|
1762
|
-
function
|
|
1762
|
+
function V(n) {
|
|
1763
1763
|
return Object.prototype.toString.call(n) === "[object Object]" && Object(n) === n;
|
|
1764
1764
|
}
|
|
1765
1765
|
function Nt(n) {
|
|
1766
1766
|
const e = [];
|
|
1767
|
-
function t(
|
|
1768
|
-
for (const s in
|
|
1769
|
-
const c =
|
|
1770
|
-
|
|
1771
|
-
key: [...
|
|
1767
|
+
function t(r, a = []) {
|
|
1768
|
+
for (const s in r) {
|
|
1769
|
+
const c = r[s];
|
|
1770
|
+
V(c) ? t(c, [...a, s]) : Array.isArray(c) ? t(It(c), [...a, s]) : e.push({
|
|
1771
|
+
key: [...a, s],
|
|
1772
1772
|
value: c
|
|
1773
1773
|
});
|
|
1774
1774
|
}
|
|
@@ -1776,25 +1776,25 @@ function Nt(n) {
|
|
|
1776
1776
|
return t(n), e;
|
|
1777
1777
|
}
|
|
1778
1778
|
function It(n) {
|
|
1779
|
-
return n.reduce((e, t,
|
|
1779
|
+
return n.reduce((e, t, r) => (e[r] = t, e), {});
|
|
1780
1780
|
}
|
|
1781
|
-
class
|
|
1781
|
+
class b {
|
|
1782
1782
|
constructor(e, t) {
|
|
1783
1783
|
m(this, "url");
|
|
1784
1784
|
m(this, "options");
|
|
1785
1785
|
m(this, "middlewares");
|
|
1786
|
-
var
|
|
1787
|
-
const
|
|
1788
|
-
this.url = e, this.options = { ...t == null ? void 0 : t.fetchOptions, headers:
|
|
1786
|
+
var a;
|
|
1787
|
+
const r = new Headers((a = t == null ? void 0 : t.fetchOptions) == null ? void 0 : a.headers);
|
|
1788
|
+
this.url = e, this.options = { ...t == null ? void 0 : t.fetchOptions, headers: r }, this.middlewares = (t == null ? void 0 : t.middlewares) ?? [];
|
|
1789
1789
|
}
|
|
1790
1790
|
async request(e, t) {
|
|
1791
|
-
const
|
|
1792
|
-
|
|
1791
|
+
const r = JSON.stringify({ query: e, variables: t }), a = new Headers(this.options.headers);
|
|
1792
|
+
a.set("Content-Type", "application/json"), a.set("Accept", "application/json");
|
|
1793
1793
|
const s = await this.runMiddlewares(
|
|
1794
1794
|
new Request(this.url, {
|
|
1795
1795
|
...this.options,
|
|
1796
|
-
body:
|
|
1797
|
-
headers:
|
|
1796
|
+
body: r,
|
|
1797
|
+
headers: a,
|
|
1798
1798
|
method: "POST"
|
|
1799
1799
|
})
|
|
1800
1800
|
);
|
|
@@ -1802,26 +1802,26 @@ class E {
|
|
|
1802
1802
|
}
|
|
1803
1803
|
/** Single file upload */
|
|
1804
1804
|
async upload(e, t) {
|
|
1805
|
-
const
|
|
1806
|
-
|
|
1805
|
+
const r = this.createUploadBody(e, t), a = new Headers(this.options.headers);
|
|
1806
|
+
a.delete("Content-Type");
|
|
1807
1807
|
const s = await this.runMiddlewares(
|
|
1808
1808
|
new Request(this.url, {
|
|
1809
1809
|
...this.options,
|
|
1810
|
-
body:
|
|
1811
|
-
headers:
|
|
1810
|
+
body: r,
|
|
1811
|
+
headers: a,
|
|
1812
1812
|
method: "POST"
|
|
1813
1813
|
})
|
|
1814
1814
|
);
|
|
1815
1815
|
return await this.exec(s);
|
|
1816
1816
|
}
|
|
1817
1817
|
async exec(e) {
|
|
1818
|
-
var t,
|
|
1818
|
+
var t, r, a, s, c, p;
|
|
1819
1819
|
try {
|
|
1820
1820
|
const u = await fetch(e);
|
|
1821
1821
|
if (!u.ok)
|
|
1822
1822
|
return { ok: !1, error: h(u.status) };
|
|
1823
1823
|
const f = await u.json(), w = f.data, l = (t = f.errors) == null ? void 0 : t.at(0);
|
|
1824
|
-
return l ? ((
|
|
1824
|
+
return l ? ((r = l.extensions) == null ? void 0 : r.code) === "FORBIDDEN" || ((a = l.extensions) == null ? void 0 : a.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) } : {
|
|
1825
1825
|
ok: !1,
|
|
1826
1826
|
error: h(500, l.message)
|
|
1827
1827
|
} : {
|
|
@@ -1837,15 +1837,15 @@ class E {
|
|
|
1837
1837
|
}
|
|
1838
1838
|
async runMiddlewares(e) {
|
|
1839
1839
|
let t = e.clone();
|
|
1840
|
-
for (const
|
|
1841
|
-
t = await
|
|
1840
|
+
for (const r of this.middlewares)
|
|
1841
|
+
t = await r(t);
|
|
1842
1842
|
return t;
|
|
1843
1843
|
}
|
|
1844
1844
|
createUploadBody(e, t) {
|
|
1845
|
-
const
|
|
1845
|
+
const r = Nt(t).filter(
|
|
1846
1846
|
(c) => c.value instanceof File || c.value instanceof Blob
|
|
1847
|
-
),
|
|
1848
|
-
|
|
1847
|
+
), a = new FormData();
|
|
1848
|
+
a.append(
|
|
1849
1849
|
"operations",
|
|
1850
1850
|
JSON.stringify({
|
|
1851
1851
|
query: e,
|
|
@@ -1853,11 +1853,11 @@ class E {
|
|
|
1853
1853
|
})
|
|
1854
1854
|
);
|
|
1855
1855
|
const s = {};
|
|
1856
|
-
return
|
|
1856
|
+
return r.forEach((c, p) => {
|
|
1857
1857
|
s[p.toString()] = [`variables.${c.key.join(".")}`];
|
|
1858
|
-
}),
|
|
1859
|
-
|
|
1860
|
-
}),
|
|
1858
|
+
}), a.append("map", JSON.stringify(s)), r.forEach((c, p) => {
|
|
1859
|
+
a.append(p.toString(), c.value);
|
|
1860
|
+
}), a;
|
|
1861
1861
|
}
|
|
1862
1862
|
}
|
|
1863
1863
|
async function g(n) {
|
|
@@ -1882,15 +1882,15 @@ class ke {
|
|
|
1882
1882
|
this.enabled && console.log(`\x1B[32m[success] ${e}`);
|
|
1883
1883
|
}
|
|
1884
1884
|
}
|
|
1885
|
-
function
|
|
1885
|
+
function H(n) {
|
|
1886
1886
|
return new Date(n.getTime());
|
|
1887
1887
|
}
|
|
1888
|
-
function
|
|
1889
|
-
const t =
|
|
1888
|
+
function O(n, e) {
|
|
1889
|
+
const t = H(n);
|
|
1890
1890
|
return t.setDate(t.getDate() + e), t;
|
|
1891
1891
|
}
|
|
1892
|
-
function
|
|
1893
|
-
const t =
|
|
1892
|
+
function U(n, e) {
|
|
1893
|
+
const t = H(n);
|
|
1894
1894
|
return t.setMinutes(t.getMinutes() + e), t;
|
|
1895
1895
|
}
|
|
1896
1896
|
function he(n, e) {
|
|
@@ -1904,18 +1904,18 @@ function _e(n) {
|
|
|
1904
1904
|
function we(n, e) {
|
|
1905
1905
|
const {
|
|
1906
1906
|
until: t,
|
|
1907
|
-
interval:
|
|
1908
|
-
maxAttempt:
|
|
1907
|
+
interval: r = 1e3,
|
|
1908
|
+
maxAttempt: a = 3
|
|
1909
1909
|
/**/
|
|
1910
1910
|
} = e;
|
|
1911
1911
|
async function s(c, p) {
|
|
1912
|
-
const u = p ??
|
|
1913
|
-
return t(f) ? f : u > 1 ? (await _e(
|
|
1912
|
+
const u = p ?? a, f = await n(...c);
|
|
1913
|
+
return t(f) ? f : u > 1 ? (await _e(r * ((a - u) / 2)), s(c, u - 1)) : f;
|
|
1914
1914
|
}
|
|
1915
1915
|
return async (...c) => await s(c);
|
|
1916
1916
|
}
|
|
1917
|
-
function
|
|
1918
|
-
const t =
|
|
1917
|
+
function q(n, e) {
|
|
1918
|
+
const t = H(n);
|
|
1919
1919
|
return t.setMinutes(t.getMinutes() - e), t;
|
|
1920
1920
|
}
|
|
1921
1921
|
class Dt {
|
|
@@ -1925,17 +1925,17 @@ class Dt {
|
|
|
1925
1925
|
m(this, "authService");
|
|
1926
1926
|
m(this, "walletService");
|
|
1927
1927
|
m(this, "_refreshing", !1);
|
|
1928
|
-
this.authService = new
|
|
1928
|
+
this.authService = new bt({
|
|
1929
1929
|
url: e.authUrl,
|
|
1930
1930
|
platform: e.platform
|
|
1931
1931
|
}), this.walletService = new Ae(
|
|
1932
|
-
new
|
|
1932
|
+
new b(e.walletUrl, {
|
|
1933
1933
|
middlewares: [
|
|
1934
1934
|
(t) => (t.headers.set("Platform", e.platform), t.headers.set("Role", "MEMBER"), t)
|
|
1935
1935
|
]
|
|
1936
1936
|
})
|
|
1937
1937
|
), this.logger = new ke({
|
|
1938
|
-
enabled: e.
|
|
1938
|
+
enabled: e.logs ?? !1
|
|
1939
1939
|
});
|
|
1940
1940
|
}
|
|
1941
1941
|
get refreshing() {
|
|
@@ -1945,7 +1945,7 @@ class Dt {
|
|
|
1945
1945
|
this._refreshing = e;
|
|
1946
1946
|
}
|
|
1947
1947
|
async create(e) {
|
|
1948
|
-
var
|
|
1948
|
+
var a;
|
|
1949
1949
|
if (this.isServer)
|
|
1950
1950
|
return this.logger.warn("'localStorage' is not available on the server."), {
|
|
1951
1951
|
ok: !1,
|
|
@@ -1964,7 +1964,7 @@ class Dt {
|
|
|
1964
1964
|
maxAttempt: 5
|
|
1965
1965
|
})();
|
|
1966
1966
|
if (!c.ok) return c;
|
|
1967
|
-
if (!((
|
|
1967
|
+
if (!((a = c.data) != null && a.member))
|
|
1968
1968
|
return {
|
|
1969
1969
|
ok: !1,
|
|
1970
1970
|
error: {
|
|
@@ -1983,8 +1983,8 @@ class Dt {
|
|
|
1983
1983
|
this.storageKey,
|
|
1984
1984
|
JSON.stringify({
|
|
1985
1985
|
...u.data,
|
|
1986
|
-
accessTokenExpiresAt:
|
|
1987
|
-
refreshTokenExpiresAt:
|
|
1986
|
+
accessTokenExpiresAt: U(f, 8).getTime(),
|
|
1987
|
+
refreshTokenExpiresAt: q(O(f, 30), 2).getTime()
|
|
1988
1988
|
})
|
|
1989
1989
|
), {
|
|
1990
1990
|
ok: !0,
|
|
@@ -1999,8 +1999,8 @@ class Dt {
|
|
|
1999
1999
|
this.storageKey,
|
|
2000
2000
|
JSON.stringify({
|
|
2001
2001
|
...s.data,
|
|
2002
|
-
accessTokenExpiresAt:
|
|
2003
|
-
refreshTokenExpiresAt:
|
|
2002
|
+
accessTokenExpiresAt: U(c, 8).getTime(),
|
|
2003
|
+
refreshTokenExpiresAt: q(O(c, 30), 2).getTime()
|
|
2004
2004
|
})
|
|
2005
2005
|
), {
|
|
2006
2006
|
ok: !0,
|
|
@@ -2018,13 +2018,13 @@ class Dt {
|
|
|
2018
2018
|
authenticator: t.data.authenticator
|
|
2019
2019
|
}
|
|
2020
2020
|
};
|
|
2021
|
-
const
|
|
2021
|
+
const r = /* @__PURE__ */ new Date();
|
|
2022
2022
|
return window.localStorage.setItem(
|
|
2023
2023
|
this.storageKey,
|
|
2024
2024
|
JSON.stringify({
|
|
2025
2025
|
...t.data,
|
|
2026
|
-
accessTokenExpiresAt:
|
|
2027
|
-
refreshTokenExpiresAt:
|
|
2026
|
+
accessTokenExpiresAt: U(r, 8).getTime(),
|
|
2027
|
+
refreshTokenExpiresAt: q(O(r, 30), 2).getTime()
|
|
2028
2028
|
})
|
|
2029
2029
|
), {
|
|
2030
2030
|
ok: !0,
|
|
@@ -2034,13 +2034,13 @@ class Dt {
|
|
|
2034
2034
|
async createFromAuthenticator(e) {
|
|
2035
2035
|
const t = await this.authService.authenticate(e);
|
|
2036
2036
|
if (t.ok) {
|
|
2037
|
-
const
|
|
2037
|
+
const r = /* @__PURE__ */ new Date();
|
|
2038
2038
|
return this.isServer ? this.logger.warn("'localStorage' is not available on the server.") : window.localStorage.setItem(
|
|
2039
2039
|
this.storageKey,
|
|
2040
2040
|
JSON.stringify({
|
|
2041
2041
|
...t.data,
|
|
2042
|
-
accessTokenExpiresAt:
|
|
2043
|
-
refreshTokenExpiresAt:
|
|
2042
|
+
accessTokenExpiresAt: U(r, 8).getTime(),
|
|
2043
|
+
refreshTokenExpiresAt: q(O(r, 30), 2).getTime()
|
|
2044
2044
|
})
|
|
2045
2045
|
), { ok: !0 };
|
|
2046
2046
|
} else
|
|
@@ -2061,9 +2061,9 @@ class Dt {
|
|
|
2061
2061
|
data: null
|
|
2062
2062
|
};
|
|
2063
2063
|
try {
|
|
2064
|
-
let t = JSON.parse(e),
|
|
2065
|
-
const
|
|
2066
|
-
if (he(
|
|
2064
|
+
let t = JSON.parse(e), r = /* @__PURE__ */ new Date();
|
|
2065
|
+
const a = new Date(t.accessTokenExpiresAt), s = new Date(t.refreshTokenExpiresAt);
|
|
2066
|
+
if (he(r, s))
|
|
2067
2067
|
return this.logger.warn("Session expired. Logging out.."), window.localStorage.removeItem(this.storageKey), {
|
|
2068
2068
|
ok: !1,
|
|
2069
2069
|
error: {
|
|
@@ -2071,7 +2071,7 @@ class Dt {
|
|
|
2071
2071
|
message: "Session expired."
|
|
2072
2072
|
}
|
|
2073
2073
|
};
|
|
2074
|
-
if (he(
|
|
2074
|
+
if (he(r, a)) {
|
|
2075
2075
|
this.logger.info("Refreshing session..."), this.refreshing = !0;
|
|
2076
2076
|
const c = await this.authService.refreshSession(t.refreshToken);
|
|
2077
2077
|
if (this.refreshing = !1, !c.ok)
|
|
@@ -2082,11 +2082,11 @@ class Dt {
|
|
|
2082
2082
|
ok: !0,
|
|
2083
2083
|
data: t
|
|
2084
2084
|
});
|
|
2085
|
-
this.logger.success("Session refreshed!"),
|
|
2085
|
+
this.logger.success("Session refreshed!"), r = /* @__PURE__ */ new Date(), t = {
|
|
2086
2086
|
...t,
|
|
2087
2087
|
...c.data,
|
|
2088
|
-
accessTokenExpiresAt:
|
|
2089
|
-
refreshTokenExpiresAt:
|
|
2088
|
+
accessTokenExpiresAt: U(r, 8).getTime(),
|
|
2089
|
+
refreshTokenExpiresAt: q(O(r, 30), 2).getTime()
|
|
2090
2090
|
}, window.localStorage.setItem(this.storageKey, JSON.stringify(t));
|
|
2091
2091
|
}
|
|
2092
2092
|
return {
|
|
@@ -2113,11 +2113,11 @@ class Dt {
|
|
|
2113
2113
|
(t = e.data) != null && t.accessToken && await this.authService.destroySession(e.data.accessToken), window.localStorage.removeItem(this.storageKey);
|
|
2114
2114
|
}
|
|
2115
2115
|
async verify() {
|
|
2116
|
-
var
|
|
2116
|
+
var r, a, s;
|
|
2117
2117
|
if (this.isServer)
|
|
2118
2118
|
return this.logger.warn("'localStorage' is not available on the server."), !0;
|
|
2119
2119
|
const e = await this.get();
|
|
2120
|
-
if (((
|
|
2120
|
+
if (((r = e.error) == null ? void 0 : r.name) === "InvalidToken" || ((a = e.error) == null ? void 0 : a.name) === "SessionExpired" || ((s = e.error) == null ? void 0 : s.name) === "AccountBlacklisted") return !1;
|
|
2121
2121
|
if (!e.data) return !0;
|
|
2122
2122
|
const t = await this.authService.verifySession(e.data.accessToken);
|
|
2123
2123
|
return t || window.localStorage.removeItem(this.storageKey), t;
|
|
@@ -2129,17 +2129,17 @@ class Dt {
|
|
|
2129
2129
|
function y(n) {
|
|
2130
2130
|
const e = {};
|
|
2131
2131
|
for (const t in n) {
|
|
2132
|
-
const
|
|
2133
|
-
if (
|
|
2134
|
-
if (
|
|
2135
|
-
e[t] = y(
|
|
2132
|
+
const r = n[t];
|
|
2133
|
+
if (r !== null && r !== void 0) {
|
|
2134
|
+
if (V(r)) {
|
|
2135
|
+
e[t] = y(r);
|
|
2136
2136
|
continue;
|
|
2137
2137
|
}
|
|
2138
|
-
if (Array.isArray(
|
|
2139
|
-
e[t] =
|
|
2138
|
+
if (Array.isArray(r)) {
|
|
2139
|
+
e[t] = r.map((a) => V(a) ? y(a) : a);
|
|
2140
2140
|
continue;
|
|
2141
2141
|
}
|
|
2142
|
-
e[t] =
|
|
2142
|
+
e[t] = r;
|
|
2143
2143
|
}
|
|
2144
2144
|
}
|
|
2145
2145
|
return e;
|
|
@@ -2200,7 +2200,7 @@ class Rt {
|
|
|
2200
2200
|
return y(t);
|
|
2201
2201
|
}
|
|
2202
2202
|
platform(e) {
|
|
2203
|
-
var t,
|
|
2203
|
+
var t, r, a, s, c, p, u, f, w, l, A, k, _, C, T, v, M, N, I, D, R, P, G, x, $, W, B, j, Q, K, z, J, X, Z, ee, te, re, ae, ne, oe, ie, se, ce, de, me, ue, le, pe, fe;
|
|
2204
2204
|
return {
|
|
2205
2205
|
paymentSettings: {
|
|
2206
2206
|
minimumFirstDepositAmount: i(e.minimumFirstDepositAmount),
|
|
@@ -2208,8 +2208,8 @@ class Rt {
|
|
|
2208
2208
|
depositGateway: {
|
|
2209
2209
|
bank: {
|
|
2210
2210
|
androidEnabled: ((t = e.bankDepositGatewaySettings) == null ? void 0 : t.androidEnabled) ?? !1,
|
|
2211
|
-
iosEnabled: ((
|
|
2212
|
-
webEnabled: ((
|
|
2211
|
+
iosEnabled: ((r = e.bankDepositGatewaySettings) == null ? void 0 : r.iosEnabled) ?? !1,
|
|
2212
|
+
webEnabled: ((a = e.bankDepositGatewaySettings) == null ? void 0 : a.webEnabled) ?? !1,
|
|
2213
2213
|
mobileWebEnabled: ((s = e.bankDepositGatewaySettings) == null ? void 0 : s.mobileWebEnabled) ?? !1,
|
|
2214
2214
|
minimumAmount: i((c = e.bankDepositGatewaySettings) == null ? void 0 : c.minimumAmount),
|
|
2215
2215
|
maximumAmount: i((p = e.bankDepositGatewaySettings) == null ? void 0 : p.maximumAmount)
|
|
@@ -2232,18 +2232,18 @@ class Rt {
|
|
|
2232
2232
|
},
|
|
2233
2233
|
mayaApp: {
|
|
2234
2234
|
androidEnabled: ((I = e.mayaAppDepositGatewaySettings) == null ? void 0 : I.androidEnabled) ?? !1,
|
|
2235
|
-
iosEnabled: ((
|
|
2236
|
-
webEnabled: ((
|
|
2237
|
-
mobileWebEnabled: ((
|
|
2238
|
-
minimumAmount: i((
|
|
2239
|
-
maximumAmount: i((
|
|
2235
|
+
iosEnabled: ((D = e.mayaAppDepositGatewaySettings) == null ? void 0 : D.iosEnabled) ?? !1,
|
|
2236
|
+
webEnabled: ((R = e.mayaAppDepositGatewaySettings) == null ? void 0 : R.webEnabled) ?? !1,
|
|
2237
|
+
mobileWebEnabled: ((P = e.mayaAppDepositGatewaySettings) == null ? void 0 : P.mobileWebEnabled) ?? !1,
|
|
2238
|
+
minimumAmount: i((G = e.mayaAppDepositGatewaySettings) == null ? void 0 : G.minimumAmount),
|
|
2239
|
+
maximumAmount: i((x = e.mayaAppDepositGatewaySettings) == null ? void 0 : x.maximumAmount)
|
|
2240
2240
|
}
|
|
2241
2241
|
},
|
|
2242
2242
|
withdrawalGateway: {
|
|
2243
2243
|
bank: {
|
|
2244
|
-
androidEnabled: ((
|
|
2245
|
-
iosEnabled: ((
|
|
2246
|
-
webEnabled: ((
|
|
2244
|
+
androidEnabled: (($ = e.bankWithdrawalGatewaySettings) == null ? void 0 : $.androidEnabled) ?? !1,
|
|
2245
|
+
iosEnabled: ((W = e.bankWithdrawalGatewaySettings) == null ? void 0 : W.iosEnabled) ?? !1,
|
|
2246
|
+
webEnabled: ((B = e.bankWithdrawalGatewaySettings) == null ? void 0 : B.webEnabled) ?? !1,
|
|
2247
2247
|
mobileWebEnabled: ((j = e.bankWithdrawalGatewaySettings) == null ? void 0 : j.mobileWebEnabled) ?? !1,
|
|
2248
2248
|
minimumAmount: i((Q = e.bankWithdrawalGatewaySettings) == null ? void 0 : Q.minimumAmount),
|
|
2249
2249
|
maximumAmount: i((K = e.bankWithdrawalGatewaySettings) == null ? void 0 : K.maximumAmount)
|
|
@@ -2260,8 +2260,8 @@ class Rt {
|
|
|
2260
2260
|
)
|
|
2261
2261
|
},
|
|
2262
2262
|
maya: {
|
|
2263
|
-
androidEnabled: ((
|
|
2264
|
-
iosEnabled: ((
|
|
2263
|
+
androidEnabled: ((re = e.mayaWithdrawalGatewaySettings) == null ? void 0 : re.androidEnabled) ?? !1,
|
|
2264
|
+
iosEnabled: ((ae = e.mayaWithdrawalGatewaySettings) == null ? void 0 : ae.iosEnabled) ?? !1,
|
|
2265
2265
|
webEnabled: ((ne = e.mayaWithdrawalGatewaySettings) == null ? void 0 : ne.webEnabled) ?? !1,
|
|
2266
2266
|
mobileWebEnabled: ((oe = e.mayaWithdrawalGatewaySettings) == null ? void 0 : oe.mobileWebEnabled) ?? !1,
|
|
2267
2267
|
minimumAmount: i((ie = e.mayaWithdrawalGatewaySettings) == null ? void 0 : ie.minimumAmount),
|
|
@@ -2269,8 +2269,8 @@ class Rt {
|
|
|
2269
2269
|
},
|
|
2270
2270
|
mayaApp: {
|
|
2271
2271
|
androidEnabled: ((ce = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : ce.androidEnabled) ?? !1,
|
|
2272
|
-
iosEnabled: ((
|
|
2273
|
-
webEnabled: ((
|
|
2272
|
+
iosEnabled: ((de = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : de.iosEnabled) ?? !1,
|
|
2273
|
+
webEnabled: ((me = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : me.webEnabled) ?? !1,
|
|
2274
2274
|
mobileWebEnabled: ((ue = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : ue.mobileWebEnabled) ?? !1,
|
|
2275
2275
|
minimumAmount: i((le = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : le.minimumAmount),
|
|
2276
2276
|
maximumAmount: i(
|
|
@@ -2396,7 +2396,7 @@ class Rt {
|
|
|
2396
2396
|
return y(t);
|
|
2397
2397
|
}
|
|
2398
2398
|
betRecord(e) {
|
|
2399
|
-
var
|
|
2399
|
+
var r;
|
|
2400
2400
|
const t = {
|
|
2401
2401
|
id: e.id,
|
|
2402
2402
|
bet: i(e.bet, 0),
|
|
@@ -2416,7 +2416,7 @@ class Rt {
|
|
|
2416
2416
|
contestName: e.contestName ?? void 0,
|
|
2417
2417
|
externalCategory: e.externalCategory ?? void 0,
|
|
2418
2418
|
metadata: {
|
|
2419
|
-
odds: ((
|
|
2419
|
+
odds: ((r = e.metadata) == null ? void 0 : r.odds) ?? void 0
|
|
2420
2420
|
}
|
|
2421
2421
|
};
|
|
2422
2422
|
return y(t);
|
|
@@ -2458,6 +2458,7 @@ class Rt {
|
|
|
2458
2458
|
return {
|
|
2459
2459
|
id: e.id,
|
|
2460
2460
|
type: e.type,
|
|
2461
|
+
tags: e.tags ?? [],
|
|
2461
2462
|
name: e.name,
|
|
2462
2463
|
images: this.staticService.gameThumbnails({
|
|
2463
2464
|
id: e.externalId,
|
|
@@ -2506,7 +2507,7 @@ class Rt {
|
|
|
2506
2507
|
dateTimeLastUpdated: new Date(e.dateTimeLastUpdated),
|
|
2507
2508
|
turnoverContributionPercentagePerGameProvider: Object.entries(
|
|
2508
2509
|
e.turnoverContributionPercentagePerGameProvider
|
|
2509
|
-
).reduce((
|
|
2510
|
+
).reduce((r, [a, s]) => (r[a] = i(s, 0), r), {})
|
|
2510
2511
|
};
|
|
2511
2512
|
}
|
|
2512
2513
|
bonus(e) {
|
|
@@ -2589,69 +2590,140 @@ class Rt {
|
|
|
2589
2590
|
}
|
|
2590
2591
|
class $t {
|
|
2591
2592
|
constructor(e) {
|
|
2592
|
-
m(this, "
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
this.
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
platform: e.sitePlatform
|
|
2593
|
+
m(this, "_config");
|
|
2594
|
+
this._config = {
|
|
2595
|
+
...e,
|
|
2596
|
+
logs: e.logs ?? !1,
|
|
2597
|
+
environment: e.environment ?? "development"
|
|
2598
|
+
};
|
|
2599
|
+
}
|
|
2600
|
+
get config() {
|
|
2601
|
+
return this._config;
|
|
2602
|
+
}
|
|
2603
|
+
set config(e) {
|
|
2604
|
+
this._config = {
|
|
2605
|
+
...this._config,
|
|
2606
|
+
...e
|
|
2607
|
+
};
|
|
2608
|
+
}
|
|
2609
|
+
get logger() {
|
|
2610
|
+
return new ke({
|
|
2611
|
+
enabled: this.config.logs ?? !1
|
|
2612
2612
|
});
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2613
|
+
}
|
|
2614
|
+
get transformer() {
|
|
2615
|
+
return new Rt(this.config);
|
|
2616
|
+
}
|
|
2617
|
+
get cmsPortalService() {
|
|
2618
|
+
return new Ct({
|
|
2619
|
+
url: this.config.environment === "development" ? "https://portal-api.development.opexacms.io/v1" : "https://portal-api.opexacms.io/v1",
|
|
2620
|
+
site: this.config.site,
|
|
2621
|
+
platform: this.config.sitePlatform
|
|
2622
|
+
});
|
|
2623
|
+
}
|
|
2624
|
+
get sessionManager() {
|
|
2625
|
+
return new Dt({
|
|
2626
|
+
authUrl: this.config.environment === "development" ? "https://auth.development.opexa.io" : "https://auth.opexa.io",
|
|
2627
|
+
walletUrl: this.config.environment === "development" ? "https://wallet.development.opexa.io/graphql" : "https://wallet.opexa.io/graphql",
|
|
2628
|
+
platform: this.config.platform,
|
|
2629
|
+
logs: this.config.environment === "development"
|
|
2630
|
+
});
|
|
2631
|
+
}
|
|
2632
|
+
get gameService() {
|
|
2633
|
+
return new Tt(
|
|
2634
|
+
new b(
|
|
2635
|
+
this.config.environment === "development" ? "https://game.development.opexa.io/graphql" : "https://game.opexa.io/graphql",
|
|
2636
|
+
{
|
|
2637
|
+
middlewares: [this.authMiddleware],
|
|
2638
|
+
fetchOptions: {
|
|
2639
|
+
headers: {
|
|
2640
|
+
Role: "MEMBER",
|
|
2641
|
+
"Platform-Code": this.config.platform
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
2619
2644
|
}
|
|
2620
|
-
}
|
|
2621
|
-
};
|
|
2622
|
-
this.gameService = new Tt(
|
|
2623
|
-
new E(
|
|
2624
|
-
t ? "https://game.development.opexa.io/graphql" : "https://game.opexa.io/graphql",
|
|
2625
|
-
a
|
|
2626
2645
|
)
|
|
2627
|
-
)
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2646
|
+
);
|
|
2647
|
+
}
|
|
2648
|
+
get fileService() {
|
|
2649
|
+
return new At(
|
|
2650
|
+
new b(
|
|
2651
|
+
this.config.environment === "development" ? "https://file.development.opexa.io/graphql" : "https://file.opexa.io/graphql",
|
|
2652
|
+
{
|
|
2653
|
+
middlewares: [this.authMiddleware],
|
|
2654
|
+
fetchOptions: {
|
|
2655
|
+
headers: {
|
|
2656
|
+
Role: "MEMBER",
|
|
2657
|
+
"Platform-Code": this.config.platform
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
}
|
|
2631
2661
|
)
|
|
2632
|
-
)
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2662
|
+
);
|
|
2663
|
+
}
|
|
2664
|
+
get walletService() {
|
|
2665
|
+
return new Ae(
|
|
2666
|
+
new b(
|
|
2667
|
+
this.config.environment === "development" ? "https://wallet.development.opexa.io/graphql" : "https://wallet.opexa.io/graphql",
|
|
2668
|
+
{
|
|
2669
|
+
middlewares: [this.authMiddleware],
|
|
2670
|
+
fetchOptions: {
|
|
2671
|
+
headers: {
|
|
2672
|
+
Role: "MEMBER",
|
|
2673
|
+
"Platform-Code": this.config.platform
|
|
2674
|
+
}
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2636
2677
|
)
|
|
2637
|
-
)
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2678
|
+
);
|
|
2679
|
+
}
|
|
2680
|
+
get accountService() {
|
|
2681
|
+
return new St(
|
|
2682
|
+
new b(
|
|
2683
|
+
this.config.environment === "development" ? "https://account.development.opexa.io/graphql" : "https://account.opexa.io/graphql",
|
|
2684
|
+
{
|
|
2685
|
+
middlewares: [this.authMiddleware],
|
|
2686
|
+
fetchOptions: {
|
|
2687
|
+
headers: {
|
|
2688
|
+
Role: "MEMBER",
|
|
2689
|
+
"Platform-Code": this.config.platform
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2641
2693
|
)
|
|
2642
|
-
)
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2694
|
+
);
|
|
2695
|
+
}
|
|
2696
|
+
get reportService() {
|
|
2697
|
+
return new kt(
|
|
2698
|
+
new b(
|
|
2699
|
+
this.config.environment === "development" ? "https://report.development.opexa.io/graphql" : "https://report.opexa.io/graphql",
|
|
2700
|
+
{
|
|
2701
|
+
middlewares: [this.authMiddleware],
|
|
2702
|
+
fetchOptions: {
|
|
2703
|
+
headers: {
|
|
2704
|
+
Role: "MEMBER",
|
|
2705
|
+
"Platform-Code": this.config.platform
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
}
|
|
2646
2709
|
)
|
|
2647
|
-
)
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2710
|
+
);
|
|
2711
|
+
}
|
|
2712
|
+
get portalService() {
|
|
2713
|
+
return new vt(
|
|
2714
|
+
new b(
|
|
2715
|
+
this.config.environment === "development" ? "https://portal.development.opexa.io/graphql" : "https://portal.opexa.io/graphql",
|
|
2716
|
+
{
|
|
2717
|
+
middlewares: [this.authMiddleware],
|
|
2718
|
+
fetchOptions: {
|
|
2719
|
+
headers: {
|
|
2720
|
+
Role: "MEMBER",
|
|
2721
|
+
"Platform-Code": this.config.platform
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
}
|
|
2651
2725
|
)
|
|
2652
|
-
)
|
|
2653
|
-
enabled: e.log ?? !1
|
|
2654
|
-
});
|
|
2726
|
+
);
|
|
2655
2727
|
}
|
|
2656
2728
|
get authMiddleware() {
|
|
2657
2729
|
return async (e) => {
|
|
@@ -2766,12 +2838,12 @@ class $t {
|
|
|
2766
2838
|
*/
|
|
2767
2839
|
watchSession(e) {
|
|
2768
2840
|
const t = Mt(e.interval ?? 3e4, 3e4, 6e4);
|
|
2769
|
-
let
|
|
2770
|
-
const
|
|
2771
|
-
await this.sessionManager.verify() || await e.onInvalid(),
|
|
2841
|
+
let r = null;
|
|
2842
|
+
const a = () => setTimeout(async () => {
|
|
2843
|
+
await this.sessionManager.verify() || await e.onInvalid(), r = a();
|
|
2772
2844
|
}, t);
|
|
2773
|
-
return
|
|
2774
|
-
|
|
2845
|
+
return r = a(), function() {
|
|
2846
|
+
r && clearTimeout(r);
|
|
2775
2847
|
};
|
|
2776
2848
|
}
|
|
2777
2849
|
async session() {
|
|
@@ -2851,7 +2923,7 @@ class $t {
|
|
|
2851
2923
|
* ```
|
|
2852
2924
|
*/
|
|
2853
2925
|
async createAccount(e) {
|
|
2854
|
-
const t = e.id ??
|
|
2926
|
+
const t = e.id ?? E.generate(S.Account).toString(), r = await this.accountService.registerMemberAccount({
|
|
2855
2927
|
input: {
|
|
2856
2928
|
id: t,
|
|
2857
2929
|
name: e.name,
|
|
@@ -2864,7 +2936,7 @@ class $t {
|
|
|
2864
2936
|
verificationCode: e.verificationCode,
|
|
2865
2937
|
reCAPTCHAResponse: e.reCAPTCHAResponse
|
|
2866
2938
|
});
|
|
2867
|
-
return
|
|
2939
|
+
return r.ok ? { ok: !0, data: { id: t } } : r;
|
|
2868
2940
|
}
|
|
2869
2941
|
async registerMayaAccount(e) {
|
|
2870
2942
|
return await this.accountService.registerMayaMemberAccount({
|
|
@@ -2942,13 +3014,13 @@ class $t {
|
|
|
2942
3014
|
* ```
|
|
2943
3015
|
*/
|
|
2944
3016
|
async submitVerificationDetails(e) {
|
|
2945
|
-
const t = e.id ??
|
|
3017
|
+
const t = e.id ?? E.generate(S.Verification).toString(), r = await this.accountService.createMemberVerification({
|
|
2946
3018
|
input: {
|
|
2947
3019
|
id: t,
|
|
2948
3020
|
...e
|
|
2949
3021
|
}
|
|
2950
3022
|
});
|
|
2951
|
-
return
|
|
3023
|
+
return r.ok ? { ok: !0, data: { id: t } } : r;
|
|
2952
3024
|
}
|
|
2953
3025
|
/**
|
|
2954
3026
|
* @example
|
|
@@ -3033,9 +3105,9 @@ class $t {
|
|
|
3033
3105
|
return t.ok ? {
|
|
3034
3106
|
ok: !0,
|
|
3035
3107
|
data: {
|
|
3036
|
-
announcements: t.data.edges.map(({ cursor:
|
|
3037
|
-
...this.transformer.transform.announcement(
|
|
3038
|
-
cursor:
|
|
3108
|
+
announcements: t.data.edges.map(({ cursor: r, node: a }) => ({
|
|
3109
|
+
...this.transformer.transform.announcement(a),
|
|
3110
|
+
cursor: r
|
|
3039
3111
|
})),
|
|
3040
3112
|
totalCount: t.data.totalCount,
|
|
3041
3113
|
endCursor: t.data.pageInfo.endCursor ?? void 0,
|
|
@@ -3066,19 +3138,19 @@ class $t {
|
|
|
3066
3138
|
* ```
|
|
3067
3139
|
*/
|
|
3068
3140
|
async createWithdrawal(e) {
|
|
3069
|
-
const t = e.id ??
|
|
3141
|
+
const t = e.id ?? E.generate(S.Withdrawal).toString();
|
|
3070
3142
|
if (e.type === "BANK") {
|
|
3071
|
-
const
|
|
3143
|
+
const r = await this.walletService.createBankWithdrawal({
|
|
3072
3144
|
input: {
|
|
3073
3145
|
id: t,
|
|
3074
3146
|
amount: e.amount.toString(),
|
|
3075
3147
|
transactionPassword: await g(e.transactionPassword)
|
|
3076
3148
|
}
|
|
3077
3149
|
});
|
|
3078
|
-
if (!
|
|
3150
|
+
if (!r.ok) return r;
|
|
3079
3151
|
}
|
|
3080
3152
|
if (e.type === "GCASH") {
|
|
3081
|
-
const
|
|
3153
|
+
const r = await this.walletService.createGCashWithdrawal({
|
|
3082
3154
|
input: {
|
|
3083
3155
|
id: t,
|
|
3084
3156
|
amount: e.amount.toString(),
|
|
@@ -3086,10 +3158,10 @@ class $t {
|
|
|
3086
3158
|
recipientMobileNumber: this.addAreaCode(e.recipientMobileNumber)
|
|
3087
3159
|
}
|
|
3088
3160
|
});
|
|
3089
|
-
if (!
|
|
3161
|
+
if (!r.ok) return r;
|
|
3090
3162
|
}
|
|
3091
3163
|
if (e.type === "MAYA") {
|
|
3092
|
-
const
|
|
3164
|
+
const r = await this.walletService.createMayaWithdrawal({
|
|
3093
3165
|
input: {
|
|
3094
3166
|
id: t,
|
|
3095
3167
|
amount: e.amount.toString(),
|
|
@@ -3097,17 +3169,17 @@ class $t {
|
|
|
3097
3169
|
recipientMobileNumber: this.addAreaCode(e.recipientMobileNumber)
|
|
3098
3170
|
}
|
|
3099
3171
|
});
|
|
3100
|
-
if (!
|
|
3172
|
+
if (!r.ok) return r;
|
|
3101
3173
|
}
|
|
3102
3174
|
if (e.type === "MAYA_APP") {
|
|
3103
|
-
const
|
|
3175
|
+
const r = await this.walletService.createMayaAppWithdrawal({
|
|
3104
3176
|
input: {
|
|
3105
3177
|
id: t,
|
|
3106
3178
|
amount: e.amount.toString(),
|
|
3107
3179
|
transactionPassword: await g(e.transactionPassword)
|
|
3108
3180
|
}
|
|
3109
3181
|
});
|
|
3110
|
-
if (!
|
|
3182
|
+
if (!r.ok) return r;
|
|
3111
3183
|
}
|
|
3112
3184
|
return { ok: !0, data: { id: t } };
|
|
3113
3185
|
}
|
|
@@ -3116,9 +3188,9 @@ class $t {
|
|
|
3116
3188
|
return t.ok ? {
|
|
3117
3189
|
ok: !0,
|
|
3118
3190
|
data: {
|
|
3119
|
-
withdrawalRecords: t.data.edges.map(({ cursor:
|
|
3120
|
-
...this.transformer.transform.withdrawalRecord(
|
|
3121
|
-
cursor:
|
|
3191
|
+
withdrawalRecords: t.data.edges.map(({ cursor: r, node: a }) => ({
|
|
3192
|
+
...this.transformer.transform.withdrawalRecord(a),
|
|
3193
|
+
cursor: r
|
|
3122
3194
|
})),
|
|
3123
3195
|
totalCount: t.data.totalCount,
|
|
3124
3196
|
endCursor: t.data.pageInfo.endCursor ?? void 0,
|
|
@@ -3152,36 +3224,36 @@ class $t {
|
|
|
3152
3224
|
* ```
|
|
3153
3225
|
*/
|
|
3154
3226
|
async createDeposit(e) {
|
|
3155
|
-
const t = e.id ??
|
|
3227
|
+
const t = e.id ?? E.generate(S.Deposit).toString();
|
|
3156
3228
|
if (e.type === "MAYA") {
|
|
3157
|
-
const
|
|
3229
|
+
const r = await this.walletService.createMayaDeposit({
|
|
3158
3230
|
input: {
|
|
3159
3231
|
id: t,
|
|
3160
3232
|
amount: e.amount.toString(),
|
|
3161
3233
|
promo: e.promo
|
|
3162
3234
|
}
|
|
3163
3235
|
});
|
|
3164
|
-
if (!
|
|
3236
|
+
if (!r.ok) return r;
|
|
3165
3237
|
}
|
|
3166
3238
|
if (e.type === "MAYA_APP") {
|
|
3167
|
-
const
|
|
3239
|
+
const r = await this.walletService.createMayaAppDeposit({
|
|
3168
3240
|
input: {
|
|
3169
3241
|
id: t,
|
|
3170
3242
|
amount: e.amount.toString(),
|
|
3171
3243
|
promo: e.promo
|
|
3172
3244
|
}
|
|
3173
3245
|
});
|
|
3174
|
-
if (!
|
|
3246
|
+
if (!r.ok) return r;
|
|
3175
3247
|
}
|
|
3176
3248
|
if (e.type === "GCASH") {
|
|
3177
|
-
const
|
|
3249
|
+
const r = await this.walletService.createGCashDeposit({
|
|
3178
3250
|
input: {
|
|
3179
3251
|
id: t,
|
|
3180
3252
|
amount: e.amount.toString(),
|
|
3181
3253
|
promo: e.promo
|
|
3182
3254
|
}
|
|
3183
3255
|
});
|
|
3184
|
-
if (!
|
|
3256
|
+
if (!r.ok) return r;
|
|
3185
3257
|
}
|
|
3186
3258
|
return { ok: !0, data: { id: t } };
|
|
3187
3259
|
}
|
|
@@ -3197,9 +3269,9 @@ class $t {
|
|
|
3197
3269
|
return t.ok ? {
|
|
3198
3270
|
ok: !0,
|
|
3199
3271
|
data: {
|
|
3200
|
-
depositRecords: t.data.edges.map(({ cursor:
|
|
3201
|
-
...this.transformer.transform.depositRecord(
|
|
3202
|
-
cursor:
|
|
3272
|
+
depositRecords: t.data.edges.map(({ cursor: r, node: a }) => ({
|
|
3273
|
+
...this.transformer.transform.depositRecord(a),
|
|
3274
|
+
cursor: r
|
|
3203
3275
|
})),
|
|
3204
3276
|
totalCount: t.data.totalCount,
|
|
3205
3277
|
endCursor: t.data.pageInfo.endCursor ?? void 0,
|
|
@@ -3216,16 +3288,16 @@ class $t {
|
|
|
3216
3288
|
/*+----------------------------------------+*/
|
|
3217
3289
|
/**/
|
|
3218
3290
|
async betRecords(e) {
|
|
3219
|
-
var
|
|
3291
|
+
var r, a;
|
|
3220
3292
|
const t = await this.reportService.betRecords({
|
|
3221
3293
|
...e,
|
|
3222
3294
|
...(e == null ? void 0 : e.filter) && {
|
|
3223
3295
|
filter: {
|
|
3224
3296
|
...e.filter,
|
|
3225
|
-
...((
|
|
3297
|
+
...((r = e.filter) == null ? void 0 : r.gameType) && {
|
|
3226
3298
|
game__type: e.filter.gameType
|
|
3227
3299
|
},
|
|
3228
|
-
...((
|
|
3300
|
+
...((a = e.filter) == null ? void 0 : a.gameProvider) && {
|
|
3229
3301
|
game__provider: e.filter.gameProvider
|
|
3230
3302
|
}
|
|
3231
3303
|
}
|
|
@@ -3261,9 +3333,9 @@ class $t {
|
|
|
3261
3333
|
return t.ok ? {
|
|
3262
3334
|
ok: !0,
|
|
3263
3335
|
data: {
|
|
3264
|
-
transactionRecords: t.data.edges.map(({ cursor:
|
|
3265
|
-
...this.transformer.transform.transactionRecord(
|
|
3266
|
-
cursor:
|
|
3336
|
+
transactionRecords: t.data.edges.map(({ cursor: r, node: a }) => ({
|
|
3337
|
+
...this.transformer.transform.transactionRecord(a),
|
|
3338
|
+
cursor: r
|
|
3267
3339
|
})),
|
|
3268
3340
|
totalCount: t.data.totalCount,
|
|
3269
3341
|
endCursor: t.data.pageInfo.endCursor ?? void 0,
|
|
@@ -3336,9 +3408,9 @@ class $t {
|
|
|
3336
3408
|
return t.ok ? {
|
|
3337
3409
|
ok: !0,
|
|
3338
3410
|
data: {
|
|
3339
|
-
games: t.data.edges.map(({ cursor:
|
|
3340
|
-
...this.transformer.transform.game(
|
|
3341
|
-
cursor:
|
|
3411
|
+
games: t.data.edges.map(({ cursor: r, node: a }) => ({
|
|
3412
|
+
...this.transformer.transform.game(a),
|
|
3413
|
+
cursor: r
|
|
3342
3414
|
})),
|
|
3343
3415
|
totalCount: t.data.totalCount,
|
|
3344
3416
|
hasNextPage: t.data.pageInfo.hasNextPage,
|
|
@@ -3351,9 +3423,9 @@ class $t {
|
|
|
3351
3423
|
return t.ok ? {
|
|
3352
3424
|
ok: !0,
|
|
3353
3425
|
data: {
|
|
3354
|
-
games: t.data.edges.map(({ cursor:
|
|
3355
|
-
...this.transformer.transform.game__next(
|
|
3356
|
-
cursor:
|
|
3426
|
+
games: t.data.edges.map(({ cursor: r, node: a }) => ({
|
|
3427
|
+
...this.transformer.transform.game__next(a),
|
|
3428
|
+
cursor: r
|
|
3357
3429
|
})),
|
|
3358
3430
|
totalCount: t.data.totalCount,
|
|
3359
3431
|
hasNextPage: t.data.pageInfo.hasNextPage,
|
|
@@ -3367,9 +3439,9 @@ class $t {
|
|
|
3367
3439
|
return t.ok ? {
|
|
3368
3440
|
ok: !0,
|
|
3369
3441
|
data: {
|
|
3370
|
-
games: t.data.edges.map(({ cursor:
|
|
3371
|
-
...this.transformer.transform.game(
|
|
3372
|
-
cursor:
|
|
3442
|
+
games: t.data.edges.map(({ cursor: r, node: a }) => ({
|
|
3443
|
+
...this.transformer.transform.game(a),
|
|
3444
|
+
cursor: r
|
|
3373
3445
|
})),
|
|
3374
3446
|
totalCount: t.data.totalCount,
|
|
3375
3447
|
hasNextPage: t.data.pageInfo.hasNextPage,
|
|
@@ -3417,11 +3489,11 @@ class $t {
|
|
|
3417
3489
|
ok: !0,
|
|
3418
3490
|
data: this.transformer.transform.gameSession(t.data)
|
|
3419
3491
|
};
|
|
3420
|
-
const
|
|
3421
|
-
return
|
|
3492
|
+
const r = await this.gameService.gameSession({ id: e });
|
|
3493
|
+
return r.ok ? {
|
|
3422
3494
|
ok: !0,
|
|
3423
|
-
data:
|
|
3424
|
-
} :
|
|
3495
|
+
data: r.data ? this.transformer.transform.gameSession(r.data) : null
|
|
3496
|
+
} : r;
|
|
3425
3497
|
}
|
|
3426
3498
|
/**
|
|
3427
3499
|
* @deprecated use `createGameSession__next`
|
|
@@ -3440,18 +3512,18 @@ class $t {
|
|
|
3440
3512
|
* ```
|
|
3441
3513
|
*/
|
|
3442
3514
|
async createGameSession(e) {
|
|
3443
|
-
const t = e.id ??
|
|
3444
|
-
return
|
|
3515
|
+
const t = e.id ?? E.generate(S.GameSession).toString(), r = await this.walletService.createGameSession({ input: { id: t, game: e.game } });
|
|
3516
|
+
return r.ok ? { ok: !0, data: { id: t } } : r;
|
|
3445
3517
|
}
|
|
3446
3518
|
/** @deprecated use `createGameSession__next` */
|
|
3447
3519
|
async createGameSession__legacy(e) {
|
|
3448
|
-
const t = e.id ??
|
|
3449
|
-
return
|
|
3520
|
+
const t = e.id ?? E.generate(S.GameSession).toString(), r = await this.gameService.createGameSession({ input: { id: t, game: e.game } });
|
|
3521
|
+
return r.ok ? { ok: !0, data: { id: t } } : r;
|
|
3450
3522
|
}
|
|
3451
3523
|
async createGameSession__next(e) {
|
|
3452
|
-
const t = e.id ??
|
|
3524
|
+
const t = e.id ?? E.generate(S.GameSession).toString();
|
|
3453
3525
|
if (e.game.startsWith("SPORTS:")) {
|
|
3454
|
-
const p = await
|
|
3526
|
+
const p = await E.generateFromKey(S.Game, e.game).then(
|
|
3455
3527
|
(f) => f.toString()
|
|
3456
3528
|
), u = await this.gameService.createGameSession({
|
|
3457
3529
|
input: {
|
|
@@ -3461,8 +3533,8 @@ class $t {
|
|
|
3461
3533
|
});
|
|
3462
3534
|
return u.ok ? { ok: !0, data: { id: t } } : u;
|
|
3463
3535
|
}
|
|
3464
|
-
const
|
|
3465
|
-
if (!
|
|
3536
|
+
const r = await this.game__next(e.game);
|
|
3537
|
+
if (!r.data)
|
|
3466
3538
|
return {
|
|
3467
3539
|
ok: !1,
|
|
3468
3540
|
error: {
|
|
@@ -3472,9 +3544,9 @@ class $t {
|
|
|
3472
3544
|
};
|
|
3473
3545
|
const {
|
|
3474
3546
|
/**/
|
|
3475
|
-
provider:
|
|
3547
|
+
provider: a,
|
|
3476
3548
|
externalId: s
|
|
3477
|
-
} =
|
|
3549
|
+
} = r.data, c = Pt.includes(a) ? await this.walletService.createGameSession({ input: { id: t, game: s } }) : await this.gameService.createGameSession({ input: { id: t, game: s } });
|
|
3478
3550
|
return c.ok ? { ok: !0, data: { id: t } } : c;
|
|
3479
3551
|
}
|
|
3480
3552
|
/** @deprecated use `endGameSession__next` */
|
|
@@ -3517,13 +3589,13 @@ class $t {
|
|
|
3517
3589
|
* ```
|
|
3518
3590
|
*/
|
|
3519
3591
|
async uploadImageFile(e) {
|
|
3520
|
-
const t = e.id ??
|
|
3592
|
+
const t = e.id ?? E.generate(S.File).toString(), r = await this.fileService.uploadPrivateImageFile({
|
|
3521
3593
|
input: {
|
|
3522
3594
|
id: t,
|
|
3523
3595
|
file: e.file
|
|
3524
3596
|
}
|
|
3525
3597
|
});
|
|
3526
|
-
return
|
|
3598
|
+
return r.ok ? { ok: !0, data: { id: t } } : r;
|
|
3527
3599
|
}
|
|
3528
3600
|
/**/
|
|
3529
3601
|
/*+----------------------------------------+*/
|
|
@@ -3549,9 +3621,9 @@ class $t {
|
|
|
3549
3621
|
return t.ok ? {
|
|
3550
3622
|
ok: !0,
|
|
3551
3623
|
data: {
|
|
3552
|
-
pointsWalletTransactions: t.data.edges.map(({ cursor:
|
|
3553
|
-
...this.transformer.transform.pointsWalletTransaction(
|
|
3554
|
-
cursor:
|
|
3624
|
+
pointsWalletTransactions: t.data.edges.map(({ cursor: r, node: a }) => ({
|
|
3625
|
+
...this.transformer.transform.pointsWalletTransaction(a),
|
|
3626
|
+
cursor: r
|
|
3555
3627
|
})),
|
|
3556
3628
|
totalCount: t.data.totalCount,
|
|
3557
3629
|
hasNextPage: t.data.pageInfo.hasNextPage,
|
|
@@ -3569,9 +3641,9 @@ class $t {
|
|
|
3569
3641
|
return t.ok ? {
|
|
3570
3642
|
ok: !0,
|
|
3571
3643
|
data: {
|
|
3572
|
-
activityRecords: t.data.edges.map(({ cursor:
|
|
3573
|
-
...this.transformer.transform.activityRecord(
|
|
3574
|
-
cursor:
|
|
3644
|
+
activityRecords: t.data.edges.map(({ cursor: r, node: a }) => ({
|
|
3645
|
+
...this.transformer.transform.activityRecord(a),
|
|
3646
|
+
cursor: r
|
|
3575
3647
|
})),
|
|
3576
3648
|
totalCount: t.data.totalCount,
|
|
3577
3649
|
hasNextPage: t.data.pageInfo.hasNextPage,
|