@opexa/portal-sdk 0.0.86 → 0.0.87
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 +63 -63
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -38
- package/dist/index.mjs.map +1 -1
- package/dist/sdk/types.d.ts +1 -1
- package/dist/services/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1029,7 +1029,7 @@ const tt = i`
|
|
|
1029
1029
|
multiplier
|
|
1030
1030
|
}
|
|
1031
1031
|
}
|
|
1032
|
-
`,
|
|
1032
|
+
`, wt = i`
|
|
1033
1033
|
query MayaSession($id: ObjectId!) {
|
|
1034
1034
|
mayaSession(id: $id) {
|
|
1035
1035
|
id
|
|
@@ -1037,7 +1037,7 @@ const tt = i`
|
|
|
1037
1037
|
dateTimeCreated
|
|
1038
1038
|
}
|
|
1039
1039
|
}
|
|
1040
|
-
`,
|
|
1040
|
+
`, yt = i`
|
|
1041
1041
|
mutation ValidateMayaSession {
|
|
1042
1042
|
validateMayaSession: validMayaSession
|
|
1043
1043
|
}
|
|
@@ -1518,8 +1518,16 @@ class _t {
|
|
|
1518
1518
|
async sendVerificationCode(e) {
|
|
1519
1519
|
if (e.channel === "EMAIL") throw new Error("Email channel is not yet supported");
|
|
1520
1520
|
function t(r) {
|
|
1521
|
-
|
|
1522
|
-
|
|
1521
|
+
switch (r) {
|
|
1522
|
+
case "MEMBER_NOT_FOUND":
|
|
1523
|
+
return "AccountNotFoundError";
|
|
1524
|
+
case "RATE_LIMIT_REACH":
|
|
1525
|
+
return "RateLimitExceededError";
|
|
1526
|
+
case "NOT_READY_TO_SEND_VERIFICATION_ERROR":
|
|
1527
|
+
return "NotReadyToSendVerficationCodeError";
|
|
1528
|
+
default:
|
|
1529
|
+
return null;
|
|
1530
|
+
}
|
|
1523
1531
|
}
|
|
1524
1532
|
try {
|
|
1525
1533
|
const r = await fetch(`${this.url}/otps`, {
|
|
@@ -1564,9 +1572,9 @@ class vt {
|
|
|
1564
1572
|
} : e;
|
|
1565
1573
|
}
|
|
1566
1574
|
async games(e) {
|
|
1567
|
-
var a, s, c, u, p, f,
|
|
1575
|
+
var a, s, c, u, p, f, w, l, _, v, M, R, N, E, I, D, S, P, $, x, C, U, O, W;
|
|
1568
1576
|
const t = new URLSearchParams();
|
|
1569
|
-
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), (u = (c = e == null ? void 0 : e.filter) == null ? void 0 : c.type) != null && u.notEqual && t.set("filter[type][neq]", e.filter.type.notEqual), (f = (p = e == null ? void 0 : e.filter) == null ? void 0 : p.type) != null && f.in && t.set("filter[type][in]", e.filter.type.in.join(",")), (l = (
|
|
1577
|
+
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), (u = (c = e == null ? void 0 : e.filter) == null ? void 0 : c.type) != null && u.notEqual && t.set("filter[type][neq]", e.filter.type.notEqual), (f = (p = e == null ? void 0 : e.filter) == null ? void 0 : p.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(",")), (v = (_ = e == null ? void 0 : e.filter) == null ? void 0 : _.provider) != null && v.equal && t.set("filter[provider][eq]", e.filter.provider.equal), (R = (M = e == null ? void 0 : e.filter) == null ? void 0 : M.provider) != null && R.notEqual && t.set("filter[provider][neq]", e.filter.provider.notEqual), (E = (N = e == null ? void 0 : e.filter) == null ? void 0 : N.provider) != null && E.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 = (S = e == null ? void 0 : e.filter) == null ? void 0 : S.tags) != null && P.equal && t.set("filter[tags][eq]", e.filter.tags.equal.toLowerCase()), (x = ($ = e == null ? void 0 : e.filter) == null ? void 0 : $.tags) != null && x.notEqual && t.set("filter[tags][neq]", e.filter.tags.notEqual.toLowerCase()), (U = (C = e == null ? void 0 : e.filter) == null ? void 0 : C.tags) != null && U.in && t.set(
|
|
1570
1578
|
"filter[tags][in]",
|
|
1571
1579
|
e.filter.tags.in.map((A) => A.toLowerCase()).join(",")
|
|
1572
1580
|
), (W = (O = e == null ? void 0 : e.filter) == null ? void 0 : O.tags) != null && W.notIn && t.set(
|
|
@@ -1917,7 +1925,7 @@ class Pt {
|
|
|
1917
1925
|
}
|
|
1918
1926
|
async mayaSession(e) {
|
|
1919
1927
|
const t = await this.client.request(
|
|
1920
|
-
|
|
1928
|
+
wt,
|
|
1921
1929
|
e
|
|
1922
1930
|
);
|
|
1923
1931
|
return t.ok ? { ok: t.ok, data: t.data.mayaSession } : t;
|
|
@@ -1955,7 +1963,7 @@ class Pt {
|
|
|
1955
1963
|
}
|
|
1956
1964
|
async validateMayaSession() {
|
|
1957
1965
|
const e = await this.client.request(
|
|
1958
|
-
|
|
1966
|
+
yt
|
|
1959
1967
|
);
|
|
1960
1968
|
return e.ok ? e.data.validateMayaSession ? {
|
|
1961
1969
|
ok: !0
|
|
@@ -2032,13 +2040,13 @@ class G {
|
|
|
2032
2040
|
const p = await fetch(e);
|
|
2033
2041
|
if (!p.ok)
|
|
2034
2042
|
return { ok: !1, error: h(p.status) };
|
|
2035
|
-
const f = await p.json(),
|
|
2043
|
+
const f = await p.json(), w = f.data, l = (t = f.errors) == null ? void 0 : t.at(0);
|
|
2036
2044
|
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" || ((u = l.extensions) == null ? void 0 : u.code) === "BAD_REQUEST" ? { ok: !1, error: h(400, l.message) } : {
|
|
2037
2045
|
ok: !1,
|
|
2038
2046
|
error: h(500, l.message)
|
|
2039
2047
|
} : {
|
|
2040
2048
|
ok: !0,
|
|
2041
|
-
data:
|
|
2049
|
+
data: w
|
|
2042
2050
|
};
|
|
2043
2051
|
} catch {
|
|
2044
2052
|
return {
|
|
@@ -2072,7 +2080,7 @@ class G {
|
|
|
2072
2080
|
}), a;
|
|
2073
2081
|
}
|
|
2074
2082
|
}
|
|
2075
|
-
async function
|
|
2083
|
+
async function y(o) {
|
|
2076
2084
|
const e = new TextEncoder().encode(o), t = await crypto.subtle.digest("SHA-256", e);
|
|
2077
2085
|
return Array.from(new Uint8Array(t)).map((s) => s.toString(16).padStart(2, "0")).join("");
|
|
2078
2086
|
}
|
|
@@ -2105,7 +2113,7 @@ function q(o, e) {
|
|
|
2105
2113
|
const t = Q(o);
|
|
2106
2114
|
return t.setMinutes(t.getMinutes() + e), t;
|
|
2107
2115
|
}
|
|
2108
|
-
function
|
|
2116
|
+
function ye(o, e) {
|
|
2109
2117
|
return o.getTime() > e.getTime();
|
|
2110
2118
|
}
|
|
2111
2119
|
function ke(o) {
|
|
@@ -2159,9 +2167,9 @@ class Gt {
|
|
|
2159
2167
|
};
|
|
2160
2168
|
if (e.type === "MAYA") {
|
|
2161
2169
|
const c = await ge(() => this.walletService.mayaSession({ id: e.sessionId }), {
|
|
2162
|
-
until: (
|
|
2170
|
+
until: (w) => {
|
|
2163
2171
|
var l;
|
|
2164
|
-
return
|
|
2172
|
+
return w.ok && ((l = w.data) == null ? void 0 : l.member) != null;
|
|
2165
2173
|
},
|
|
2166
2174
|
interval: 1e3,
|
|
2167
2175
|
maxAttempt: 5
|
|
@@ -2176,7 +2184,7 @@ class Gt {
|
|
|
2176
2184
|
}
|
|
2177
2185
|
};
|
|
2178
2186
|
const p = await ge(() => this.authService.createSession(e), {
|
|
2179
|
-
until: (
|
|
2187
|
+
until: (w) => w.ok,
|
|
2180
2188
|
interval: 1e3,
|
|
2181
2189
|
maxAttempt: 5
|
|
2182
2190
|
})();
|
|
@@ -2266,7 +2274,7 @@ class Gt {
|
|
|
2266
2274
|
try {
|
|
2267
2275
|
let t = JSON.parse(e), r = /* @__PURE__ */ new Date();
|
|
2268
2276
|
const a = new Date(t.accessTokenExpiresAt), s = new Date(t.refreshTokenExpiresAt);
|
|
2269
|
-
if (
|
|
2277
|
+
if (ye(r, s))
|
|
2270
2278
|
return this.logger.warn("Session expired. Logging out.."), window.localStorage.removeItem(this.storageKey), {
|
|
2271
2279
|
ok: !1,
|
|
2272
2280
|
error: {
|
|
@@ -2274,7 +2282,7 @@ class Gt {
|
|
|
2274
2282
|
message: "Session expired."
|
|
2275
2283
|
}
|
|
2276
2284
|
};
|
|
2277
|
-
if (
|
|
2285
|
+
if (ye(r, a)) {
|
|
2278
2286
|
this.logger.info("Refreshing session..."), this.refreshing = !0;
|
|
2279
2287
|
const c = await this.authService.refreshSession(t.refreshToken);
|
|
2280
2288
|
if (this.refreshing = !1, !c.ok)
|
|
@@ -2404,7 +2412,7 @@ class Ot {
|
|
|
2404
2412
|
return g(t);
|
|
2405
2413
|
}
|
|
2406
2414
|
platform(e) {
|
|
2407
|
-
var t, r, a, s, c, u, p, f,
|
|
2415
|
+
var t, r, a, s, c, u, p, f, w, l, _, v, M, R, N, E, I, D, S, P, $, x, C, U, O, W, A, K, z, J, X, Z, ee, te, re, ae, oe, ne, ie, se, ce, me, de, ue, le, pe, fe, he, we;
|
|
2408
2416
|
return {
|
|
2409
2417
|
timezone: e.timezone,
|
|
2410
2418
|
currency: e.currency,
|
|
@@ -2423,7 +2431,7 @@ class Ot {
|
|
|
2423
2431
|
gcash: {
|
|
2424
2432
|
androidEnabled: ((p = e.gcashDepositGatewaySettings) == null ? void 0 : p.androidEnabled) ?? !1,
|
|
2425
2433
|
iosEnabled: ((f = e.gcashDepositGatewaySettings) == null ? void 0 : f.iosEnabled) ?? !1,
|
|
2426
|
-
webEnabled: ((
|
|
2434
|
+
webEnabled: ((w = e.gcashDepositGatewaySettings) == null ? void 0 : w.webEnabled) ?? !1,
|
|
2427
2435
|
mobileWebEnabled: ((l = e.gcashDepositGatewaySettings) == null ? void 0 : l.mobileWebEnabled) ?? !1,
|
|
2428
2436
|
minimumAmount: n((_ = e.gcashDepositGatewaySettings) == null ? void 0 : _.minimumAmount),
|
|
2429
2437
|
maximumAmount: n((v = e.gcashDepositGatewaySettings) == null ? void 0 : v.maximumAmount)
|
|
@@ -2487,7 +2495,7 @@ class Ot {
|
|
|
2487
2495
|
}
|
|
2488
2496
|
},
|
|
2489
2497
|
pointsClubSettings: {
|
|
2490
|
-
multiplier: n((
|
|
2498
|
+
multiplier: n((we = e.pointsClubSettings) == null ? void 0 : we.multiplier, 0)
|
|
2491
2499
|
}
|
|
2492
2500
|
};
|
|
2493
2501
|
}
|
|
@@ -2801,7 +2809,7 @@ class Ot {
|
|
|
2801
2809
|
upline: e.upline,
|
|
2802
2810
|
downline: e.downline,
|
|
2803
2811
|
turnover: n(e.turnover, 0),
|
|
2804
|
-
|
|
2812
|
+
commission: n(e.commission, 0),
|
|
2805
2813
|
dateTimeCreated: new Date(e.dateTimeCreated)
|
|
2806
2814
|
};
|
|
2807
2815
|
}
|
|
@@ -2848,7 +2856,7 @@ class qt {
|
|
|
2848
2856
|
}), this.logger = new Ce({
|
|
2849
2857
|
enabled: c ?? !1
|
|
2850
2858
|
});
|
|
2851
|
-
const p = u ? "https://auth.opexa.io" : "https://auth.development.opexa.io", f = u ? "https://wallet.opexa.io/graphql" : "https://wallet.development.opexa.io/graphql",
|
|
2859
|
+
const p = u ? "https://auth.opexa.io" : "https://auth.development.opexa.io", f = u ? "https://wallet.opexa.io/graphql" : "https://wallet.development.opexa.io/graphql", w = u ? "https://report.opexa.io/graphql" : "https://report.development.opexa.io/graphql", l = u ? "https://account.opexa.io/graphql" : "https://account.development.opexa.io/graphql", _ = u ? "https://portal.opexa.io/graphql" : "https://portal.development.opexa.io/graphql", v = u ? "https://file.opexa.io/graphql" : "https://file.development.opexa.io/graphql", M = u ? "https://game.opexa.io/graphql" : "https://game.development.opexa.io/graphql", R = "https://portal-api.opexacms.io/v1", N = new vt({
|
|
2852
2860
|
url: R,
|
|
2853
2861
|
site: t,
|
|
2854
2862
|
platform: r
|
|
@@ -2860,7 +2868,7 @@ class qt {
|
|
|
2860
2868
|
"Platform-Code": a
|
|
2861
2869
|
}
|
|
2862
2870
|
}
|
|
2863
|
-
}, I = new Rt(new G(M, E)), D = new Mt(new G(v, E)), S = new Pt(new G(f, E)), P = new Tt(new G(l, E)), $ = new It(new G(
|
|
2871
|
+
}, I = new Rt(new G(M, E)), D = new Mt(new G(v, E)), S = new Pt(new G(f, E)), P = new Tt(new G(l, E)), $ = new It(new G(w, E)), x = new Nt(new G(_, E)), C = new _t({
|
|
2864
2872
|
url: p,
|
|
2865
2873
|
platform: a
|
|
2866
2874
|
}), U = new Gt({
|
|
@@ -2882,7 +2890,7 @@ class qt {
|
|
|
2882
2890
|
case "NAME_AND_PASSWORD": {
|
|
2883
2891
|
const t = await this.sessionManager.create({
|
|
2884
2892
|
...e,
|
|
2885
|
-
password: await
|
|
2893
|
+
password: await y(e.password)
|
|
2886
2894
|
});
|
|
2887
2895
|
return t.ok ? t.data ? {
|
|
2888
2896
|
ok: !0,
|
|
@@ -2909,7 +2917,7 @@ class qt {
|
|
|
2909
2917
|
return await this.sessionManager.createFromAuthenticator({
|
|
2910
2918
|
type: "SECURITY_QUESTION",
|
|
2911
2919
|
token: e.token,
|
|
2912
|
-
secretAnswer: await
|
|
2920
|
+
secretAnswer: await y(e.secretAnswer)
|
|
2913
2921
|
});
|
|
2914
2922
|
default:
|
|
2915
2923
|
return {
|
|
@@ -2994,7 +3002,7 @@ class qt {
|
|
|
2994
3002
|
name: e.name,
|
|
2995
3003
|
domain: e.domain,
|
|
2996
3004
|
birthDay: typeof e.dateOfBirth == "string" ? e.dateOfBirth : e.dateOfBirth.toISOString(),
|
|
2997
|
-
password: await
|
|
3005
|
+
password: await y(e.password),
|
|
2998
3006
|
mobileNumber: b(e.mobileNumber)
|
|
2999
3007
|
},
|
|
3000
3008
|
referralCode: e.referralCode,
|
|
@@ -3021,7 +3029,7 @@ class qt {
|
|
|
3021
3029
|
input: {
|
|
3022
3030
|
id: t,
|
|
3023
3031
|
name: e.name,
|
|
3024
|
-
password: await
|
|
3032
|
+
password: await y(e.password),
|
|
3025
3033
|
mobileNumber: e.mobileNumber ? b(e.mobileNumber) : void 0
|
|
3026
3034
|
},
|
|
3027
3035
|
reCAPTCHAResponse: e.reCAPTCHAResponse
|
|
@@ -3032,7 +3040,7 @@ class qt {
|
|
|
3032
3040
|
return await this.accountService.registerMayaMemberAccount({
|
|
3033
3041
|
input: {
|
|
3034
3042
|
name: e.name,
|
|
3035
|
-
password: await
|
|
3043
|
+
password: await y(e.password),
|
|
3036
3044
|
domain: e.domain
|
|
3037
3045
|
}
|
|
3038
3046
|
});
|
|
@@ -3043,12 +3051,12 @@ class qt {
|
|
|
3043
3051
|
id: e,
|
|
3044
3052
|
data: {
|
|
3045
3053
|
...t,
|
|
3046
|
-
password: t.password ? await
|
|
3047
|
-
transactionPassword: t.transactionPassword ? await
|
|
3054
|
+
password: t.password ? await y(t.password) : void 0,
|
|
3055
|
+
transactionPassword: t.transactionPassword ? await y(t.transactionPassword) : void 0,
|
|
3048
3056
|
...t.mobileNumber && {
|
|
3049
3057
|
mobileNumber: b(t.mobileNumber)
|
|
3050
3058
|
},
|
|
3051
|
-
secretAnswer: t.secretAnswer ? await
|
|
3059
|
+
secretAnswer: t.secretAnswer ? await y(t.secretAnswer) : void 0
|
|
3052
3060
|
}
|
|
3053
3061
|
}
|
|
3054
3062
|
});
|
|
@@ -3090,7 +3098,7 @@ class qt {
|
|
|
3090
3098
|
return await this.accountService.resetPassword({
|
|
3091
3099
|
input: {
|
|
3092
3100
|
mobileNumber: b(e.mobileNumber),
|
|
3093
|
-
newPassword: await
|
|
3101
|
+
newPassword: await y(e.newPassword)
|
|
3094
3102
|
},
|
|
3095
3103
|
verificationCode: e.verificationCode
|
|
3096
3104
|
});
|
|
@@ -3180,7 +3188,7 @@ class qt {
|
|
|
3180
3188
|
input: {
|
|
3181
3189
|
id: t,
|
|
3182
3190
|
amount: e.amount.toString(),
|
|
3183
|
-
transactionPassword: await
|
|
3191
|
+
transactionPassword: await y(e.transactionPassword)
|
|
3184
3192
|
}
|
|
3185
3193
|
});
|
|
3186
3194
|
if (!r.ok) return r;
|
|
@@ -3190,7 +3198,7 @@ class qt {
|
|
|
3190
3198
|
input: {
|
|
3191
3199
|
id: t,
|
|
3192
3200
|
amount: e.amount.toString(),
|
|
3193
|
-
transactionPassword: await
|
|
3201
|
+
transactionPassword: await y(e.transactionPassword),
|
|
3194
3202
|
recipientMobileNumber: b(e.recipientMobileNumber)
|
|
3195
3203
|
}
|
|
3196
3204
|
});
|
|
@@ -3201,7 +3209,7 @@ class qt {
|
|
|
3201
3209
|
input: {
|
|
3202
3210
|
id: t,
|
|
3203
3211
|
amount: e.amount.toString(),
|
|
3204
|
-
transactionPassword: await
|
|
3212
|
+
transactionPassword: await y(e.transactionPassword),
|
|
3205
3213
|
recipientMobileNumber: b(e.recipientMobileNumber)
|
|
3206
3214
|
}
|
|
3207
3215
|
});
|
|
@@ -3212,7 +3220,7 @@ class qt {
|
|
|
3212
3220
|
input: {
|
|
3213
3221
|
id: t,
|
|
3214
3222
|
amount: e.amount.toString(),
|
|
3215
|
-
transactionPassword: await
|
|
3223
|
+
transactionPassword: await y(e.transactionPassword)
|
|
3216
3224
|
}
|
|
3217
3225
|
});
|
|
3218
3226
|
if (!r.ok) return r;
|
|
@@ -3461,13 +3469,13 @@ class qt {
|
|
|
3461
3469
|
if (e.game.startsWith("SPORTS:")) {
|
|
3462
3470
|
const f = await k.generateFromKey(T.Game, e.game).then(
|
|
3463
3471
|
(l) => l.toString()
|
|
3464
|
-
),
|
|
3472
|
+
), w = await this.gameService.createGameSession({
|
|
3465
3473
|
input: {
|
|
3466
3474
|
id: t,
|
|
3467
3475
|
game: f
|
|
3468
3476
|
}
|
|
3469
3477
|
});
|
|
3470
|
-
return
|
|
3478
|
+
return w.ok ? { ok: !0, data: { id: t } } : w;
|
|
3471
3479
|
}
|
|
3472
3480
|
const a = await this.game(e.game);
|
|
3473
3481
|
if (!a.data)
|