@opexa/portal-sdk 0.0.4 → 0.0.6

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.
Files changed (37) hide show
  1. package/dist/index.js +63 -63
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.mjs +422 -392
  4. package/dist/index.mjs.map +1 -1
  5. package/dist/sdk.d.ts +22 -1
  6. package/dist/{graphql → services}/file.service.d.ts +1 -2
  7. package/dist/{graphql → services}/transaction.d.ts +0 -1
  8. package/dist/{session-service.d.ts → session-manager.d.ts} +10 -4
  9. package/dist/transformer.d.ts +1 -1
  10. package/dist/types.d.ts +1 -6
  11. package/dist/utils/graphql-client.d.ts +3 -2
  12. package/dist/utils/http-error.d.ts +21 -1
  13. package/dist/utils/sleep.d.ts +1 -0
  14. package/package.json +2 -5
  15. /package/dist/{graphql → services}/account.service.d.ts +0 -0
  16. /package/dist/{graphql → services}/announcement.d.ts +0 -0
  17. /package/dist/{graphql → services}/auth.service.d.ts +0 -0
  18. /package/dist/{graphql → services}/bet-record.d.ts +0 -0
  19. /package/dist/{graphql → services}/bonus.d.ts +0 -0
  20. /package/dist/{graphql → services}/cashback.d.ts +0 -0
  21. /package/dist/{graphql → services}/deposit.d.ts +0 -0
  22. /package/dist/{graphql → services}/file.d.ts +0 -0
  23. /package/dist/{graphql → services}/game.d.ts +0 -0
  24. /package/dist/{graphql → services}/game.service.d.ts +0 -0
  25. /package/dist/{graphql → services}/index.d.ts +0 -0
  26. /package/dist/{graphql → services}/member.d.ts +0 -0
  27. /package/dist/{graphql → services}/platform.d.ts +0 -0
  28. /package/dist/{graphql → services}/points.d.ts +0 -0
  29. /package/dist/{graphql → services}/portal.service.d.ts +0 -0
  30. /package/dist/{graphql → services}/promo.d.ts +0 -0
  31. /package/dist/{graphql → services}/report.service.d.ts +0 -0
  32. /package/dist/{graphql → services}/session.d.ts +0 -0
  33. /package/dist/{graphql → services}/static.service.d.ts +0 -0
  34. /package/dist/{graphql → services}/types.d.ts +0 -0
  35. /package/dist/{graphql → services}/wallet.d.ts +0 -0
  36. /package/dist/{graphql → services}/wallet.service.d.ts +0 -0
  37. /package/dist/{graphql → services}/withdrawal.d.ts +0 -0
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- var we = Object.defineProperty;
2
- var ge = (i, e, t) => e in i ? we(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var c = (i, e, t) => ge(i, typeof e != "symbol" ? e + "" : e, t);
4
- import { ObjectId as w } from "@opexa/object-id";
5
- import { ObjectId as kt } from "@opexa/object-id";
6
- const g = {
1
+ var ge = Object.defineProperty;
2
+ var ye = (i, e, t) => e in i ? ge(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var d = (i, e, t) => ye(i, typeof e != "symbol" ? e + "" : e, t);
4
+ import { ObjectId as f } from "@opexa/object-id";
5
+ import { ObjectId as Ct } from "@opexa/object-id";
6
+ const w = {
7
7
  Account: 8,
8
8
  Deposit: 9,
9
9
  Withdrawal: 14,
@@ -12,15 +12,33 @@ const g = {
12
12
  GameSession: 204,
13
13
  MayaSession: 230
14
14
  };
15
+ class he {
16
+ constructor(e) {
17
+ d(this, "enabled");
18
+ this.enabled = (e == null ? void 0 : e.enabled) ?? !0;
19
+ }
20
+ info(e) {
21
+ this.enabled && console.log(`\x1B[34m[info] ${e}`);
22
+ }
23
+ warn(e) {
24
+ this.enabled && console.log(`\x1B[33m[warn] ${e}`);
25
+ }
26
+ error(e) {
27
+ this.enabled && console.log(`\x1B[31m[error] ${e}`);
28
+ }
29
+ success(e) {
30
+ this.enabled && console.log(`\x1B[32m[success] ${e}`);
31
+ }
32
+ }
15
33
  function n(i, ...e) {
16
34
  let t = "";
17
- for (const [a, o] of i.entries()) {
18
- const d = e.at(a) ?? "";
19
- t = `${t}${o}${d}`;
35
+ for (const [a, r] of i.entries()) {
36
+ const s = e.at(a) ?? "";
37
+ t = `${t}${r}${s}`;
20
38
  }
21
39
  return t.trim();
22
40
  }
23
- const ye = n`
41
+ const be = n`
24
42
  query Announcements($first: Int, $after: Cursor, $filter: AnnouncementFilterInput) {
25
43
  announcements(first: $first, after: $after, filter: $filter) {
26
44
  edges {
@@ -46,15 +64,15 @@ const ye = n`
46
64
  }
47
65
  }
48
66
  }
49
- `, b = n`
67
+ `, y = n`
50
68
  fragment GameFragment on Game {
51
69
  id
52
70
  type
53
71
  name
54
72
  provider
55
73
  }
56
- `, be = n`
57
- ${b}
74
+ `, Ae = n`
75
+ ${y}
58
76
 
59
77
  query Game($id: ObjectId!) {
60
78
  node(id: $id) {
@@ -64,7 +82,7 @@ const ye = n`
64
82
  }
65
83
  }
66
84
  `, Se = n`
67
- ${b}
85
+ ${y}
68
86
 
69
87
  query Games($after: Cursor, $first: Int, $filter: GameFilterInput) {
70
88
  games(after: $after, first: $first, filter: $filter) {
@@ -83,16 +101,16 @@ const ye = n`
83
101
  }
84
102
  }
85
103
  }
86
- `, Ae = n`
87
- ${b}
104
+ `, Ee = n`
105
+ ${y}
88
106
 
89
107
  query GamesByName($search: String!, $filter: GameFilterInput, $first: Int) {
90
108
  gamesByName(search: $search, filter: $filter, first: $first) {
91
109
  ...GameFragment
92
110
  }
93
111
  }
94
- `, Ee = n`
95
- ${b}
112
+ `, ke = n`
113
+ ${y}
96
114
 
97
115
  query GameSession($id: ObjectId!) {
98
116
  node(id: $id) {
@@ -108,7 +126,7 @@ const ye = n`
108
126
  }
109
127
  }
110
128
  }
111
- `, ke = n`
129
+ `, Ce = n`
112
130
  mutation CreateGameSession($input: CreateGameSessionInput!) {
113
131
  createGameSession(input: $input) {
114
132
  ... on GameDoesNotExistError {
@@ -117,12 +135,12 @@ const ye = n`
117
135
  }
118
136
  }
119
137
  }
120
- `, Ce = n`
138
+ `, Te = n`
121
139
  mutation EndGameSession($input: EndGameSessionInput!) {
122
140
  endGameSession(input: $input)
123
141
  }
124
- `, Te = n`
125
- ${b}
142
+ `, _e = n`
143
+ ${y}
126
144
 
127
145
  query BetRecords($first: Int, $after: Cursor, $filter: BetRecordFilterInput) {
128
146
  member {
@@ -180,16 +198,16 @@ const ye = n`
180
198
  }
181
199
  }
182
200
 
183
- ${b}
184
- `, S = n`
201
+ ${y}
202
+ `, A = n`
185
203
  fragment FileFragment on File {
186
204
  id
187
205
  url
188
206
  status
189
207
  dateTimeCreated
190
208
  }
191
- `, de = n`
192
- ${S}
209
+ `, me = n`
210
+ ${A}
193
211
 
194
212
  query File($id: ObjectId!) {
195
213
  node(id: $id) {
@@ -217,8 +235,8 @@ n`
217
235
  }
218
236
  }
219
237
  `;
220
- const pe = n`
221
- ${S}
238
+ const fe = n`
239
+ ${A}
222
240
 
223
241
  fragment CashbackFragment on Cashback {
224
242
  id
@@ -233,16 +251,16 @@ const pe = n`
233
251
  dateTimeCreated
234
252
  dateTimeLastUpdated
235
253
  }
236
- `, _e = n`
237
- ${pe}
254
+ `, De = n`
255
+ ${fe}
238
256
 
239
257
  query Cashbacks {
240
258
  cashbacks {
241
259
  ...CashbackFragment
242
260
  }
243
261
  }
244
- `, A = n`
245
- ${S}
262
+ `, E = n`
263
+ ${A}
246
264
 
247
265
  fragment PromoFragment on Promo {
248
266
  id
@@ -260,16 +278,16 @@ const pe = n`
260
278
  dateTimeCreated
261
279
  dateTimeLastUpdated
262
280
  }
263
- `, De = n`
264
- ${A}
281
+ `, Me = n`
282
+ ${E}
265
283
 
266
284
  query Promos {
267
285
  promos {
268
286
  ...PromoFragment
269
287
  }
270
288
  }
271
- `, Me = n`
272
- ${A}
289
+ `, Ne = n`
290
+ ${E}
273
291
 
274
292
  query AvailablePromos($filter: PromoFilterInput) {
275
293
  availablePromos(filter: $filter) {
@@ -277,7 +295,7 @@ const pe = n`
277
295
  }
278
296
  }
279
297
  `, Re = n`
280
- ${A}
298
+ ${E}
281
299
 
282
300
  query Bonus {
283
301
  bonus {
@@ -305,8 +323,8 @@ const pe = n`
305
323
  dateTimeLastUpdated
306
324
  }
307
325
  }
308
- `, Ne = n`
309
- ${pe}
326
+ `, Ie = n`
327
+ ${fe}
310
328
 
311
329
  query CashbackBonuses {
312
330
  cashbackBonuses {
@@ -319,7 +337,7 @@ const pe = n`
319
337
  dateTimeLastUpdated
320
338
  }
321
339
  }
322
- `, Ie = n`
340
+ `, Ge = n`
323
341
  mutation ClaimCashbackBonus($input: ClaimCashbackBonusInput!) {
324
342
  claimCashbackBonus(input: $input) {
325
343
  ... on CashbackBonusDoesNotExistError {
@@ -328,7 +346,7 @@ const pe = n`
328
346
  }
329
347
  }
330
348
  }
331
- `, Ge = n`
349
+ `, $e = n`
332
350
  query DepositRecords($after: Cursor, $first: Int, $filter: DepositRecordFilterInput) {
333
351
  member {
334
352
  depositRecords(after: $after, first: $first, filter: $filter) {
@@ -357,7 +375,7 @@ const pe = n`
357
375
  }
358
376
  }
359
377
  }
360
- `, $e = n`
378
+ `, Pe = n`
361
379
  mutation CreateGCashDeposit($input: CreateGCashDepositInput!) {
362
380
  createGCashDeposit(input: $input) {
363
381
  ... on DepositPromoMaximumAmountExceededError {
@@ -394,7 +412,7 @@ const pe = n`
394
412
  }
395
413
  }
396
414
  }
397
- `, Pe = n`
415
+ `, We = n`
398
416
  mutation CreateMayaDeposit($input: CreateMayaDepositInput!) {
399
417
  createMayaDeposit(input: $input) {
400
418
  ... on DepositPromoMaximumAmountExceededError {
@@ -431,7 +449,7 @@ const pe = n`
431
449
  }
432
450
  }
433
451
  }
434
- `, Ue = n`
452
+ `, Be = n`
435
453
  mutation CreateMayaAppDeposit($input: CreateMayaAppDepositInput!) {
436
454
  createMayaAppDeposit(input: $input) {
437
455
  ... on DepositPromoMaximumAmountExceededError {
@@ -468,7 +486,7 @@ const pe = n`
468
486
  }
469
487
  }
470
488
  }
471
- `, We = n`
489
+ `, Ue = n`
472
490
  query Deposit($id: ObjectId!) {
473
491
  node(id: $id) {
474
492
  ... on GCashDeposit {
@@ -509,13 +527,13 @@ const pe = n`
509
527
  }
510
528
  }
511
529
  }
512
- `, Be = n`
530
+ `, xe = n`
513
531
  query DepositsCount {
514
532
  member {
515
533
  depositsCount
516
534
  }
517
535
  }
518
- `, xe = n`
536
+ `, qe = n`
519
537
  query Member {
520
538
  member {
521
539
  dateTimeLastActive
@@ -544,8 +562,8 @@ const pe = n`
544
562
  }
545
563
  }
546
564
  }
547
- `, qe = n`
548
- ${S}
565
+ `, Fe = n`
566
+ ${A}
549
567
 
550
568
  query MemberVerification {
551
569
  memberAccount: self {
@@ -568,7 +586,7 @@ const pe = n`
568
586
  }
569
587
  }
570
588
  }
571
- `, Fe = n`
589
+ `, Le = n`
572
590
  mutation RegisterMemberAccount(
573
591
  $input: RegisterMemberAccountInput!
574
592
  $referralCode: String
@@ -611,7 +629,7 @@ const pe = n`
611
629
  }
612
630
  }
613
631
  }
614
- `, Le = n`
632
+ `, Ve = n`
615
633
  mutation UpdateMemberAccount($input: UpdateMemberAccountInput!) {
616
634
  updateMemberAccount(input: $input) {
617
635
  ... on AccountNameNotAvailableError {
@@ -644,7 +662,7 @@ const pe = n`
644
662
  }
645
663
  }
646
664
  }
647
- `, Ve = n`
665
+ `, He = n`
648
666
  mutation ResetPassword($input: ResetPasswordInput!, $verificationCode: String) {
649
667
  resetPassword(input: $input, verificationCode: $verificationCode) {
650
668
  ... on AccountNotFoundError {
@@ -657,11 +675,11 @@ const pe = n`
657
675
  }
658
676
  }
659
677
  }
660
- `, He = n`
678
+ `, Ye = n`
661
679
  mutation DeleteMemberAccount($input: DeleteMemberAccountInput!) {
662
680
  deleteMemberAccount(input: $input)
663
681
  }
664
- `, Ye = n`
682
+ `, je = n`
665
683
  mutation SendVerificationCode($input: SendVerificationCodeInput!) {
666
684
  sendVerificationCode(input: $input) {
667
685
  ... on InvalidPlatformError {
@@ -674,7 +692,7 @@ const pe = n`
674
692
  }
675
693
  }
676
694
  }
677
- `, je = n`
695
+ `, Qe = n`
678
696
  mutation VerifyMobileNumber($input: VerifyMobileNumberInput!) {
679
697
  verifyMobileNumber(input: $input) {
680
698
  ... on InvalidSMSVerificationCodeError {
@@ -687,7 +705,7 @@ const pe = n`
687
705
  }
688
706
  }
689
707
  }
690
- `, Qe = n`
708
+ `, Ke = n`
691
709
  mutation CreateMemberVerification($input: CreateMemberVerificationInput!) {
692
710
  createMemberVerification(input: $input) {
693
711
  ... on FileDoesNotExistError {
@@ -704,7 +722,7 @@ const pe = n`
704
722
  }
705
723
  }
706
724
  }
707
- `, Ke = n`
725
+ `, ze = n`
708
726
  mutation UpdateMemberVerification($input: UpdateMemberVerificationInput!) {
709
727
  updateMemberVerification(input: $input) {
710
728
  ... on FileDoesNotExistError {
@@ -725,7 +743,7 @@ const pe = n`
725
743
  }
726
744
  }
727
745
  }
728
- `, ze = n`
746
+ `, Je = n`
729
747
  query ProfileCompletion {
730
748
  profileCompletion {
731
749
  completionPercentage
@@ -736,7 +754,7 @@ const pe = n`
736
754
  accountPassword
737
755
  }
738
756
  }
739
- `, Je = n`
757
+ `, Ze = n`
740
758
  fragment DepositGatewaySettingsCoreData on DepositGatewaySettings {
741
759
  minimumAmount
742
760
  maximumAmount
@@ -790,7 +808,7 @@ const pe = n`
790
808
  multiplier
791
809
  }
792
810
  }
793
- `, Ze = n`
811
+ `, Xe = n`
794
812
  query PointsWallet {
795
813
  pointsWallet {
796
814
  id
@@ -799,7 +817,7 @@ const pe = n`
799
817
  dateTimeCreated
800
818
  }
801
819
  }
802
- `, Xe = n`
820
+ `, et = n`
803
821
  mutation PointsToCashConversion($input: PointsToCashConversionInput!) {
804
822
  pointsToCashConversion(input: $input) {
805
823
  ... on InsufficientPointsError {
@@ -808,7 +826,7 @@ const pe = n`
808
826
  }
809
827
  }
810
828
  }
811
- `, et = n`
829
+ `, tt = n`
812
830
  query TransactionRecords($first: Int, $after: Cursor, $filter: TransactionRecordFilter) {
813
831
  member {
814
832
  transactionRecords(first: $first, after: $after, filter: $filter) {
@@ -834,7 +852,7 @@ const pe = n`
834
852
  }
835
853
  }
836
854
  }
837
- `, tt = n`
855
+ `, at = n`
838
856
  query Wallet {
839
857
  wallet {
840
858
  id
@@ -844,7 +862,7 @@ const pe = n`
844
862
  dateTimeLastUpdated
845
863
  }
846
864
  }
847
- `, at = n`
865
+ `, rt = n`
848
866
  query WithdrawalRecords($first: Int, $after: Cursor, $filter: WithdrawalRecordFilterInput) {
849
867
  member {
850
868
  withdrawalRecords(first: $first, after: $after, filter: $filter) {
@@ -911,7 +929,7 @@ const pe = n`
911
929
  }
912
930
  }
913
931
  }
914
- `, rt = n`
932
+ `, ot = n`
915
933
  mutation CreateGCashWithdrawal($input: CreateGCashWithdrawalInput!) {
916
934
  createGCashWithdrawal(input: $input) {
917
935
  ... on AccountNotVerifiedError {
@@ -940,7 +958,7 @@ const pe = n`
940
958
  }
941
959
  }
942
960
  }
943
- `, ot = n`
961
+ `, nt = n`
944
962
  mutation CreateMayaWithdrawal($input: CreateMayaWithdrawalInput!) {
945
963
  createMayaWithdrawal(input: $input) {
946
964
  ... on AccountNotVerifiedError {
@@ -969,7 +987,7 @@ const pe = n`
969
987
  }
970
988
  }
971
989
  }
972
- `, nt = n`
990
+ `, it = n`
973
991
  mutation CreateMayaAppWithdrawal($input: CreateMayaAppWithdrawalInput!) {
974
992
  createMayaAppWithdrawal(input: $input) {
975
993
  ... on AccountNotVerifiedError {
@@ -994,7 +1012,7 @@ const pe = n`
994
1012
  }
995
1013
  }
996
1014
  }
997
- `, it = n`
1015
+ `, st = n`
998
1016
  mutation CreateBankWithdrawal($input: CreateBankWithdrawalInput!) {
999
1017
  createBankWithdrawal(input: $input) {
1000
1018
  ... on MobileNumberNotVerifiedError {
@@ -1023,14 +1041,14 @@ const pe = n`
1023
1041
  }
1024
1042
  }
1025
1043
  }
1026
- `, st = n`
1044
+ `, dt = n`
1027
1045
  query RemainingDailyWithdrawalsCount {
1028
1046
  remainingDailyWithdrawalsCount
1029
1047
  }
1030
1048
  `;
1031
- class dt {
1049
+ class mt {
1032
1050
  constructor(e) {
1033
- c(this, "client");
1051
+ d(this, "client");
1034
1052
  this.client = e;
1035
1053
  }
1036
1054
  /** aka `Query.self` */
@@ -1043,7 +1061,7 @@ class dt {
1043
1061
  }
1044
1062
  async registerMemberAccount(e) {
1045
1063
  const t = await this.client.request(
1046
- Fe,
1064
+ Le,
1047
1065
  e
1048
1066
  );
1049
1067
  return t.ok ? t.data.registerMemberAccount ? {
@@ -1055,7 +1073,7 @@ class dt {
1055
1073
  }
1056
1074
  async updateMemberAccount(e) {
1057
1075
  const t = await this.client.request(
1058
- Le,
1076
+ Ve,
1059
1077
  e
1060
1078
  );
1061
1079
  return t.ok ? t.data.updateMemberAccount ? {
@@ -1067,7 +1085,7 @@ class dt {
1067
1085
  }
1068
1086
  async deleteMemberAccount(e) {
1069
1087
  const t = await this.client.request(
1070
- He,
1088
+ Ye,
1071
1089
  e
1072
1090
  );
1073
1091
  return t.ok ? t.data.deleteMemberAccount ? {
@@ -1082,7 +1100,7 @@ class dt {
1082
1100
  }
1083
1101
  async resetPassword(e) {
1084
1102
  const t = await this.client.request(
1085
- Ve,
1103
+ He,
1086
1104
  e
1087
1105
  );
1088
1106
  return t.ok ? t.data.resetPassword ? {
@@ -1093,15 +1111,15 @@ class dt {
1093
1111
  } : t;
1094
1112
  }
1095
1113
  async profileCompletion() {
1096
- const e = await this.client.request(ze);
1114
+ const e = await this.client.request(Je);
1097
1115
  return e.ok ? { ok: !0, data: e.data.profileCompletion } : e;
1098
1116
  }
1099
1117
  async platform() {
1100
- return await this.client.request(Je);
1118
+ return await this.client.request(Ze);
1101
1119
  }
1102
1120
  async sendVerificationCode(e) {
1103
1121
  const t = await this.client.request(
1104
- Ye,
1122
+ je,
1105
1123
  e
1106
1124
  );
1107
1125
  return t.ok ? t.data.sendVerificationCode ? {
@@ -1113,7 +1131,7 @@ class dt {
1113
1131
  }
1114
1132
  async verifyMobileNumber(e) {
1115
1133
  const t = await this.client.request(
1116
- je,
1134
+ Qe,
1117
1135
  e
1118
1136
  );
1119
1137
  return t.ok ? t.data.verifyMobileNumber ? {
@@ -1125,7 +1143,7 @@ class dt {
1125
1143
  }
1126
1144
  async createMemberVerification(e) {
1127
1145
  const t = await this.client.request(
1128
- Qe,
1146
+ Ke,
1129
1147
  e
1130
1148
  );
1131
1149
  return t.ok ? t.data.createMemberVerification ? {
@@ -1137,7 +1155,7 @@ class dt {
1137
1155
  }
1138
1156
  async updateMemberVerification(e) {
1139
1157
  const t = await this.client.request(
1140
- Ke,
1158
+ ze,
1141
1159
  e
1142
1160
  );
1143
1161
  return t.ok ? t.data.updateMemberVerification ? {
@@ -1148,28 +1166,28 @@ class dt {
1148
1166
  } : t;
1149
1167
  }
1150
1168
  async memberVerification() {
1151
- const e = await this.client.request(qe);
1169
+ const e = await this.client.request(Fe);
1152
1170
  return e.ok ? {
1153
1171
  ok: !0,
1154
1172
  data: e.data.memberAccount.verification
1155
1173
  } : e;
1156
1174
  }
1157
1175
  async announcements(e) {
1158
- const t = await this.client.request(ye, e);
1176
+ const t = await this.client.request(be, e);
1159
1177
  return t.ok ? {
1160
1178
  ok: !0,
1161
1179
  data: t.data.announcements
1162
1180
  } : t;
1163
1181
  }
1164
1182
  }
1165
- function l(i, e) {
1166
- const t = ct[i];
1183
+ function h(i, e) {
1184
+ const t = S[i] ? S[i] : S[500];
1167
1185
  return {
1168
1186
  code: t.code,
1169
1187
  message: e ?? t.message
1170
1188
  };
1171
1189
  }
1172
- const ct = {
1190
+ const S = {
1173
1191
  400: {
1174
1192
  code: "HttpBadRequest",
1175
1193
  message: "Bad Request"
@@ -1198,37 +1216,45 @@ const ct = {
1198
1216
  code: "HttpInternalServerError",
1199
1217
  message: "Internal Server Error"
1200
1218
  },
1219
+ 502: {
1220
+ code: "HttpBadGateway",
1221
+ message: "Bad Gateway"
1222
+ },
1201
1223
  503: {
1202
1224
  code: "HttpServiceUnavailable",
1203
1225
  message: "Service Unavailable"
1226
+ },
1227
+ 504: {
1228
+ code: "HttpGatewayTimeout",
1229
+ message: "Gateway Timeout"
1204
1230
  }
1205
1231
  };
1206
- async function f(i) {
1232
+ async function p(i) {
1207
1233
  const e = new TextEncoder().encode(i), t = await crypto.subtle.digest("SHA-256", e);
1208
- return Array.from(new Uint8Array(t)).map((d) => d.toString(16).padStart(2, "0")).join("");
1234
+ return Array.from(new Uint8Array(t)).map((s) => s.toString(16).padStart(2, "0")).join("");
1209
1235
  }
1210
- class mt {
1236
+ class ct {
1211
1237
  constructor(e) {
1212
- c(this, "url");
1213
- c(this, "platform");
1238
+ d(this, "url");
1239
+ d(this, "platform");
1214
1240
  this.url = e.url, this.platform = e.platform;
1215
1241
  }
1216
1242
  async createSession(e) {
1217
1243
  const t = new Headers();
1218
1244
  if (t.set("Content-Type", "application/json"), t.set("Platform-Code", this.platform), t.set("Role", "MEMBER"), "name" in e) {
1219
- const a = `${e.name}:${await f(e.password)}`, o = Buffer.from(a).toString("base64");
1220
- t.set("Authorization", `Basic ${o}`);
1245
+ const a = `${e.name}:${await p(e.password)}`, r = Buffer.from(a).toString("base64");
1246
+ t.set("Authorization", `Basic ${r}`);
1221
1247
  }
1222
1248
  if ("mobileNumber" in e) {
1223
- const a = `${e.mobileNumber}:${e.verificationCode}`, o = Buffer.from(a).toString("base64");
1224
- t.set("Authorization", `Basic ${o}`);
1249
+ const a = `${e.mobileNumber}:${e.verificationCode}`, r = Buffer.from(a).toString("base64");
1250
+ t.set("Authorization", `Basic ${r}`);
1225
1251
  }
1226
1252
  try {
1227
1253
  const a = await fetch(`${this.url}/sessions`, {
1228
1254
  method: "POST",
1229
1255
  headers: t
1230
- }), o = await a.json();
1231
- return a.status === 401 || a.status === 403 ? o.code === "ACCOUNT_BLACKLISTED" ? {
1256
+ }), r = await a.json();
1257
+ return a.status === 401 || a.status === 403 ? r.code === "ACCOUNT_BLACKLISTED" ? {
1232
1258
  ok: !1,
1233
1259
  error: {
1234
1260
  code: "AccountBlacklisted",
@@ -1242,10 +1268,10 @@ class mt {
1242
1268
  }
1243
1269
  } : a.ok ? {
1244
1270
  ok: !0,
1245
- data: o
1271
+ data: r
1246
1272
  } : {
1247
1273
  ok: !1,
1248
- error: l(a.status)
1274
+ error: h(a.status)
1249
1275
  };
1250
1276
  } catch {
1251
1277
  return {
@@ -1285,7 +1311,7 @@ class mt {
1285
1311
  data: a
1286
1312
  } : {
1287
1313
  ok: !1,
1288
- error: l(t.status)
1314
+ error: h(t.status)
1289
1315
  };
1290
1316
  } catch {
1291
1317
  return {
@@ -1310,7 +1336,7 @@ class mt {
1310
1336
  });
1311
1337
  return t.ok ? { ok: !0 } : {
1312
1338
  ok: !1,
1313
- error: l(t.status)
1339
+ error: h(t.status)
1314
1340
  };
1315
1341
  } catch {
1316
1342
  return {
@@ -1341,18 +1367,18 @@ class mt {
1341
1367
  }
1342
1368
  class ut {
1343
1369
  constructor(e) {
1344
- c(this, "client");
1370
+ d(this, "client");
1345
1371
  this.client = e;
1346
1372
  }
1347
1373
  async file(e) {
1348
- const t = await this.client.request(de, e);
1374
+ const t = await this.client.request(me, e);
1349
1375
  return t.ok ? {
1350
1376
  ok: !0,
1351
1377
  data: t.data.node
1352
1378
  } : t;
1353
1379
  }
1354
1380
  async uploadPrivateImageFile(e) {
1355
- const t = await this.client.upload(de, e);
1381
+ const t = await this.client.upload(me, e);
1356
1382
  return t.ok ? t.data.uploadPrivateImageFile ? {
1357
1383
  ok: !1,
1358
1384
  error: t.data.uploadPrivateImageFile
@@ -1361,13 +1387,13 @@ class ut {
1361
1387
  } : t;
1362
1388
  }
1363
1389
  }
1364
- class fe {
1390
+ class we {
1365
1391
  constructor(e) {
1366
- c(this, "client");
1392
+ d(this, "client");
1367
1393
  this.client = e;
1368
1394
  }
1369
1395
  async game(e) {
1370
- const t = await this.client.request(be, e);
1396
+ const t = await this.client.request(Ae, e);
1371
1397
  return t.ok ? { ok: !0, data: t.data.node } : t;
1372
1398
  }
1373
1399
  async games(e) {
@@ -1375,16 +1401,16 @@ class fe {
1375
1401
  return t.ok ? { ok: !0, data: t.data.games } : t;
1376
1402
  }
1377
1403
  async gamesByName(e) {
1378
- const t = await this.client.request(Ae, e);
1404
+ const t = await this.client.request(Ee, e);
1379
1405
  return t.ok ? { ok: !0, data: t.data.gamesByName } : t;
1380
1406
  }
1381
1407
  async gameSession(e) {
1382
- const t = await this.client.request(Ee, e);
1408
+ const t = await this.client.request(ke, e);
1383
1409
  return t.ok ? { ok: !0, data: t.data.node } : t;
1384
1410
  }
1385
1411
  async createGameSession(e) {
1386
1412
  const t = await this.client.request(
1387
- ke,
1413
+ Ce,
1388
1414
  e
1389
1415
  );
1390
1416
  return t.ok ? t.data.createGameSession ? {
@@ -1396,7 +1422,7 @@ class fe {
1396
1422
  }
1397
1423
  async endGameSession(e) {
1398
1424
  const t = await this.client.request(
1399
- Ce,
1425
+ Te,
1400
1426
  e
1401
1427
  );
1402
1428
  return t.ok ? t.data.endGameSession ? {
@@ -1412,43 +1438,43 @@ class fe {
1412
1438
  }
1413
1439
  class lt {
1414
1440
  constructor(e) {
1415
- c(this, "client");
1441
+ d(this, "client");
1416
1442
  this.client = e;
1417
1443
  }
1418
1444
  async betRecords(e) {
1419
- const t = await this.client.request(Te, e);
1445
+ const t = await this.client.request(_e, e);
1420
1446
  return t.ok ? { ok: t.ok, data: t.data.member.betRecords } : t;
1421
1447
  }
1422
1448
  async transactionRecords(e) {
1423
1449
  const t = await this.client.request(
1424
- et,
1450
+ tt,
1425
1451
  e
1426
1452
  );
1427
1453
  return t.ok ? { ok: t.ok, data: t.data.member.transactionRecords } : t;
1428
1454
  }
1429
1455
  async withdrawalRecords(e) {
1430
1456
  const t = await this.client.request(
1431
- at,
1457
+ rt,
1432
1458
  e
1433
1459
  );
1434
1460
  return t.ok ? { ok: t.ok, data: t.data.member.withdrawalRecords } : t;
1435
1461
  }
1436
1462
  async depositRecords(e) {
1437
- const t = await this.client.request(Ge, e);
1463
+ const t = await this.client.request($e, e);
1438
1464
  return t.ok ? { ok: t.ok, data: t.data.member.depositRecords } : t;
1439
1465
  }
1440
1466
  async depositsCount() {
1441
- const e = await this.client.request(Be);
1467
+ const e = await this.client.request(xe);
1442
1468
  return e.ok ? { ok: e.ok, data: e.data.member.depositsCount } : e;
1443
1469
  }
1444
1470
  async member() {
1445
- const e = await this.client.request(xe);
1471
+ const e = await this.client.request(qe);
1446
1472
  return e.ok ? { ok: e.ok, data: e.data.member } : e;
1447
1473
  }
1448
1474
  }
1449
1475
  class pt {
1450
1476
  constructor(e) {
1451
- c(this, "url");
1477
+ d(this, "url");
1452
1478
  this.url = e.url;
1453
1479
  }
1454
1480
  gameThumbnails(e) {
@@ -1458,26 +1484,26 @@ class pt {
1458
1484
  ];
1459
1485
  }
1460
1486
  }
1461
- class ft extends fe {
1487
+ class ht extends we {
1462
1488
  async promos() {
1463
- const e = await this.client.request(De);
1489
+ const e = await this.client.request(Me);
1464
1490
  return e.ok ? { ok: e.ok, data: e.data.promos } : e;
1465
1491
  }
1466
1492
  async cashbacks() {
1467
- const e = await this.client.request(_e);
1493
+ const e = await this.client.request(De);
1468
1494
  return e.ok ? { ok: e.ok, data: e.data.cashbacks } : e;
1469
1495
  }
1470
1496
  async availablePromos(e) {
1471
- const t = await this.client.request(Me, e);
1497
+ const t = await this.client.request(Ne, e);
1472
1498
  return t.ok ? { ok: t.ok, data: t.data.availablePromos } : t;
1473
1499
  }
1474
1500
  async cashbackBonuses() {
1475
- const e = await this.client.request(Ne);
1501
+ const e = await this.client.request(Ie);
1476
1502
  return e.ok ? { ok: e.ok, data: e.data.cashbackBonuses } : e;
1477
1503
  }
1478
1504
  async claimCashbackBonus(e) {
1479
1505
  const t = await this.client.request(
1480
- Ie,
1506
+ Ge,
1481
1507
  e
1482
1508
  );
1483
1509
  return t.ok ? t.data.claimCashbackBonus ? {
@@ -1495,16 +1521,16 @@ class ft extends fe {
1495
1521
  return e.ok ? { ok: e.ok, data: e.data.bonus } : e;
1496
1522
  }
1497
1523
  async wallet() {
1498
- const e = await this.client.request(tt);
1524
+ const e = await this.client.request(at);
1499
1525
  return e.ok ? { ok: e.ok, data: e.data.wallet } : e;
1500
1526
  }
1501
1527
  async deposit(e) {
1502
- const t = await this.client.request(We, e);
1528
+ const t = await this.client.request(Ue, e);
1503
1529
  return t.ok ? { ok: t.ok, data: t.data.node } : t;
1504
1530
  }
1505
1531
  async createGCashDeposit(e) {
1506
1532
  const t = await this.client.request(
1507
- $e,
1533
+ Pe,
1508
1534
  e
1509
1535
  );
1510
1536
  return t.ok ? t.data.createGCashDeposit ? {
@@ -1516,7 +1542,7 @@ class ft extends fe {
1516
1542
  }
1517
1543
  async createMayaDeposit(e) {
1518
1544
  const t = await this.client.request(
1519
- Pe,
1545
+ We,
1520
1546
  e
1521
1547
  );
1522
1548
  return t.ok ? t.data.createMayaDeposit ? {
@@ -1528,7 +1554,7 @@ class ft extends fe {
1528
1554
  }
1529
1555
  async createMayaAppDeposit(e) {
1530
1556
  const t = await this.client.request(
1531
- Ue,
1557
+ Be,
1532
1558
  e
1533
1559
  );
1534
1560
  return t.ok ? t.data.createMayaAppDeposit ? {
@@ -1540,7 +1566,7 @@ class ft extends fe {
1540
1566
  }
1541
1567
  async createGCashWithdrawal(e) {
1542
1568
  const t = await this.client.request(
1543
- rt,
1569
+ ot,
1544
1570
  e
1545
1571
  );
1546
1572
  return t.ok ? t.data.createGCashWithdrawal ? {
@@ -1552,7 +1578,7 @@ class ft extends fe {
1552
1578
  }
1553
1579
  async createMayaWithdrawal(e) {
1554
1580
  const t = await this.client.request(
1555
- ot,
1581
+ nt,
1556
1582
  e
1557
1583
  );
1558
1584
  return t.ok ? t.data.createMayaWithdrawal ? {
@@ -1564,7 +1590,7 @@ class ft extends fe {
1564
1590
  }
1565
1591
  async createMayaAppWithdrawal(e) {
1566
1592
  const t = await this.client.request(
1567
- nt,
1593
+ it,
1568
1594
  e
1569
1595
  );
1570
1596
  return t.ok ? t.data.createMayaAppWithdrawal ? {
@@ -1576,7 +1602,7 @@ class ft extends fe {
1576
1602
  }
1577
1603
  async createBankWithdrawal(e) {
1578
1604
  const t = await this.client.request(
1579
- it,
1605
+ st,
1580
1606
  e
1581
1607
  );
1582
1608
  return t.ok ? t.data.createBankWithdrawal ? {
@@ -1588,17 +1614,17 @@ class ft extends fe {
1588
1614
  }
1589
1615
  async remainingDailyWithdrawalsCount() {
1590
1616
  const e = await this.client.request(
1591
- st
1617
+ dt
1592
1618
  );
1593
1619
  return e.ok ? { ok: e.ok, data: e.data.remainingDailyWithdrawalsCount } : e;
1594
1620
  }
1595
1621
  async pointsWallet() {
1596
- const e = await this.client.request(Ze);
1622
+ const e = await this.client.request(Xe);
1597
1623
  return e.ok ? { ok: e.ok, data: e.data.pointsWallet } : e;
1598
1624
  }
1599
1625
  async pointsToCashConversion(e) {
1600
1626
  const t = await this.client.request(
1601
- Xe,
1627
+ et,
1602
1628
  e
1603
1629
  );
1604
1630
  return t.ok ? t.data.pointsToCashConversion ? {
@@ -1609,9 +1635,9 @@ class ft extends fe {
1609
1635
  } : t;
1610
1636
  }
1611
1637
  }
1612
- class ht {
1638
+ class ft {
1613
1639
  constructor(e) {
1614
- c(this, "client");
1640
+ d(this, "client");
1615
1641
  this.client = e;
1616
1642
  }
1617
1643
  async latestBetRecords() {
@@ -1622,48 +1648,44 @@ class ht {
1622
1648
  } : e;
1623
1649
  }
1624
1650
  }
1625
- class he {
1626
- constructor(e) {
1627
- c(this, "enabled");
1628
- this.enabled = (e == null ? void 0 : e.enabled) ?? !0;
1629
- }
1630
- info(e) {
1631
- this.enabled && console.log(`\x1B[34m[info] ${e}`);
1632
- }
1633
- warn(e) {
1634
- this.enabled && console.log(`\x1B[33m[warn] ${e}`);
1635
- }
1636
- error(e) {
1637
- this.enabled && console.log(`\x1B[31m[error] ${e}`);
1638
- }
1639
- success(e) {
1640
- this.enabled && console.log(`\x1B[32m[success] ${e}`);
1641
- }
1642
- }
1643
- function E(i) {
1651
+ function k(i) {
1644
1652
  return new Date(i.getTime());
1645
1653
  }
1646
1654
  function ce(i, e) {
1647
- const t = E(i);
1655
+ const t = k(i);
1648
1656
  return t.setDate(t.getDate() + e), t;
1649
1657
  }
1650
- function me(i, e) {
1651
- const t = E(i);
1658
+ function ue(i, e) {
1659
+ const t = k(i);
1652
1660
  return t.setMinutes(t.getMinutes() + e), t;
1653
1661
  }
1654
- function ue(i, e) {
1662
+ function le(i, e) {
1655
1663
  return i.getTime() > e.getTime();
1656
1664
  }
1657
- function le(i, e) {
1658
- const t = E(i);
1665
+ function wt(i) {
1666
+ return new Promise((e) => {
1667
+ setTimeout(e, i);
1668
+ });
1669
+ }
1670
+ function pe(i, e) {
1671
+ const t = k(i);
1659
1672
  return t.setMinutes(t.getMinutes() - e), t;
1660
1673
  }
1661
- class wt {
1674
+ class gt {
1662
1675
  constructor(e) {
1663
- c(this, "logger");
1664
- c(this, "storageKey", "session");
1665
- c(this, "authService");
1666
- this.logger = new he(), this.authService = new mt(e);
1676
+ d(this, "logger");
1677
+ d(this, "storageKey", "session");
1678
+ d(this, "authService");
1679
+ d(this, "_refreshing", !1);
1680
+ this.authService = new ct(e), this.logger = new he({
1681
+ enabled: e.log ?? !1
1682
+ });
1683
+ }
1684
+ get refreshing() {
1685
+ return this._refreshing;
1686
+ }
1687
+ set refreshing(e) {
1688
+ this._refreshing = e;
1667
1689
  }
1668
1690
  async create(e) {
1669
1691
  const t = await this.authService.createSession(e);
@@ -1673,19 +1695,21 @@ class wt {
1673
1695
  this.storageKey,
1674
1696
  JSON.stringify({
1675
1697
  ...t.data,
1676
- accessTokenExpiresAt: me(a, 8).getTime(),
1677
- refreshTokenExpiresAt: le(ce(a, 30), 2).getTime()
1698
+ accessTokenExpiresAt: ue(a, 8).getTime(),
1699
+ refreshTokenExpiresAt: pe(ce(a, 30), 2).getTime()
1678
1700
  })
1679
1701
  ), { ok: !0 };
1680
1702
  } else
1681
1703
  return t;
1682
1704
  }
1683
- async session() {
1705
+ async get() {
1684
1706
  if (this.isServer)
1685
1707
  return this.logger.warn("'localStorage' is not available on the server."), {
1686
1708
  ok: !0,
1687
1709
  data: null
1688
1710
  };
1711
+ if (this.refreshing)
1712
+ return await wt(1e3), await this.get();
1689
1713
  const e = window.localStorage.getItem(this.storageKey);
1690
1714
  if (!e)
1691
1715
  return {
@@ -1694,8 +1718,8 @@ class wt {
1694
1718
  };
1695
1719
  try {
1696
1720
  let t = JSON.parse(e), a = /* @__PURE__ */ new Date();
1697
- const o = new Date(t.accessTokenExpiresAt), d = new Date(t.refreshTokenExpiresAt);
1698
- if (ue(a, d))
1721
+ const r = new Date(t.accessTokenExpiresAt), s = new Date(t.refreshTokenExpiresAt);
1722
+ if (le(a, s))
1699
1723
  return this.logger.warn("Session expired. Logging out.."), window.localStorage.removeItem(this.storageKey), {
1700
1724
  ok: !1,
1701
1725
  error: {
@@ -1703,9 +1727,10 @@ class wt {
1703
1727
  message: "Session expired."
1704
1728
  }
1705
1729
  };
1706
- if (ue(a, o)) {
1730
+ if (le(a, r)) {
1731
+ this.logger.info("Refreshing session..."), this.refreshing = !0;
1707
1732
  const m = await this.authService.refreshSession(t.refreshToken);
1708
- if (this.logger.info("Refreshing session..."), !m.ok)
1733
+ if (this.refreshing = !1, !m.ok)
1709
1734
  return this.logger.error(`Failed to refresh session: ${m.error.message}`), m.error.code === "InvalidToken" || m.error.code === "AccountBlacklisted" ? (window.localStorage.removeItem(this.storageKey), {
1710
1735
  ok: !1,
1711
1736
  error: m.error
@@ -1716,8 +1741,8 @@ class wt {
1716
1741
  this.logger.success("Session refreshed!"), a = /* @__PURE__ */ new Date(), t = {
1717
1742
  ...t,
1718
1743
  ...m.data,
1719
- accessTokenExpiresAt: me(a, 8).getTime(),
1720
- refreshTokenExpiresAt: le(ce(a, 30), 2).getTime()
1744
+ accessTokenExpiresAt: ue(a, 8).getTime(),
1745
+ refreshTokenExpiresAt: pe(ce(a, 30), 2).getTime()
1721
1746
  }, window.localStorage.setItem(this.storageKey, JSON.stringify(t));
1722
1747
  }
1723
1748
  return {
@@ -1740,15 +1765,15 @@ class wt {
1740
1765
  this.logger.warn("'localStorage' is not available on the server.");
1741
1766
  return;
1742
1767
  }
1743
- const e = await this.session();
1768
+ const e = await this.get();
1744
1769
  (t = e.data) != null && t.accessToken && await this.authService.destroySession(e.data.accessToken), window.localStorage.removeItem(this.storageKey);
1745
1770
  }
1746
1771
  async verify() {
1747
- var a, o, d;
1772
+ var a, r, s;
1748
1773
  if (this.isServer)
1749
1774
  return this.logger.warn("'localStorage' is not available on the server."), !0;
1750
- const e = await this.session();
1751
- if (((a = e.error) == null ? void 0 : a.code) === "InvalidToken" || ((o = e.error) == null ? void 0 : o.code) === "SessionExpired" || ((d = e.error) == null ? void 0 : d.code) === "AccountBlacklisted") return !1;
1775
+ const e = await this.get();
1776
+ if (((a = e.error) == null ? void 0 : a.code) === "InvalidToken" || ((r = e.error) == null ? void 0 : r.code) === "SessionExpired" || ((s = e.error) == null ? void 0 : s.code) === "AccountBlacklisted") return !1;
1752
1777
  if (!e.data) return !0;
1753
1778
  const t = await this.authService.verifySession(e.data.accessToken);
1754
1779
  return t || window.localStorage.removeItem(this.storageKey), t;
@@ -1757,7 +1782,7 @@ class wt {
1757
1782
  return typeof window > "u";
1758
1783
  }
1759
1784
  }
1760
- function r(i, e) {
1785
+ function o(i, e) {
1761
1786
  if (typeof i == "number" && !Number.isNaN(i))
1762
1787
  return i;
1763
1788
  if (typeof i == "string") {
@@ -1767,9 +1792,9 @@ function r(i, e) {
1767
1792
  }
1768
1793
  return e;
1769
1794
  }
1770
- class gt {
1795
+ class yt {
1771
1796
  constructor(e) {
1772
- c(this, "staticService");
1797
+ d(this, "staticService");
1773
1798
  const t = (e == null ? void 0 : e.environment) === "development";
1774
1799
  this.staticService = new pt({
1775
1800
  url: t ? "https://static.development.opexa.io/graphql" : "https://static.opexa.io/graphql"
@@ -1800,88 +1825,88 @@ class gt {
1800
1825
  };
1801
1826
  }
1802
1827
  platform(e) {
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;
1828
+ var t, a, r, s, m, c, l, b, u, C, T, _, v, D, M, N, R, I, G, $, P, W, B, U, x, q, O, F, L, V, H, Y, j, Q, K, z, J, Z, X, ee, te, ae, re, oe, ne, ie, se, de;
1804
1829
  return {
1805
1830
  paymentSettings: {
1806
- minimumFirstDepositAmount: r(e.minimumFirstDepositAmount),
1831
+ minimumFirstDepositAmount: o(e.minimumFirstDepositAmount),
1807
1832
  restrictWithdrawalsToVerifiedMembers: e.restrictWithdrawalsToVerifiedMembers,
1808
1833
  depositGateway: {
1809
1834
  bank: {
1810
1835
  androidEnabled: ((t = e.bankDepositGatewaySettings) == null ? void 0 : t.androidEnabled) ?? !1,
1811
1836
  iosEnabled: ((a = e.bankDepositGatewaySettings) == null ? void 0 : a.iosEnabled) ?? !1,
1812
- webEnabled: ((o = e.bankDepositGatewaySettings) == null ? void 0 : o.webEnabled) ?? !1,
1813
- mobileWebEnabled: ((d = e.bankDepositGatewaySettings) == null ? void 0 : d.mobileWebEnabled) ?? !1,
1814
- minimumAmount: r((m = e.bankDepositGatewaySettings) == null ? void 0 : m.minimumAmount),
1815
- maximumAmount: r((u = e.bankDepositGatewaySettings) == null ? void 0 : u.maximumAmount)
1837
+ webEnabled: ((r = e.bankDepositGatewaySettings) == null ? void 0 : r.webEnabled) ?? !1,
1838
+ mobileWebEnabled: ((s = e.bankDepositGatewaySettings) == null ? void 0 : s.mobileWebEnabled) ?? !1,
1839
+ minimumAmount: o((m = e.bankDepositGatewaySettings) == null ? void 0 : m.minimumAmount),
1840
+ maximumAmount: o((c = e.bankDepositGatewaySettings) == null ? void 0 : c.maximumAmount)
1816
1841
  },
1817
1842
  gcash: {
1818
- androidEnabled: ((p = e.gcashDepositGatewaySettings) == null ? void 0 : p.androidEnabled) ?? !1,
1819
- iosEnabled: ((y = e.gcashDepositGatewaySettings) == null ? void 0 : y.iosEnabled) ?? !1,
1820
- webEnabled: ((s = e.gcashDepositGatewaySettings) == null ? void 0 : s.webEnabled) ?? !1,
1821
- mobileWebEnabled: ((k = e.gcashDepositGatewaySettings) == null ? void 0 : k.mobileWebEnabled) ?? !1,
1822
- minimumAmount: r((C = e.gcashDepositGatewaySettings) == null ? void 0 : C.minimumAmount),
1823
- maximumAmount: r((T = e.gcashDepositGatewaySettings) == null ? void 0 : T.maximumAmount)
1843
+ androidEnabled: ((l = e.gcashDepositGatewaySettings) == null ? void 0 : l.androidEnabled) ?? !1,
1844
+ iosEnabled: ((b = e.gcashDepositGatewaySettings) == null ? void 0 : b.iosEnabled) ?? !1,
1845
+ webEnabled: ((u = e.gcashDepositGatewaySettings) == null ? void 0 : u.webEnabled) ?? !1,
1846
+ mobileWebEnabled: ((C = e.gcashDepositGatewaySettings) == null ? void 0 : C.mobileWebEnabled) ?? !1,
1847
+ minimumAmount: o((T = e.gcashDepositGatewaySettings) == null ? void 0 : T.minimumAmount),
1848
+ maximumAmount: o((_ = e.gcashDepositGatewaySettings) == null ? void 0 : _.maximumAmount)
1824
1849
  },
1825
1850
  maya: {
1826
1851
  androidEnabled: ((v = e.mayaDepositGatewaySettings) == null ? void 0 : v.androidEnabled) ?? !1,
1827
- iosEnabled: ((_ = e.mayaDepositGatewaySettings) == null ? void 0 : _.iosEnabled) ?? !1,
1828
- webEnabled: ((D = e.mayaDepositGatewaySettings) == null ? void 0 : D.webEnabled) ?? !1,
1829
- mobileWebEnabled: ((M = e.mayaDepositGatewaySettings) == null ? void 0 : M.mobileWebEnabled) ?? !1,
1830
- minimumAmount: r((R = e.mayaDepositGatewaySettings) == null ? void 0 : R.minimumAmount),
1831
- maximumAmount: r((N = e.mayaDepositGatewaySettings) == null ? void 0 : N.maximumAmount)
1852
+ iosEnabled: ((D = e.mayaDepositGatewaySettings) == null ? void 0 : D.iosEnabled) ?? !1,
1853
+ webEnabled: ((M = e.mayaDepositGatewaySettings) == null ? void 0 : M.webEnabled) ?? !1,
1854
+ mobileWebEnabled: ((N = e.mayaDepositGatewaySettings) == null ? void 0 : N.mobileWebEnabled) ?? !1,
1855
+ minimumAmount: o((R = e.mayaDepositGatewaySettings) == null ? void 0 : R.minimumAmount),
1856
+ maximumAmount: o((I = e.mayaDepositGatewaySettings) == null ? void 0 : I.maximumAmount)
1832
1857
  },
1833
1858
  mayaApp: {
1834
- androidEnabled: ((I = e.mayaAppDepositGatewaySettings) == null ? void 0 : I.androidEnabled) ?? !1,
1835
- iosEnabled: ((G = e.mayaAppDepositGatewaySettings) == null ? void 0 : G.iosEnabled) ?? !1,
1836
- webEnabled: (($ = e.mayaAppDepositGatewaySettings) == null ? void 0 : $.webEnabled) ?? !1,
1837
- mobileWebEnabled: ((P = e.mayaAppDepositGatewaySettings) == null ? void 0 : P.mobileWebEnabled) ?? !1,
1838
- minimumAmount: r((U = e.mayaAppDepositGatewaySettings) == null ? void 0 : U.minimumAmount),
1839
- maximumAmount: r((W = e.mayaAppDepositGatewaySettings) == null ? void 0 : W.maximumAmount)
1859
+ androidEnabled: ((G = e.mayaAppDepositGatewaySettings) == null ? void 0 : G.androidEnabled) ?? !1,
1860
+ iosEnabled: (($ = e.mayaAppDepositGatewaySettings) == null ? void 0 : $.iosEnabled) ?? !1,
1861
+ webEnabled: ((P = e.mayaAppDepositGatewaySettings) == null ? void 0 : P.webEnabled) ?? !1,
1862
+ mobileWebEnabled: ((W = e.mayaAppDepositGatewaySettings) == null ? void 0 : W.mobileWebEnabled) ?? !1,
1863
+ minimumAmount: o((B = e.mayaAppDepositGatewaySettings) == null ? void 0 : B.minimumAmount),
1864
+ maximumAmount: o((U = e.mayaAppDepositGatewaySettings) == null ? void 0 : U.maximumAmount)
1840
1865
  }
1841
1866
  },
1842
1867
  withdrawalGateway: {
1843
1868
  bank: {
1844
- androidEnabled: ((B = e.bankWithdrawalGatewaySettings) == null ? void 0 : B.androidEnabled) ?? !1,
1845
- iosEnabled: ((x = e.bankWithdrawalGatewaySettings) == null ? void 0 : x.iosEnabled) ?? !1,
1869
+ androidEnabled: ((x = e.bankWithdrawalGatewaySettings) == null ? void 0 : x.androidEnabled) ?? !1,
1870
+ iosEnabled: ((q = e.bankWithdrawalGatewaySettings) == null ? void 0 : q.iosEnabled) ?? !1,
1846
1871
  webEnabled: ((O = e.bankWithdrawalGatewaySettings) == null ? void 0 : O.webEnabled) ?? !1,
1847
- mobileWebEnabled: ((q = e.bankWithdrawalGatewaySettings) == null ? void 0 : q.mobileWebEnabled) ?? !1,
1848
- minimumAmount: r((F = e.bankWithdrawalGatewaySettings) == null ? void 0 : F.minimumAmount),
1849
- maximumAmount: r((L = e.bankWithdrawalGatewaySettings) == null ? void 0 : L.maximumAmount)
1872
+ mobileWebEnabled: ((F = e.bankWithdrawalGatewaySettings) == null ? void 0 : F.mobileWebEnabled) ?? !1,
1873
+ minimumAmount: o((L = e.bankWithdrawalGatewaySettings) == null ? void 0 : L.minimumAmount),
1874
+ maximumAmount: o((V = e.bankWithdrawalGatewaySettings) == null ? void 0 : V.maximumAmount)
1850
1875
  },
1851
1876
  gcash: {
1852
- androidEnabled: ((V = e.gcashWithdrawalGatewaySettings) == null ? void 0 : V.androidEnabled) ?? !1,
1853
- iosEnabled: ((H = e.gcashWithdrawalGatewaySettings) == null ? void 0 : H.iosEnabled) ?? !1,
1854
- webEnabled: ((Y = e.gcashWithdrawalGatewaySettings) == null ? void 0 : Y.webEnabled) ?? !1,
1855
- mobileWebEnabled: ((j = e.gcashWithdrawalGatewaySettings) == null ? void 0 : j.mobileWebEnabled) ?? !1,
1856
- minimumAmount: r((Q = e.gcashWithdrawalGatewaySettings) == null ? void 0 : Q.minimumAmount),
1857
- maximumAmount: r(
1858
- (K = e.gcashWithdrawalGatewaySettings) == null ? void 0 : K.maximumAmount,
1877
+ androidEnabled: ((H = e.gcashWithdrawalGatewaySettings) == null ? void 0 : H.androidEnabled) ?? !1,
1878
+ iosEnabled: ((Y = e.gcashWithdrawalGatewaySettings) == null ? void 0 : Y.iosEnabled) ?? !1,
1879
+ webEnabled: ((j = e.gcashWithdrawalGatewaySettings) == null ? void 0 : j.webEnabled) ?? !1,
1880
+ mobileWebEnabled: ((Q = e.gcashWithdrawalGatewaySettings) == null ? void 0 : Q.mobileWebEnabled) ?? !1,
1881
+ minimumAmount: o((K = e.gcashWithdrawalGatewaySettings) == null ? void 0 : K.minimumAmount),
1882
+ maximumAmount: o(
1883
+ (z = e.gcashWithdrawalGatewaySettings) == null ? void 0 : z.maximumAmount,
1859
1884
  1e6
1860
1885
  )
1861
1886
  },
1862
1887
  maya: {
1863
- androidEnabled: ((z = e.mayaWithdrawalGatewaySettings) == null ? void 0 : z.androidEnabled) ?? !1,
1864
- iosEnabled: ((J = e.mayaWithdrawalGatewaySettings) == null ? void 0 : J.iosEnabled) ?? !1,
1865
- webEnabled: ((Z = e.mayaWithdrawalGatewaySettings) == null ? void 0 : Z.webEnabled) ?? !1,
1866
- mobileWebEnabled: ((X = e.mayaWithdrawalGatewaySettings) == null ? void 0 : X.mobileWebEnabled) ?? !1,
1867
- minimumAmount: r((ee = e.mayaWithdrawalGatewaySettings) == null ? void 0 : ee.minimumAmount),
1868
- maximumAmount: r((te = e.mayaWithdrawalGatewaySettings) == null ? void 0 : te.maximumAmount)
1888
+ androidEnabled: ((J = e.mayaWithdrawalGatewaySettings) == null ? void 0 : J.androidEnabled) ?? !1,
1889
+ iosEnabled: ((Z = e.mayaWithdrawalGatewaySettings) == null ? void 0 : Z.iosEnabled) ?? !1,
1890
+ webEnabled: ((X = e.mayaWithdrawalGatewaySettings) == null ? void 0 : X.webEnabled) ?? !1,
1891
+ mobileWebEnabled: ((ee = e.mayaWithdrawalGatewaySettings) == null ? void 0 : ee.mobileWebEnabled) ?? !1,
1892
+ minimumAmount: o((te = e.mayaWithdrawalGatewaySettings) == null ? void 0 : te.minimumAmount),
1893
+ maximumAmount: o((ae = e.mayaWithdrawalGatewaySettings) == null ? void 0 : ae.maximumAmount)
1869
1894
  },
1870
1895
  mayaApp: {
1871
- androidEnabled: ((ae = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : ae.androidEnabled) ?? !1,
1872
- iosEnabled: ((re = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : re.iosEnabled) ?? !1,
1873
- webEnabled: ((oe = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : oe.webEnabled) ?? !1,
1874
- mobileWebEnabled: ((ne = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : ne.mobileWebEnabled) ?? !1,
1875
- minimumAmount: r((ie = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : ie.minimumAmount),
1876
- maximumAmount: r(
1877
- (se = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : se.maximumAmount,
1896
+ androidEnabled: ((re = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : re.androidEnabled) ?? !1,
1897
+ iosEnabled: ((oe = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : oe.iosEnabled) ?? !1,
1898
+ webEnabled: ((ne = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : ne.webEnabled) ?? !1,
1899
+ mobileWebEnabled: ((ie = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : ie.mobileWebEnabled) ?? !1,
1900
+ minimumAmount: o((se = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : se.minimumAmount),
1901
+ maximumAmount: o(
1902
+ (de = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : de.maximumAmount,
1878
1903
  1e6
1879
1904
  )
1880
1905
  }
1881
1906
  }
1882
1907
  },
1883
1908
  pointsClubSettings: {
1884
- multiplier: r(e.pointsClubSettings.multiplier, 0)
1909
+ multiplier: o(e.pointsClubSettings.multiplier, 0)
1885
1910
  }
1886
1911
  };
1887
1912
  }
@@ -1909,7 +1934,7 @@ class gt {
1909
1934
  wallet(e) {
1910
1935
  return {
1911
1936
  ...e,
1912
- balance: r(e.balance, 0),
1937
+ balance: o(e.balance, 0),
1913
1938
  dateTimeCreated: new Date(e.dateTimeCreated),
1914
1939
  dateTimeLastUpdated: new Date(e.dateTimeLastUpdated)
1915
1940
  };
@@ -1932,7 +1957,7 @@ class gt {
1932
1957
  profileCompletion(e) {
1933
1958
  return {
1934
1959
  ...e,
1935
- completionPercentage: r(e, 0)
1960
+ completionPercentage: o(e, 0)
1936
1961
  };
1937
1962
  }
1938
1963
  announcement(e) {
@@ -1947,9 +1972,9 @@ class gt {
1947
1972
  withdrawalRecord(e) {
1948
1973
  return {
1949
1974
  ...e,
1950
- amount: r(e.amount, 0),
1951
- netAmount: r(e.netAmount, 0),
1952
- fee: r(e.fee, 0),
1975
+ amount: o(e.amount, 0),
1976
+ netAmount: o(e.netAmount, 0),
1977
+ fee: o(e.fee, 0),
1953
1978
  reference: e.reference ?? void 0,
1954
1979
  bank: e.bank ?? void 0,
1955
1980
  recipientMobileNumber: e.recipientMobileNumber ?? void 0,
@@ -1961,9 +1986,9 @@ class gt {
1961
1986
  deposit(e) {
1962
1987
  return {
1963
1988
  ...e,
1964
- fee: r(e.fee, 0),
1965
- amount: r(e.amount, 0),
1966
- netAmount: r(e.netAmount, 0),
1989
+ fee: o(e.fee, 0),
1990
+ amount: o(e.amount, 0),
1991
+ netAmount: o(e.netAmount, 0),
1967
1992
  reference: e.reference ?? void 0,
1968
1993
  checkoutUrl: e.checkoutUrl ?? void 0,
1969
1994
  dateTimeCreated: new Date(e.dateTimeCreated),
@@ -1973,9 +1998,9 @@ class gt {
1973
1998
  depositRecord(e) {
1974
1999
  return {
1975
2000
  ...e,
1976
- amount: r(e.amount, 0),
1977
- fee: r(e.fee, 0),
1978
- netAmount: r(e.netAmount, 0),
2001
+ amount: o(e.amount, 0),
2002
+ fee: o(e.fee, 0),
2003
+ netAmount: o(e.netAmount, 0),
1979
2004
  reference: e.reference ?? void 0,
1980
2005
  dateTimeCreated: new Date(e.dateTimeCreated),
1981
2006
  dateTimeLastUpdated: new Date(e.dateTimeLastUpdated)
@@ -1985,12 +2010,12 @@ class gt {
1985
2010
  var t, a;
1986
2011
  return {
1987
2012
  ...e,
1988
- bet: r(e.bet, 0),
1989
- payout: r(e.payout, 0),
1990
- jackpotContribution: r(e.jackpotContribution, 0),
1991
- jackpotPayout: r(e.jackpotPayout, 0),
1992
- winloss: r(e.winloss),
1993
- validBet: r(e.validBet, 0),
2013
+ bet: o(e.bet, 0),
2014
+ payout: o(e.payout, 0),
2015
+ jackpotContribution: o(e.jackpotContribution, 0),
2016
+ jackpotPayout: o(e.jackpotPayout, 0),
2017
+ winloss: o(e.winloss),
2018
+ validBet: o(e.validBet, 0),
1994
2019
  vendorRoundId: e.vendorRoundId ?? void 0,
1995
2020
  game: this.game(e.game),
1996
2021
  dateTimeSettled: e.dateTimeSettled ? new Date(e.dateTimeSettled) : void 0,
@@ -2001,7 +2026,7 @@ class gt {
2001
2026
  externalCategory: e.externalCategory ?? void 0,
2002
2027
  metadata: {
2003
2028
  odds: ((t = e.metadata) == null ? void 0 : t.odds) ?? void 0,
2004
- validBet: r((a = e.metadata) == null ? void 0 : a.validBet)
2029
+ validBet: o((a = e.metadata) == null ? void 0 : a.validBet)
2005
2030
  }
2006
2031
  };
2007
2032
  }
@@ -2009,9 +2034,9 @@ class gt {
2009
2034
  return {
2010
2035
  ...e,
2011
2036
  game: this.game(e.game),
2012
- bet: r(e.bet, 0),
2013
- payout: r(e.payout, 0),
2014
- validBet: r(e.validBet, 0),
2037
+ bet: o(e.bet, 0),
2038
+ payout: o(e.payout, 0),
2039
+ validBet: o(e.validBet, 0),
2015
2040
  dateTimeSettled: new Date(e.dateTimeSettled),
2016
2041
  dateTimeCreated: new Date(e.dateTimeCreated)
2017
2042
  };
@@ -2019,24 +2044,17 @@ class gt {
2019
2044
  transactionRecord(e) {
2020
2045
  return {
2021
2046
  ...e,
2022
- amount: r(e.amount, 0),
2047
+ amount: o(e.amount, 0),
2023
2048
  content: e.content ?? void 0,
2024
- currentBalance: r(e.currentBalance, 0),
2025
- dateTimeCreated: new Date(e.dateTimeCreated),
2026
- dateTimeLastUpdated: new Date(e.dateTimeLastUpdated)
2049
+ currentBalance: o(e.currentBalance, 0),
2050
+ dateTimeCreated: new Date(e.dateTimeCreated)
2027
2051
  };
2028
2052
  }
2029
2053
  game(e) {
2030
2054
  const t = this.staticService.gameThumbnails(e);
2031
2055
  return {
2032
2056
  ...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
- }
2057
+ images: t
2040
2058
  };
2041
2059
  }
2042
2060
  gameSession(e) {
@@ -2054,8 +2072,8 @@ class gt {
2054
2072
  ...e.banner,
2055
2073
  dateTimeCreated: new Date(e.banner.dateTimeCreated)
2056
2074
  },
2057
- maximumBonusAmount: r(e.maximumBonusAmount),
2058
- minimumBonusAmount: r(e.minimumBonusAmount),
2075
+ maximumBonusAmount: o(e.maximumBonusAmount),
2076
+ minimumBonusAmount: o(e.minimumBonusAmount),
2059
2077
  activationEndDateTime: new Date(e.activationEndDateTime),
2060
2078
  activationStartDateTime: new Date(e.activationStartDateTime),
2061
2079
  dateTimeCreated: new Date(e.dateTimeCreated),
@@ -2082,22 +2100,22 @@ class gt {
2082
2100
  /* deposit here does not have an id and depositNumber field */
2083
2101
  deposit: e.deposit ? {
2084
2102
  ...e.deposit,
2085
- fee: r(e.deposit.fee, 0),
2086
- amount: r(e.deposit.amount, 0),
2087
- netAmount: r(e.deposit.netAmount, 0),
2103
+ fee: o(e.deposit.fee, 0),
2104
+ amount: o(e.deposit.amount, 0),
2105
+ netAmount: o(e.deposit.netAmount, 0),
2088
2106
  reference: e.deposit.reference ?? void 0,
2089
2107
  dateTimeCreated: new Date(e.deposit.dateTimeCreated),
2090
2108
  dateTimeLastUpdated: new Date(e.deposit.dateTimeLastUpdated)
2091
2109
  } : void 0,
2092
- balance: r(e.balance, 0),
2093
- amount: r(e.amount, 0),
2110
+ balance: o(e.balance, 0),
2111
+ amount: o(e.amount, 0),
2094
2112
  expiration: new Date(e.expiration),
2095
- turnoverRequirement: r(e.turnoverRequirement, 0),
2096
- currentTurnoverRequirementContribution: r(
2113
+ turnoverRequirement: o(e.turnoverRequirement, 0),
2114
+ currentTurnoverRequirementContribution: o(
2097
2115
  e.currentTurnoverRequirementContribution,
2098
2116
  0
2099
2117
  ),
2100
- currentTurnoverRequirementContributionPercentage: r(
2118
+ currentTurnoverRequirementContributionPercentage: o(
2101
2119
  e.currentTurnoverRequirementContributionPercentage,
2102
2120
  0
2103
2121
  ),
@@ -2108,7 +2126,7 @@ class gt {
2108
2126
  cashbackBonus(e) {
2109
2127
  return {
2110
2128
  id: e.id,
2111
- balance: r(e.balance, 0),
2129
+ balance: o(e.balance, 0),
2112
2130
  cashback: this.cashback(e.cashback),
2113
2131
  dateTimeCreated: new Date(e.dateTimeCreated),
2114
2132
  dateTimeLastUpdated: new Date(e.dateTimeLastUpdated)
@@ -2124,75 +2142,66 @@ class gt {
2124
2142
  pointsWallet(e) {
2125
2143
  return {
2126
2144
  id: e.id,
2127
- points: r(e.points, 0),
2145
+ points: o(e.points, 0),
2128
2146
  account: e.account,
2129
2147
  dateTimeCreated: new Date(e.dateTimeCreated)
2130
2148
  };
2131
2149
  }
2132
2150
  }
2133
- class h {
2151
+ class g {
2134
2152
  constructor(e, t) {
2135
- c(this, "url");
2136
- c(this, "options");
2137
- c(this, "middlewares");
2138
- var o;
2139
- const a = new Headers((o = t == null ? void 0 : t.fetchOptions) == null ? void 0 : o.headers);
2153
+ d(this, "url");
2154
+ d(this, "options");
2155
+ d(this, "middlewares");
2156
+ var r;
2157
+ const a = new Headers((r = t == null ? void 0 : t.fetchOptions) == null ? void 0 : r.headers);
2140
2158
  this.url = e, this.options = { ...t == null ? void 0 : t.fetchOptions, headers: a }, this.middlewares = (t == null ? void 0 : t.middlewares) ?? [];
2141
2159
  }
2142
2160
  async request(e, t) {
2143
- var m;
2144
- const a = JSON.stringify({ query: e, variables: t }), o = new Headers(this.options.headers);
2145
- o.set("Content-Type", "application/json"), o.set("Accept", "application/json");
2146
- const d = await this.runMiddlewares(
2161
+ const a = JSON.stringify({ query: e, variables: t }), r = new Headers(this.options.headers);
2162
+ r.set("Content-Type", "application/json"), r.set("Accept", "application/json");
2163
+ const s = await this.runMiddlewares(
2147
2164
  new Request(this.url, {
2148
2165
  ...this.options,
2149
2166
  body: a,
2150
- headers: o,
2167
+ headers: r,
2151
2168
  method: "POST"
2152
2169
  })
2153
2170
  );
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
- }
2171
+ return await this.exec(s);
2169
2172
  }
2170
2173
  /** Single file upload */
2171
2174
  async upload(e, t) {
2172
- var m;
2173
- const a = h.createUploadBody(e, t), o = new Headers(this.options.headers);
2174
- o.set("Accept", "application/json"), o.delete("Content-Type");
2175
- const d = await this.runMiddlewares(
2175
+ const a = this.createUploadBody(e, t), r = new Headers(this.options.headers);
2176
+ r.set("Accept", "application/json"), r.delete("Content-Type");
2177
+ const s = await this.runMiddlewares(
2176
2178
  new Request(this.url, {
2177
2179
  ...this.options,
2178
2180
  body: a,
2179
- headers: o,
2181
+ headers: r,
2180
2182
  method: "POST"
2181
2183
  })
2182
2184
  );
2185
+ return await this.exec(s);
2186
+ }
2187
+ async exec(e) {
2188
+ var t, a, r, s, m;
2183
2189
  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) } : {
2190
+ const c = await fetch(e);
2191
+ if (!c.ok)
2192
+ return { ok: !1, error: h(c.status) };
2193
+ const l = await c.json(), b = l.data, u = (t = l.errors) == null ? void 0 : t.at(0);
2194
+ return u ? ((a = u.extensions) == null ? void 0 : a.code) === "FORBIDDEN" ? { ok: !1, error: h(403, u.message) } : ((r = u.extensions) == null ? void 0 : r.code) === "UNAUTHORIZED" ? { ok: !1, error: h(401, u.message) } : ((s = u.extensions) == null ? void 0 : s.code) === "BAD_USER_INPUT" || ((m = u.extensions) == null ? void 0 : m.code) === "BAD_REQUEST" ? { ok: !1, error: h(400, u.message) } : {
2195
+ ok: !1,
2196
+ error: h(500, u.message)
2197
+ } : {
2189
2198
  ok: !0,
2190
- data: y
2199
+ data: b
2191
2200
  };
2192
2201
  } catch {
2193
2202
  return {
2194
2203
  ok: !1,
2195
- error: l(500)
2204
+ error: h(500)
2196
2205
  };
2197
2206
  }
2198
2207
  }
@@ -2202,28 +2211,28 @@ class h {
2202
2211
  t = await a(t);
2203
2212
  return t;
2204
2213
  }
2205
- static createUploadBody(e, t) {
2206
- const { files: a, others: o } = h.extractFiles(t), d = new FormData();
2207
- d.append(
2214
+ createUploadBody(e, t) {
2215
+ const { files: a, others: r } = this.extractFiles(t), s = new FormData();
2216
+ s.append(
2208
2217
  "operations",
2209
2218
  JSON.stringify({
2210
2219
  query: e,
2211
2220
  variables: t
2212
2221
  })
2213
- ), Object.entries(o).forEach(([u, p]) => {
2214
- d.append(u, JSON.stringify(p));
2222
+ ), Object.entries(r).forEach(([c, l]) => {
2223
+ s.append(c, JSON.stringify(l));
2215
2224
  });
2216
2225
  const m = {};
2217
- return Object.keys(a).forEach((u, p) => {
2218
- m[p.toString()] = `variables.${u}`;
2219
- }), d.append("map", JSON.stringify(m)), Object.values(a).forEach((u, p) => {
2220
- d.append(p.toString(), u);
2221
- }), d;
2226
+ return Object.keys(a).forEach((c, l) => {
2227
+ m[l.toString()] = `variables.${c}`;
2228
+ }), s.append("map", JSON.stringify(m)), Object.values(a).forEach((c, l) => {
2229
+ s.append(l.toString(), c);
2230
+ }), s;
2222
2231
  }
2223
- static extractFiles(e) {
2232
+ extractFiles(e) {
2224
2233
  const t = {}, a = {};
2225
- return Object.entries(e).forEach(([o, d]) => {
2226
- d instanceof File || d instanceof Blob ? t[o] = d : a[o] = d;
2234
+ return Object.entries(e).forEach(([r, s]) => {
2235
+ s instanceof File || s instanceof Blob ? t[r] = s : a[r] = s;
2227
2236
  }), {
2228
2237
  files: t,
2229
2238
  others: a
@@ -2232,19 +2241,19 @@ class h {
2232
2241
  }
2233
2242
  class St {
2234
2243
  constructor(e) {
2235
- c(this, "gameService");
2236
- c(this, "fileService");
2237
- c(this, "walletService");
2238
- c(this, "reportService");
2239
- c(this, "portalService");
2240
- c(this, "accountService");
2241
- c(this, "sessionService");
2242
- c(this, "transformer");
2243
- c(this, "logger");
2244
+ d(this, "gameService");
2245
+ d(this, "fileService");
2246
+ d(this, "walletService");
2247
+ d(this, "reportService");
2248
+ d(this, "portalService");
2249
+ d(this, "accountService");
2250
+ d(this, "sessionManager");
2251
+ d(this, "transformer");
2252
+ d(this, "logger");
2244
2253
  const t = e.environment === "development";
2245
- this.sessionService = new wt({
2246
- url: t ? "https://auth.development.opexa.io" : "https://auth.opexa.io",
2247
- platform: e.platform
2254
+ this.sessionManager = new gt({
2255
+ ...e,
2256
+ url: t ? "https://auth.development.opexa.io" : "https://auth.opexa.io"
2248
2257
  });
2249
2258
  const a = {
2250
2259
  middlewares: [this.authMiddleware],
@@ -2255,69 +2264,90 @@ class St {
2255
2264
  }
2256
2265
  }
2257
2266
  };
2258
- this.gameService = new fe(
2259
- new h(
2267
+ this.gameService = new we(
2268
+ new g(
2260
2269
  t ? "https://game.development.opexa.io/graphql" : "https://game.opexa.io/graphql",
2261
2270
  a
2262
2271
  )
2263
2272
  ), this.fileService = new ut(
2264
- new h(
2273
+ new g(
2265
2274
  t ? "https://file.development.opexa.io/graphql" : "https://file.opexa.io/graphql",
2266
2275
  a
2267
2276
  )
2268
- ), this.walletService = new ft(
2269
- new h(
2277
+ ), this.walletService = new ht(
2278
+ new g(
2270
2279
  t ? "https://wallet.development.opexa.io/graphql" : "https://wallet.opexa.io/graphql",
2271
2280
  a
2272
2281
  )
2273
2282
  ), this.reportService = new lt(
2274
- new h(
2283
+ new g(
2275
2284
  t ? "https://report.development.opexa.io/graphql" : "https://report.opexa.io/graphql",
2276
2285
  a
2277
2286
  )
2278
- ), this.accountService = new dt(
2279
- new h(
2287
+ ), this.accountService = new mt(
2288
+ new g(
2280
2289
  t ? "https://account.development.opexa.io/graphql" : "https://account.opexa.io/graphql",
2281
2290
  a
2282
2291
  )
2283
- ), this.portalService = new ht(
2284
- new h(
2292
+ ), this.portalService = new ft(
2293
+ new g(
2285
2294
  t ? "https://portal.development.opexa.io/graphql" : "https://portal.opexa.io/graphql",
2286
2295
  a
2287
2296
  )
2288
- ), this.transformer = new gt(e), this.logger = new he({
2297
+ ), this.transformer = new yt(e), this.logger = new he({
2289
2298
  enabled: e.log ?? !1
2290
2299
  });
2291
2300
  }
2292
2301
  get authMiddleware() {
2293
2302
  return async (e) => {
2294
2303
  this.logger.info("Checking for session");
2295
- const t = await this.sessionService.session();
2304
+ const t = await this.sessionManager.get();
2296
2305
  return t.data ? (e.headers.append("Authorization", `Bearer ${t.data.accessToken}`), this.logger.info("Session found"), this.logger.success("Added 'Authorization' header")) : this.logger.info("No session found"), e;
2297
2306
  };
2298
2307
  }
2299
2308
  async signIn(e) {
2300
- const t = await this.sessionService.create(e);
2309
+ const t = await this.sessionManager.create(e);
2301
2310
  return t.ok ? { ok: !0 } : t;
2302
2311
  }
2303
2312
  async signOut() {
2304
- await this.sessionService.destroy();
2313
+ await this.sessionManager.destroy();
2305
2314
  }
2306
2315
  /**
2316
+ * @description Watches the session if it is still valid whenever signed in.
2307
2317
  * @returns Unsubscribe function
2318
+ * @example
2319
+ * ```tsx
2320
+ * import * as React from 'react';
2321
+ * import { useAuthenticated } from '@lib/stores';
2322
+ *
2323
+ * function WatchSession() {
2324
+ * const { setAuthenticated } = useAuthenticated();
2325
+ *
2326
+ * React.useEffect(() => {
2327
+ * const unsubscribe = sdk.watchSession({
2328
+ * interval: 30000,
2329
+ * onInvalid() {
2330
+ * setAuthenticated(false);
2331
+ * },
2332
+ * });
2333
+ *
2334
+ * return unsubscribe;
2335
+ * }, []);
2336
+ * }
2337
+ * ```
2308
2338
  */
2309
2339
  watchSession(e) {
2310
2340
  const t = e.interval ?? 3e4, a = e.onInvalid;
2311
- let o = null;
2312
- const d = () => setTimeout(async () => {
2313
- await this.sessionService.verify() || await a(), o = d();
2341
+ let r = null;
2342
+ const s = () => setTimeout(async () => {
2343
+ await this.sessionManager.verify() || await a(), r = s();
2314
2344
  }, t);
2315
- return o = d(), function() {
2316
- o && clearTimeout(o);
2345
+ return r = s(), function() {
2346
+ r && clearTimeout(r);
2317
2347
  };
2318
2348
  }
2319
2349
  async session() {
2320
- const e = await this.sessionService.session();
2350
+ const e = await this.sessionManager.get();
2321
2351
  return e.ok ? {
2322
2352
  ok: !0,
2323
2353
  data: e.data ? {
@@ -2378,12 +2408,12 @@ class St {
2378
2408
  * ```
2379
2409
  */
2380
2410
  async createAccount(e) {
2381
- const t = e.id ?? w.generate(g.Account).toString(), a = await this.accountService.registerMemberAccount({
2411
+ const t = e.id ?? f.generate(w.Account).toString(), a = await this.accountService.registerMemberAccount({
2382
2412
  input: {
2383
2413
  id: t,
2384
2414
  name: e.name,
2385
2415
  birthDay: typeof e.dateOfBirth == "string" ? e.dateOfBirth : e.dateOfBirth.toISOString(),
2386
- password: await f(e.password),
2416
+ password: await p(e.password),
2387
2417
  mobileNumber: this.addAreaCode(e.mobileNumber),
2388
2418
  domain: e.domain
2389
2419
  },
@@ -2413,8 +2443,8 @@ class St {
2413
2443
  id: e,
2414
2444
  data: {
2415
2445
  ...t,
2416
- password: t.password ? await f(t.password) : void 0,
2417
- transactionPassword: t.transactionPassword ? await f(t.transactionPassword) : void 0,
2446
+ password: t.password ? await p(t.password) : void 0,
2447
+ transactionPassword: t.transactionPassword ? await p(t.transactionPassword) : void 0,
2418
2448
  ...t.mobileNumber && {
2419
2449
  mobileNumber: this.addAreaCode(t.mobileNumber)
2420
2450
  }
@@ -2458,7 +2488,7 @@ class St {
2458
2488
  * ```
2459
2489
  */
2460
2490
  async submitVerificationDetails(e) {
2461
- const t = e.id ?? w.generate(g.Verification).toString(), a = await this.accountService.createMemberVerification({
2491
+ const t = e.id ?? f.generate(w.Verification).toString(), a = await this.accountService.createMemberVerification({
2462
2492
  input: {
2463
2493
  id: t,
2464
2494
  ...e
@@ -2495,7 +2525,7 @@ class St {
2495
2525
  return await this.accountService.resetPassword({
2496
2526
  input: {
2497
2527
  mobileNumber: this.addAreaCode(e.mobileNumber),
2498
- newPassword: await f(e.newPassword)
2528
+ newPassword: await p(e.newPassword)
2499
2529
  },
2500
2530
  verificationCode: e.verificationCode
2501
2531
  });
@@ -2549,8 +2579,8 @@ class St {
2549
2579
  return t.ok ? {
2550
2580
  ok: !0,
2551
2581
  data: {
2552
- announcements: t.data.edges.map(({ cursor: a, node: o }) => ({
2553
- ...this.transformer.transform.announcement(o),
2582
+ announcements: t.data.edges.map(({ cursor: a, node: r }) => ({
2583
+ ...this.transformer.transform.announcement(r),
2554
2584
  cursor: a
2555
2585
  })),
2556
2586
  totalCount: t.data.totalCount,
@@ -2582,13 +2612,13 @@ class St {
2582
2612
  * ```
2583
2613
  */
2584
2614
  async createWithdrawal(e) {
2585
- const t = e.id ?? w.generate(g.Withdrawal).toString();
2615
+ const t = e.id ?? f.generate(w.Withdrawal).toString();
2586
2616
  if (e.type === "BANK") {
2587
2617
  const a = await this.walletService.createBankWithdrawal({
2588
2618
  input: {
2589
2619
  id: t,
2590
2620
  amount: e.amount.toString(),
2591
- transactionPassword: await f(e.transactionPassword)
2621
+ transactionPassword: await p(e.transactionPassword)
2592
2622
  }
2593
2623
  });
2594
2624
  if (!a.ok) return a;
@@ -2598,7 +2628,7 @@ class St {
2598
2628
  input: {
2599
2629
  id: t,
2600
2630
  amount: e.amount.toString(),
2601
- transactionPassword: await f(e.transactionPassword),
2631
+ transactionPassword: await p(e.transactionPassword),
2602
2632
  recipientMobileNumber: this.addAreaCode(e.recipientMobileNumber)
2603
2633
  }
2604
2634
  });
@@ -2609,7 +2639,7 @@ class St {
2609
2639
  input: {
2610
2640
  id: t,
2611
2641
  amount: e.amount.toString(),
2612
- transactionPassword: await f(e.transactionPassword),
2642
+ transactionPassword: await p(e.transactionPassword),
2613
2643
  recipientMobileNumber: this.addAreaCode(e.recipientMobileNumber)
2614
2644
  }
2615
2645
  });
@@ -2620,7 +2650,7 @@ class St {
2620
2650
  input: {
2621
2651
  id: t,
2622
2652
  amount: e.amount.toString(),
2623
- transactionPassword: await f(e.transactionPassword)
2653
+ transactionPassword: await p(e.transactionPassword)
2624
2654
  }
2625
2655
  });
2626
2656
  if (!a.ok) return a;
@@ -2632,8 +2662,8 @@ class St {
2632
2662
  return t.ok ? {
2633
2663
  ok: !0,
2634
2664
  data: {
2635
- withdrawalRecords: t.data.edges.map(({ cursor: a, node: o }) => ({
2636
- ...this.transformer.transform.withdrawalRecord(o),
2665
+ withdrawalRecords: t.data.edges.map(({ cursor: a, node: r }) => ({
2666
+ ...this.transformer.transform.withdrawalRecord(r),
2637
2667
  cursor: a
2638
2668
  })),
2639
2669
  totalCount: t.data.totalCount,
@@ -2668,7 +2698,7 @@ class St {
2668
2698
  * ```
2669
2699
  */
2670
2700
  async createDeposit(e) {
2671
- const t = e.id ?? w.generate(g.Deposit).toString();
2701
+ const t = e.id ?? f.generate(w.Deposit).toString();
2672
2702
  if (e.type === "MAYA") {
2673
2703
  const a = await this.walletService.createMayaDeposit({
2674
2704
  input: {
@@ -2713,8 +2743,8 @@ class St {
2713
2743
  return t.ok ? {
2714
2744
  ok: !0,
2715
2745
  data: {
2716
- depositRecords: t.data.edges.map(({ cursor: a, node: o }) => ({
2717
- ...this.transformer.transform.depositRecord(o),
2746
+ depositRecords: t.data.edges.map(({ cursor: a, node: r }) => ({
2747
+ ...this.transformer.transform.depositRecord(r),
2718
2748
  cursor: a
2719
2749
  })),
2720
2750
  totalCount: t.data.totalCount,
@@ -2736,8 +2766,8 @@ class St {
2736
2766
  return t.ok ? {
2737
2767
  ok: !0,
2738
2768
  data: {
2739
- betRecords: t.data.edges.map(({ cursor: a, node: o }) => ({
2740
- ...this.transformer.transform.betRecord(o),
2769
+ betRecords: t.data.edges.map(({ cursor: a, node: r }) => ({
2770
+ ...this.transformer.transform.betRecord(r),
2741
2771
  cursor: a
2742
2772
  })),
2743
2773
  totalCount: t.data.totalCount,
@@ -2763,8 +2793,8 @@ class St {
2763
2793
  return t.ok ? {
2764
2794
  ok: !0,
2765
2795
  data: {
2766
- transactionRecords: t.data.edges.map(({ cursor: a, node: o }) => ({
2767
- ...this.transformer.transform.transactionRecord(o),
2796
+ transactionRecords: t.data.edges.map(({ cursor: a, node: r }) => ({
2797
+ ...this.transformer.transform.transactionRecord(r),
2768
2798
  cursor: a
2769
2799
  })),
2770
2800
  totalCount: t.data.totalCount,
@@ -2826,8 +2856,8 @@ class St {
2826
2856
  return t.ok ? {
2827
2857
  ok: !0,
2828
2858
  data: {
2829
- games: t.data.edges.map(({ cursor: a, node: o }) => ({
2830
- ...this.transformer.transform.game(o),
2859
+ games: t.data.edges.map(({ cursor: a, node: r }) => ({
2860
+ ...this.transformer.transform.game(r),
2831
2861
  cursor: a
2832
2862
  })),
2833
2863
  totalCount: t.data.totalCount,
@@ -2855,8 +2885,8 @@ class St {
2855
2885
  return t.ok ? {
2856
2886
  ok: !0,
2857
2887
  data: {
2858
- games: t.data.edges.map(({ cursor: a, node: o }) => ({
2859
- ...this.transformer.transform.game(o),
2888
+ games: t.data.edges.map(({ cursor: a, node: r }) => ({
2889
+ ...this.transformer.transform.game(r),
2860
2890
  cursor: a
2861
2891
  })),
2862
2892
  totalCount: t.data.totalCount,
@@ -2881,7 +2911,7 @@ class St {
2881
2911
  * ```
2882
2912
  */
2883
2913
  async createGameSession(e) {
2884
- const t = e.id ?? w.generate(g.GameSession).toString(), a = await this.gameService.createGameSession({
2914
+ const t = e.id ?? f.generate(w.GameSession).toString(), a = await this.gameService.createGameSession({
2885
2915
  input: {
2886
2916
  id: t,
2887
2917
  game: e.game
@@ -2905,7 +2935,7 @@ class St {
2905
2935
  * ```
2906
2936
  */
2907
2937
  async createGameSession__next(e) {
2908
- const t = e.id ?? w.generate(g.GameSession).toString(), a = await this.walletService.createGameSession({
2938
+ const t = e.id ?? f.generate(w.GameSession).toString(), a = await this.walletService.createGameSession({
2909
2939
  input: {
2910
2940
  id: t,
2911
2941
  game: e.game
@@ -2961,7 +2991,7 @@ class St {
2961
2991
  * ```
2962
2992
  */
2963
2993
  async uploadImageFile(e) {
2964
- const t = e.id ?? w.generate(g.File).toString(), a = await this.fileService.uploadPrivateImageFile({
2994
+ const t = e.id ?? f.generate(w.File).toString(), a = await this.fileService.uploadPrivateImageFile({
2965
2995
  input: {
2966
2996
  id: t,
2967
2997
  file: e.file
@@ -2993,8 +3023,8 @@ class St {
2993
3023
  }
2994
3024
  }
2995
3025
  export {
2996
- kt as ObjectId,
2997
- g as ObjectType,
3026
+ Ct as ObjectId,
3027
+ w as ObjectType,
2998
3028
  St as Sdk
2999
3029
  };
3000
3030
  //# sourceMappingURL=index.mjs.map