@opexa/portal-sdk 0.0.7 → 0.0.9

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 (39) hide show
  1. package/dist/index.d.ts +0 -3
  2. package/dist/index.js +67 -59
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +759 -573
  5. package/dist/index.mjs.map +1 -1
  6. package/dist/sdk/index.d.ts +4 -0
  7. package/dist/{sdk.d.ts → sdk/sdk.d.ts} +38 -2
  8. package/dist/{session-manager.d.ts → sdk/session-manager.d.ts} +6 -2
  9. package/dist/{transformer.d.ts → sdk/transformer.d.ts} +1 -1
  10. package/dist/{types.d.ts → sdk/types.d.ts} +121 -95
  11. package/dist/services/account.service.d.ts +3 -2
  12. package/dist/services/auth.service.d.ts +8 -6
  13. package/dist/services/bet-record.d.ts +1 -7
  14. package/dist/services/bonus.d.ts +3 -2
  15. package/dist/services/cashback.d.ts +2 -4
  16. package/dist/services/deposit.d.ts +8 -17
  17. package/dist/services/file.d.ts +20 -10
  18. package/dist/services/file.service.d.ts +1 -1
  19. package/dist/services/game.d.ts +26 -12
  20. package/dist/services/game.service.d.ts +3 -2
  21. package/dist/services/member.d.ts +15 -9
  22. package/dist/services/platform.d.ts +1 -1
  23. package/dist/services/points.d.ts +3 -2
  24. package/dist/services/portal.service.d.ts +1 -1
  25. package/dist/services/promo.d.ts +2 -4
  26. package/dist/services/report.service.d.ts +2 -1
  27. package/dist/services/session.d.ts +64 -9
  28. package/dist/services/types.d.ts +9 -32
  29. package/dist/services/wallet.service.d.ts +3 -1
  30. package/dist/services/withdrawal.d.ts +6 -5
  31. package/dist/utils/graphql-client.d.ts +4 -11
  32. package/dist/utils/rest-client.d.ts +34 -0
  33. package/dist/utils/status-code-to-error.d.ts +3 -0
  34. package/dist/utils/types.d.ts +25 -3
  35. package/package.json +12 -12
  36. package/dist/utils/http-error.d.ts +0 -26
  37. /package/dist/{logger.d.ts → sdk/logger.d.ts} +0 -0
  38. /package/dist/{object-id.d.ts → sdk/object-id.d.ts} +0 -0
  39. /package/dist/{object-type.d.ts → sdk/object-type.d.ts} +0 -0
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
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 = {
1
+ var ye = Object.defineProperty;
2
+ var be = (i, e, t) => e in i ? ye(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var c = (i, e, t) => be(i, typeof e != "symbol" ? e + "" : e, t);
4
+ import { ObjectId as w } from "@opexa/object-id";
5
+ import { ObjectId as vt } from "@opexa/object-id";
6
+ const f = {
7
7
  Account: 8,
8
8
  Deposit: 9,
9
9
  Withdrawal: 14,
@@ -12,33 +12,15 @@ const w = {
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
- }
33
- function n(i, ...e) {
15
+ function o(i, ...e) {
34
16
  let t = "";
35
17
  for (const [a, r] of i.entries()) {
36
- const s = e.at(a) ?? "";
37
- t = `${t}${r}${s}`;
18
+ const n = e.at(a) ?? "";
19
+ t = `${t}${r}${n}`;
38
20
  }
39
21
  return t.trim();
40
22
  }
41
- const be = n`
23
+ const Se = o`
42
24
  query Announcements($first: Int, $after: Cursor, $filter: AnnouncementFilterInput) {
43
25
  announcements(first: $first, after: $after, filter: $filter) {
44
26
  edges {
@@ -64,14 +46,14 @@ const be = n`
64
46
  }
65
47
  }
66
48
  }
67
- `, y = n`
49
+ `, y = o`
68
50
  fragment GameFragment on Game {
69
51
  id
70
52
  type
71
53
  name
72
54
  provider
73
55
  }
74
- `, Ae = n`
56
+ `, Ae = o`
75
57
  ${y}
76
58
 
77
59
  query Game($id: ObjectId!) {
@@ -81,7 +63,7 @@ const be = n`
81
63
  }
82
64
  }
83
65
  }
84
- `, Se = n`
66
+ `, Ee = o`
85
67
  ${y}
86
68
 
87
69
  query Games($after: Cursor, $first: Int, $filter: GameFilterInput) {
@@ -101,7 +83,7 @@ const be = n`
101
83
  }
102
84
  }
103
85
  }
104
- `, Ee = n`
86
+ `, ke = o`
105
87
  ${y}
106
88
 
107
89
  query GamesByName($search: String!, $filter: GameFilterInput, $first: Int) {
@@ -109,7 +91,7 @@ const be = n`
109
91
  ...GameFragment
110
92
  }
111
93
  }
112
- `, ke = n`
94
+ `, Ce = o`
113
95
  ${y}
114
96
 
115
97
  query GameSession($id: ObjectId!) {
@@ -126,7 +108,7 @@ const be = n`
126
108
  }
127
109
  }
128
110
  }
129
- `, Ce = n`
111
+ `, Te = o`
130
112
  mutation CreateGameSession($input: CreateGameSessionInput!) {
131
113
  createGameSession(input: $input) {
132
114
  ... on GameDoesNotExistError {
@@ -135,11 +117,11 @@ const be = n`
135
117
  }
136
118
  }
137
119
  }
138
- `, Te = n`
120
+ `, _e = o`
139
121
  mutation EndGameSession($input: EndGameSessionInput!) {
140
122
  endGameSession(input: $input)
141
123
  }
142
- `, _e = n`
124
+ `, ve = o`
143
125
  ${y}
144
126
 
145
127
  query BetRecords($first: Int, $after: Cursor, $filter: BetRecordFilterInput) {
@@ -179,7 +161,7 @@ const be = n`
179
161
  }
180
162
  }
181
163
  }
182
- `, ve = n`
164
+ `, De = o`
183
165
  query LatestBetRecords {
184
166
  latestBetRecords {
185
167
  id
@@ -199,15 +181,15 @@ const be = n`
199
181
  }
200
182
 
201
183
  ${y}
202
- `, A = n`
184
+ `, C = o`
203
185
  fragment FileFragment on File {
204
186
  id
205
187
  url
206
188
  status
207
189
  dateTimeCreated
208
190
  }
209
- `, me = n`
210
- ${A}
191
+ `, pe = o`
192
+ ${C}
211
193
 
212
194
  query File($id: ObjectId!) {
213
195
  node(id: $id) {
@@ -217,7 +199,7 @@ const be = n`
217
199
  }
218
200
  }
219
201
  `;
220
- n`
202
+ o`
221
203
  mutation UploadPrivateImageFile($input: UploadFileInput!) {
222
204
  uploadPrivateImageFile(input: $input) {
223
205
  ... on FileFormatNotSupportedError {
@@ -235,8 +217,8 @@ n`
235
217
  }
236
218
  }
237
219
  `;
238
- const fe = n`
239
- ${A}
220
+ const we = o`
221
+ ${C}
240
222
 
241
223
  fragment CashbackFragment on Cashback {
242
224
  id
@@ -251,16 +233,16 @@ const fe = n`
251
233
  dateTimeCreated
252
234
  dateTimeLastUpdated
253
235
  }
254
- `, De = n`
255
- ${fe}
236
+ `, Me = o`
237
+ ${we}
256
238
 
257
239
  query Cashbacks {
258
240
  cashbacks {
259
241
  ...CashbackFragment
260
242
  }
261
243
  }
262
- `, E = n`
263
- ${A}
244
+ `, _ = o`
245
+ ${C}
264
246
 
265
247
  fragment PromoFragment on Promo {
266
248
  id
@@ -278,24 +260,24 @@ const fe = n`
278
260
  dateTimeCreated
279
261
  dateTimeLastUpdated
280
262
  }
281
- `, Me = n`
282
- ${E}
263
+ `, Ne = o`
264
+ ${_}
283
265
 
284
266
  query Promos {
285
267
  promos {
286
268
  ...PromoFragment
287
269
  }
288
270
  }
289
- `, Ne = n`
290
- ${E}
271
+ `, Re = o`
272
+ ${_}
291
273
 
292
274
  query AvailablePromos($filter: PromoFilterInput) {
293
275
  availablePromos(filter: $filter) {
294
276
  ...PromoFragment
295
277
  }
296
278
  }
297
- `, Re = n`
298
- ${E}
279
+ `, Ie = o`
280
+ ${_}
299
281
 
300
282
  query Bonus {
301
283
  bonus {
@@ -323,8 +305,8 @@ const fe = n`
323
305
  dateTimeLastUpdated
324
306
  }
325
307
  }
326
- `, Ie = n`
327
- ${fe}
308
+ `, Ge = o`
309
+ ${we}
328
310
 
329
311
  query CashbackBonuses {
330
312
  cashbackBonuses {
@@ -337,7 +319,7 @@ const fe = n`
337
319
  dateTimeLastUpdated
338
320
  }
339
321
  }
340
- `, Ge = n`
322
+ `, Pe = o`
341
323
  mutation ClaimCashbackBonus($input: ClaimCashbackBonusInput!) {
342
324
  claimCashbackBonus(input: $input) {
343
325
  ... on CashbackBonusDoesNotExistError {
@@ -346,7 +328,7 @@ const fe = n`
346
328
  }
347
329
  }
348
330
  }
349
- `, $e = n`
331
+ `, $e = o`
350
332
  query DepositRecords($after: Cursor, $first: Int, $filter: DepositRecordFilterInput) {
351
333
  member {
352
334
  depositRecords(after: $after, first: $first, filter: $filter) {
@@ -375,7 +357,7 @@ const fe = n`
375
357
  }
376
358
  }
377
359
  }
378
- `, Pe = n`
360
+ `, Ue = o`
379
361
  mutation CreateGCashDeposit($input: CreateGCashDepositInput!) {
380
362
  createGCashDeposit(input: $input) {
381
363
  ... on DepositPromoMaximumAmountExceededError {
@@ -412,7 +394,7 @@ const fe = n`
412
394
  }
413
395
  }
414
396
  }
415
- `, We = n`
397
+ `, xe = o`
416
398
  mutation CreateMayaDeposit($input: CreateMayaDepositInput!) {
417
399
  createMayaDeposit(input: $input) {
418
400
  ... on DepositPromoMaximumAmountExceededError {
@@ -449,7 +431,7 @@ const fe = n`
449
431
  }
450
432
  }
451
433
  }
452
- `, Be = n`
434
+ `, We = o`
453
435
  mutation CreateMayaAppDeposit($input: CreateMayaAppDepositInput!) {
454
436
  createMayaAppDeposit(input: $input) {
455
437
  ... on DepositPromoMaximumAmountExceededError {
@@ -486,7 +468,7 @@ const fe = n`
486
468
  }
487
469
  }
488
470
  }
489
- `, Ue = n`
471
+ `, Be = o`
490
472
  query Deposit($id: ObjectId!) {
491
473
  node(id: $id) {
492
474
  ... on GCashDeposit {
@@ -521,25 +503,24 @@ const fe = n`
521
503
  fee
522
504
  status
523
505
  reference
524
- checkoutUrl
525
506
  dateTimeCreated
526
507
  dateTimeLastUpdated
527
508
  }
528
509
  }
529
510
  }
530
- `, xe = n`
511
+ `, Oe = o`
531
512
  query DepositsCount {
532
513
  member {
533
514
  depositsCount
534
515
  }
535
516
  }
536
- `, qe = n`
517
+ `, qe = o`
537
518
  query Member {
538
519
  member {
539
520
  dateTimeLastActive
540
521
  }
541
522
  }
542
- `, Oe = n`
523
+ `, Fe = o`
543
524
  query MemberAccount {
544
525
  memberAccount: self {
545
526
  ... on MemberAccount {
@@ -557,13 +538,14 @@ const fe = n`
557
538
  mobileNumberVerified
558
539
  mobileNumberVerificationRequired
559
540
  transactionPassword
541
+ secretAnswerSubmitted
560
542
  dateTimeCreated
561
543
  dateTimeLastUpdated
562
544
  }
563
545
  }
564
546
  }
565
- `, Fe = n`
566
- ${A}
547
+ `, Le = o`
548
+ ${C}
567
549
 
568
550
  query MemberVerification {
569
551
  memberAccount: self {
@@ -586,7 +568,7 @@ const fe = n`
586
568
  }
587
569
  }
588
570
  }
589
- `, Le = n`
571
+ `, Ve = o`
590
572
  mutation RegisterMemberAccount(
591
573
  $input: RegisterMemberAccountInput!
592
574
  $referralCode: String
@@ -629,7 +611,7 @@ const fe = n`
629
611
  }
630
612
  }
631
613
  }
632
- `, Ve = n`
614
+ `, He = o`
633
615
  mutation UpdateMemberAccount($input: UpdateMemberAccountInput!) {
634
616
  updateMemberAccount(input: $input) {
635
617
  ... on AccountNameNotAvailableError {
@@ -662,7 +644,7 @@ const fe = n`
662
644
  }
663
645
  }
664
646
  }
665
- `, He = n`
647
+ `, Ye = o`
666
648
  mutation ResetPassword($input: ResetPasswordInput!, $verificationCode: String) {
667
649
  resetPassword(input: $input, verificationCode: $verificationCode) {
668
650
  ... on AccountNotFoundError {
@@ -675,11 +657,11 @@ const fe = n`
675
657
  }
676
658
  }
677
659
  }
678
- `, Ye = n`
660
+ `, Qe = o`
679
661
  mutation DeleteMemberAccount($input: DeleteMemberAccountInput!) {
680
662
  deleteMemberAccount(input: $input)
681
663
  }
682
- `, je = n`
664
+ `, je = o`
683
665
  mutation SendVerificationCode($input: SendVerificationCodeInput!) {
684
666
  sendVerificationCode(input: $input) {
685
667
  ... on InvalidPlatformError {
@@ -692,7 +674,7 @@ const fe = n`
692
674
  }
693
675
  }
694
676
  }
695
- `, Qe = n`
677
+ `, Ke = o`
696
678
  mutation VerifyMobileNumber($input: VerifyMobileNumberInput!) {
697
679
  verifyMobileNumber(input: $input) {
698
680
  ... on InvalidSMSVerificationCodeError {
@@ -705,7 +687,7 @@ const fe = n`
705
687
  }
706
688
  }
707
689
  }
708
- `, Ke = n`
690
+ `, ze = o`
709
691
  mutation CreateMemberVerification($input: CreateMemberVerificationInput!) {
710
692
  createMemberVerification(input: $input) {
711
693
  ... on FileDoesNotExistError {
@@ -722,7 +704,7 @@ const fe = n`
722
704
  }
723
705
  }
724
706
  }
725
- `, ze = n`
707
+ `, Je = o`
726
708
  mutation UpdateMemberVerification($input: UpdateMemberVerificationInput!) {
727
709
  updateMemberVerification(input: $input) {
728
710
  ... on FileDoesNotExistError {
@@ -743,7 +725,7 @@ const fe = n`
743
725
  }
744
726
  }
745
727
  }
746
- `, Je = n`
728
+ `, Xe = o`
747
729
  query ProfileCompletion {
748
730
  profileCompletion {
749
731
  completionPercentage
@@ -754,7 +736,7 @@ const fe = n`
754
736
  accountPassword
755
737
  }
756
738
  }
757
- `, Ze = n`
739
+ `, Ze = o`
758
740
  fragment DepositGatewaySettingsCoreData on DepositGatewaySettings {
759
741
  minimumAmount
760
742
  maximumAmount
@@ -808,7 +790,7 @@ const fe = n`
808
790
  multiplier
809
791
  }
810
792
  }
811
- `, Xe = n`
793
+ `, et = o`
812
794
  query PointsWallet {
813
795
  pointsWallet {
814
796
  id
@@ -817,16 +799,24 @@ const fe = n`
817
799
  dateTimeCreated
818
800
  }
819
801
  }
820
- `, et = n`
802
+ `, tt = o`
821
803
  mutation PointsToCashConversion($input: PointsToCashConversionInput!) {
822
804
  pointsToCashConversion(input: $input) {
823
805
  ... on InsufficientPointsError {
806
+ code: __typename
824
807
  message
825
- __typename
826
808
  }
827
809
  }
828
810
  }
829
- `, tt = n`
811
+ `, at = o`
812
+ query MayaSession($id: ObjectId!) {
813
+ mayaSession(id: $id) {
814
+ id
815
+ member
816
+ dateTimeCreated
817
+ }
818
+ }
819
+ `, rt = o`
830
820
  query TransactionRecords($first: Int, $after: Cursor, $filter: TransactionRecordFilter) {
831
821
  member {
832
822
  transactionRecords(first: $first, after: $after, filter: $filter) {
@@ -852,7 +842,7 @@ const fe = n`
852
842
  }
853
843
  }
854
844
  }
855
- `, at = n`
845
+ `, nt = o`
856
846
  query Wallet {
857
847
  wallet {
858
848
  id
@@ -862,7 +852,7 @@ const fe = n`
862
852
  dateTimeLastUpdated
863
853
  }
864
854
  }
865
- `, rt = n`
855
+ `, st = o`
866
856
  query WithdrawalRecords($first: Int, $after: Cursor, $filter: WithdrawalRecordFilterInput) {
867
857
  member {
868
858
  withdrawalRecords(first: $first, after: $after, filter: $filter) {
@@ -929,7 +919,7 @@ const fe = n`
929
919
  }
930
920
  }
931
921
  }
932
- `, ot = n`
922
+ `, ot = o`
933
923
  mutation CreateGCashWithdrawal($input: CreateGCashWithdrawalInput!) {
934
924
  createGCashWithdrawal(input: $input) {
935
925
  ... on AccountNotVerifiedError {
@@ -958,7 +948,7 @@ const fe = n`
958
948
  }
959
949
  }
960
950
  }
961
- `, nt = n`
951
+ `, it = o`
962
952
  mutation CreateMayaWithdrawal($input: CreateMayaWithdrawalInput!) {
963
953
  createMayaWithdrawal(input: $input) {
964
954
  ... on AccountNotVerifiedError {
@@ -987,7 +977,7 @@ const fe = n`
987
977
  }
988
978
  }
989
979
  }
990
- `, it = n`
980
+ `, dt = o`
991
981
  mutation CreateMayaAppWithdrawal($input: CreateMayaAppWithdrawalInput!) {
992
982
  createMayaAppWithdrawal(input: $input) {
993
983
  ... on AccountNotVerifiedError {
@@ -1012,7 +1002,7 @@ const fe = n`
1012
1002
  }
1013
1003
  }
1014
1004
  }
1015
- `, st = n`
1005
+ `, ct = o`
1016
1006
  mutation CreateBankWithdrawal($input: CreateBankWithdrawalInput!) {
1017
1007
  createBankWithdrawal(input: $input) {
1018
1008
  ... on MobileNumberNotVerifiedError {
@@ -1041,29 +1031,26 @@ const fe = n`
1041
1031
  }
1042
1032
  }
1043
1033
  }
1044
- `, dt = n`
1034
+ `, mt = o`
1045
1035
  query RemainingDailyWithdrawalsCount {
1046
1036
  remainingDailyWithdrawalsCount
1047
1037
  }
1048
1038
  `;
1049
- class mt {
1039
+ class ut {
1050
1040
  constructor(e) {
1051
- d(this, "client");
1041
+ c(this, "client");
1052
1042
  this.client = e;
1053
1043
  }
1054
1044
  /** aka `Query.self` */
1055
1045
  async memberAccount() {
1056
- const e = await this.client.request(Oe);
1046
+ const e = await this.client.request(Fe);
1057
1047
  return e.ok ? {
1058
1048
  ok: !0,
1059
1049
  data: e.data.memberAccount
1060
1050
  } : e;
1061
1051
  }
1062
1052
  async registerMemberAccount(e) {
1063
- const t = await this.client.request(
1064
- Le,
1065
- e
1066
- );
1053
+ const t = await this.client.request(Ve, e);
1067
1054
  return t.ok ? t.data.registerMemberAccount ? {
1068
1055
  ok: !1,
1069
1056
  error: t.data.registerMemberAccount
@@ -1072,10 +1059,7 @@ class mt {
1072
1059
  } : t;
1073
1060
  }
1074
1061
  async updateMemberAccount(e) {
1075
- const t = await this.client.request(
1076
- Ve,
1077
- e
1078
- );
1062
+ const t = await this.client.request(He, e);
1079
1063
  return t.ok ? t.data.updateMemberAccount ? {
1080
1064
  ok: !1,
1081
1065
  error: t.data.updateMemberAccount
@@ -1084,10 +1068,7 @@ class mt {
1084
1068
  } : t;
1085
1069
  }
1086
1070
  async deleteMemberAccount(e) {
1087
- const t = await this.client.request(
1088
- Ye,
1089
- e
1090
- );
1071
+ const t = await this.client.request(Qe, e);
1091
1072
  return t.ok ? t.data.deleteMemberAccount ? {
1092
1073
  ok: !0
1093
1074
  } : {
@@ -1100,7 +1081,7 @@ class mt {
1100
1081
  }
1101
1082
  async resetPassword(e) {
1102
1083
  const t = await this.client.request(
1103
- He,
1084
+ Ye,
1104
1085
  e
1105
1086
  );
1106
1087
  return t.ok ? t.data.resetPassword ? {
@@ -1111,17 +1092,14 @@ class mt {
1111
1092
  } : t;
1112
1093
  }
1113
1094
  async profileCompletion() {
1114
- const e = await this.client.request(Je);
1095
+ const e = await this.client.request(Xe);
1115
1096
  return e.ok ? { ok: !0, data: e.data.profileCompletion } : e;
1116
1097
  }
1117
1098
  async platform() {
1118
1099
  return await this.client.request(Ze);
1119
1100
  }
1120
1101
  async sendVerificationCode(e) {
1121
- const t = await this.client.request(
1122
- je,
1123
- e
1124
- );
1102
+ const t = await this.client.request(je, e);
1125
1103
  return t.ok ? t.data.sendVerificationCode ? {
1126
1104
  ok: !1,
1127
1105
  error: t.data.sendVerificationCode
@@ -1130,10 +1108,7 @@ class mt {
1130
1108
  } : t;
1131
1109
  }
1132
1110
  async verifyMobileNumber(e) {
1133
- const t = await this.client.request(
1134
- Qe,
1135
- e
1136
- );
1111
+ const t = await this.client.request(Ke, e);
1137
1112
  return t.ok ? t.data.verifyMobileNumber ? {
1138
1113
  ok: !1,
1139
1114
  error: t.data.verifyMobileNumber
@@ -1142,10 +1117,7 @@ class mt {
1142
1117
  } : t;
1143
1118
  }
1144
1119
  async createMemberVerification(e) {
1145
- const t = await this.client.request(
1146
- Ke,
1147
- e
1148
- );
1120
+ const t = await this.client.request(ze, e);
1149
1121
  return t.ok ? t.data.createMemberVerification ? {
1150
1122
  ok: !1,
1151
1123
  error: t.data.createMemberVerification
@@ -1154,10 +1126,7 @@ class mt {
1154
1126
  } : t;
1155
1127
  }
1156
1128
  async updateMemberVerification(e) {
1157
- const t = await this.client.request(
1158
- ze,
1159
- e
1160
- );
1129
+ const t = await this.client.request(Je, e);
1161
1130
  return t.ok ? t.data.updateMemberVerification ? {
1162
1131
  ok: !1,
1163
1132
  error: t.data.updateMemberVerification
@@ -1166,14 +1135,17 @@ class mt {
1166
1135
  } : t;
1167
1136
  }
1168
1137
  async memberVerification() {
1169
- const e = await this.client.request(Fe);
1138
+ const e = await this.client.request(Le);
1170
1139
  return e.ok ? {
1171
1140
  ok: !0,
1172
1141
  data: e.data.memberAccount.verification
1173
1142
  } : e;
1174
1143
  }
1175
1144
  async announcements(e) {
1176
- const t = await this.client.request(be, e);
1145
+ const t = await this.client.request(
1146
+ Se,
1147
+ e
1148
+ );
1177
1149
  return t.ok ? {
1178
1150
  ok: !0,
1179
1151
  data: t.data.announcements
@@ -1181,204 +1153,256 @@ class mt {
1181
1153
  }
1182
1154
  }
1183
1155
  function h(i, e) {
1184
- const t = S[i] ? S[i] : S[500];
1156
+ const t = T[i] ? T[i] : T[500];
1185
1157
  return {
1186
1158
  code: t.code,
1187
1159
  message: e ?? t.message
1188
1160
  };
1189
1161
  }
1190
- const S = {
1191
- 400: {
1192
- code: "HttpBadRequest",
1193
- message: "Bad Request"
1194
- },
1195
- 401: {
1196
- code: "HttpUnauthorized",
1197
- message: "Unauthorized"
1198
- },
1199
- 403: {
1200
- code: "HttpForbidden",
1201
- message: "Forbidden"
1202
- },
1203
- 404: {
1204
- code: "HttpNotFound",
1205
- message: "Not Found"
1206
- },
1207
- 408: {
1208
- code: "HttpRequestTimeout",
1209
- message: "Request Timeout"
1210
- },
1211
- 429: {
1212
- code: "HttpTooManyRequests",
1213
- message: "Too Many Requests"
1214
- },
1215
- 500: {
1216
- code: "HttpInternalServerError",
1217
- message: "Internal Server Error"
1218
- },
1219
- 502: {
1220
- code: "HttpBadGateway",
1221
- message: "Bad Gateway"
1222
- },
1223
- 503: {
1224
- code: "HttpServiceUnavailable",
1225
- message: "Service Unavailable"
1226
- },
1227
- 504: {
1228
- code: "HttpGatewayTimeout",
1229
- message: "Gateway Timeout"
1230
- }
1162
+ const T = {
1163
+ 400: { code: "HttpBadRequest", message: "Bad Request" },
1164
+ 401: { code: "HttpUnauthorized", message: "Unauthorized" },
1165
+ 403: { code: "HttpForbidden", message: "Forbidden" },
1166
+ 404: { code: "HttpNotFound", message: "Not Found" },
1167
+ 408: { code: "HttpRequestTimeout", message: "Request Timeout" },
1168
+ 429: { code: "HttpTooManyRequests", message: "Too Many Requests" },
1169
+ 500: { code: "HttpInternalServerError", message: "Internal Server Error" }
1231
1170
  };
1232
- async function p(i) {
1233
- const e = new TextEncoder().encode(i), t = await crypto.subtle.digest("SHA-256", e);
1234
- return Array.from(new Uint8Array(t)).map((s) => s.toString(16).padStart(2, "0")).join("");
1235
- }
1236
- class ct {
1237
- constructor(e) {
1238
- d(this, "url");
1239
- d(this, "platform");
1240
- this.url = e.url, this.platform = e.platform;
1171
+ class lt {
1172
+ constructor(e, t) {
1173
+ c(this, "url");
1174
+ c(this, "options");
1175
+ c(this, "middlewares");
1176
+ var r;
1177
+ const a = new Headers((r = t == null ? void 0 : t.fetchOptions) == null ? void 0 : r.headers);
1178
+ a.append("Content-Type", "application/json"), this.url = e, this.options = { ...t == null ? void 0 : t.fetchOptions, headers: a }, this.middlewares = (t == null ? void 0 : t.middlewares) ?? [];
1241
1179
  }
1242
- async createSession(e) {
1243
- const t = new Headers();
1244
- if (t.set("Content-Type", "application/json"), t.set("Platform-Code", this.platform), t.set("Role", "MEMBER"), "name" in e) {
1245
- const a = `${e.name}:${await p(e.password)}`, r = Buffer.from(a).toString("base64");
1246
- t.set("Authorization", `Basic ${r}`);
1247
- }
1248
- if ("mobileNumber" in e) {
1249
- const a = `${e.mobileNumber}:${e.verificationCode}`, r = Buffer.from(a).toString("base64");
1250
- t.set("Authorization", `Basic ${r}`);
1251
- }
1180
+ async post(e, t) {
1181
+ const a = new URL(this.url);
1182
+ a.pathname = e, t != null && t.searchParams && t.searchParams.forEach((d, m) => {
1183
+ a.searchParams.append(m, d);
1184
+ });
1185
+ const r = t != null && t.body ? JSON.stringify(t.body) : void 0, n = await this.runMiddlewares(
1186
+ new Request(a, {
1187
+ ...this.options,
1188
+ body: r,
1189
+ method: "POST"
1190
+ })
1191
+ );
1192
+ t != null && t.headers && new Headers(t.headers).forEach((d, m) => {
1193
+ n.headers.set(m, d);
1194
+ });
1252
1195
  try {
1253
- const a = await fetch(`${this.url}/sessions`, {
1254
- method: "POST",
1255
- headers: t
1256
- }), r = await a.json();
1257
- return a.status === 401 || a.status === 403 ? r.code === "ACCOUNT_BLACKLISTED" ? {
1258
- ok: !1,
1259
- error: {
1260
- code: "AccountBlacklisted",
1261
- message: "Account is blacklisted"
1262
- }
1263
- } : {
1264
- ok: !1,
1265
- error: {
1266
- code: "AccountNotFound",
1267
- message: "Account not found."
1268
- }
1269
- } : a.ok ? {
1196
+ const d = await fetch(n);
1197
+ return d.ok ? {
1270
1198
  ok: !0,
1271
- data: r
1199
+ data: await d.json()
1272
1200
  } : {
1273
1201
  ok: !1,
1274
- error: h(a.status)
1202
+ error: await this.safeToJson(d) ?? h(d.status)
1275
1203
  };
1276
1204
  } catch {
1277
1205
  return {
1278
1206
  ok: !1,
1279
1207
  error: {
1280
- code: "UnknownError",
1208
+ code: "HttpInternalServerError",
1281
1209
  message: "Something went wrong."
1282
1210
  }
1283
1211
  };
1284
1212
  }
1285
1213
  }
1286
- async refreshSession(e) {
1214
+ async get(e, t) {
1215
+ const a = new URL(this.url);
1216
+ a.pathname = e, t != null && t.searchParams && t.searchParams.forEach((n, d) => {
1217
+ a.searchParams.append(d, n);
1218
+ });
1219
+ const r = await this.runMiddlewares(
1220
+ new Request(a, {
1221
+ ...this.options,
1222
+ method: "GET"
1223
+ })
1224
+ );
1225
+ t != null && t.headers && new Headers(t.headers).forEach((n, d) => {
1226
+ r.headers.set(d, n);
1227
+ });
1287
1228
  try {
1288
- const t = await fetch(`${this.url}/session:refresh`, {
1289
- method: "POST",
1290
- headers: {
1291
- "Content-Type": "application/json",
1292
- Authorization: `Bearer ${e}`,
1293
- "Platform-Code": this.platform,
1294
- Role: "MEMBER"
1295
- }
1296
- }), a = await t.json();
1297
- return t.status === 401 || t.status === 403 ? a.code === "ACCOUNT_BLACKLISTED" ? {
1298
- ok: !1,
1299
- error: {
1300
- code: "AccountBlacklisted",
1301
- message: "Account is blacklisted"
1302
- }
1303
- } : {
1304
- ok: !1,
1305
- error: {
1306
- code: "InvalidToken",
1307
- message: "Invalid token."
1308
- }
1309
- } : t.ok ? {
1229
+ const n = await fetch(r);
1230
+ return n.ok ? {
1310
1231
  ok: !0,
1311
- data: a
1232
+ data: await n.json()
1312
1233
  } : {
1313
1234
  ok: !1,
1314
- error: h(t.status)
1235
+ error: await this.safeToJson(n) ?? h(n.status)
1315
1236
  };
1316
1237
  } catch {
1317
1238
  return {
1318
1239
  ok: !1,
1319
1240
  error: {
1320
- code: "UnknownError",
1241
+ code: "HttpInternalServerError",
1321
1242
  message: "Something went wrong."
1322
1243
  }
1323
1244
  };
1324
1245
  }
1325
1246
  }
1326
- async destroySession(e) {
1247
+ async delete(e, t) {
1248
+ const a = new URL(this.url);
1249
+ a.pathname = e, t != null && t.searchParams && t.searchParams.forEach((n, d) => {
1250
+ a.searchParams.append(d, n);
1251
+ });
1252
+ const r = await this.runMiddlewares(
1253
+ new Request(a, {
1254
+ ...this.options,
1255
+ method: "DELETE"
1256
+ })
1257
+ );
1258
+ t != null && t.headers && new Headers(t.headers).forEach((n, d) => {
1259
+ r.headers.set(d, n);
1260
+ });
1327
1261
  try {
1328
- const t = await fetch(`${this.url}/session`, {
1329
- method: "DELETE",
1330
- headers: {
1331
- "Content-Type": "application/json",
1332
- Authorization: `Bearer ${e}`,
1333
- "Platform-Code": this.platform,
1334
- Role: "MEMBER"
1335
- }
1336
- });
1337
- return t.ok ? { ok: !0 } : {
1262
+ const n = await fetch(r);
1263
+ return n.ok ? {
1264
+ ok: !0
1265
+ } : {
1338
1266
  ok: !1,
1339
- error: h(t.status)
1267
+ error: h(n.status)
1340
1268
  };
1341
1269
  } catch {
1342
1270
  return {
1343
1271
  ok: !1,
1344
1272
  error: {
1345
- code: "UnknownError",
1273
+ code: "HttpInternalServerError",
1346
1274
  message: "Something went wrong."
1347
1275
  }
1348
1276
  };
1349
1277
  }
1350
1278
  }
1351
- async verifySession(e) {
1279
+ async runMiddlewares(e) {
1280
+ let t = e.clone();
1281
+ for (const a of this.middlewares)
1282
+ t = await a(t);
1283
+ return t;
1284
+ }
1285
+ async safeToJson(e) {
1352
1286
  try {
1353
- const t = await fetch(`${this.url}/session`, {
1354
- method: "GET",
1355
- headers: {
1356
- "Content-Type": "application/json",
1357
- Authorization: `Bearer ${e}`,
1358
- "Platform-Code": this.platform,
1359
- Role: "MEMBER"
1360
- }
1361
- });
1362
- if (t.status === 403 || t.status === 401) return !1;
1287
+ return await e.json();
1363
1288
  } catch {
1289
+ return null;
1364
1290
  }
1365
- return !0;
1366
1291
  }
1367
1292
  }
1368
- class ut {
1293
+ class pt {
1369
1294
  constructor(e) {
1370
- d(this, "client");
1295
+ c(this, "client");
1296
+ this.client = new lt(e.url, {
1297
+ middlewares: [
1298
+ (t) => (t.headers.set("Platform-Code", e.platform), t.headers.set("Role", "MEMBER"), t)
1299
+ ]
1300
+ });
1301
+ }
1302
+ async createSession(e) {
1303
+ const t = new Headers();
1304
+ switch (e.type) {
1305
+ case "NAME_AND_PASSWORD": {
1306
+ const r = `${e.name}:${e.password}`, n = Buffer.from(r).toString("base64");
1307
+ t.set("Authorization", `Basic ${n}`);
1308
+ break;
1309
+ }
1310
+ case "MOBILE_NUMBER": {
1311
+ const r = `${e.mobileNumber}:${e.verificationCode}`, n = Buffer.from(r).toString("base64");
1312
+ t.set("Authorization", `MobileNumberOTP ${n}`);
1313
+ break;
1314
+ }
1315
+ case "MAYA": {
1316
+ t.set("Authorization", `Maya ${e.sessionId}`);
1317
+ break;
1318
+ }
1319
+ }
1320
+ const a = await this.client.post("/sessions", {
1321
+ headers: t
1322
+ });
1323
+ return a.ok ? a : a.error.code === "ACCOUNT_BLACKLISTED" ? {
1324
+ ok: !1,
1325
+ error: {
1326
+ code: "AccountBlacklisted",
1327
+ message: "Account is blacklisted"
1328
+ }
1329
+ } : a.error.code === "HttpForbidden" || a.error.code === "HttpUnauthorized" ? {
1330
+ ok: !1,
1331
+ error: {
1332
+ code: "AccountNotFound",
1333
+ message: "Invalid credentials."
1334
+ }
1335
+ } : a;
1336
+ }
1337
+ async authenticate(e) {
1338
+ if (e.type === "SECURITY_QUESTION") {
1339
+ const t = await this.client.post(
1340
+ `/session/${e.token}/authenticate`,
1341
+ {
1342
+ body: {
1343
+ secretAnswer: e.secretAnswer
1344
+ }
1345
+ }
1346
+ );
1347
+ return t.ok ? t : t.error.code === "HttpForbidden" || t.error.code === "HttpUnauthorized" ? {
1348
+ ok: !1,
1349
+ error: {
1350
+ code: "InvalidTokenOrAnswer",
1351
+ message: "Invalid token or secret answer"
1352
+ }
1353
+ } : t;
1354
+ }
1355
+ throw new Error("Invalid input 'type'");
1356
+ }
1357
+ async refreshSession(e) {
1358
+ const t = await this.client.post("/session:refresh", {
1359
+ headers: {
1360
+ Authorization: `Bearer ${e}`
1361
+ }
1362
+ });
1363
+ return t.ok ? t : t.error.code === "ACCOUNT_BLACKLISTED" ? {
1364
+ ok: !1,
1365
+ error: {
1366
+ code: "AccountBlacklisted",
1367
+ message: "Account is blacklisted"
1368
+ }
1369
+ } : t.error.code === "HttpForbidden" || t.error.code === "HttpUnauthorized" ? {
1370
+ ok: !1,
1371
+ error: {
1372
+ code: "InvalidToken",
1373
+ message: "Invalid token."
1374
+ }
1375
+ } : t;
1376
+ }
1377
+ async destroySession(e) {
1378
+ return await this.client.delete("/session", {
1379
+ headers: {
1380
+ Authorization: `Bearer ${e}`
1381
+ }
1382
+ });
1383
+ }
1384
+ async verifySession(e) {
1385
+ return (await this.client.get("/session", {
1386
+ headers: {
1387
+ Authorization: `Bearer ${e}`
1388
+ }
1389
+ })).ok;
1390
+ }
1391
+ }
1392
+ class ht {
1393
+ constructor(e) {
1394
+ c(this, "client");
1371
1395
  this.client = e;
1372
1396
  }
1373
1397
  async file(e) {
1374
- const t = await this.client.request(me, e);
1398
+ const t = await this.client.request(pe, e);
1375
1399
  return t.ok ? {
1376
1400
  ok: !0,
1377
1401
  data: t.data.node
1378
1402
  } : t;
1379
1403
  }
1380
1404
  async uploadPrivateImageFile(e) {
1381
- const t = await this.client.upload(me, e);
1405
+ const t = await this.client.upload(pe, e);
1382
1406
  return t.ok ? t.data.uploadPrivateImageFile ? {
1383
1407
  ok: !1,
1384
1408
  error: t.data.uploadPrivateImageFile
@@ -1387,9 +1411,9 @@ class ut {
1387
1411
  } : t;
1388
1412
  }
1389
1413
  }
1390
- class we {
1414
+ class fe {
1391
1415
  constructor(e) {
1392
- d(this, "client");
1416
+ c(this, "client");
1393
1417
  this.client = e;
1394
1418
  }
1395
1419
  async game(e) {
@@ -1397,22 +1421,25 @@ class we {
1397
1421
  return t.ok ? { ok: !0, data: t.data.node } : t;
1398
1422
  }
1399
1423
  async games(e) {
1400
- const t = await this.client.request(Se, e);
1424
+ const t = await this.client.request(Ee, e);
1401
1425
  return t.ok ? { ok: !0, data: t.data.games } : t;
1402
1426
  }
1403
1427
  async gamesByName(e) {
1404
- const t = await this.client.request(Ee, e);
1428
+ const t = await this.client.request(
1429
+ ke,
1430
+ e
1431
+ );
1405
1432
  return t.ok ? { ok: !0, data: t.data.gamesByName } : t;
1406
1433
  }
1407
1434
  async gameSession(e) {
1408
- const t = await this.client.request(ke, e);
1409
- return t.ok ? { ok: !0, data: t.data.node } : t;
1410
- }
1411
- async createGameSession(e) {
1412
1435
  const t = await this.client.request(
1413
1436
  Ce,
1414
1437
  e
1415
1438
  );
1439
+ return t.ok ? { ok: !0, data: t.data.node } : t;
1440
+ }
1441
+ async createGameSession(e) {
1442
+ const t = await this.client.request(Te, e);
1416
1443
  return t.ok ? t.data.createGameSession ? {
1417
1444
  ok: !1,
1418
1445
  error: t.data.createGameSession
@@ -1422,7 +1449,7 @@ class we {
1422
1449
  }
1423
1450
  async endGameSession(e) {
1424
1451
  const t = await this.client.request(
1425
- Te,
1452
+ _e,
1426
1453
  e
1427
1454
  );
1428
1455
  return t.ok ? t.data.endGameSession ? {
@@ -1436,35 +1463,38 @@ class we {
1436
1463
  } : t;
1437
1464
  }
1438
1465
  }
1439
- class lt {
1466
+ class wt {
1440
1467
  constructor(e) {
1441
- d(this, "client");
1468
+ c(this, "client");
1442
1469
  this.client = e;
1443
1470
  }
1444
1471
  async betRecords(e) {
1445
- const t = await this.client.request(_e, e);
1446
- return t.ok ? { ok: t.ok, data: t.data.member.betRecords } : t;
1447
- }
1448
- async transactionRecords(e) {
1449
1472
  const t = await this.client.request(
1450
- tt,
1473
+ ve,
1451
1474
  e
1452
1475
  );
1476
+ return t.ok ? { ok: t.ok, data: t.data.member.betRecords } : t;
1477
+ }
1478
+ async transactionRecords(e) {
1479
+ const t = await this.client.request(rt, e);
1453
1480
  return t.ok ? { ok: t.ok, data: t.data.member.transactionRecords } : t;
1454
1481
  }
1455
1482
  async withdrawalRecords(e) {
1456
1483
  const t = await this.client.request(
1457
- rt,
1484
+ st,
1458
1485
  e
1459
1486
  );
1460
1487
  return t.ok ? { ok: t.ok, data: t.data.member.withdrawalRecords } : t;
1461
1488
  }
1462
1489
  async depositRecords(e) {
1463
- const t = await this.client.request($e, e);
1490
+ const t = await this.client.request(
1491
+ $e,
1492
+ e
1493
+ );
1464
1494
  return t.ok ? { ok: t.ok, data: t.data.member.depositRecords } : t;
1465
1495
  }
1466
1496
  async depositsCount() {
1467
- const e = await this.client.request(xe);
1497
+ const e = await this.client.request(Oe);
1468
1498
  return e.ok ? { ok: e.ok, data: e.data.member.depositsCount } : e;
1469
1499
  }
1470
1500
  async member() {
@@ -1472,9 +1502,9 @@ class lt {
1472
1502
  return e.ok ? { ok: e.ok, data: e.data.member } : e;
1473
1503
  }
1474
1504
  }
1475
- class pt {
1505
+ class ft {
1476
1506
  constructor(e) {
1477
- d(this, "url");
1507
+ c(this, "url");
1478
1508
  this.url = e.url;
1479
1509
  }
1480
1510
  gameThumbnails(e) {
@@ -1484,28 +1514,28 @@ class pt {
1484
1514
  ];
1485
1515
  }
1486
1516
  }
1487
- class ht extends we {
1517
+ class gt extends fe {
1488
1518
  async promos() {
1489
- const e = await this.client.request(Me);
1519
+ const e = await this.client.request(Ne);
1490
1520
  return e.ok ? { ok: e.ok, data: e.data.promos } : e;
1491
1521
  }
1492
1522
  async cashbacks() {
1493
- const e = await this.client.request(De);
1523
+ const e = await this.client.request(Me);
1494
1524
  return e.ok ? { ok: e.ok, data: e.data.cashbacks } : e;
1495
1525
  }
1496
1526
  async availablePromos(e) {
1497
- const t = await this.client.request(Ne, e);
1527
+ const t = await this.client.request(
1528
+ Re,
1529
+ e
1530
+ );
1498
1531
  return t.ok ? { ok: t.ok, data: t.data.availablePromos } : t;
1499
1532
  }
1500
1533
  async cashbackBonuses() {
1501
- const e = await this.client.request(Ie);
1534
+ const e = await this.client.request(Ge);
1502
1535
  return e.ok ? { ok: e.ok, data: e.data.cashbackBonuses } : e;
1503
1536
  }
1504
1537
  async claimCashbackBonus(e) {
1505
- const t = await this.client.request(
1506
- Ge,
1507
- e
1508
- );
1538
+ const t = await this.client.request(Pe, e);
1509
1539
  return t.ok ? t.data.claimCashbackBonus ? {
1510
1540
  ok: !1,
1511
1541
  error: t.data.claimCashbackBonus
@@ -1517,22 +1547,22 @@ class ht extends we {
1517
1547
  };
1518
1548
  }
1519
1549
  async bonus() {
1520
- const e = await this.client.request(Re);
1550
+ const e = await this.client.request(Ie);
1521
1551
  return e.ok ? { ok: e.ok, data: e.data.bonus } : e;
1522
1552
  }
1523
1553
  async wallet() {
1524
- const e = await this.client.request(at);
1554
+ const e = await this.client.request(nt);
1525
1555
  return e.ok ? { ok: e.ok, data: e.data.wallet } : e;
1526
1556
  }
1527
1557
  async deposit(e) {
1528
- const t = await this.client.request(Ue, e);
1529
- return t.ok ? { ok: t.ok, data: t.data.node } : t;
1530
- }
1531
- async createGCashDeposit(e) {
1532
1558
  const t = await this.client.request(
1533
- Pe,
1559
+ Be,
1534
1560
  e
1535
1561
  );
1562
+ return t.ok ? { ok: t.ok, data: t.data.node } : t;
1563
+ }
1564
+ async createGCashDeposit(e) {
1565
+ const t = await this.client.request(Ue, e);
1536
1566
  return t.ok ? t.data.createGCashDeposit ? {
1537
1567
  ok: !1,
1538
1568
  error: t.data.createGCashDeposit
@@ -1541,10 +1571,7 @@ class ht extends we {
1541
1571
  } : t;
1542
1572
  }
1543
1573
  async createMayaDeposit(e) {
1544
- const t = await this.client.request(
1545
- We,
1546
- e
1547
- );
1574
+ const t = await this.client.request(xe, e);
1548
1575
  return t.ok ? t.data.createMayaDeposit ? {
1549
1576
  ok: !1,
1550
1577
  error: t.data.createMayaDeposit
@@ -1553,10 +1580,7 @@ class ht extends we {
1553
1580
  } : t;
1554
1581
  }
1555
1582
  async createMayaAppDeposit(e) {
1556
- const t = await this.client.request(
1557
- Be,
1558
- e
1559
- );
1583
+ const t = await this.client.request(We, e);
1560
1584
  return t.ok ? t.data.createMayaAppDeposit ? {
1561
1585
  ok: !1,
1562
1586
  error: t.data.createMayaAppDeposit
@@ -1565,10 +1589,7 @@ class ht extends we {
1565
1589
  } : t;
1566
1590
  }
1567
1591
  async createGCashWithdrawal(e) {
1568
- const t = await this.client.request(
1569
- ot,
1570
- e
1571
- );
1592
+ const t = await this.client.request(ot, e);
1572
1593
  return t.ok ? t.data.createGCashWithdrawal ? {
1573
1594
  ok: !1,
1574
1595
  error: t.data.createGCashWithdrawal
@@ -1577,10 +1598,7 @@ class ht extends we {
1577
1598
  } : t;
1578
1599
  }
1579
1600
  async createMayaWithdrawal(e) {
1580
- const t = await this.client.request(
1581
- nt,
1582
- e
1583
- );
1601
+ const t = await this.client.request(it, e);
1584
1602
  return t.ok ? t.data.createMayaWithdrawal ? {
1585
1603
  ok: !1,
1586
1604
  error: t.data.createMayaWithdrawal
@@ -1589,10 +1607,7 @@ class ht extends we {
1589
1607
  } : t;
1590
1608
  }
1591
1609
  async createMayaAppWithdrawal(e) {
1592
- const t = await this.client.request(
1593
- it,
1594
- e
1595
- );
1610
+ const t = await this.client.request(dt, e);
1596
1611
  return t.ok ? t.data.createMayaAppWithdrawal ? {
1597
1612
  ok: !1,
1598
1613
  error: t.data.createMayaAppWithdrawal
@@ -1601,10 +1616,7 @@ class ht extends we {
1601
1616
  } : t;
1602
1617
  }
1603
1618
  async createBankWithdrawal(e) {
1604
- const t = await this.client.request(
1605
- st,
1606
- e
1607
- );
1619
+ const t = await this.client.request(ct, e);
1608
1620
  return t.ok ? t.data.createBankWithdrawal ? {
1609
1621
  ok: !1,
1610
1622
  error: t.data.createBankWithdrawal
@@ -1614,19 +1626,16 @@ class ht extends we {
1614
1626
  }
1615
1627
  async remainingDailyWithdrawalsCount() {
1616
1628
  const e = await this.client.request(
1617
- dt
1629
+ mt
1618
1630
  );
1619
1631
  return e.ok ? { ok: e.ok, data: e.data.remainingDailyWithdrawalsCount } : e;
1620
1632
  }
1621
1633
  async pointsWallet() {
1622
- const e = await this.client.request(Xe);
1634
+ const e = await this.client.request(et);
1623
1635
  return e.ok ? { ok: e.ok, data: e.data.pointsWallet } : e;
1624
1636
  }
1625
1637
  async pointsToCashConversion(e) {
1626
- const t = await this.client.request(
1627
- et,
1628
- e
1629
- );
1638
+ const t = await this.client.request(tt, e);
1630
1639
  return t.ok ? t.data.pointsToCashConversion ? {
1631
1640
  ok: !1,
1632
1641
  error: t.data.pointsToCashConversion
@@ -1634,50 +1643,176 @@ class ht extends we {
1634
1643
  ok: !0
1635
1644
  } : t;
1636
1645
  }
1646
+ async mayaSession(e) {
1647
+ const t = await this.client.request(
1648
+ at,
1649
+ e
1650
+ );
1651
+ return t.ok ? { ok: t.ok, data: t.data.mayaSession } : t;
1652
+ }
1637
1653
  }
1638
- class ft {
1654
+ class yt {
1639
1655
  constructor(e) {
1640
- d(this, "client");
1656
+ c(this, "client");
1641
1657
  this.client = e;
1642
1658
  }
1643
1659
  async latestBetRecords() {
1644
- const e = await this.client.request(ve);
1660
+ const e = await this.client.request(De);
1645
1661
  return e.ok ? {
1646
1662
  ok: !0,
1647
1663
  data: e.data.latestBetRecords
1648
1664
  } : e;
1649
1665
  }
1650
1666
  }
1651
- function k(i) {
1667
+ class g {
1668
+ constructor(e, t) {
1669
+ c(this, "url");
1670
+ c(this, "options");
1671
+ c(this, "middlewares");
1672
+ var r;
1673
+ const a = new Headers((r = t == null ? void 0 : t.fetchOptions) == null ? void 0 : r.headers);
1674
+ this.url = e, this.options = { ...t == null ? void 0 : t.fetchOptions, headers: a }, this.middlewares = (t == null ? void 0 : t.middlewares) ?? [];
1675
+ }
1676
+ async request(e, t) {
1677
+ const a = JSON.stringify({ query: e, variables: t }), r = new Headers(this.options.headers);
1678
+ r.set("Content-Type", "application/json"), r.set("Accept", "application/json");
1679
+ const n = await this.runMiddlewares(
1680
+ new Request(this.url, {
1681
+ ...this.options,
1682
+ body: a,
1683
+ headers: r,
1684
+ method: "POST"
1685
+ })
1686
+ );
1687
+ return await this.exec(n);
1688
+ }
1689
+ /** Single file upload */
1690
+ async upload(e, t) {
1691
+ const a = this.createUploadBody(e, t), r = new Headers(this.options.headers);
1692
+ r.set("Accept", "application/json"), r.delete("Content-Type");
1693
+ const n = await this.runMiddlewares(
1694
+ new Request(this.url, {
1695
+ ...this.options,
1696
+ body: a,
1697
+ headers: r,
1698
+ method: "POST"
1699
+ })
1700
+ );
1701
+ return await this.exec(n);
1702
+ }
1703
+ async exec(e) {
1704
+ var t, a, r, n, d, m;
1705
+ try {
1706
+ const l = await fetch(e);
1707
+ if (!l.ok)
1708
+ return { ok: !1, error: h(l.status) };
1709
+ const b = await l.json(), k = b.data, u = (t = b.errors) == null ? void 0 : t.at(0);
1710
+ 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) } : ((n = u.extensions) == null ? void 0 : n.code) === "BAD_USER_INPUT" || ((d = u.extensions) == null ? void 0 : d.code) === "BAD_REQUEST" ? { ok: !1, error: h(400, u.message) } : ((m = u.extensions) == null ? void 0 : m.code) === "ACCESS_TOKEN_EXPIRED" ? {
1711
+ ok: !1,
1712
+ error: {
1713
+ code: "HttpForbidden",
1714
+ message: u.message ?? "Access token expired."
1715
+ }
1716
+ } : {
1717
+ ok: !1,
1718
+ error: h(500, u.message)
1719
+ } : {
1720
+ ok: !0,
1721
+ data: k
1722
+ };
1723
+ } catch {
1724
+ return {
1725
+ ok: !1,
1726
+ error: h(500)
1727
+ };
1728
+ }
1729
+ }
1730
+ async runMiddlewares(e) {
1731
+ let t = e.clone();
1732
+ for (const a of this.middlewares)
1733
+ t = await a(t);
1734
+ return t;
1735
+ }
1736
+ createUploadBody(e, t) {
1737
+ const { files: a, others: r } = this.extractFiles(t), n = new FormData();
1738
+ n.append(
1739
+ "operations",
1740
+ JSON.stringify({
1741
+ query: e,
1742
+ variables: t
1743
+ })
1744
+ ), Object.entries(r).forEach(([m, l]) => {
1745
+ n.append(m, JSON.stringify(l));
1746
+ });
1747
+ const d = {};
1748
+ return Object.keys(a).forEach((m, l) => {
1749
+ d[l.toString()] = `variables.${m}`;
1750
+ }), n.append("map", JSON.stringify(d)), Object.values(a).forEach((m, l) => {
1751
+ n.append(l.toString(), m);
1752
+ }), n;
1753
+ }
1754
+ extractFiles(e) {
1755
+ const t = {}, a = {};
1756
+ return Object.entries(e).forEach(([r, n]) => {
1757
+ n instanceof File || n instanceof Blob ? t[r] = n : a[r] = n;
1758
+ }), {
1759
+ files: t,
1760
+ others: a
1761
+ };
1762
+ }
1763
+ }
1764
+ async function p(i) {
1765
+ const e = new TextEncoder().encode(i), t = await crypto.subtle.digest("SHA-256", e);
1766
+ return Array.from(new Uint8Array(t)).map((n) => n.toString(16).padStart(2, "0")).join("");
1767
+ }
1768
+ class ge {
1769
+ constructor(e) {
1770
+ c(this, "enabled");
1771
+ this.enabled = (e == null ? void 0 : e.enabled) ?? !0;
1772
+ }
1773
+ info(e) {
1774
+ this.enabled && console.log(`\x1B[34m[info] ${e}`);
1775
+ }
1776
+ warn(e) {
1777
+ this.enabled && console.log(`\x1B[33m[warn] ${e}`);
1778
+ }
1779
+ error(e) {
1780
+ this.enabled && console.log(`\x1B[31m[error] ${e}`);
1781
+ }
1782
+ success(e) {
1783
+ this.enabled && console.log(`\x1B[32m[success] ${e}`);
1784
+ }
1785
+ }
1786
+ function v(i) {
1652
1787
  return new Date(i.getTime());
1653
1788
  }
1654
- function ce(i, e) {
1655
- const t = k(i);
1789
+ function S(i, e) {
1790
+ const t = v(i);
1656
1791
  return t.setDate(t.getDate() + e), t;
1657
1792
  }
1658
- function ue(i, e) {
1659
- const t = k(i);
1793
+ function A(i, e) {
1794
+ const t = v(i);
1660
1795
  return t.setMinutes(t.getMinutes() + e), t;
1661
1796
  }
1662
- function le(i, e) {
1797
+ function he(i, e) {
1663
1798
  return i.getTime() > e.getTime();
1664
1799
  }
1665
- function wt(i) {
1800
+ function bt(i) {
1666
1801
  return new Promise((e) => {
1667
1802
  setTimeout(e, i);
1668
1803
  });
1669
1804
  }
1670
- function pe(i, e) {
1671
- const t = k(i);
1805
+ function E(i, e) {
1806
+ const t = v(i);
1672
1807
  return t.setMinutes(t.getMinutes() - e), t;
1673
1808
  }
1674
- class gt {
1809
+ class St {
1675
1810
  constructor(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({
1811
+ c(this, "logger");
1812
+ c(this, "storageKey", "session");
1813
+ c(this, "authService");
1814
+ c(this, "_refreshing", !1);
1815
+ this.authService = new pt(e), this.logger = new ge({
1681
1816
  enabled: e.log ?? !1
1682
1817
  });
1683
1818
  }
@@ -1688,15 +1823,83 @@ class gt {
1688
1823
  this._refreshing = e;
1689
1824
  }
1690
1825
  async create(e) {
1826
+ if (this.isServer)
1827
+ return this.logger.warn("'localStorage' is not available on the server."), {
1828
+ ok: !1,
1829
+ error: {
1830
+ code: "UnknownError",
1831
+ message: "Server sign in is not supported."
1832
+ }
1833
+ };
1834
+ if (e.type === "MAYA") {
1835
+ const r = await this.authService.createSession(e);
1836
+ if (r.ok) {
1837
+ const n = /* @__PURE__ */ new Date();
1838
+ return window.localStorage.setItem(
1839
+ this.storageKey,
1840
+ JSON.stringify({
1841
+ ...r.data,
1842
+ maya: !0,
1843
+ accessTokenExpiresAt: A(n, 8).getTime(),
1844
+ refreshTokenExpiresAt: E(S(n, 30), 2).getTime()
1845
+ })
1846
+ ), {
1847
+ ok: !0,
1848
+ data: null
1849
+ };
1850
+ }
1851
+ return r;
1852
+ }
1853
+ if (e.type === "MOBILE_NUMBER") {
1854
+ const r = await this.authService.createSession(e);
1855
+ if (r.ok) {
1856
+ const n = /* @__PURE__ */ new Date();
1857
+ return window.localStorage.setItem(
1858
+ this.storageKey,
1859
+ JSON.stringify({
1860
+ ...r.data,
1861
+ accessTokenExpiresAt: A(n, 8).getTime(),
1862
+ refreshTokenExpiresAt: E(S(n, 30), 2).getTime()
1863
+ })
1864
+ ), {
1865
+ ok: !0,
1866
+ data: null
1867
+ };
1868
+ }
1869
+ return r;
1870
+ }
1691
1871
  const t = await this.authService.createSession(e);
1872
+ if (!t.ok) return t;
1873
+ if (t.data.authenticator)
1874
+ return {
1875
+ ok: !0,
1876
+ data: {
1877
+ authenticator: t.data.authenticator
1878
+ }
1879
+ };
1880
+ const a = /* @__PURE__ */ new Date();
1881
+ return window.localStorage.setItem(
1882
+ this.storageKey,
1883
+ JSON.stringify({
1884
+ ...t.data,
1885
+ accessTokenExpiresAt: A(a, 8).getTime(),
1886
+ refreshTokenExpiresAt: E(S(a, 30), 2).getTime()
1887
+ })
1888
+ ), {
1889
+ ok: !0,
1890
+ data: null
1891
+ };
1892
+ }
1893
+ async createFromAuthenticator(e) {
1894
+ const t = await this.authService.authenticate(e);
1692
1895
  if (t.ok) {
1693
1896
  const a = /* @__PURE__ */ new Date();
1694
1897
  return this.isServer ? this.logger.warn("'localStorage' is not available on the server.") : window.localStorage.setItem(
1695
1898
  this.storageKey,
1696
1899
  JSON.stringify({
1697
1900
  ...t.data,
1698
- accessTokenExpiresAt: ue(a, 8).getTime(),
1699
- refreshTokenExpiresAt: pe(ce(a, 30), 2).getTime()
1901
+ accessTokenExpiresAt: A(a, 8).getTime(),
1902
+ refreshTokenExpiresAt: E(S(a, 30), 2).getTime()
1700
1903
  })
1701
1904
  ), { ok: !0 };
1702
1905
  } else
@@ -1709,7 +1912,7 @@ class gt {
1709
1912
  data: null
1710
1913
  };
1711
1914
  if (this.refreshing)
1712
- return await wt(1e3), await this.get();
1915
+ return await bt(1e3), await this.get();
1713
1916
  const e = window.localStorage.getItem(this.storageKey);
1714
1917
  if (!e)
1715
1918
  return {
@@ -1718,8 +1921,8 @@ class gt {
1718
1921
  };
1719
1922
  try {
1720
1923
  let t = JSON.parse(e), a = /* @__PURE__ */ new Date();
1721
- const r = new Date(t.accessTokenExpiresAt), s = new Date(t.refreshTokenExpiresAt);
1722
- if (le(a, s))
1924
+ const r = new Date(t.accessTokenExpiresAt), n = new Date(t.refreshTokenExpiresAt);
1925
+ if (he(a, n))
1723
1926
  return this.logger.warn("Session expired. Logging out.."), window.localStorage.removeItem(this.storageKey), {
1724
1927
  ok: !1,
1725
1928
  error: {
@@ -1727,22 +1930,22 @@ class gt {
1727
1930
  message: "Session expired."
1728
1931
  }
1729
1932
  };
1730
- if (le(a, r)) {
1933
+ if (he(a, r)) {
1731
1934
  this.logger.info("Refreshing session..."), this.refreshing = !0;
1732
- const m = await this.authService.refreshSession(t.refreshToken);
1733
- if (this.refreshing = !1, !m.ok)
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), {
1935
+ const d = await this.authService.refreshSession(t.refreshToken);
1936
+ if (this.refreshing = !1, !d.ok)
1937
+ return this.logger.error(`Failed to refresh session: ${d.error.message}`), d.error.code === "InvalidToken" || d.error.code === "AccountBlacklisted" ? (window.localStorage.removeItem(this.storageKey), {
1735
1938
  ok: !1,
1736
- error: m.error
1939
+ error: d.error
1737
1940
  }) : (this.logger.warn("Old session returned."), {
1738
1941
  ok: !0,
1739
1942
  data: t
1740
1943
  });
1741
1944
  this.logger.success("Session refreshed!"), a = /* @__PURE__ */ new Date(), t = {
1742
1945
  ...t,
1743
- ...m.data,
1744
- accessTokenExpiresAt: ue(a, 8).getTime(),
1745
- refreshTokenExpiresAt: pe(ce(a, 30), 2).getTime()
1946
+ ...d.data,
1947
+ accessTokenExpiresAt: A(a, 8).getTime(),
1948
+ refreshTokenExpiresAt: E(S(a, 30), 2).getTime()
1746
1949
  }, window.localStorage.setItem(this.storageKey, JSON.stringify(t));
1747
1950
  }
1748
1951
  return {
@@ -1769,11 +1972,11 @@ class gt {
1769
1972
  (t = e.data) != null && t.accessToken && await this.authService.destroySession(e.data.accessToken), window.localStorage.removeItem(this.storageKey);
1770
1973
  }
1771
1974
  async verify() {
1772
- var a, r, s;
1975
+ var a, r, n;
1773
1976
  if (this.isServer)
1774
1977
  return this.logger.warn("'localStorage' is not available on the server."), !0;
1775
1978
  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;
1979
+ if (((a = e.error) == null ? void 0 : a.code) === "InvalidToken" || ((r = e.error) == null ? void 0 : r.code) === "SessionExpired" || ((n = e.error) == null ? void 0 : n.code) === "AccountBlacklisted") return !1;
1777
1980
  if (!e.data) return !0;
1778
1981
  const t = await this.authService.verifySession(e.data.accessToken);
1779
1982
  return t || window.localStorage.removeItem(this.storageKey), t;
@@ -1782,7 +1985,7 @@ class gt {
1782
1985
  return typeof window > "u";
1783
1986
  }
1784
1987
  }
1785
- function o(i, e) {
1988
+ function s(i, e) {
1786
1989
  if (typeof i == "number" && !Number.isNaN(i))
1787
1990
  return i;
1788
1991
  if (typeof i == "string") {
@@ -1792,11 +1995,11 @@ function o(i, e) {
1792
1995
  }
1793
1996
  return e;
1794
1997
  }
1795
- class yt {
1998
+ class At {
1796
1999
  constructor(e) {
1797
- d(this, "staticService");
2000
+ c(this, "staticService");
1798
2001
  const t = (e == null ? void 0 : e.environment) === "development";
1799
- this.staticService = new pt({
2002
+ this.staticService = new ft({
1800
2003
  url: t ? "https://static.development.opexa.io/graphql" : "https://static.opexa.io/graphql"
1801
2004
  });
1802
2005
  }
@@ -1825,88 +2028,88 @@ class yt {
1825
2028
  };
1826
2029
  }
1827
2030
  platform(e) {
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;
2031
+ var t, a, r, n, d, m, l, b, k, u, D, M, N, R, I, G, P, $, U, x, W, B, O, q, F, L, V, H, Y, Q, j, K, z, J, X, Z, ee, te, ae, re, ne, se, oe, ie, de, ce, me, ue, le;
1829
2032
  return {
1830
2033
  paymentSettings: {
1831
- minimumFirstDepositAmount: o(e.minimumFirstDepositAmount),
2034
+ minimumFirstDepositAmount: s(e.minimumFirstDepositAmount),
1832
2035
  restrictWithdrawalsToVerifiedMembers: e.restrictWithdrawalsToVerifiedMembers,
1833
2036
  depositGateway: {
1834
2037
  bank: {
1835
2038
  androidEnabled: ((t = e.bankDepositGatewaySettings) == null ? void 0 : t.androidEnabled) ?? !1,
1836
2039
  iosEnabled: ((a = e.bankDepositGatewaySettings) == null ? void 0 : a.iosEnabled) ?? !1,
1837
2040
  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)
2041
+ mobileWebEnabled: ((n = e.bankDepositGatewaySettings) == null ? void 0 : n.mobileWebEnabled) ?? !1,
2042
+ minimumAmount: s((d = e.bankDepositGatewaySettings) == null ? void 0 : d.minimumAmount),
2043
+ maximumAmount: s((m = e.bankDepositGatewaySettings) == null ? void 0 : m.maximumAmount)
1841
2044
  },
1842
2045
  gcash: {
1843
2046
  androidEnabled: ((l = e.gcashDepositGatewaySettings) == null ? void 0 : l.androidEnabled) ?? !1,
1844
2047
  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)
2048
+ webEnabled: ((k = e.gcashDepositGatewaySettings) == null ? void 0 : k.webEnabled) ?? !1,
2049
+ mobileWebEnabled: ((u = e.gcashDepositGatewaySettings) == null ? void 0 : u.mobileWebEnabled) ?? !1,
2050
+ minimumAmount: s((D = e.gcashDepositGatewaySettings) == null ? void 0 : D.minimumAmount),
2051
+ maximumAmount: s((M = e.gcashDepositGatewaySettings) == null ? void 0 : M.maximumAmount)
1849
2052
  },
1850
2053
  maya: {
1851
- androidEnabled: ((v = e.mayaDepositGatewaySettings) == null ? void 0 : v.androidEnabled) ?? !1,
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)
2054
+ androidEnabled: ((N = e.mayaDepositGatewaySettings) == null ? void 0 : N.androidEnabled) ?? !1,
2055
+ iosEnabled: ((R = e.mayaDepositGatewaySettings) == null ? void 0 : R.iosEnabled) ?? !1,
2056
+ webEnabled: ((I = e.mayaDepositGatewaySettings) == null ? void 0 : I.webEnabled) ?? !1,
2057
+ mobileWebEnabled: ((G = e.mayaDepositGatewaySettings) == null ? void 0 : G.mobileWebEnabled) ?? !1,
2058
+ minimumAmount: s((P = e.mayaDepositGatewaySettings) == null ? void 0 : P.minimumAmount),
2059
+ maximumAmount: s(($ = e.mayaDepositGatewaySettings) == null ? void 0 : $.maximumAmount)
1857
2060
  },
1858
2061
  mayaApp: {
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)
2062
+ androidEnabled: ((U = e.mayaAppDepositGatewaySettings) == null ? void 0 : U.androidEnabled) ?? !1,
2063
+ iosEnabled: ((x = e.mayaAppDepositGatewaySettings) == null ? void 0 : x.iosEnabled) ?? !1,
2064
+ webEnabled: ((W = e.mayaAppDepositGatewaySettings) == null ? void 0 : W.webEnabled) ?? !1,
2065
+ mobileWebEnabled: ((B = e.mayaAppDepositGatewaySettings) == null ? void 0 : B.mobileWebEnabled) ?? !1,
2066
+ minimumAmount: s((O = e.mayaAppDepositGatewaySettings) == null ? void 0 : O.minimumAmount),
2067
+ maximumAmount: s((q = e.mayaAppDepositGatewaySettings) == null ? void 0 : q.maximumAmount)
1865
2068
  }
1866
2069
  },
1867
2070
  withdrawalGateway: {
1868
2071
  bank: {
1869
- androidEnabled: ((x = e.bankWithdrawalGatewaySettings) == null ? void 0 : x.androidEnabled) ?? !1,
1870
- iosEnabled: ((q = e.bankWithdrawalGatewaySettings) == null ? void 0 : q.iosEnabled) ?? !1,
1871
- webEnabled: ((O = e.bankWithdrawalGatewaySettings) == null ? void 0 : O.webEnabled) ?? !1,
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)
2072
+ androidEnabled: ((F = e.bankWithdrawalGatewaySettings) == null ? void 0 : F.androidEnabled) ?? !1,
2073
+ iosEnabled: ((L = e.bankWithdrawalGatewaySettings) == null ? void 0 : L.iosEnabled) ?? !1,
2074
+ webEnabled: ((V = e.bankWithdrawalGatewaySettings) == null ? void 0 : V.webEnabled) ?? !1,
2075
+ mobileWebEnabled: ((H = e.bankWithdrawalGatewaySettings) == null ? void 0 : H.mobileWebEnabled) ?? !1,
2076
+ minimumAmount: s((Y = e.bankWithdrawalGatewaySettings) == null ? void 0 : Y.minimumAmount),
2077
+ maximumAmount: s((Q = e.bankWithdrawalGatewaySettings) == null ? void 0 : Q.maximumAmount)
1875
2078
  },
1876
2079
  gcash: {
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,
2080
+ androidEnabled: ((j = e.gcashWithdrawalGatewaySettings) == null ? void 0 : j.androidEnabled) ?? !1,
2081
+ iosEnabled: ((K = e.gcashWithdrawalGatewaySettings) == null ? void 0 : K.iosEnabled) ?? !1,
2082
+ webEnabled: ((z = e.gcashWithdrawalGatewaySettings) == null ? void 0 : z.webEnabled) ?? !1,
2083
+ mobileWebEnabled: ((J = e.gcashWithdrawalGatewaySettings) == null ? void 0 : J.mobileWebEnabled) ?? !1,
2084
+ minimumAmount: s((X = e.gcashWithdrawalGatewaySettings) == null ? void 0 : X.minimumAmount),
2085
+ maximumAmount: s(
2086
+ (Z = e.gcashWithdrawalGatewaySettings) == null ? void 0 : Z.maximumAmount,
1884
2087
  1e6
1885
2088
  )
1886
2089
  },
1887
2090
  maya: {
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)
2091
+ androidEnabled: ((ee = e.mayaWithdrawalGatewaySettings) == null ? void 0 : ee.androidEnabled) ?? !1,
2092
+ iosEnabled: ((te = e.mayaWithdrawalGatewaySettings) == null ? void 0 : te.iosEnabled) ?? !1,
2093
+ webEnabled: ((ae = e.mayaWithdrawalGatewaySettings) == null ? void 0 : ae.webEnabled) ?? !1,
2094
+ mobileWebEnabled: ((re = e.mayaWithdrawalGatewaySettings) == null ? void 0 : re.mobileWebEnabled) ?? !1,
2095
+ minimumAmount: s((ne = e.mayaWithdrawalGatewaySettings) == null ? void 0 : ne.minimumAmount),
2096
+ maximumAmount: s((se = e.mayaWithdrawalGatewaySettings) == null ? void 0 : se.maximumAmount)
1894
2097
  },
1895
2098
  mayaApp: {
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,
2099
+ androidEnabled: ((oe = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : oe.androidEnabled) ?? !1,
2100
+ iosEnabled: ((ie = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : ie.iosEnabled) ?? !1,
2101
+ webEnabled: ((de = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : de.webEnabled) ?? !1,
2102
+ mobileWebEnabled: ((ce = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : ce.mobileWebEnabled) ?? !1,
2103
+ minimumAmount: s((me = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : me.minimumAmount),
2104
+ maximumAmount: s(
2105
+ (ue = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : ue.maximumAmount,
1903
2106
  1e6
1904
2107
  )
1905
2108
  }
1906
2109
  }
1907
2110
  },
1908
2111
  pointsClubSettings: {
1909
- multiplier: o(e.pointsClubSettings.multiplier, 0)
2112
+ multiplier: s((le = e.pointsClubSettings) == null ? void 0 : le.multiplier, 0)
1910
2113
  }
1911
2114
  };
1912
2115
  }
@@ -1926,6 +2129,7 @@ class yt {
1926
2129
  validId: e.validId ?? void 0,
1927
2130
  verificationStatus: e.verificationStatus,
1928
2131
  transactionPassword: e.transactionPassword,
2132
+ secretAnswerSubmitted: e.secretAnswerSubmitted ?? !1,
1929
2133
  dateTimeLastActive: e.dateTimeLastActive ? new Date(e.dateTimeLastActive) : void 0,
1930
2134
  dateTimeCreated: new Date(e.dateTimeCreated),
1931
2135
  dateTimeLastUpdated: new Date(e.dateTimeLastUpdated)
@@ -1934,7 +2138,7 @@ class yt {
1934
2138
  wallet(e) {
1935
2139
  return {
1936
2140
  ...e,
1937
- balance: o(e.balance, 0),
2141
+ balance: s(e.balance, 0),
1938
2142
  dateTimeCreated: new Date(e.dateTimeCreated),
1939
2143
  dateTimeLastUpdated: new Date(e.dateTimeLastUpdated)
1940
2144
  };
@@ -1957,7 +2161,7 @@ class yt {
1957
2161
  profileCompletion(e) {
1958
2162
  return {
1959
2163
  ...e,
1960
- completionPercentage: o(e, 0)
2164
+ completionPercentage: s(e, 0)
1961
2165
  };
1962
2166
  }
1963
2167
  announcement(e) {
@@ -1972,9 +2176,9 @@ class yt {
1972
2176
  withdrawalRecord(e) {
1973
2177
  return {
1974
2178
  ...e,
1975
- amount: o(e.amount, 0),
1976
- netAmount: o(e.netAmount, 0),
1977
- fee: o(e.fee, 0),
2179
+ amount: s(e.amount, 0),
2180
+ netAmount: s(e.netAmount, 0),
2181
+ fee: s(e.fee, 0),
1978
2182
  reference: e.reference ?? void 0,
1979
2183
  bank: e.bank ?? void 0,
1980
2184
  recipientMobileNumber: e.recipientMobileNumber ?? void 0,
@@ -1986,9 +2190,9 @@ class yt {
1986
2190
  deposit(e) {
1987
2191
  return {
1988
2192
  ...e,
1989
- fee: o(e.fee, 0),
1990
- amount: o(e.amount, 0),
1991
- netAmount: o(e.netAmount, 0),
2193
+ fee: s(e.fee, 0),
2194
+ amount: s(e.amount, 0),
2195
+ netAmount: s(e.netAmount, 0),
1992
2196
  reference: e.reference ?? void 0,
1993
2197
  checkoutUrl: e.checkoutUrl ?? void 0,
1994
2198
  dateTimeCreated: new Date(e.dateTimeCreated),
@@ -1998,24 +2202,24 @@ class yt {
1998
2202
  depositRecord(e) {
1999
2203
  return {
2000
2204
  ...e,
2001
- amount: o(e.amount, 0),
2002
- fee: o(e.fee, 0),
2003
- netAmount: o(e.netAmount, 0),
2205
+ amount: s(e.amount, 0),
2206
+ fee: s(e.fee, 0),
2207
+ netAmount: s(e.netAmount, 0),
2004
2208
  reference: e.reference ?? void 0,
2005
2209
  dateTimeCreated: new Date(e.dateTimeCreated),
2006
2210
  dateTimeLastUpdated: new Date(e.dateTimeLastUpdated)
2007
2211
  };
2008
2212
  }
2009
2213
  betRecord(e) {
2010
- var t, a;
2214
+ var t;
2011
2215
  return {
2012
2216
  ...e,
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),
2217
+ bet: s(e.bet, 0),
2218
+ payout: s(e.payout, 0),
2219
+ jackpotContribution: s(e.jackpotContribution, 0),
2220
+ jackpotPayout: s(e.jackpotPayout, 0),
2221
+ winloss: s(e.winloss),
2222
+ validBet: s(e.validBet, 0),
2019
2223
  vendorRoundId: e.vendorRoundId ?? void 0,
2020
2224
  game: this.game(e.game),
2021
2225
  dateTimeSettled: e.dateTimeSettled ? new Date(e.dateTimeSettled) : void 0,
@@ -2025,8 +2229,7 @@ class yt {
2025
2229
  contestName: e.contestName ?? void 0,
2026
2230
  externalCategory: e.externalCategory ?? void 0,
2027
2231
  metadata: {
2028
- odds: ((t = e.metadata) == null ? void 0 : t.odds) ?? void 0,
2029
- validBet: o((a = e.metadata) == null ? void 0 : a.validBet)
2232
+ odds: ((t = e.metadata) == null ? void 0 : t.odds) ?? void 0
2030
2233
  }
2031
2234
  };
2032
2235
  }
@@ -2034,9 +2237,9 @@ class yt {
2034
2237
  return {
2035
2238
  ...e,
2036
2239
  game: this.game(e.game),
2037
- bet: o(e.bet, 0),
2038
- payout: o(e.payout, 0),
2039
- validBet: o(e.validBet, 0),
2240
+ bet: s(e.bet, 0),
2241
+ payout: s(e.payout, 0),
2242
+ validBet: s(e.validBet, 0),
2040
2243
  dateTimeSettled: new Date(e.dateTimeSettled),
2041
2244
  dateTimeCreated: new Date(e.dateTimeCreated)
2042
2245
  };
@@ -2044,9 +2247,9 @@ class yt {
2044
2247
  transactionRecord(e) {
2045
2248
  return {
2046
2249
  ...e,
2047
- amount: o(e.amount, 0),
2250
+ amount: s(e.amount, 0),
2048
2251
  content: e.content ?? void 0,
2049
- currentBalance: o(e.currentBalance, 0),
2252
+ currentBalance: s(e.currentBalance, 0),
2050
2253
  dateTimeCreated: new Date(e.dateTimeCreated)
2051
2254
  };
2052
2255
  }
@@ -2072,8 +2275,8 @@ class yt {
2072
2275
  ...e.banner,
2073
2276
  dateTimeCreated: new Date(e.banner.dateTimeCreated)
2074
2277
  },
2075
- maximumBonusAmount: o(e.maximumBonusAmount),
2076
- minimumBonusAmount: o(e.minimumBonusAmount),
2278
+ maximumBonusAmount: s(e.maximumBonusAmount),
2279
+ minimumBonusAmount: s(e.minimumBonusAmount),
2077
2280
  activationEndDateTime: new Date(e.activationEndDateTime),
2078
2281
  activationStartDateTime: new Date(e.activationStartDateTime),
2079
2282
  dateTimeCreated: new Date(e.dateTimeCreated),
@@ -2100,22 +2303,22 @@ class yt {
2100
2303
  /* deposit here does not have an id and depositNumber field */
2101
2304
  deposit: e.deposit ? {
2102
2305
  ...e.deposit,
2103
- fee: o(e.deposit.fee, 0),
2104
- amount: o(e.deposit.amount, 0),
2105
- netAmount: o(e.deposit.netAmount, 0),
2306
+ fee: s(e.deposit.fee, 0),
2307
+ amount: s(e.deposit.amount, 0),
2308
+ netAmount: s(e.deposit.netAmount, 0),
2106
2309
  reference: e.deposit.reference ?? void 0,
2107
2310
  dateTimeCreated: new Date(e.deposit.dateTimeCreated),
2108
2311
  dateTimeLastUpdated: new Date(e.deposit.dateTimeLastUpdated)
2109
2312
  } : void 0,
2110
- balance: o(e.balance, 0),
2111
- amount: o(e.amount, 0),
2313
+ balance: s(e.balance, 0),
2314
+ amount: s(e.amount, 0),
2112
2315
  expiration: new Date(e.expiration),
2113
- turnoverRequirement: o(e.turnoverRequirement, 0),
2114
- currentTurnoverRequirementContribution: o(
2316
+ turnoverRequirement: s(e.turnoverRequirement, 0),
2317
+ currentTurnoverRequirementContribution: s(
2115
2318
  e.currentTurnoverRequirementContribution,
2116
2319
  0
2117
2320
  ),
2118
- currentTurnoverRequirementContributionPercentage: o(
2321
+ currentTurnoverRequirementContributionPercentage: s(
2119
2322
  e.currentTurnoverRequirementContributionPercentage,
2120
2323
  0
2121
2324
  ),
@@ -2126,7 +2329,7 @@ class yt {
2126
2329
  cashbackBonus(e) {
2127
2330
  return {
2128
2331
  id: e.id,
2129
- balance: o(e.balance, 0),
2332
+ balance: s(e.balance, 0),
2130
2333
  cashback: this.cashback(e.cashback),
2131
2334
  dateTimeCreated: new Date(e.dateTimeCreated),
2132
2335
  dateTimeLastUpdated: new Date(e.dateTimeLastUpdated)
@@ -2142,116 +2345,25 @@ class yt {
2142
2345
  pointsWallet(e) {
2143
2346
  return {
2144
2347
  id: e.id,
2145
- points: o(e.points, 0),
2348
+ points: s(e.points, 0),
2146
2349
  account: e.account,
2147
2350
  dateTimeCreated: new Date(e.dateTimeCreated)
2148
2351
  };
2149
2352
  }
2150
2353
  }
2151
- class g {
2152
- constructor(e, t) {
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);
2158
- this.url = e, this.options = { ...t == null ? void 0 : t.fetchOptions, headers: a }, this.middlewares = (t == null ? void 0 : t.middlewares) ?? [];
2159
- }
2160
- async request(e, t) {
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(
2164
- new Request(this.url, {
2165
- ...this.options,
2166
- body: a,
2167
- headers: r,
2168
- method: "POST"
2169
- })
2170
- );
2171
- return await this.exec(s);
2172
- }
2173
- /** Single file upload */
2174
- async upload(e, t) {
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(
2178
- new Request(this.url, {
2179
- ...this.options,
2180
- body: a,
2181
- headers: r,
2182
- method: "POST"
2183
- })
2184
- );
2185
- return await this.exec(s);
2186
- }
2187
- async exec(e) {
2188
- var t, a, r, s, m;
2189
- try {
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
- } : {
2198
- ok: !0,
2199
- data: b
2200
- };
2201
- } catch {
2202
- return {
2203
- ok: !1,
2204
- error: h(500)
2205
- };
2206
- }
2207
- }
2208
- async runMiddlewares(e) {
2209
- let t = e.clone();
2210
- for (const a of this.middlewares)
2211
- t = await a(t);
2212
- return t;
2213
- }
2214
- createUploadBody(e, t) {
2215
- const { files: a, others: r } = this.extractFiles(t), s = new FormData();
2216
- s.append(
2217
- "operations",
2218
- JSON.stringify({
2219
- query: e,
2220
- variables: t
2221
- })
2222
- ), Object.entries(r).forEach(([c, l]) => {
2223
- s.append(c, JSON.stringify(l));
2224
- });
2225
- const m = {};
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;
2231
- }
2232
- extractFiles(e) {
2233
- const t = {}, a = {};
2234
- return Object.entries(e).forEach(([r, s]) => {
2235
- s instanceof File || s instanceof Blob ? t[r] = s : a[r] = s;
2236
- }), {
2237
- files: t,
2238
- others: a
2239
- };
2240
- }
2241
- }
2242
- class St {
2354
+ class Ct {
2243
2355
  constructor(e) {
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");
2356
+ c(this, "gameService");
2357
+ c(this, "fileService");
2358
+ c(this, "walletService");
2359
+ c(this, "reportService");
2360
+ c(this, "portalService");
2361
+ c(this, "accountService");
2362
+ c(this, "sessionManager");
2363
+ c(this, "transformer");
2364
+ c(this, "logger");
2253
2365
  const t = e.environment === "development";
2254
- this.sessionManager = new gt({
2366
+ this.sessionManager = new St({
2255
2367
  ...e,
2256
2368
  url: t ? "https://auth.development.opexa.io" : "https://auth.opexa.io"
2257
2369
  });
@@ -2264,37 +2376,37 @@ class St {
2264
2376
  }
2265
2377
  }
2266
2378
  };
2267
- this.gameService = new we(
2379
+ this.gameService = new fe(
2268
2380
  new g(
2269
2381
  t ? "https://game.development.opexa.io/graphql" : "https://game.opexa.io/graphql",
2270
2382
  a
2271
2383
  )
2272
- ), this.fileService = new ut(
2384
+ ), this.fileService = new ht(
2273
2385
  new g(
2274
2386
  t ? "https://file.development.opexa.io/graphql" : "https://file.opexa.io/graphql",
2275
2387
  a
2276
2388
  )
2277
- ), this.walletService = new ht(
2389
+ ), this.walletService = new gt(
2278
2390
  new g(
2279
2391
  t ? "https://wallet.development.opexa.io/graphql" : "https://wallet.opexa.io/graphql",
2280
2392
  a
2281
2393
  )
2282
- ), this.reportService = new lt(
2394
+ ), this.reportService = new wt(
2283
2395
  new g(
2284
2396
  t ? "https://report.development.opexa.io/graphql" : "https://report.opexa.io/graphql",
2285
2397
  a
2286
2398
  )
2287
- ), this.accountService = new mt(
2399
+ ), this.accountService = new ut(
2288
2400
  new g(
2289
2401
  t ? "https://account.development.opexa.io/graphql" : "https://account.opexa.io/graphql",
2290
2402
  a
2291
2403
  )
2292
- ), this.portalService = new ft(
2404
+ ), this.portalService = new yt(
2293
2405
  new g(
2294
2406
  t ? "https://portal.development.opexa.io/graphql" : "https://portal.opexa.io/graphql",
2295
2407
  a
2296
2408
  )
2297
- ), this.transformer = new yt(e), this.logger = new he({
2409
+ ), this.transformer = new At(e), this.logger = new ge({
2298
2410
  enabled: e.log ?? !1
2299
2411
  });
2300
2412
  }
@@ -2306,8 +2418,81 @@ class St {
2306
2418
  };
2307
2419
  }
2308
2420
  async signIn(e) {
2309
- const t = await this.sessionManager.create(e);
2310
- return t.ok ? { ok: !0 } : t;
2421
+ switch (e.type) {
2422
+ case "NAME_AND_PASSWORD": {
2423
+ const t = await this.sessionManager.create({
2424
+ ...e,
2425
+ password: await p(e.password)
2426
+ });
2427
+ return t.data ? {
2428
+ ok: !0,
2429
+ data: {
2430
+ "2FAEnabled": !0,
2431
+ authenticator: t.data.authenticator
2432
+ }
2433
+ } : {
2434
+ ok: !0,
2435
+ data: {
2436
+ "2FAEnabled": !1
2437
+ }
2438
+ };
2439
+ }
2440
+ default: {
2441
+ const t = await this.sessionManager.create(e);
2442
+ return t.ok ? { ok: !0 } : t;
2443
+ }
2444
+ }
2445
+ }
2446
+ /**
2447
+ * @example
2448
+ * ```ts
2449
+ * const signInResult = await signIn({
2450
+ * type: 'NAME_AND_PASSWORD',
2451
+ * name: data.name,
2452
+ * password: data.password,
2453
+ * });
2454
+ *
2455
+ * if (!signInResult.ok) {
2456
+ * return window.alert(signInResult.error.message);
2457
+ * }
2458
+ *
2459
+ * if (!signInResult.data) {
2460
+ * // Signed in. No more steps needed
2461
+ * return;
2462
+ * }
2463
+ *
2464
+ * const secretAnswer = window.prompt(SECRET_QUESTIONS_MAP[signInResult.secretQuestion]);
2465
+ *
2466
+ * const authResult = await sdk.authenticate({
2467
+ * type: 'SECURITY_QUESTION',
2468
+ * token: signInResult.token,
2469
+ * secretAnswer: secretAnswer,
2470
+ * });
2471
+ *
2472
+ * if (!authResult.ok) {
2473
+ * window.alert(res.error.message);
2474
+ * } else {
2475
+ * // Signed in
2476
+ * }
2477
+ * ```
2478
+ */
2479
+ async authenticate(e) {
2480
+ switch (e.type) {
2481
+ case "SECURITY_QUESTION":
2482
+ return await this.sessionManager.createFromAuthenticator({
2483
+ type: "SECURITY_QUESTION",
2484
+ token: e.token,
2485
+ secretAnswer: await p(e.secretAnswer)
2486
+ });
2487
+ default:
2488
+ return {
2489
+ ok: !1,
2490
+ error: {
2491
+ code: "HttpBadRequest",
2492
+ message: "Invalid input 'type'"
2493
+ }
2494
+ };
2495
+ }
2311
2496
  }
2312
2497
  async signOut() {
2313
2498
  await this.sessionManager.destroy();
@@ -2339,10 +2524,10 @@ class St {
2339
2524
  watchSession(e) {
2340
2525
  const t = e.interval ?? 3e4, a = e.onInvalid;
2341
2526
  let r = null;
2342
- const s = () => setTimeout(async () => {
2343
- await this.sessionManager.verify() || await a(), r = s();
2527
+ const n = () => setTimeout(async () => {
2528
+ await this.sessionManager.verify() || await a(), r = n();
2344
2529
  }, t);
2345
- return r = s(), function() {
2530
+ return r = n(), function() {
2346
2531
  r && clearTimeout(r);
2347
2532
  };
2348
2533
  }
@@ -2408,7 +2593,7 @@ class St {
2408
2593
  * ```
2409
2594
  */
2410
2595
  async createAccount(e) {
2411
- const t = e.id ?? f.generate(w.Account).toString(), a = await this.accountService.registerMemberAccount({
2596
+ const t = e.id ?? w.generate(f.Account).toString(), a = await this.accountService.registerMemberAccount({
2412
2597
  input: {
2413
2598
  id: t,
2414
2599
  name: e.name,
@@ -2448,7 +2633,8 @@ class St {
2448
2633
  transactionPassword: t.transactionPassword ? await p(t.transactionPassword) : void 0,
2449
2634
  ...t.mobileNumber && {
2450
2635
  mobileNumber: this.addAreaCode(t.mobileNumber)
2451
- }
2636
+ },
2637
+ secretAnswer: t.secretAnswer ? await p(t.secretAnswer) : void 0
2452
2638
  }
2453
2639
  }
2454
2640
  });
@@ -2489,7 +2675,7 @@ class St {
2489
2675
  * ```
2490
2676
  */
2491
2677
  async submitVerificationDetails(e) {
2492
- const t = e.id ?? f.generate(w.Verification).toString(), a = await this.accountService.createMemberVerification({
2678
+ const t = e.id ?? w.generate(f.Verification).toString(), a = await this.accountService.createMemberVerification({
2493
2679
  input: {
2494
2680
  id: t,
2495
2681
  ...e
@@ -2613,7 +2799,7 @@ class St {
2613
2799
  * ```
2614
2800
  */
2615
2801
  async createWithdrawal(e) {
2616
- const t = e.id ?? f.generate(w.Withdrawal).toString();
2802
+ const t = e.id ?? w.generate(f.Withdrawal).toString();
2617
2803
  if (e.type === "BANK") {
2618
2804
  const a = await this.walletService.createBankWithdrawal({
2619
2805
  input: {
@@ -2699,7 +2885,7 @@ class St {
2699
2885
  * ```
2700
2886
  */
2701
2887
  async createDeposit(e) {
2702
- const t = e.id ?? f.generate(w.Deposit).toString();
2888
+ const t = e.id ?? w.generate(f.Deposit).toString();
2703
2889
  if (e.type === "MAYA") {
2704
2890
  const a = await this.walletService.createMayaDeposit({
2705
2891
  input: {
@@ -2912,7 +3098,7 @@ class St {
2912
3098
  * ```
2913
3099
  */
2914
3100
  async createGameSession(e) {
2915
- const t = e.id ?? f.generate(w.GameSession).toString(), a = await this.gameService.createGameSession({
3101
+ const t = e.id ?? w.generate(f.GameSession).toString(), a = await this.gameService.createGameSession({
2916
3102
  input: {
2917
3103
  id: t,
2918
3104
  game: e.game
@@ -2936,7 +3122,7 @@ class St {
2936
3122
  * ```
2937
3123
  */
2938
3124
  async createGameSession__next(e) {
2939
- const t = e.id ?? f.generate(w.GameSession).toString(), a = await this.walletService.createGameSession({
3125
+ const t = e.id ?? w.generate(f.GameSession).toString(), a = await this.walletService.createGameSession({
2940
3126
  input: {
2941
3127
  id: t,
2942
3128
  game: e.game
@@ -2992,7 +3178,7 @@ class St {
2992
3178
  * ```
2993
3179
  */
2994
3180
  async uploadImageFile(e) {
2995
- const t = e.id ?? f.generate(w.File).toString(), a = await this.fileService.uploadPrivateImageFile({
3181
+ const t = e.id ?? w.generate(f.File).toString(), a = await this.fileService.uploadPrivateImageFile({
2996
3182
  input: {
2997
3183
  id: t,
2998
3184
  file: e.file
@@ -3024,8 +3210,8 @@ class St {
3024
3210
  }
3025
3211
  }
3026
3212
  export {
3027
- Ct as ObjectId,
3028
- w as ObjectType,
3029
- St as Sdk
3213
+ vt as ObjectId,
3214
+ f as ObjectType,
3215
+ Ct as Sdk
3030
3216
  };
3031
3217
  //# sourceMappingURL=index.mjs.map