@opexa/portal-sdk 0.0.2 → 0.0.4

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.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  var we = Object.defineProperty;
2
2
  var ge = (i, e, t) => e in i ? we(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
3
  var c = (i, e, t) => ge(i, typeof e != "symbol" ? e + "" : e, t);
4
- import { ObjectId as g } from "@opexa/object-id";
4
+ import { ObjectId as w } from "@opexa/object-id";
5
5
  import { ObjectId as kt } from "@opexa/object-id";
6
- const y = {
6
+ const g = {
7
7
  Account: 8,
8
8
  Deposit: 9,
9
9
  Withdrawal: 14,
@@ -357,7 +357,7 @@ const pe = n`
357
357
  }
358
358
  }
359
359
  }
360
- `, Pe = n`
360
+ `, $e = n`
361
361
  mutation CreateGCashDeposit($input: CreateGCashDepositInput!) {
362
362
  createGCashDeposit(input: $input) {
363
363
  ... on DepositPromoMaximumAmountExceededError {
@@ -394,7 +394,7 @@ const pe = n`
394
394
  }
395
395
  }
396
396
  }
397
- `, $e = n`
397
+ `, Pe = n`
398
398
  mutation CreateMayaDeposit($input: CreateMayaDepositInput!) {
399
399
  createMayaDeposit(input: $input) {
400
400
  ... on DepositPromoMaximumAmountExceededError {
@@ -1451,8 +1451,11 @@ class pt {
1451
1451
  c(this, "url");
1452
1452
  this.url = e.url;
1453
1453
  }
1454
- gameThumbnail(e) {
1455
- return `${this.url}/images/${e.provider.toLowerCase()}/thumbnail-${e.id}.webp`;
1454
+ gameThumbnails(e) {
1455
+ return [
1456
+ `${this.url}/images/${e.provider.toLowerCase()}/thumbnail-${e.id}.webp`,
1457
+ `${this.url}/images/${e.provider.toLowerCase()}/thumbnail-${e.provider.toLowerCase()}.webp`
1458
+ ];
1456
1459
  }
1457
1460
  }
1458
1461
  class ft extends fe {
@@ -1501,7 +1504,7 @@ class ft extends fe {
1501
1504
  }
1502
1505
  async createGCashDeposit(e) {
1503
1506
  const t = await this.client.request(
1504
- Pe,
1507
+ $e,
1505
1508
  e
1506
1509
  );
1507
1510
  return t.ok ? t.data.createGCashDeposit ? {
@@ -1513,7 +1516,7 @@ class ft extends fe {
1513
1516
  }
1514
1517
  async createMayaDeposit(e) {
1515
1518
  const t = await this.client.request(
1516
- $e,
1519
+ Pe,
1517
1520
  e
1518
1521
  );
1519
1522
  return t.ok ? t.data.createMayaDeposit ? {
@@ -1797,7 +1800,7 @@ class gt {
1797
1800
  };
1798
1801
  }
1799
1802
  platform(e) {
1800
- var t, a, o, d, m, u, p, s, w, k, C, T, v, _, D, M, R, N, I, G, P, $, U, W, B, x, O, q, F, L, V, H, Y, j, Q, K, z, J, Z, X, ee, te, ae, re, oe, ne, ie, se;
1803
+ var t, a, o, d, m, u, p, y, s, k, C, T, v, _, D, M, R, N, I, G, $, P, U, W, B, x, O, q, F, L, V, H, Y, j, Q, K, z, J, Z, X, ee, te, ae, re, oe, ne, ie, se;
1801
1804
  return {
1802
1805
  paymentSettings: {
1803
1806
  minimumFirstDepositAmount: r(e.minimumFirstDepositAmount),
@@ -1813,8 +1816,8 @@ class gt {
1813
1816
  },
1814
1817
  gcash: {
1815
1818
  androidEnabled: ((p = e.gcashDepositGatewaySettings) == null ? void 0 : p.androidEnabled) ?? !1,
1816
- iosEnabled: ((s = e.gcashDepositGatewaySettings) == null ? void 0 : s.iosEnabled) ?? !1,
1817
- webEnabled: ((w = e.gcashDepositGatewaySettings) == null ? void 0 : w.webEnabled) ?? !1,
1819
+ iosEnabled: ((y = e.gcashDepositGatewaySettings) == null ? void 0 : y.iosEnabled) ?? !1,
1820
+ webEnabled: ((s = e.gcashDepositGatewaySettings) == null ? void 0 : s.webEnabled) ?? !1,
1818
1821
  mobileWebEnabled: ((k = e.gcashDepositGatewaySettings) == null ? void 0 : k.mobileWebEnabled) ?? !1,
1819
1822
  minimumAmount: r((C = e.gcashDepositGatewaySettings) == null ? void 0 : C.minimumAmount),
1820
1823
  maximumAmount: r((T = e.gcashDepositGatewaySettings) == null ? void 0 : T.maximumAmount)
@@ -1830,8 +1833,8 @@ class gt {
1830
1833
  mayaApp: {
1831
1834
  androidEnabled: ((I = e.mayaAppDepositGatewaySettings) == null ? void 0 : I.androidEnabled) ?? !1,
1832
1835
  iosEnabled: ((G = e.mayaAppDepositGatewaySettings) == null ? void 0 : G.iosEnabled) ?? !1,
1833
- webEnabled: ((P = e.mayaAppDepositGatewaySettings) == null ? void 0 : P.webEnabled) ?? !1,
1834
- mobileWebEnabled: (($ = e.mayaAppDepositGatewaySettings) == null ? void 0 : $.mobileWebEnabled) ?? !1,
1836
+ webEnabled: (($ = e.mayaAppDepositGatewaySettings) == null ? void 0 : $.webEnabled) ?? !1,
1837
+ mobileWebEnabled: ((P = e.mayaAppDepositGatewaySettings) == null ? void 0 : P.mobileWebEnabled) ?? !1,
1835
1838
  minimumAmount: r((U = e.mayaAppDepositGatewaySettings) == null ? void 0 : U.minimumAmount),
1836
1839
  maximumAmount: r((W = e.mayaAppDepositGatewaySettings) == null ? void 0 : W.maximumAmount)
1837
1840
  }
@@ -2024,9 +2027,16 @@ class gt {
2024
2027
  };
2025
2028
  }
2026
2029
  game(e) {
2030
+ const t = this.staticService.gameThumbnails(e);
2027
2031
  return {
2028
2032
  ...e,
2029
- image: this.staticService.gameThumbnail(e)
2033
+ images: t,
2034
+ get image() {
2035
+ return console.warn(
2036
+ "'game.image' is deprecated and will be removed in next version.",
2037
+ "Please use 'game.images' instead."
2038
+ ), t[0];
2039
+ }
2030
2040
  };
2031
2041
  }
2032
2042
  gameSession(e) {
@@ -2130,7 +2140,7 @@ class h {
2130
2140
  this.url = e, this.options = { ...t == null ? void 0 : t.fetchOptions, headers: a }, this.middlewares = (t == null ? void 0 : t.middlewares) ?? [];
2131
2141
  }
2132
2142
  async request(e, t) {
2133
- var w;
2143
+ var m;
2134
2144
  const a = JSON.stringify({ query: e, variables: t }), o = new Headers(this.options.headers);
2135
2145
  o.set("Content-Type", "application/json"), o.set("Accept", "application/json");
2136
2146
  const d = await this.runMiddlewares(
@@ -2140,18 +2150,26 @@ class h {
2140
2150
  headers: o,
2141
2151
  method: "POST"
2142
2152
  })
2143
- ), m = await fetch(d);
2144
- if (!m.ok)
2145
- return { ok: !1, error: l(m.status) };
2146
- const u = await m.json(), p = u.data, s = (w = u.errors) == null ? void 0 : w.at(0);
2147
- return (s == null ? void 0 : s.extensions.code) === "FORBIDDEN" ? { ok: !1, error: l(403, s.message) } : (s == null ? void 0 : s.extensions.code) === "UNAUTHORIZED" ? { ok: !1, error: l(401, s.message) } : (s == null ? void 0 : s.extensions.code) === "BAD_USER_INPUT" ? { ok: !1, error: l(400, s.message) } : (s == null ? void 0 : s.extensions.code) === "INTERNAL_SERVER_ERROR" ? { ok: !1, error: l(500, s.message) } : {
2148
- ok: !0,
2149
- data: p
2150
- };
2153
+ );
2154
+ try {
2155
+ const u = await fetch(d);
2156
+ if (!u.ok)
2157
+ return { ok: !1, error: l(u.status) };
2158
+ const p = await u.json(), y = p.data, s = (m = p.errors) == null ? void 0 : m.at(0);
2159
+ return (s == null ? void 0 : s.extensions.code) === "FORBIDDEN" ? { ok: !1, error: l(403, s.message) } : (s == null ? void 0 : s.extensions.code) === "UNAUTHORIZED" ? { ok: !1, error: l(401, s.message) } : (s == null ? void 0 : s.extensions.code) === "BAD_USER_INPUT" ? { ok: !1, error: l(400, s.message) } : (s == null ? void 0 : s.extensions.code) === "INTERNAL_SERVER_ERROR" ? { ok: !1, error: l(500, s.message) } : {
2160
+ ok: !0,
2161
+ data: y
2162
+ };
2163
+ } catch {
2164
+ return {
2165
+ ok: !1,
2166
+ error: l(500)
2167
+ };
2168
+ }
2151
2169
  }
2152
2170
  /** Single file upload */
2153
2171
  async upload(e, t) {
2154
- var w;
2172
+ var m;
2155
2173
  const a = h.createUploadBody(e, t), o = new Headers(this.options.headers);
2156
2174
  o.set("Accept", "application/json"), o.delete("Content-Type");
2157
2175
  const d = await this.runMiddlewares(
@@ -2161,14 +2179,22 @@ class h {
2161
2179
  headers: o,
2162
2180
  method: "POST"
2163
2181
  })
2164
- ), m = await fetch(d);
2165
- if (!m.ok)
2166
- return { ok: !1, error: l(m.status) };
2167
- const u = await m.json(), p = u.data, s = (w = u.errors) == null ? void 0 : w.at(0);
2168
- return (s == null ? void 0 : s.extensions.code) === "FORBIDDEN" ? { ok: !1, error: l(403) } : (s == null ? void 0 : s.extensions.code) === "UNAUTHORIZED" ? { ok: !1, error: l(401) } : (s == null ? void 0 : s.extensions.code) === "BAD_USER_INPUT" ? { ok: !1, error: l(400) } : (s == null ? void 0 : s.extensions.code) === "INTERNAL_SERVER_ERROR" ? { ok: !1, error: l(500, s.message) } : {
2169
- ok: !0,
2170
- data: p
2171
- };
2182
+ );
2183
+ try {
2184
+ const u = await fetch(d);
2185
+ if (!u.ok)
2186
+ return { ok: !1, error: l(u.status) };
2187
+ const p = await u.json(), y = p.data, s = (m = p.errors) == null ? void 0 : m.at(0);
2188
+ return (s == null ? void 0 : s.extensions.code) === "FORBIDDEN" ? { ok: !1, error: l(403) } : (s == null ? void 0 : s.extensions.code) === "UNAUTHORIZED" ? { ok: !1, error: l(401) } : (s == null ? void 0 : s.extensions.code) === "BAD_USER_INPUT" ? { ok: !1, error: l(400) } : (s == null ? void 0 : s.extensions.code) === "INTERNAL_SERVER_ERROR" ? { ok: !1, error: l(500, s.message) } : {
2189
+ ok: !0,
2190
+ data: y
2191
+ };
2192
+ } catch {
2193
+ return {
2194
+ ok: !1,
2195
+ error: l(500)
2196
+ };
2197
+ }
2172
2198
  }
2173
2199
  async runMiddlewares(e) {
2174
2200
  let t = e.clone();
@@ -2352,7 +2378,7 @@ class St {
2352
2378
  * ```
2353
2379
  */
2354
2380
  async createAccount(e) {
2355
- const t = e.id ?? g.generate(y.Account).toString(), a = await this.accountService.registerMemberAccount({
2381
+ const t = e.id ?? w.generate(g.Account).toString(), a = await this.accountService.registerMemberAccount({
2356
2382
  input: {
2357
2383
  id: t,
2358
2384
  name: e.name,
@@ -2432,7 +2458,7 @@ class St {
2432
2458
  * ```
2433
2459
  */
2434
2460
  async submitVerificationDetails(e) {
2435
- const t = e.id ?? g.generate(y.Verification).toString(), a = await this.accountService.createMemberVerification({
2461
+ const t = e.id ?? w.generate(g.Verification).toString(), a = await this.accountService.createMemberVerification({
2436
2462
  input: {
2437
2463
  id: t,
2438
2464
  ...e
@@ -2556,7 +2582,7 @@ class St {
2556
2582
  * ```
2557
2583
  */
2558
2584
  async createWithdrawal(e) {
2559
- const t = e.id ?? g.generate(y.Withdrawal).toString();
2585
+ const t = e.id ?? w.generate(g.Withdrawal).toString();
2560
2586
  if (e.type === "BANK") {
2561
2587
  const a = await this.walletService.createBankWithdrawal({
2562
2588
  input: {
@@ -2642,7 +2668,7 @@ class St {
2642
2668
  * ```
2643
2669
  */
2644
2670
  async createDeposit(e) {
2645
- const t = e.id ?? g.generate(y.Deposit).toString();
2671
+ const t = e.id ?? w.generate(g.Deposit).toString();
2646
2672
  if (e.type === "MAYA") {
2647
2673
  const a = await this.walletService.createMayaDeposit({
2648
2674
  input: {
@@ -2855,7 +2881,7 @@ class St {
2855
2881
  * ```
2856
2882
  */
2857
2883
  async createGameSession(e) {
2858
- const t = e.id ?? g.generate(y.GameSession).toString(), a = await this.gameService.createGameSession({
2884
+ const t = e.id ?? w.generate(g.GameSession).toString(), a = await this.gameService.createGameSession({
2859
2885
  input: {
2860
2886
  id: t,
2861
2887
  game: e.game
@@ -2879,7 +2905,7 @@ class St {
2879
2905
  * ```
2880
2906
  */
2881
2907
  async createGameSession__next(e) {
2882
- const t = e.id ?? g.generate(y.GameSession).toString(), a = await this.walletService.createGameSession({
2908
+ const t = e.id ?? w.generate(g.GameSession).toString(), a = await this.walletService.createGameSession({
2883
2909
  input: {
2884
2910
  id: t,
2885
2911
  game: e.game
@@ -2935,7 +2961,7 @@ class St {
2935
2961
  * ```
2936
2962
  */
2937
2963
  async uploadImageFile(e) {
2938
- const t = e.id ?? g.generate(y.File).toString(), a = await this.fileService.uploadPrivateImageFile({
2964
+ const t = e.id ?? w.generate(g.File).toString(), a = await this.fileService.uploadPrivateImageFile({
2939
2965
  input: {
2940
2966
  id: t,
2941
2967
  file: e.file
@@ -2968,7 +2994,7 @@ class St {
2968
2994
  }
2969
2995
  export {
2970
2996
  kt as ObjectId,
2971
- y as ObjectType,
2997
+ g as ObjectType,
2972
2998
  St as Sdk
2973
2999
  };
2974
3000
  //# sourceMappingURL=index.mjs.map