@opexa/portal-sdk 0.0.1

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 (50) hide show
  1. package/README.md +1591 -0
  2. package/dist/graphql/account.service.d.ts +24 -0
  3. package/dist/graphql/announcement.d.ts +29 -0
  4. package/dist/graphql/auth.service.d.ts +16 -0
  5. package/dist/graphql/bet-record.d.ts +71 -0
  6. package/dist/graphql/bonus.d.ts +43 -0
  7. package/dist/graphql/cashback.d.ts +22 -0
  8. package/dist/graphql/deposit.d.ts +94 -0
  9. package/dist/graphql/file.d.ts +38 -0
  10. package/dist/graphql/file.service.d.ts +11 -0
  11. package/dist/graphql/game.d.ts +84 -0
  12. package/dist/graphql/game.service.d.ts +14 -0
  13. package/dist/graphql/index.d.ts +23 -0
  14. package/dist/graphql/member.d.ts +182 -0
  15. package/dist/graphql/platform.d.ts +38 -0
  16. package/dist/graphql/points.d.ts +22 -0
  17. package/dist/graphql/portal.service.d.ts +9 -0
  18. package/dist/graphql/promo.d.ts +35 -0
  19. package/dist/graphql/report.service.d.ts +18 -0
  20. package/dist/graphql/session.d.ts +25 -0
  21. package/dist/graphql/static.service.d.ts +12 -0
  22. package/dist/graphql/transaction.d.ts +26 -0
  23. package/dist/graphql/types.d.ts +93 -0
  24. package/dist/graphql/wallet.d.ts +14 -0
  25. package/dist/graphql/wallet.service.d.ts +30 -0
  26. package/dist/graphql/withdrawal.d.ts +106 -0
  27. package/dist/index.d.ts +4 -0
  28. package/dist/index.js +1007 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/index.mjs +2916 -0
  31. package/dist/index.mjs.map +1 -0
  32. package/dist/logger.d.ts +15 -0
  33. package/dist/object-id.d.ts +1 -0
  34. package/dist/object-type.d.ts +9 -0
  35. package/dist/sdk.d.ts +228 -0
  36. package/dist/session-service.d.ts +25 -0
  37. package/dist/transformer.d.ts +52 -0
  38. package/dist/types.d.ts +839 -0
  39. package/dist/utils/add-days.d.ts +1 -0
  40. package/dist/utils/add-minutes.d.ts +1 -0
  41. package/dist/utils/clone-date.d.ts +1 -0
  42. package/dist/utils/gql.d.ts +1 -0
  43. package/dist/utils/graphql-client.d.ts +29 -0
  44. package/dist/utils/http-error.d.ts +6 -0
  45. package/dist/utils/is-after.d.ts +4 -0
  46. package/dist/utils/parse-decimal.d.ts +2 -0
  47. package/dist/utils/sha256.d.ts +1 -0
  48. package/dist/utils/sub-minutes.d.ts +1 -0
  49. package/dist/utils/types.d.ts +5 -0
  50. package/package.json +81 -0
package/dist/index.mjs ADDED
@@ -0,0 +1,2916 @@
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 d = (i, e, t) => ge(i, typeof e != "symbol" ? e + "" : e, t);
4
+ import { ObjectId as g } from "@opexa/object-id";
5
+ import { ObjectId as Ct } from "@opexa/object-id";
6
+ const y = {
7
+ Account: 8,
8
+ Deposit: 9,
9
+ Withdrawal: 14,
10
+ Verification: 15,
11
+ File: 16,
12
+ GameSession: 204,
13
+ MayaSession: 230
14
+ };
15
+ function o(i, ...e) {
16
+ let t = "";
17
+ for (const [a, n] of i.entries()) {
18
+ const m = e.at(a) ?? "";
19
+ t = `${t}${n}${m}`;
20
+ }
21
+ return t.trim();
22
+ }
23
+ const ye = o`
24
+ query Announcements($first: Int, $after: Cursor, $filter: AnnouncementFilterInput) {
25
+ announcements(first: $first, after: $after, filter: $filter) {
26
+ edges {
27
+ cursor
28
+ node {
29
+ ... on Announcement {
30
+ id
31
+ type
32
+ title
33
+ status
34
+ message
35
+ activationStartDateTime
36
+ activationEndDateTime
37
+ dateTimeCreated
38
+ dateTimeLastUpdated
39
+ }
40
+ }
41
+ }
42
+ totalCount
43
+ pageInfo {
44
+ hasNextPage
45
+ endCursor
46
+ }
47
+ }
48
+ }
49
+ `, b = o`
50
+ fragment GameFragment on Game {
51
+ id
52
+ type
53
+ name
54
+ provider
55
+ }
56
+ `, be = o`
57
+ ${b}
58
+
59
+ query Game($id: ObjectId!) {
60
+ node(id: $id) {
61
+ ... on Game {
62
+ ...GameFragment
63
+ }
64
+ }
65
+ }
66
+ `, Ae = o`
67
+ ${b}
68
+
69
+ query Games($after: Cursor, $first: Int, $filter: GameFilterInput) {
70
+ games(after: $after, first: $first, filter: $filter) {
71
+ totalCount
72
+ edges {
73
+ cursor
74
+ node {
75
+ ... on Game {
76
+ ...GameFragment
77
+ }
78
+ }
79
+ }
80
+ pageInfo {
81
+ hasNextPage
82
+ endCursor
83
+ }
84
+ }
85
+ }
86
+ `, Se = o`
87
+ ${b}
88
+
89
+ query GamesByName($search: String!, $filter: GameFilterInput, $first: Int) {
90
+ gamesByName(search: $search, filter: $filter, first: $first) {
91
+ ...GameFragment
92
+ }
93
+ }
94
+ `, Ee = o`
95
+ ${b}
96
+
97
+ query GameSession($id: ObjectId!) {
98
+ node(id: $id) {
99
+ ... on GameSession {
100
+ id
101
+ game {
102
+ ...GameFragment
103
+ }
104
+ status
105
+ launchUrl
106
+ dateTimeCreated
107
+ dateTimeLastUpdated
108
+ }
109
+ }
110
+ }
111
+ `, Ce = o`
112
+ mutation CreateGameSession($input: CreateGameSessionInput!) {
113
+ createGameSession(input: $input) {
114
+ ... on GameDoesNotExistError {
115
+ code: __typename
116
+ message
117
+ }
118
+ }
119
+ }
120
+ `, ke = o`
121
+ mutation EndGameSession($input: EndGameSessionInput!) {
122
+ endGameSession(input: $input)
123
+ }
124
+ `, Te = o`
125
+ ${b}
126
+
127
+ query BetRecords($first: Int, $after: Cursor, $filter: BetRecordFilterInput) {
128
+ member {
129
+ betRecords(first: $first, after: $after, filter: $filter) {
130
+ totalCount
131
+ edges {
132
+ cursor
133
+ node {
134
+ ... on BetRecord {
135
+ id
136
+ serialCode
137
+ game {
138
+ ...GameFragment
139
+ }
140
+ bet
141
+ payout
142
+ winloss
143
+ jackpotPayout
144
+ jackpotContribution
145
+ status
146
+ dateTimeCreated
147
+ dateTimeSettled
148
+ dateTimeLastUpdated
149
+ metadata
150
+ vendorRoundId
151
+ betContent
152
+ contestName
153
+ externalCategory
154
+ }
155
+ }
156
+ }
157
+ pageInfo {
158
+ hasNextPage
159
+ endCursor
160
+ }
161
+ }
162
+ }
163
+ }
164
+ `, _e = o`
165
+ query LatestBetRecords {
166
+ latestBetRecords {
167
+ id
168
+ member {
169
+ id
170
+ name
171
+ }
172
+ game {
173
+ ...GameFragment
174
+ }
175
+ bet
176
+ payout
177
+ validBet
178
+ dateTimeSettled
179
+ dateTimeCreated
180
+ }
181
+ }
182
+
183
+ ${b}
184
+ `, A = o`
185
+ fragment FileFragment on File {
186
+ id
187
+ url
188
+ status
189
+ dateTimeCreated
190
+ }
191
+ `, de = o`
192
+ ${A}
193
+
194
+ query File($id: ObjectId!) {
195
+ node(id: $id) {
196
+ ... on File {
197
+ ...FileFragment
198
+ }
199
+ }
200
+ }
201
+ `;
202
+ o`
203
+ mutation UploadPrivateImageFile($input: UploadFileInput!) {
204
+ uploadPrivateImageFile(input: $input) {
205
+ ... on FileFormatNotSupportedError {
206
+ code: __typename
207
+ message
208
+ }
209
+ ... on FileNameTooLongError {
210
+ code: __typename
211
+ message
212
+ }
213
+ ... on FileSizeTooBigError {
214
+ code: __typename
215
+ message
216
+ }
217
+ }
218
+ }
219
+ `;
220
+ const pe = o`
221
+ ${A}
222
+
223
+ fragment CashbackFragment on Cashback {
224
+ id
225
+ name
226
+ banner {
227
+ ...FileFragment
228
+ }
229
+ status
230
+ description
231
+ activationStartDateTime
232
+ activationEndDateTime
233
+ dateTimeCreated
234
+ dateTimeLastUpdated
235
+ }
236
+ `, ve = o`
237
+ ${pe}
238
+
239
+ query Cashbacks {
240
+ cashbacks {
241
+ ...CashbackFragment
242
+ }
243
+ }
244
+ `, S = o`
245
+ ${A}
246
+
247
+ fragment PromoFragment on Promo {
248
+ id
249
+ type
250
+ name
251
+ banner {
252
+ ...FileFragment
253
+ }
254
+ status
255
+ description
256
+ maximumBonusAmount
257
+ minimumBonusAmount
258
+ activationStartDateTime
259
+ activationEndDateTime
260
+ dateTimeCreated
261
+ dateTimeLastUpdated
262
+ }
263
+ `, De = o`
264
+ ${S}
265
+
266
+ query Promos {
267
+ promos {
268
+ ...PromoFragment
269
+ }
270
+ }
271
+ `, Me = o`
272
+ ${S}
273
+
274
+ query AvailablePromos($filter: PromoFilterInput) {
275
+ availablePromos(filter: $filter) {
276
+ ...PromoFragment
277
+ }
278
+ }
279
+ `, Re = o`
280
+ ${S}
281
+
282
+ query Bonus {
283
+ bonus {
284
+ id
285
+ promo {
286
+ ...PromoFragment
287
+ }
288
+ deposit {
289
+ type
290
+ amount
291
+ netAmount
292
+ fee
293
+ status
294
+ reference
295
+ dateTimeCreated
296
+ dateTimeLastUpdated
297
+ }
298
+ amount
299
+ balance
300
+ turnoverRequirement
301
+ currentTurnoverRequirementContribution
302
+ currentTurnoverRequirementContributionPercentage
303
+ expiration
304
+ dateTimeCreated
305
+ dateTimeLastUpdated
306
+ }
307
+ }
308
+ `, Ne = o`
309
+ ${pe}
310
+
311
+ query CashbackBonuses {
312
+ cashbackBonuses {
313
+ id
314
+ balance
315
+ cashback {
316
+ ...CashbackFragment
317
+ }
318
+ dateTimeCreated
319
+ dateTimeLastUpdated
320
+ }
321
+ }
322
+ `, Ie = o`
323
+ mutation ClaimCashbackBonus($input: ClaimCashbackBonusInput!) {
324
+ claimCashbackBonus(input: $input) {
325
+ ... on CashbackBonusDoesNotExistError {
326
+ code: __typename
327
+ message
328
+ }
329
+ }
330
+ }
331
+ `, Ge = o`
332
+ query DepositRecords($after: Cursor, $first: Int, $filter: DepositRecordFilterInput) {
333
+ member {
334
+ depositRecords(after: $after, first: $first, filter: $filter) {
335
+ edges {
336
+ cursor
337
+ node {
338
+ ... on DepositRecord {
339
+ id
340
+ type
341
+ amount
342
+ netAmount
343
+ fee
344
+ status
345
+ reference
346
+ depositNumber
347
+ dateTimeCreated
348
+ dateTimeLastUpdated
349
+ }
350
+ }
351
+ }
352
+ totalCount
353
+ pageInfo {
354
+ hasNextPage
355
+ endCursor
356
+ }
357
+ }
358
+ }
359
+ }
360
+ `, Pe = o`
361
+ mutation CreateGCashDeposit($input: CreateGCashDepositInput!) {
362
+ createGCashDeposit(input: $input) {
363
+ ... on DepositPromoMaximumAmountExceededError {
364
+ code: __typename
365
+ message
366
+ }
367
+ ... on DepositPromoMinimumAmountNotMetError {
368
+ code: __typename
369
+ message
370
+ }
371
+ ... on HasActiveBonusError {
372
+ code: __typename
373
+ message
374
+ }
375
+ ... on MaximumDepositAmountExceededError {
376
+ code: __typename
377
+ message
378
+ }
379
+ ... on MinimumDepositAmountNotMetError {
380
+ code: __typename
381
+ message
382
+ }
383
+ ... on MinimumFirstDepositAmountNotMetError {
384
+ code: __typename
385
+ message
386
+ }
387
+ ... on PromoNotEnabledError {
388
+ code: __typename
389
+ message
390
+ }
391
+ ... on WalletDoesNotExistError {
392
+ code: __typename
393
+ message
394
+ }
395
+ }
396
+ }
397
+ `, $e = o`
398
+ mutation CreateMayaDeposit($input: CreateMayaDepositInput!) {
399
+ createMayaDeposit(input: $input) {
400
+ ... on DepositPromoMaximumAmountExceededError {
401
+ code: __typename
402
+ message
403
+ }
404
+ ... on DepositPromoMinimumAmountNotMetError {
405
+ code: __typename
406
+ message
407
+ }
408
+ ... on HasActiveBonusError {
409
+ code: __typename
410
+ message
411
+ }
412
+ ... on MaximumDepositAmountExceededError {
413
+ code: __typename
414
+ message
415
+ }
416
+ ... on MinimumDepositAmountNotMetError {
417
+ code: __typename
418
+ message
419
+ }
420
+ ... on MinimumFirstDepositAmountNotMetError {
421
+ code: __typename
422
+ message
423
+ }
424
+ ... on PromoNotEnabledError {
425
+ code: __typename
426
+ message
427
+ }
428
+ ... on WalletDoesNotExistError {
429
+ code: __typename
430
+ message
431
+ }
432
+ }
433
+ }
434
+ `, We = o`
435
+ mutation CreateMayaAppDeposit($input: CreateMayaAppDepositInput!) {
436
+ createMayaAppDeposit(input: $input) {
437
+ ... on DepositPromoMaximumAmountExceededError {
438
+ code: __typename
439
+ message
440
+ }
441
+ ... on DepositPromoMinimumAmountNotMetError {
442
+ code: __typename
443
+ message
444
+ }
445
+ ... on HasActiveBonusError {
446
+ code: __typename
447
+ message
448
+ }
449
+ ... on MaximumDepositAmountExceededError {
450
+ code: __typename
451
+ message
452
+ }
453
+ ... on MinimumDepositAmountNotMetError {
454
+ code: __typename
455
+ message
456
+ }
457
+ ... on MinimumFirstDepositAmountNotMetError {
458
+ code: __typename
459
+ message
460
+ }
461
+ ... on PromoNotEnabledError {
462
+ code: __typename
463
+ message
464
+ }
465
+ ... on WalletDoesNotExistError {
466
+ code: __typename
467
+ message
468
+ }
469
+ }
470
+ }
471
+ `, Be = o`
472
+ query Deposit($id: ObjectId!) {
473
+ node(id: $id) {
474
+ ... on GCashDeposit {
475
+ id
476
+ type
477
+ amount
478
+ netAmount
479
+ fee
480
+ status
481
+ reference
482
+ checkoutUrl
483
+ dateTimeCreated
484
+ dateTimeLastUpdated
485
+ }
486
+ ... on MayaDeposit {
487
+ id
488
+ type
489
+ amount
490
+ netAmount
491
+ fee
492
+ status
493
+ reference
494
+ checkoutUrl
495
+ dateTimeCreated
496
+ dateTimeLastUpdated
497
+ }
498
+ ... on MayaAppDeposit {
499
+ id
500
+ type
501
+ amount
502
+ netAmount
503
+ fee
504
+ status
505
+ reference
506
+ checkoutUrl
507
+ dateTimeCreated
508
+ dateTimeLastUpdated
509
+ }
510
+ }
511
+ }
512
+ `, Ue = o`
513
+ query DepositsCount {
514
+ member {
515
+ depositsCount
516
+ }
517
+ }
518
+ `, xe = o`
519
+ query Member {
520
+ member {
521
+ dateTimeLastActive
522
+ }
523
+ }
524
+ `, Oe = o`
525
+ query MemberAccount {
526
+ memberAccount: self {
527
+ ... on MemberAccount {
528
+ id
529
+ name
530
+ status
531
+ realName
532
+ emailAddress
533
+ mobileNumber
534
+ birthDay
535
+ verified
536
+ verificationStatus
537
+ nickName
538
+ validId
539
+ mobileNumberVerified
540
+ mobileNumberVerificationRequired
541
+ transactionPassword
542
+ dateTimeCreated
543
+ dateTimeLastUpdated
544
+ }
545
+ }
546
+ }
547
+ `, qe = o`
548
+ ${A}
549
+
550
+ query MemberVerification {
551
+ memberAccount: self {
552
+ ... on MemberAccount {
553
+ verification {
554
+ id
555
+ status
556
+ address
557
+ sourceOfIncome
558
+ natureOfWork
559
+ nationality
560
+ placeOfBirth
561
+ idFrontImage {
562
+ ...FileFragment
563
+ }
564
+ selfieImage {
565
+ ...FileFragment
566
+ }
567
+ }
568
+ }
569
+ }
570
+ }
571
+ `, Fe = o`
572
+ mutation RegisterMemberAccount(
573
+ $input: RegisterMemberAccountInput!
574
+ $referralCode: String
575
+ $verificationCode: String
576
+ $reCAPTCHAResponse: String
577
+ ) {
578
+ registerMemberAccount(
579
+ input: $input
580
+ referralCode: $referralCode
581
+ verificationCode: $verificationCode
582
+ reCAPTCHAResponse: $reCAPTCHAResponse
583
+ ) {
584
+ ... on AccountNameNotAvailableError {
585
+ code: __typename
586
+ message
587
+ }
588
+ ... on InvalidPlatformError {
589
+ code: __typename
590
+ message
591
+ }
592
+ ... on InvalidPlatformError {
593
+ code: __typename
594
+ message
595
+ }
596
+ ... on InvalidReCAPTCHAResponseError {
597
+ code: __typename
598
+ message
599
+ }
600
+ ... on InvalidSMSVerificationCodeError {
601
+ code: __typename
602
+ message
603
+ }
604
+ ... on MinimumAgeRequirementError {
605
+ code: __typename
606
+ message
607
+ }
608
+ ... on MobileNumberNotAvailableError {
609
+ code: __typename
610
+ message
611
+ }
612
+ }
613
+ }
614
+ `, Le = o`
615
+ mutation UpdateMemberAccount($input: UpdateMemberAccountInput!) {
616
+ updateMemberAccount(input: $input) {
617
+ ... on AccountNameNotAvailableError {
618
+ code: __typename
619
+ message
620
+ }
621
+ ... on EmailAddressNotAvailableError {
622
+ code: __typename
623
+ message
624
+ }
625
+ ... on InvalidTransactionPasswordError {
626
+ code: __typename
627
+ message
628
+ }
629
+ ... on MobileNumberNotAvailableError {
630
+ code: __typename
631
+ message
632
+ }
633
+ ... on NickNameNotAvailableError {
634
+ code: __typename
635
+ message
636
+ }
637
+ ... on RealNameAlreadySetError {
638
+ code: __typename
639
+ message
640
+ }
641
+ ... on ValidIdAlreadySetError {
642
+ code: __typename
643
+ message
644
+ }
645
+ }
646
+ }
647
+ `, Ve = o`
648
+ mutation ResetPassword($input: ResetPasswordInput!, $verificationCode: String) {
649
+ resetPassword(input: $input, verificationCode: $verificationCode) {
650
+ ... on AccountNotFoundError {
651
+ code: __typename
652
+ message
653
+ }
654
+ ... on InvalidVerificationCodeError {
655
+ code: __typename
656
+ message
657
+ }
658
+ }
659
+ }
660
+ `, He = o`
661
+ mutation DeleteMemberAccount($input: DeleteMemberAccountInput!) {
662
+ deleteMemberAccount(input: $input)
663
+ }
664
+ `, Ye = o`
665
+ mutation SendVerificationCode($input: SendVerificationCodeInput!) {
666
+ sendVerificationCode(input: $input) {
667
+ ... on InvalidPlatformError {
668
+ code: __typename
669
+ message
670
+ }
671
+ ... on NotReadyToSendVerficationCodeError {
672
+ code: __typename
673
+ message
674
+ }
675
+ }
676
+ }
677
+ `, je = o`
678
+ mutation VerifyMobileNumber($input: VerifyMobileNumberInput!) {
679
+ verifyMobileNumber(input: $input) {
680
+ ... on InvalidSMSVerificationCodeError {
681
+ code: __typename
682
+ message
683
+ }
684
+ ... on MobileNumberAlreadyVerifiedError {
685
+ code: __typename
686
+ message
687
+ }
688
+ }
689
+ }
690
+ `, Qe = o`
691
+ mutation CreateMemberVerification($input: CreateMemberVerificationInput!) {
692
+ createMemberVerification(input: $input) {
693
+ ... on FileDoesNotExistError {
694
+ code: __typename
695
+ message
696
+ }
697
+ ... on FileNotReadyError {
698
+ code: __typename
699
+ message
700
+ }
701
+ ... on MemberVerificationAlreadyExistsError {
702
+ code: __typename
703
+ message
704
+ }
705
+ }
706
+ }
707
+ `, Ke = o`
708
+ mutation UpdateMemberVerification($input: UpdateMemberVerificationInput!) {
709
+ updateMemberVerification(input: $input) {
710
+ ... on FileDoesNotExistError {
711
+ code: __typename
712
+ message
713
+ }
714
+ ... on FileNotReadyError {
715
+ code: __typename
716
+ message
717
+ }
718
+ ... on MemberVerificationAlreadyApprovedError {
719
+ code: __typename
720
+ message
721
+ }
722
+ ... on MemberVerificationDoesNotExistError {
723
+ code: __typename
724
+ message
725
+ }
726
+ }
727
+ }
728
+ `, ze = o`
729
+ query ProfileCompletion {
730
+ profileCompletion {
731
+ completionPercentage
732
+ personalInformation
733
+ accountVerification
734
+ mobileNumberVerification
735
+ transactionPassword
736
+ accountPassword
737
+ }
738
+ }
739
+ `, Je = o`
740
+ fragment DepositGatewaySettingsCoreData on DepositGatewaySettings {
741
+ minimumAmount
742
+ maximumAmount
743
+ fixedFee
744
+ percentageFee
745
+ webEnabled
746
+ mobileWebEnabled
747
+ androidEnabled
748
+ iosEnabled
749
+ }
750
+
751
+ fragment WithdrawalGatewaySettingsCoreData on WithdrawalGatewaySettings {
752
+ minimumAmount
753
+ maximumAmount
754
+ fixedFee
755
+ percentageFee
756
+ webEnabled
757
+ mobileWebEnabled
758
+ androidEnabled
759
+ iosEnabled
760
+ }
761
+
762
+ query Platform {
763
+ minimumFirstDepositAmount
764
+ restrictWithdrawalsToVerifiedMembers
765
+ bankDepositGatewaySettings: depositGatewaySettings(gateway: BANK) {
766
+ ...DepositGatewaySettingsCoreData
767
+ }
768
+ gcashDepositGatewaySettings: depositGatewaySettings(gateway: GCASH) {
769
+ ...DepositGatewaySettingsCoreData
770
+ }
771
+ mayaDepositGatewaySettings: depositGatewaySettings(gateway: MAYA) {
772
+ ...DepositGatewaySettingsCoreData
773
+ }
774
+ mayaAppDepositGatewaySettings: depositGatewaySettings(gateway: MAYA_APP) {
775
+ ...DepositGatewaySettingsCoreData
776
+ }
777
+ bankWithdrawalGatewaySettings: withdrawalGatewaySettings(gateway: BANK) {
778
+ ...WithdrawalGatewaySettingsCoreData
779
+ }
780
+ gcashWithdrawalGatewaySettings: withdrawalGatewaySettings(gateway: GCASH) {
781
+ ...WithdrawalGatewaySettingsCoreData
782
+ }
783
+ mayaWithdrawalGatewaySettings: withdrawalGatewaySettings(gateway: MAYA) {
784
+ ...WithdrawalGatewaySettingsCoreData
785
+ }
786
+ mayaAppWithdrawalGatewaySettings: withdrawalGatewaySettings(gateway: MAYA_APP) {
787
+ ...WithdrawalGatewaySettingsCoreData
788
+ }
789
+ pointsClubSettings {
790
+ multiplier
791
+ }
792
+ }
793
+ `, Ze = o`
794
+ query PointsWallet {
795
+ pointsWallet {
796
+ id
797
+ points
798
+ account
799
+ dateTimeCreated
800
+ }
801
+ }
802
+ `, Xe = o`
803
+ mutation PointsToCashConversion($input: PointsToCashConversionInput!) {
804
+ pointsToCashConversion(input: $input) {
805
+ ... on InsufficientPointsError {
806
+ message
807
+ __typename
808
+ }
809
+ }
810
+ }
811
+ `, et = o`
812
+ query TransactionRecords($first: Int, $after: Cursor, $filter: TransactionRecordFilter) {
813
+ member {
814
+ transactionRecords(first: $first, after: $after, filter: $filter) {
815
+ edges {
816
+ cursor
817
+ node {
818
+ ... on TransactionRecord {
819
+ id
820
+ type
821
+ amount
822
+ content
823
+ currentBalance
824
+ referenceNumber
825
+ dateTimeCreated
826
+ }
827
+ }
828
+ }
829
+ totalCount
830
+ pageInfo {
831
+ hasNextPage
832
+ endCursor
833
+ }
834
+ }
835
+ }
836
+ }
837
+ `, tt = o`
838
+ query Wallet {
839
+ wallet {
840
+ id
841
+ balance
842
+ currency
843
+ dateTimeCreated
844
+ dateTimeLastUpdated
845
+ }
846
+ }
847
+ `, at = o`
848
+ query WithdrawalRecords($first: Int, $after: Cursor, $filter: WithdrawalRecordFilterInput) {
849
+ member {
850
+ withdrawalRecords(first: $first, after: $after, filter: $filter) {
851
+ edges {
852
+ cursor
853
+ node {
854
+ ... on BankWithdrawalRecord {
855
+ id
856
+ type
857
+ bank
858
+ fee
859
+ netAmount
860
+ reference
861
+ amount
862
+ status
863
+ withdrawalNumber
864
+ dateTimeCreated
865
+ dateTimeLastUpdated
866
+ }
867
+ ... on GCashWithdrawalRecord {
868
+ id
869
+ type
870
+ fee
871
+ netAmount
872
+ reference
873
+ amount
874
+ status
875
+ withdrawalNumber
876
+ recipientMobileNumber
877
+ dateTimeCreated
878
+ dateTimeLastUpdated
879
+ }
880
+ ... on ManualWithdrawalRecord {
881
+ id
882
+ type
883
+ fee
884
+ netAmount
885
+ reference
886
+ amount
887
+ status
888
+ withdrawalNumber
889
+ dateTimeCreated
890
+ dateTimeLastUpdated
891
+ }
892
+ ... on MayaAppWithdrawalRecord {
893
+ id
894
+ type
895
+ fee
896
+ netAmount
897
+ reference
898
+ amount
899
+ status
900
+ withdrawalNumber
901
+ dateTimeCreated
902
+ dateTimeLastUpdated
903
+ }
904
+ }
905
+ }
906
+ totalCount
907
+ pageInfo {
908
+ hasNextPage
909
+ endCursor
910
+ }
911
+ }
912
+ }
913
+ }
914
+ `, rt = o`
915
+ mutation CreateGCashWithdrawal($input: CreateGCashWithdrawalInput!) {
916
+ createGCashWithdrawal(input: $input) {
917
+ ... on AccountNotVerifiedError {
918
+ code: __typename
919
+ message
920
+ }
921
+ ... on InvalidTransactionPasswordError {
922
+ code: __typename
923
+ message
924
+ }
925
+ ... on InvalidWithdrawalAmountError {
926
+ code: __typename
927
+ message
928
+ }
929
+ ... on MobileNumberNotVerifiedError {
930
+ code: __typename
931
+ message
932
+ }
933
+ ... on NotEnoughBalanceError {
934
+ code: __typename
935
+ message
936
+ }
937
+ ... on WithdrawalDailyLimitExceededError {
938
+ code: __typename
939
+ message
940
+ }
941
+ }
942
+ }
943
+ `, ot = o`
944
+ mutation CreateMayaWithdrawal($input: CreateMayaWithdrawalInput!) {
945
+ createMayaWithdrawal(input: $input) {
946
+ ... on AccountNotVerifiedError {
947
+ code: __typename
948
+ message
949
+ }
950
+ ... on InvalidTransactionPasswordError {
951
+ code: __typename
952
+ message
953
+ }
954
+ ... on InvalidWithdrawalAmountError {
955
+ code: __typename
956
+ message
957
+ }
958
+ ... on MobileNumberNotVerifiedError {
959
+ code: __typename
960
+ message
961
+ }
962
+ ... on NotEnoughBalanceError {
963
+ code: __typename
964
+ message
965
+ }
966
+ ... on WithdrawalDailyLimitExceededError {
967
+ code: __typename
968
+ message
969
+ }
970
+ }
971
+ }
972
+ `, nt = o`
973
+ mutation CreateMayaAppWithdrawal($input: CreateMayaAppWithdrawalInput!) {
974
+ createMayaAppWithdrawal(input: $input) {
975
+ ... on AccountNotVerifiedError {
976
+ code: __typename
977
+ message
978
+ }
979
+ ... on InvalidTransactionPasswordError {
980
+ code: __typename
981
+ message
982
+ }
983
+ ... on InvalidWithdrawalAmountError {
984
+ code: __typename
985
+ message
986
+ }
987
+ ... on NotEnoughBalanceError {
988
+ code: __typename
989
+ message
990
+ }
991
+ ... on WithdrawalDailyLimitExceededError {
992
+ code: __typename
993
+ message
994
+ }
995
+ }
996
+ }
997
+ `, it = o`
998
+ mutation CreateBankWithdrawal($input: CreateBankWithdrawalInput!) {
999
+ createBankWithdrawal(input: $input) {
1000
+ ... on MobileNumberNotVerifiedError {
1001
+ code: __typename
1002
+ message
1003
+ }
1004
+ ... on AccountNotVerifiedError {
1005
+ code: __typename
1006
+ message
1007
+ }
1008
+ ... on InvalidWithdrawalAmountError {
1009
+ code: __typename
1010
+ message
1011
+ }
1012
+ ... on WithdrawalDailyLimitExceededError {
1013
+ code: __typename
1014
+ message
1015
+ }
1016
+ ... on InvalidTransactionPasswordError {
1017
+ code: __typename
1018
+ message
1019
+ }
1020
+ ... on NotEnoughBalanceError {
1021
+ code: __typename
1022
+ message
1023
+ }
1024
+ }
1025
+ }
1026
+ `, st = o`
1027
+ query RemainingDailyWithdrawalsCount {
1028
+ remainingDailyWithdrawalsCount
1029
+ }
1030
+ `;
1031
+ class dt {
1032
+ constructor(e) {
1033
+ d(this, "client");
1034
+ this.client = e;
1035
+ }
1036
+ /** aka `Query.self` */
1037
+ async memberAccount() {
1038
+ const e = await this.client.request(Oe);
1039
+ return e.ok ? {
1040
+ ok: !0,
1041
+ data: e.data.memberAccount
1042
+ } : e;
1043
+ }
1044
+ async registerMemberAccount(e) {
1045
+ const t = await this.client.request(
1046
+ Fe,
1047
+ e
1048
+ );
1049
+ return t.ok ? t.data.registerMemberAccount ? {
1050
+ ok: !1,
1051
+ error: t.data.registerMemberAccount
1052
+ } : {
1053
+ ok: !0
1054
+ } : t;
1055
+ }
1056
+ async updateMemberAccount(e) {
1057
+ const t = await this.client.request(
1058
+ Le,
1059
+ e
1060
+ );
1061
+ return t.ok ? t.data.updateMemberAccount ? {
1062
+ ok: !1,
1063
+ error: t.data.updateMemberAccount
1064
+ } : {
1065
+ ok: !0
1066
+ } : t;
1067
+ }
1068
+ async deleteMemberAccount(e) {
1069
+ const t = await this.client.request(
1070
+ He,
1071
+ e
1072
+ );
1073
+ return t.ok ? t.data.deleteMemberAccount ? {
1074
+ ok: !0
1075
+ } : {
1076
+ ok: !1,
1077
+ error: {
1078
+ code: "UnknownError",
1079
+ message: "Something went wrong."
1080
+ }
1081
+ } : t;
1082
+ }
1083
+ async resetPassword(e) {
1084
+ const t = await this.client.request(
1085
+ Ve,
1086
+ e
1087
+ );
1088
+ return t.ok ? t.data.resetPassword ? {
1089
+ ok: !1,
1090
+ error: t.data.resetPassword
1091
+ } : {
1092
+ ok: !0
1093
+ } : t;
1094
+ }
1095
+ async profileCompletion() {
1096
+ const e = await this.client.request(ze);
1097
+ return e.ok ? { ok: !0, data: e.data.profileCompletion } : e;
1098
+ }
1099
+ async platform() {
1100
+ return await this.client.request(Je);
1101
+ }
1102
+ async sendVerificationCode(e) {
1103
+ const t = await this.client.request(
1104
+ Ye,
1105
+ e
1106
+ );
1107
+ return t.ok ? t.data.sendVerificationCode ? {
1108
+ ok: !1,
1109
+ error: t.data.sendVerificationCode
1110
+ } : {
1111
+ ok: !0
1112
+ } : t;
1113
+ }
1114
+ async verifyMobileNumber(e) {
1115
+ const t = await this.client.request(
1116
+ je,
1117
+ e
1118
+ );
1119
+ return t.ok ? t.data.verifyMobileNumber ? {
1120
+ ok: !1,
1121
+ error: t.data.verifyMobileNumber
1122
+ } : {
1123
+ ok: !0
1124
+ } : t;
1125
+ }
1126
+ async createMemberVerification(e) {
1127
+ const t = await this.client.request(
1128
+ Qe,
1129
+ e
1130
+ );
1131
+ return t.ok ? t.data.createMemberVerification ? {
1132
+ ok: !1,
1133
+ error: t.data.createMemberVerification
1134
+ } : {
1135
+ ok: !0
1136
+ } : t;
1137
+ }
1138
+ async updateMemberVerification(e) {
1139
+ const t = await this.client.request(
1140
+ Ke,
1141
+ e
1142
+ );
1143
+ return t.ok ? t.data.updateMemberVerification ? {
1144
+ ok: !1,
1145
+ error: t.data.updateMemberVerification
1146
+ } : {
1147
+ ok: !0
1148
+ } : t;
1149
+ }
1150
+ async memberVerification() {
1151
+ const e = await this.client.request(qe);
1152
+ return e.ok ? {
1153
+ ok: !0,
1154
+ data: e.data.memberAccount.verification
1155
+ } : e;
1156
+ }
1157
+ async announcements(e) {
1158
+ const t = await this.client.request(ye, e);
1159
+ return t.ok ? {
1160
+ ok: !0,
1161
+ data: t.data.announcements
1162
+ } : t;
1163
+ }
1164
+ }
1165
+ function u(i, e) {
1166
+ const t = mt[i];
1167
+ return {
1168
+ code: t.code,
1169
+ message: e ?? t.message
1170
+ };
1171
+ }
1172
+ const mt = {
1173
+ 400: {
1174
+ code: "HttpBadRequest",
1175
+ message: "Bad Request"
1176
+ },
1177
+ 401: {
1178
+ code: "HttpUnauthorized",
1179
+ message: "Unauthorized"
1180
+ },
1181
+ 403: {
1182
+ code: "HttpForbidden",
1183
+ message: "Forbidden"
1184
+ },
1185
+ 404: {
1186
+ code: "HttpNotFound",
1187
+ message: "Not Found"
1188
+ },
1189
+ 408: {
1190
+ code: "HttpRequestTimeout",
1191
+ message: "Request Timeout"
1192
+ },
1193
+ 429: {
1194
+ code: "HttpTooManyRequests",
1195
+ message: "Too Many Requests"
1196
+ },
1197
+ 500: {
1198
+ code: "HttpInternalServerError",
1199
+ message: "Internal Server Error"
1200
+ },
1201
+ 503: {
1202
+ code: "HttpServiceUnavailable",
1203
+ message: "Service Unavailable"
1204
+ }
1205
+ };
1206
+ async function h(i) {
1207
+ const e = new TextEncoder().encode(i), t = await crypto.subtle.digest("SHA-256", e);
1208
+ return Array.from(new Uint8Array(t)).map((m) => m.toString(16).padStart(2, "0")).join("");
1209
+ }
1210
+ class ct {
1211
+ constructor(e) {
1212
+ d(this, "url");
1213
+ d(this, "platform");
1214
+ this.url = e.url, this.platform = e.platform;
1215
+ }
1216
+ async createSession(e) {
1217
+ const t = new Headers();
1218
+ 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 h(e.password)}`, n = Buffer.from(a).toString("base64");
1220
+ t.set("Authorization", `Basic ${n}`);
1221
+ }
1222
+ if ("mobileNumber" in e) {
1223
+ const a = `${e.mobileNumber}:${e.verificationCode}`, n = Buffer.from(a).toString("base64");
1224
+ t.set("Authorization", `Basic ${n}`);
1225
+ }
1226
+ try {
1227
+ const a = await fetch(`${this.url}/sessions`, {
1228
+ method: "POST",
1229
+ headers: t
1230
+ }), n = await a.json();
1231
+ return a.status === 401 || a.status === 403 ? n.code === "ACCOUNT_BLACKLISTED" ? {
1232
+ ok: !1,
1233
+ error: {
1234
+ code: "AccountBlacklisted",
1235
+ message: "Account is blacklisted"
1236
+ }
1237
+ } : {
1238
+ ok: !1,
1239
+ error: {
1240
+ code: "AccountNotFound",
1241
+ message: "Account not found."
1242
+ }
1243
+ } : a.ok ? {
1244
+ ok: !0,
1245
+ data: n
1246
+ } : {
1247
+ ok: !1,
1248
+ error: u(a.status)
1249
+ };
1250
+ } catch {
1251
+ return {
1252
+ ok: !1,
1253
+ error: u(500)
1254
+ };
1255
+ }
1256
+ }
1257
+ async refreshSession(e) {
1258
+ try {
1259
+ const t = await fetch(`${this.url}/session:refresh`, {
1260
+ method: "POST",
1261
+ headers: {
1262
+ "Content-Type": "application/json",
1263
+ Authorization: `Bearer ${e}`,
1264
+ "Platform-Code": this.platform,
1265
+ Role: "MEMBER"
1266
+ }
1267
+ }), a = await t.json();
1268
+ return t.status === 401 || t.status === 403 ? a.code === "ACCOUNT_BLACKLISTED" ? {
1269
+ ok: !1,
1270
+ error: {
1271
+ code: "AccountBlacklisted",
1272
+ message: "Account is blacklisted"
1273
+ }
1274
+ } : {
1275
+ ok: !1,
1276
+ error: {
1277
+ code: "InvalidToken",
1278
+ message: "Invalid token."
1279
+ }
1280
+ } : t.ok ? {
1281
+ ok: !0,
1282
+ data: a
1283
+ } : {
1284
+ ok: !1,
1285
+ error: u(t.status)
1286
+ };
1287
+ } catch {
1288
+ return {
1289
+ ok: !1,
1290
+ error: u(500)
1291
+ };
1292
+ }
1293
+ }
1294
+ async destroySession(e) {
1295
+ try {
1296
+ const t = await fetch(`${this.url}/session`, {
1297
+ method: "DELETE",
1298
+ headers: {
1299
+ "Content-Type": "application/json",
1300
+ Authorization: `Bearer ${e}`,
1301
+ "Platform-Code": this.platform,
1302
+ Role: "MEMBER"
1303
+ }
1304
+ });
1305
+ return t.ok ? { ok: !0 } : {
1306
+ ok: !1,
1307
+ error: u(t.status)
1308
+ };
1309
+ } catch {
1310
+ return {
1311
+ ok: !1,
1312
+ error: {
1313
+ code: "UnknownError",
1314
+ message: "Something went wrong."
1315
+ }
1316
+ };
1317
+ }
1318
+ }
1319
+ async verifySession(e) {
1320
+ try {
1321
+ const t = await fetch(`${this.url}/session`, {
1322
+ method: "GET",
1323
+ headers: {
1324
+ "Content-Type": "application/json",
1325
+ Authorization: `Bearer ${e}`,
1326
+ "Platform-Code": this.platform,
1327
+ Role: "MEMBER"
1328
+ }
1329
+ });
1330
+ if (t.status === 403 || t.status === 401) return !1;
1331
+ } catch {
1332
+ }
1333
+ return !0;
1334
+ }
1335
+ }
1336
+ class ut {
1337
+ constructor(e) {
1338
+ d(this, "client");
1339
+ this.client = e;
1340
+ }
1341
+ async file(e) {
1342
+ const t = await this.client.request(de, e);
1343
+ return t.ok ? {
1344
+ ok: !0,
1345
+ data: t.data.node
1346
+ } : t;
1347
+ }
1348
+ async uploadPrivateImageFile(e) {
1349
+ const t = await this.client.upload(de, e);
1350
+ return t.ok ? t.data.uploadPrivateImageFile ? {
1351
+ ok: !1,
1352
+ error: t.data.uploadPrivateImageFile
1353
+ } : {
1354
+ ok: !0
1355
+ } : t;
1356
+ }
1357
+ }
1358
+ class he {
1359
+ constructor(e) {
1360
+ d(this, "client");
1361
+ this.client = e;
1362
+ }
1363
+ async game(e) {
1364
+ const t = await this.client.request(be, e);
1365
+ return t.ok ? { ok: !0, data: t.data.node } : t;
1366
+ }
1367
+ async games(e) {
1368
+ const t = await this.client.request(Ae, e);
1369
+ return t.ok ? { ok: !0, data: t.data.games } : t;
1370
+ }
1371
+ async gamesByName(e) {
1372
+ const t = await this.client.request(Se, e);
1373
+ return t.ok ? { ok: !0, data: t.data.gamesByName } : t;
1374
+ }
1375
+ async gameSession(e) {
1376
+ const t = await this.client.request(Ee, e);
1377
+ return t.ok ? { ok: !0, data: t.data.node } : t;
1378
+ }
1379
+ async createGameSession(e) {
1380
+ const t = await this.client.request(
1381
+ Ce,
1382
+ e
1383
+ );
1384
+ return t.ok ? t.data.createGameSession ? {
1385
+ ok: !1,
1386
+ error: t.data.createGameSession
1387
+ } : {
1388
+ ok: !0
1389
+ } : t;
1390
+ }
1391
+ async endGameSession(e) {
1392
+ const t = await this.client.request(
1393
+ ke,
1394
+ e
1395
+ );
1396
+ return t.ok ? t.data.endGameSession ? {
1397
+ ok: !0
1398
+ } : {
1399
+ ok: !1,
1400
+ error: {
1401
+ code: "UnknownError",
1402
+ message: "Something went wrong."
1403
+ }
1404
+ } : t;
1405
+ }
1406
+ }
1407
+ class lt {
1408
+ constructor(e) {
1409
+ d(this, "client");
1410
+ this.client = e;
1411
+ }
1412
+ async betRecords(e) {
1413
+ const t = await this.client.request(Te, e);
1414
+ return t.ok ? { ok: t.ok, data: t.data.member.betRecords } : t;
1415
+ }
1416
+ async transactionRecords(e) {
1417
+ const t = await this.client.request(
1418
+ et,
1419
+ e
1420
+ );
1421
+ return t.ok ? { ok: t.ok, data: t.data.member.transactionRecords } : t;
1422
+ }
1423
+ async withdrawalRecords(e) {
1424
+ const t = await this.client.request(
1425
+ at,
1426
+ e
1427
+ );
1428
+ return t.ok ? { ok: t.ok, data: t.data.member.withdrawalRecords } : t;
1429
+ }
1430
+ async depositRecords(e) {
1431
+ const t = await this.client.request(Ge, e);
1432
+ return t.ok ? { ok: t.ok, data: t.data.member.depositRecords } : t;
1433
+ }
1434
+ async depositsCount() {
1435
+ const e = await this.client.request(Ue);
1436
+ return e.ok ? { ok: e.ok, data: e.data.member.depositsCount } : e;
1437
+ }
1438
+ async member() {
1439
+ const e = await this.client.request(xe);
1440
+ return e.ok ? { ok: e.ok, data: e.data.member } : e;
1441
+ }
1442
+ }
1443
+ class pt {
1444
+ constructor(e) {
1445
+ d(this, "url");
1446
+ this.url = e.url;
1447
+ }
1448
+ gameThumbnail(e) {
1449
+ return `${this.url}/images/${e.provider.toLowerCase()}/thumbnail-${e.id}.webp`;
1450
+ }
1451
+ }
1452
+ class ht extends he {
1453
+ async promos() {
1454
+ const e = await this.client.request(De);
1455
+ return e.ok ? { ok: e.ok, data: e.data.promos } : e;
1456
+ }
1457
+ async cashbacks() {
1458
+ const e = await this.client.request(ve);
1459
+ return e.ok ? { ok: e.ok, data: e.data.cashbacks } : e;
1460
+ }
1461
+ async availablePromos(e) {
1462
+ const t = await this.client.request(Me, e);
1463
+ return t.ok ? { ok: t.ok, data: t.data.availablePromos } : t;
1464
+ }
1465
+ async cashbackBonuses() {
1466
+ const e = await this.client.request(Ne);
1467
+ return e.ok ? { ok: e.ok, data: e.data.cashbackBonuses } : e;
1468
+ }
1469
+ async claimCashbackBonus(e) {
1470
+ const t = await this.client.request(
1471
+ Ie,
1472
+ e
1473
+ );
1474
+ return t.ok ? t.data.claimCashbackBonus ? {
1475
+ ok: !1,
1476
+ error: t.data.claimCashbackBonus
1477
+ } : {
1478
+ ok: !0
1479
+ } : {
1480
+ ok: t.ok,
1481
+ error: t.error
1482
+ };
1483
+ }
1484
+ async bonus() {
1485
+ const e = await this.client.request(Re);
1486
+ return e.ok ? { ok: e.ok, data: e.data.bonus } : e;
1487
+ }
1488
+ async wallet() {
1489
+ const e = await this.client.request(tt);
1490
+ return e.ok ? { ok: e.ok, data: e.data.wallet } : e;
1491
+ }
1492
+ async deposit(e) {
1493
+ const t = await this.client.request(Be, e);
1494
+ return t.ok ? { ok: t.ok, data: t.data.node } : t;
1495
+ }
1496
+ async createGCashDeposit(e) {
1497
+ const t = await this.client.request(
1498
+ Pe,
1499
+ e
1500
+ );
1501
+ return t.ok ? t.data.createGCashDeposit ? {
1502
+ ok: !1,
1503
+ error: t.data.createGCashDeposit
1504
+ } : {
1505
+ ok: !0
1506
+ } : t;
1507
+ }
1508
+ async createMayaDeposit(e) {
1509
+ const t = await this.client.request(
1510
+ $e,
1511
+ e
1512
+ );
1513
+ return t.ok ? t.data.createMayaDeposit ? {
1514
+ ok: !1,
1515
+ error: t.data.createMayaDeposit
1516
+ } : {
1517
+ ok: !0
1518
+ } : t;
1519
+ }
1520
+ async createMayaAppDeposit(e) {
1521
+ const t = await this.client.request(
1522
+ We,
1523
+ e
1524
+ );
1525
+ return t.ok ? t.data.createMayaAppDeposit ? {
1526
+ ok: !1,
1527
+ error: t.data.createMayaAppDeposit
1528
+ } : {
1529
+ ok: !0
1530
+ } : t;
1531
+ }
1532
+ async createGCashWithdrawal(e) {
1533
+ const t = await this.client.request(
1534
+ rt,
1535
+ e
1536
+ );
1537
+ return t.ok ? t.data.createGCashWithdrawal ? {
1538
+ ok: !1,
1539
+ error: t.data.createGCashWithdrawal
1540
+ } : {
1541
+ ok: !0
1542
+ } : t;
1543
+ }
1544
+ async createMayaWithdrawal(e) {
1545
+ const t = await this.client.request(
1546
+ ot,
1547
+ e
1548
+ );
1549
+ return t.ok ? t.data.createMayaWithdrawal ? {
1550
+ ok: !1,
1551
+ error: t.data.createMayaWithdrawal
1552
+ } : {
1553
+ ok: !0
1554
+ } : t;
1555
+ }
1556
+ async createMayaAppWithdrawal(e) {
1557
+ const t = await this.client.request(
1558
+ nt,
1559
+ e
1560
+ );
1561
+ return t.ok ? t.data.createMayaAppWithdrawal ? {
1562
+ ok: !1,
1563
+ error: t.data.createMayaAppWithdrawal
1564
+ } : {
1565
+ ok: !0
1566
+ } : t;
1567
+ }
1568
+ async createBankWithdrawal(e) {
1569
+ const t = await this.client.request(
1570
+ it,
1571
+ e
1572
+ );
1573
+ return t.ok ? t.data.createBankWithdrawal ? {
1574
+ ok: !1,
1575
+ error: t.data.createBankWithdrawal
1576
+ } : {
1577
+ ok: !0
1578
+ } : t;
1579
+ }
1580
+ async remainingDailyWithdrawalsCount() {
1581
+ const e = await this.client.request(
1582
+ st
1583
+ );
1584
+ return e.ok ? { ok: e.ok, data: e.data.remainingDailyWithdrawalsCount } : e;
1585
+ }
1586
+ async pointsWallet() {
1587
+ const e = await this.client.request(Ze);
1588
+ return e.ok ? { ok: e.ok, data: e.data.pointsWallet } : e;
1589
+ }
1590
+ async pointsToCashConversion(e) {
1591
+ const t = await this.client.request(
1592
+ Xe,
1593
+ e
1594
+ );
1595
+ return t.ok ? t.data.pointsToCashConversion ? {
1596
+ ok: !1,
1597
+ error: t.data.pointsToCashConversion
1598
+ } : {
1599
+ ok: !0
1600
+ } : t;
1601
+ }
1602
+ }
1603
+ class ft {
1604
+ constructor(e) {
1605
+ d(this, "client");
1606
+ this.client = e;
1607
+ }
1608
+ async latestBetRecords() {
1609
+ const e = await this.client.request(_e);
1610
+ return e.ok ? {
1611
+ ok: !0,
1612
+ data: e.data.latestBetRecords
1613
+ } : e;
1614
+ }
1615
+ }
1616
+ class fe {
1617
+ constructor(e) {
1618
+ d(this, "enabled");
1619
+ this.enabled = (e == null ? void 0 : e.enabled) ?? !0;
1620
+ }
1621
+ info(e) {
1622
+ this.enabled && console.log(`\x1B[34m[info] ${e}`);
1623
+ }
1624
+ warn(e) {
1625
+ this.enabled && console.log(`\x1B[33m[warn] ${e}`);
1626
+ }
1627
+ error(e) {
1628
+ this.enabled && console.log(`\x1B[31m[error] ${e}`);
1629
+ }
1630
+ success(e) {
1631
+ this.enabled && console.log(`\x1B[32m[success] ${e}`);
1632
+ }
1633
+ }
1634
+ function E(i) {
1635
+ return new Date(i.getTime());
1636
+ }
1637
+ function me(i, e) {
1638
+ const t = E(i);
1639
+ return t.setDate(t.getDate() + e), t;
1640
+ }
1641
+ function ce(i, e) {
1642
+ const t = E(i);
1643
+ return t.setMinutes(t.getMinutes() + e), t;
1644
+ }
1645
+ function ue(i, e) {
1646
+ return i.getTime() > e.getTime();
1647
+ }
1648
+ function le(i, e) {
1649
+ const t = E(i);
1650
+ return t.setMinutes(t.getMinutes() - e), t;
1651
+ }
1652
+ class wt {
1653
+ constructor(e) {
1654
+ d(this, "logger");
1655
+ d(this, "storageKey", "session");
1656
+ d(this, "authService");
1657
+ this.logger = new fe(), this.authService = new ct(e);
1658
+ }
1659
+ async create(e) {
1660
+ const t = await this.authService.createSession(e);
1661
+ if (t.ok) {
1662
+ const a = /* @__PURE__ */ new Date();
1663
+ return this.isServer ? this.logger.warn("'localStorage' is not available on the server.") : window.localStorage.setItem(
1664
+ this.storageKey,
1665
+ JSON.stringify({
1666
+ ...t.data,
1667
+ accessTokenExpiresAt: ce(a, 8).getTime(),
1668
+ refreshTokenExpiresAt: le(me(a, 30), 2).getTime()
1669
+ })
1670
+ ), { ok: !0 };
1671
+ } else
1672
+ return t;
1673
+ }
1674
+ async session() {
1675
+ if (this.isServer)
1676
+ return this.logger.warn("'localStorage' is not available on the server."), null;
1677
+ const e = window.localStorage.getItem(this.storageKey);
1678
+ if (!e) return null;
1679
+ try {
1680
+ let t = JSON.parse(e), a = /* @__PURE__ */ new Date();
1681
+ const n = new Date(t.accessTokenExpiresAt), m = new Date(t.refreshTokenExpiresAt);
1682
+ if (ue(a, m))
1683
+ return this.logger.warn("Session expired. Logging out.."), window.localStorage.removeItem(this.storageKey), null;
1684
+ if (ue(a, n)) {
1685
+ const c = await this.authService.refreshSession(t.refreshToken);
1686
+ if (this.logger.info("Refreshing session..."), !c.ok)
1687
+ return this.logger.error(`Failed to refresh session: ${c.error.message}`), c.error.code === "InvalidToken" || c.error.code === "AccountBlacklisted" ? (window.localStorage.removeItem(this.storageKey), null) : (this.logger.warn("Old session returned."), t);
1688
+ this.logger.success("Session refreshed!"), a = /* @__PURE__ */ new Date(), t = {
1689
+ ...t,
1690
+ ...c.data,
1691
+ accessTokenExpiresAt: ce(a, 8).getTime(),
1692
+ refreshTokenExpiresAt: le(me(a, 30), 2).getTime()
1693
+ }, window.localStorage.setItem(this.storageKey, JSON.stringify(t));
1694
+ }
1695
+ return t;
1696
+ } catch {
1697
+ return null;
1698
+ }
1699
+ }
1700
+ async destroy() {
1701
+ if (this.isServer) {
1702
+ this.logger.warn("'localStorage' is not available on the server.");
1703
+ return;
1704
+ }
1705
+ const e = await this.session();
1706
+ e && await this.authService.destroySession(e.accessToken), window.localStorage.removeItem(this.storageKey);
1707
+ }
1708
+ get isServer() {
1709
+ return typeof window > "u";
1710
+ }
1711
+ }
1712
+ function r(i, e) {
1713
+ if (typeof i == "number" && !Number.isNaN(i))
1714
+ return i;
1715
+ if (typeof i == "string") {
1716
+ const t = Number.parseFloat(i);
1717
+ if (!Number.isNaN(t))
1718
+ return t;
1719
+ }
1720
+ return e;
1721
+ }
1722
+ class gt {
1723
+ constructor(e) {
1724
+ d(this, "staticService");
1725
+ const t = (e == null ? void 0 : e.environment) === "development";
1726
+ this.staticService = new pt({
1727
+ url: t ? "https://static.development.opexa.io/graphql" : "https://static.opexa.io/graphql"
1728
+ });
1729
+ }
1730
+ get transform() {
1731
+ return {
1732
+ platform: this.platform.bind(this),
1733
+ account: this.account.bind(this),
1734
+ wallet: this.wallet.bind(this),
1735
+ verificationDetails: this.verificationDetails.bind(this),
1736
+ profileCompletion: this.profileCompletion.bind(this),
1737
+ announcement: this.announcement.bind(this),
1738
+ withdrawalRecord: this.withdrawalRecord.bind(this),
1739
+ deposit: this.deposit.bind(this),
1740
+ depositRecord: this.depositRecord.bind(this),
1741
+ betRecord: this.betRecord.bind(this),
1742
+ latestBetRecord: this.latestBetRecord.bind(this),
1743
+ transactionRecord: this.transactionRecord.bind(this),
1744
+ game: this.game.bind(this),
1745
+ gameSession: this.gameSession.bind(this),
1746
+ promo: this.promo.bind(this),
1747
+ cashback: this.cashback.bind(this),
1748
+ bonus: this.bonus.bind(this),
1749
+ cashbackBonus: this.cashbackBonus.bind(this),
1750
+ file: this.file.bind(this),
1751
+ pointsWallet: this.pointsWallet.bind(this)
1752
+ };
1753
+ }
1754
+ platform(e) {
1755
+ var t, a, n, m, c, l, p, s, w, C, k, T, _, v, D, M, R, N, I, G, P, $, W, B, U, x, O, q, F, L, V, H, Y, j, Q, K, z, J, Z, X, ee, te, ae, re, oe, ne, ie, se;
1756
+ return {
1757
+ paymentSettings: {
1758
+ minimumFirstDepositAmount: r(e.minimumFirstDepositAmount),
1759
+ restrictWithdrawalsToVerifiedMembers: e.restrictWithdrawalsToVerifiedMembers,
1760
+ depositGateway: {
1761
+ bank: {
1762
+ androidEnabled: ((t = e.bankDepositGatewaySettings) == null ? void 0 : t.androidEnabled) ?? !1,
1763
+ iosEnabled: ((a = e.bankDepositGatewaySettings) == null ? void 0 : a.iosEnabled) ?? !1,
1764
+ webEnabled: ((n = e.bankDepositGatewaySettings) == null ? void 0 : n.webEnabled) ?? !1,
1765
+ mobileWebEnabled: ((m = e.bankDepositGatewaySettings) == null ? void 0 : m.mobileWebEnabled) ?? !1,
1766
+ minimumAmount: r((c = e.bankDepositGatewaySettings) == null ? void 0 : c.minimumAmount),
1767
+ maximumAmount: r((l = e.bankDepositGatewaySettings) == null ? void 0 : l.maximumAmount)
1768
+ },
1769
+ gcash: {
1770
+ androidEnabled: ((p = e.gcashDepositGatewaySettings) == null ? void 0 : p.androidEnabled) ?? !1,
1771
+ iosEnabled: ((s = e.gcashDepositGatewaySettings) == null ? void 0 : s.iosEnabled) ?? !1,
1772
+ webEnabled: ((w = e.gcashDepositGatewaySettings) == null ? void 0 : w.webEnabled) ?? !1,
1773
+ mobileWebEnabled: ((C = e.gcashDepositGatewaySettings) == null ? void 0 : C.mobileWebEnabled) ?? !1,
1774
+ minimumAmount: r((k = e.gcashDepositGatewaySettings) == null ? void 0 : k.minimumAmount),
1775
+ maximumAmount: r((T = e.gcashDepositGatewaySettings) == null ? void 0 : T.maximumAmount)
1776
+ },
1777
+ maya: {
1778
+ androidEnabled: ((_ = e.mayaDepositGatewaySettings) == null ? void 0 : _.androidEnabled) ?? !1,
1779
+ iosEnabled: ((v = e.mayaDepositGatewaySettings) == null ? void 0 : v.iosEnabled) ?? !1,
1780
+ webEnabled: ((D = e.mayaDepositGatewaySettings) == null ? void 0 : D.webEnabled) ?? !1,
1781
+ mobileWebEnabled: ((M = e.mayaDepositGatewaySettings) == null ? void 0 : M.mobileWebEnabled) ?? !1,
1782
+ minimumAmount: r((R = e.mayaDepositGatewaySettings) == null ? void 0 : R.minimumAmount),
1783
+ maximumAmount: r((N = e.mayaDepositGatewaySettings) == null ? void 0 : N.maximumAmount)
1784
+ },
1785
+ mayaApp: {
1786
+ androidEnabled: ((I = e.mayaAppDepositGatewaySettings) == null ? void 0 : I.androidEnabled) ?? !1,
1787
+ iosEnabled: ((G = e.mayaAppDepositGatewaySettings) == null ? void 0 : G.iosEnabled) ?? !1,
1788
+ webEnabled: ((P = e.mayaAppDepositGatewaySettings) == null ? void 0 : P.webEnabled) ?? !1,
1789
+ mobileWebEnabled: (($ = e.mayaAppDepositGatewaySettings) == null ? void 0 : $.mobileWebEnabled) ?? !1,
1790
+ minimumAmount: r((W = e.mayaAppDepositGatewaySettings) == null ? void 0 : W.minimumAmount),
1791
+ maximumAmount: r((B = e.mayaAppDepositGatewaySettings) == null ? void 0 : B.maximumAmount)
1792
+ }
1793
+ },
1794
+ withdrawalGateway: {
1795
+ bank: {
1796
+ androidEnabled: ((U = e.bankWithdrawalGatewaySettings) == null ? void 0 : U.androidEnabled) ?? !1,
1797
+ iosEnabled: ((x = e.bankWithdrawalGatewaySettings) == null ? void 0 : x.iosEnabled) ?? !1,
1798
+ webEnabled: ((O = e.bankWithdrawalGatewaySettings) == null ? void 0 : O.webEnabled) ?? !1,
1799
+ mobileWebEnabled: ((q = e.bankWithdrawalGatewaySettings) == null ? void 0 : q.mobileWebEnabled) ?? !1,
1800
+ minimumAmount: r((F = e.bankWithdrawalGatewaySettings) == null ? void 0 : F.minimumAmount),
1801
+ maximumAmount: r((L = e.bankWithdrawalGatewaySettings) == null ? void 0 : L.maximumAmount)
1802
+ },
1803
+ gcash: {
1804
+ androidEnabled: ((V = e.gcashWithdrawalGatewaySettings) == null ? void 0 : V.androidEnabled) ?? !1,
1805
+ iosEnabled: ((H = e.gcashWithdrawalGatewaySettings) == null ? void 0 : H.iosEnabled) ?? !1,
1806
+ webEnabled: ((Y = e.gcashWithdrawalGatewaySettings) == null ? void 0 : Y.webEnabled) ?? !1,
1807
+ mobileWebEnabled: ((j = e.gcashWithdrawalGatewaySettings) == null ? void 0 : j.mobileWebEnabled) ?? !1,
1808
+ minimumAmount: r((Q = e.gcashWithdrawalGatewaySettings) == null ? void 0 : Q.minimumAmount),
1809
+ maximumAmount: r(
1810
+ (K = e.gcashWithdrawalGatewaySettings) == null ? void 0 : K.maximumAmount,
1811
+ 1e6
1812
+ )
1813
+ },
1814
+ maya: {
1815
+ androidEnabled: ((z = e.mayaWithdrawalGatewaySettings) == null ? void 0 : z.androidEnabled) ?? !1,
1816
+ iosEnabled: ((J = e.mayaWithdrawalGatewaySettings) == null ? void 0 : J.iosEnabled) ?? !1,
1817
+ webEnabled: ((Z = e.mayaWithdrawalGatewaySettings) == null ? void 0 : Z.webEnabled) ?? !1,
1818
+ mobileWebEnabled: ((X = e.mayaWithdrawalGatewaySettings) == null ? void 0 : X.mobileWebEnabled) ?? !1,
1819
+ minimumAmount: r((ee = e.mayaWithdrawalGatewaySettings) == null ? void 0 : ee.minimumAmount),
1820
+ maximumAmount: r((te = e.mayaWithdrawalGatewaySettings) == null ? void 0 : te.maximumAmount)
1821
+ },
1822
+ mayaApp: {
1823
+ androidEnabled: ((ae = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : ae.androidEnabled) ?? !1,
1824
+ iosEnabled: ((re = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : re.iosEnabled) ?? !1,
1825
+ webEnabled: ((oe = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : oe.webEnabled) ?? !1,
1826
+ mobileWebEnabled: ((ne = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : ne.mobileWebEnabled) ?? !1,
1827
+ minimumAmount: r((ie = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : ie.minimumAmount),
1828
+ maximumAmount: r(
1829
+ (se = e.mayaAppWithdrawalGatewaySettings) == null ? void 0 : se.maximumAmount,
1830
+ 1e6
1831
+ )
1832
+ }
1833
+ }
1834
+ },
1835
+ pointsClubSettings: {
1836
+ multiplier: r(e.pointsClubSettings.multiplier, 0)
1837
+ }
1838
+ };
1839
+ }
1840
+ account(e) {
1841
+ return {
1842
+ id: e.id,
1843
+ name: e.name,
1844
+ status: e.status,
1845
+ verified: e.verified,
1846
+ nickName: e.nickName ?? void 0,
1847
+ realName: e.realName ?? void 0,
1848
+ dateOfBirth: e.birthDay ? new Date(e.birthDay) : void 0,
1849
+ emailAddress: e.emailAddress ?? void 0,
1850
+ mobileNumber: e.mobileNumber ?? void 0,
1851
+ mobileNumberVerified: e.mobileNumberVerified ?? !1,
1852
+ mobileNumberVerificationRequired: e.mobileNumberVerificationRequired ?? !1,
1853
+ validId: e.validId ?? void 0,
1854
+ verificationStatus: e.verificationStatus,
1855
+ transactionPassword: e.transactionPassword,
1856
+ dateTimeLastActive: e.dateTimeLastActive ? new Date(e.dateTimeLastActive) : void 0,
1857
+ dateTimeCreated: new Date(e.dateTimeCreated),
1858
+ dateTimeLastUpdated: new Date(e.dateTimeLastUpdated)
1859
+ };
1860
+ }
1861
+ wallet(e) {
1862
+ return {
1863
+ ...e,
1864
+ balance: r(e.balance, 0),
1865
+ dateTimeCreated: new Date(e.dateTimeCreated),
1866
+ dateTimeLastUpdated: new Date(e.dateTimeLastUpdated)
1867
+ };
1868
+ }
1869
+ verificationDetails(e) {
1870
+ return {
1871
+ ...e,
1872
+ idFrontImage: {
1873
+ ...e.idFrontImage,
1874
+ url: e.idFrontImage.url ?? void 0,
1875
+ dateTimeCreated: new Date(e.idFrontImage.dateTimeCreated)
1876
+ },
1877
+ selfieImage: {
1878
+ ...e.selfieImage,
1879
+ url: e.selfieImage.url ?? void 0,
1880
+ dateTimeCreated: new Date(e.selfieImage.dateTimeCreated)
1881
+ }
1882
+ };
1883
+ }
1884
+ profileCompletion(e) {
1885
+ return {
1886
+ ...e,
1887
+ completionPercentage: r(e, 0)
1888
+ };
1889
+ }
1890
+ announcement(e) {
1891
+ return {
1892
+ ...e,
1893
+ activationEndDateTime: new Date(e.activationEndDateTime),
1894
+ activationStartDateTime: new Date(e.activationStartDateTime),
1895
+ dateTimeCreated: new Date(e.dateTimeCreated),
1896
+ dateTimeLastUpdated: new Date(e.dateTimeLastUpdated)
1897
+ };
1898
+ }
1899
+ withdrawalRecord(e) {
1900
+ return {
1901
+ ...e,
1902
+ amount: r(e.amount, 0),
1903
+ netAmount: r(e.netAmount, 0),
1904
+ fee: r(e.fee, 0),
1905
+ reference: e.reference ?? void 0,
1906
+ bank: e.bank ?? void 0,
1907
+ recipientMobileNumber: e.recipientMobileNumber ?? void 0,
1908
+ dateTimeConfirmed: e.dateTimeConfirmed ? new Date(e.dateTimeConfirmed) : void 0,
1909
+ dateTimeCreated: new Date(e.dateTimeCreated),
1910
+ dateTimeLastUpdated: new Date(e.dateTimeLastUpdated)
1911
+ };
1912
+ }
1913
+ deposit(e) {
1914
+ return {
1915
+ ...e,
1916
+ fee: r(e.fee, 0),
1917
+ amount: r(e.amount, 0),
1918
+ netAmount: r(e.netAmount, 0),
1919
+ reference: e.reference ?? void 0,
1920
+ checkoutUrl: e.checkoutUrl ?? void 0,
1921
+ dateTimeCreated: new Date(e.dateTimeCreated),
1922
+ dateTimeLastUpdated: new Date(e.dateTimeLastUpdated)
1923
+ };
1924
+ }
1925
+ depositRecord(e) {
1926
+ return {
1927
+ ...e,
1928
+ amount: r(e.amount, 0),
1929
+ fee: r(e.fee, 0),
1930
+ netAmount: r(e.netAmount, 0),
1931
+ reference: e.reference ?? void 0,
1932
+ dateTimeCreated: new Date(e.dateTimeCreated),
1933
+ dateTimeLastUpdated: new Date(e.dateTimeLastUpdated)
1934
+ };
1935
+ }
1936
+ betRecord(e) {
1937
+ var t, a;
1938
+ return {
1939
+ ...e,
1940
+ bet: r(e.bet, 0),
1941
+ payout: r(e.payout, 0),
1942
+ jackpotContribution: r(e.jackpotContribution, 0),
1943
+ jackpotPayout: r(e.jackpotPayout, 0),
1944
+ winloss: r(e.winloss),
1945
+ validBet: r(e.validBet, 0),
1946
+ vendorRoundId: e.vendorRoundId ?? void 0,
1947
+ game: this.game(e.game),
1948
+ dateTimeSettled: e.dateTimeSettled ? new Date(e.dateTimeSettled) : void 0,
1949
+ dateTimeCreated: new Date(e.dateTimeCreated),
1950
+ dateTimeLastUpdated: new Date(e.dateTimeLastUpdated),
1951
+ betContent: e.betContent ?? void 0,
1952
+ contestName: e.contestName ?? void 0,
1953
+ externalCategory: e.externalCategory ?? void 0,
1954
+ metadata: {
1955
+ odds: ((t = e.metadata) == null ? void 0 : t.odds) ?? void 0,
1956
+ validBet: r((a = e.metadata) == null ? void 0 : a.validBet)
1957
+ }
1958
+ };
1959
+ }
1960
+ latestBetRecord(e) {
1961
+ return {
1962
+ ...e,
1963
+ game: this.game(e.game),
1964
+ bet: r(e.bet, 0),
1965
+ payout: r(e.payout, 0),
1966
+ validBet: r(e.validBet, 0),
1967
+ dateTimeSettled: new Date(e.dateTimeSettled),
1968
+ dateTimeCreated: new Date(e.dateTimeCreated)
1969
+ };
1970
+ }
1971
+ transactionRecord(e) {
1972
+ return {
1973
+ ...e,
1974
+ amount: r(e.amount, 0),
1975
+ content: e.content ?? void 0,
1976
+ currentBalance: r(e.currentBalance, 0),
1977
+ dateTimeCreated: new Date(e.dateTimeCreated),
1978
+ dateTimeLastUpdated: new Date(e.dateTimeLastUpdated)
1979
+ };
1980
+ }
1981
+ game(e) {
1982
+ return {
1983
+ ...e,
1984
+ image: this.staticService.gameThumbnail(e)
1985
+ };
1986
+ }
1987
+ gameSession(e) {
1988
+ return {
1989
+ ...e,
1990
+ game: this.game(e.game),
1991
+ dateTimeCreated: new Date(e.dateTimeCreated),
1992
+ dateTimeLastUpdated: new Date(e.dateTimeLastUpdated)
1993
+ };
1994
+ }
1995
+ promo(e) {
1996
+ return {
1997
+ ...e,
1998
+ banner: {
1999
+ ...e.banner,
2000
+ dateTimeCreated: new Date(e.banner.dateTimeCreated)
2001
+ },
2002
+ maximumBonusAmount: r(e.maximumBonusAmount),
2003
+ minimumBonusAmount: r(e.minimumBonusAmount),
2004
+ activationEndDateTime: new Date(e.activationEndDateTime),
2005
+ activationStartDateTime: new Date(e.activationStartDateTime),
2006
+ dateTimeCreated: new Date(e.dateTimeCreated),
2007
+ dateTimeLastUpdated: new Date(e.dateTimeLastUpdated)
2008
+ };
2009
+ }
2010
+ cashback(e) {
2011
+ return {
2012
+ ...e,
2013
+ banner: {
2014
+ ...e.banner,
2015
+ dateTimeCreated: new Date(e.banner.dateTimeCreated)
2016
+ },
2017
+ activationEndDateTime: new Date(e.activationEndDateTime),
2018
+ activationStartDateTime: new Date(e.activationStartDateTime),
2019
+ dateTimeCreated: new Date(e.dateTimeCreated),
2020
+ dateTimeLastUpdated: new Date(e.dateTimeLastUpdated)
2021
+ };
2022
+ }
2023
+ bonus(e) {
2024
+ return {
2025
+ ...e,
2026
+ promo: this.promo(e.promo),
2027
+ /* deposit here does not have an id and depositNumber field */
2028
+ deposit: e.deposit ? {
2029
+ ...e.deposit,
2030
+ fee: r(e.deposit.fee, 0),
2031
+ amount: r(e.deposit.amount, 0),
2032
+ netAmount: r(e.deposit.netAmount, 0),
2033
+ reference: e.deposit.reference ?? void 0,
2034
+ dateTimeCreated: new Date(e.deposit.dateTimeCreated),
2035
+ dateTimeLastUpdated: new Date(e.deposit.dateTimeLastUpdated)
2036
+ } : void 0,
2037
+ balance: r(e.balance, 0),
2038
+ amount: r(e.amount, 0),
2039
+ expiration: new Date(e.expiration),
2040
+ turnoverRequirement: r(e.turnoverRequirement, 0),
2041
+ currentTurnoverRequirementContribution: r(
2042
+ e.currentTurnoverRequirementContribution,
2043
+ 0
2044
+ ),
2045
+ currentTurnoverRequirementContributionPercentage: r(
2046
+ e.currentTurnoverRequirementContributionPercentage,
2047
+ 0
2048
+ ),
2049
+ dateTimeCreated: new Date(e.dateTimeCreated),
2050
+ dateTimeLastUpdated: new Date(e.dateTimeLastUpdated)
2051
+ };
2052
+ }
2053
+ cashbackBonus(e) {
2054
+ return {
2055
+ id: e.id,
2056
+ balance: r(e.balance, 0),
2057
+ cashback: this.cashback(e.cashback),
2058
+ dateTimeCreated: new Date(e.dateTimeCreated),
2059
+ dateTimeLastUpdated: new Date(e.dateTimeLastUpdated)
2060
+ };
2061
+ }
2062
+ file(e) {
2063
+ return {
2064
+ ...e,
2065
+ url: e.url ?? void 0,
2066
+ dateTimeCreated: new Date(e.dateTimeCreated)
2067
+ };
2068
+ }
2069
+ pointsWallet(e) {
2070
+ return {
2071
+ id: e.id,
2072
+ points: r(e.points, 0),
2073
+ account: e.account,
2074
+ dateTimeCreated: new Date(e.dateTimeCreated)
2075
+ };
2076
+ }
2077
+ }
2078
+ class f {
2079
+ constructor(e, t) {
2080
+ d(this, "url");
2081
+ d(this, "options");
2082
+ d(this, "middlewares");
2083
+ var n;
2084
+ const a = new Headers((n = t == null ? void 0 : t.fetchOptions) == null ? void 0 : n.headers);
2085
+ this.url = e, this.options = { ...t == null ? void 0 : t.fetchOptions, headers: a }, this.middlewares = (t == null ? void 0 : t.middlewares) ?? [];
2086
+ }
2087
+ async request(e, t) {
2088
+ var w;
2089
+ const a = JSON.stringify({ query: e, variables: t }), n = new Headers(this.options.headers);
2090
+ n.set("Content-Type", "application/json"), n.set("Accept", "application/json");
2091
+ const m = await this.runMiddlewares(
2092
+ new Request(this.url, {
2093
+ ...this.options,
2094
+ body: a,
2095
+ headers: n,
2096
+ method: "POST"
2097
+ })
2098
+ ), c = await fetch(m);
2099
+ if (!c.ok)
2100
+ return { ok: !1, error: u(c.status) };
2101
+ const l = await c.json(), p = l.data, s = (w = l.errors) == null ? void 0 : w.at(0);
2102
+ return (s == null ? void 0 : s.extensions.code) === "FORBIDDEN" ? { ok: !1, error: u(403, s.message) } : (s == null ? void 0 : s.extensions.code) === "UNAUTHORIZED" ? { ok: !1, error: u(401, s.message) } : (s == null ? void 0 : s.extensions.code) === "BAD_USER_INPUT" ? { ok: !1, error: u(400, s.message) } : (s == null ? void 0 : s.extensions.code) === "INTERNAL_SERVER_ERROR" ? { ok: !1, error: u(500, s.message) } : {
2103
+ ok: !0,
2104
+ data: p
2105
+ };
2106
+ }
2107
+ /** Single file upload */
2108
+ async upload(e, t) {
2109
+ var w;
2110
+ const a = f.createUploadBody(e, t), n = new Headers(this.options.headers);
2111
+ n.set("Accept", "application/json"), n.delete("Content-Type");
2112
+ const m = await this.runMiddlewares(
2113
+ new Request(this.url, {
2114
+ ...this.options,
2115
+ body: a,
2116
+ headers: n,
2117
+ method: "POST"
2118
+ })
2119
+ ), c = await fetch(m);
2120
+ if (!c.ok)
2121
+ return { ok: !1, error: u(c.status) };
2122
+ const l = await c.json(), p = l.data, s = (w = l.errors) == null ? void 0 : w.at(0);
2123
+ return (s == null ? void 0 : s.extensions.code) === "FORBIDDEN" ? { ok: !1, error: u(403) } : (s == null ? void 0 : s.extensions.code) === "UNAUTHORIZED" ? { ok: !1, error: u(401) } : (s == null ? void 0 : s.extensions.code) === "BAD_USER_INPUT" ? { ok: !1, error: u(400) } : (s == null ? void 0 : s.extensions.code) === "INTERNAL_SERVER_ERROR" ? { ok: !1, error: u(500, s.message) } : {
2124
+ ok: !0,
2125
+ data: p
2126
+ };
2127
+ }
2128
+ async runMiddlewares(e) {
2129
+ let t = e.clone();
2130
+ for (const a of this.middlewares)
2131
+ t = await a(t);
2132
+ return t;
2133
+ }
2134
+ static createUploadBody(e, t) {
2135
+ const { files: a, others: n } = f.extractFiles(t), m = new FormData();
2136
+ m.append(
2137
+ "operations",
2138
+ JSON.stringify({
2139
+ query: e,
2140
+ variables: t
2141
+ })
2142
+ ), Object.entries(n).forEach(([l, p]) => {
2143
+ m.append(l, JSON.stringify(p));
2144
+ });
2145
+ const c = {};
2146
+ return Object.keys(a).forEach((l, p) => {
2147
+ c[p.toString()] = `variables.${l}`;
2148
+ }), m.append("map", JSON.stringify(c)), Object.values(a).forEach((l, p) => {
2149
+ m.append(p.toString(), l);
2150
+ }), m;
2151
+ }
2152
+ static extractFiles(e) {
2153
+ const t = {}, a = {};
2154
+ return Object.entries(e).forEach(([n, m]) => {
2155
+ m instanceof File || m instanceof Blob ? t[n] = m : a[n] = m;
2156
+ }), {
2157
+ files: t,
2158
+ others: a
2159
+ };
2160
+ }
2161
+ }
2162
+ class At {
2163
+ constructor(e) {
2164
+ d(this, "gameService");
2165
+ d(this, "fileService");
2166
+ d(this, "walletService");
2167
+ d(this, "reportService");
2168
+ d(this, "portalService");
2169
+ d(this, "accountService");
2170
+ d(this, "sessionService");
2171
+ d(this, "transformer");
2172
+ d(this, "logger");
2173
+ const t = e.environment === "development";
2174
+ this.sessionService = new wt({
2175
+ url: t ? "https://auth.development.opexa.io" : "https://auth.opexa.io",
2176
+ platform: e.platform
2177
+ });
2178
+ const a = {
2179
+ middlewares: [this.authMiddleware],
2180
+ fetchOptions: {
2181
+ headers: {
2182
+ Role: "MEMBER",
2183
+ "Platform-Code": e.platform
2184
+ }
2185
+ }
2186
+ };
2187
+ this.gameService = new he(
2188
+ new f(
2189
+ t ? "https://game.development.opexa.io/graphql" : "https://game.opexa.io/graphql",
2190
+ a
2191
+ )
2192
+ ), this.fileService = new ut(
2193
+ new f(
2194
+ t ? "https://file.development.opexa.io/graphql" : "https://file.opexa.io/graphql",
2195
+ a
2196
+ )
2197
+ ), this.walletService = new ht(
2198
+ new f(
2199
+ t ? "https://wallet.development.opexa.io/graphql" : "https://wallet.opexa.io/graphql",
2200
+ a
2201
+ )
2202
+ ), this.reportService = new lt(
2203
+ new f(
2204
+ t ? "https://report.development.opexa.io/graphql" : "https://report.opexa.io/graphql",
2205
+ a
2206
+ )
2207
+ ), this.accountService = new dt(
2208
+ new f(
2209
+ t ? "https://account.development.opexa.io/graphql" : "https://account.opexa.io/graphql",
2210
+ a
2211
+ )
2212
+ ), this.portalService = new ft(
2213
+ new f(
2214
+ t ? "https://portal.development.opexa.io/graphql" : "https://portal.opexa.io/graphql",
2215
+ a
2216
+ )
2217
+ ), this.transformer = new gt(e), this.logger = new fe({
2218
+ enabled: e.log ?? !1
2219
+ });
2220
+ }
2221
+ get authMiddleware() {
2222
+ return async (e) => {
2223
+ this.logger.info("Checking for session");
2224
+ const t = await this.sessionService.session();
2225
+ return t ? (e.headers.append("Authorization", `Bearer ${t.accessToken}`), this.logger.info("Session found"), this.logger.success("Added 'Authorization' header")) : this.logger.info("No session found"), e;
2226
+ };
2227
+ }
2228
+ async signIn(e) {
2229
+ const t = await this.sessionService.create(e);
2230
+ return t.ok ? { ok: !0 } : t;
2231
+ }
2232
+ async signOut() {
2233
+ await this.sessionService.destroy();
2234
+ }
2235
+ async session() {
2236
+ const e = await this.sessionService.session();
2237
+ return {
2238
+ ok: !0,
2239
+ data: e ? {
2240
+ id: e.session.id,
2241
+ dateTimeCreated: new Date(e.session.dateTimeCreated)
2242
+ } : null
2243
+ };
2244
+ }
2245
+ /*
2246
+ * ========================================
2247
+ * Platform
2248
+ * ========================================
2249
+ */
2250
+ async platform() {
2251
+ const e = await this.accountService.platform();
2252
+ return e.ok ? {
2253
+ ok: !0,
2254
+ data: this.transformer.transform.platform(e.data)
2255
+ } : e;
2256
+ }
2257
+ /*
2258
+ * ========================================
2259
+ * Account
2260
+ * ========================================
2261
+ */
2262
+ async account() {
2263
+ const [e, t] = await Promise.all([
2264
+ this.accountService.memberAccount(),
2265
+ this.reportService.member()
2266
+ ]);
2267
+ return e.ok ? t.ok ? {
2268
+ ok: !0,
2269
+ data: this.transformer.transform.account({
2270
+ ...e.data,
2271
+ ...t.data
2272
+ })
2273
+ } : { ok: !1, error: t.error } : { ok: !1, error: e.error };
2274
+ }
2275
+ /**
2276
+ * @example
2277
+ * ```ts
2278
+ * const res = await sdk.createAccount({
2279
+ * id: ObjectId.generate(ObjectType.Account).toString(),
2280
+ * name: data.name,
2281
+ * password: data.password,
2282
+ * dateOfBirth: new Date(data.dateOfBirth),
2283
+ * mobileNumber: data.mobileNumber,
2284
+ * domain: data.domain,
2285
+ * verificationCode: data.verificationCode,
2286
+ * reCAPTCHAResponse: data.reCAPTCHAResponse,
2287
+ * });
2288
+ *
2289
+ * if (!res.ok) {
2290
+ * window.alert(res.error.message);
2291
+ * } else {
2292
+ * // Do something
2293
+ * }
2294
+ * ```
2295
+ */
2296
+ async createAccount(e) {
2297
+ const t = e.id ?? g.generate(y.Account).toString(), a = await this.accountService.registerMemberAccount({
2298
+ input: {
2299
+ id: t,
2300
+ name: e.name,
2301
+ birthDay: typeof e.dateOfBirth == "string" ? e.dateOfBirth : e.dateOfBirth.toISOString(),
2302
+ password: await h(e.password),
2303
+ mobileNumber: this.addAreaCode(e.mobileNumber),
2304
+ domain: e.domain
2305
+ },
2306
+ verificationCode: e.verificationCode,
2307
+ reCAPTCHAResponse: e.reCAPTCHAResponse
2308
+ });
2309
+ return a.ok ? { ok: !0, data: { id: t } } : a;
2310
+ }
2311
+ /**
2312
+ * @example
2313
+ * ```ts
2314
+ * const res = await sdk.updateAccount(user.id, {
2315
+ * validId: data.validId,
2316
+ * realName: data.realName,
2317
+ * });
2318
+ *
2319
+ * if (!res.ok) {
2320
+ * window.alert(res.error.message);
2321
+ * } else {
2322
+ * // Do something
2323
+ * }
2324
+ * ```
2325
+ */
2326
+ async updateAccount(e, t) {
2327
+ return await this.accountService.updateMemberAccount({
2328
+ input: {
2329
+ id: e,
2330
+ data: {
2331
+ ...t,
2332
+ password: t.password ? await h(t.password) : void 0,
2333
+ transactionPassword: t.transactionPassword ? await h(t.transactionPassword) : void 0,
2334
+ ...t.mobileNumber && {
2335
+ mobileNumber: this.addAreaCode(t.mobileNumber)
2336
+ }
2337
+ }
2338
+ }
2339
+ });
2340
+ }
2341
+ async deleteAccount(e) {
2342
+ return await this.accountService.deleteMemberAccount({
2343
+ input: {
2344
+ id: e
2345
+ }
2346
+ });
2347
+ }
2348
+ async verificationDetails() {
2349
+ const e = await this.accountService.memberVerification();
2350
+ return e.ok ? {
2351
+ ok: !0,
2352
+ data: e.data ? this.transformer.transform.verificationDetails(e.data) : null
2353
+ } : e;
2354
+ }
2355
+ /**
2356
+ * @example
2357
+ * ```ts
2358
+ * const res = await sdk.submitVerificationDetails({
2359
+ * id: ObjectId.generate(ObjectType.Verification).toString(),
2360
+ * idFrontImage: data.idFrontImage,
2361
+ * selfieImage: data.selfieImage,
2362
+ * address: data.address,
2363
+ * sourceOfIncome: data.sourceOfIncome,
2364
+ * natureOfWork: data.natureOfWork,
2365
+ * placeOfBirth: data.placeOfBirth,
2366
+ * nationality: data.nationality,
2367
+ * });
2368
+ *
2369
+ * if (!res.ok) {
2370
+ * window.alert(res.error.message);
2371
+ * } else {
2372
+ * // Do something
2373
+ * }
2374
+ * ```
2375
+ */
2376
+ async submitVerificationDetails(e) {
2377
+ const t = e.id ?? g.generate(y.Verification).toString(), a = await this.accountService.createMemberVerification({
2378
+ input: {
2379
+ id: t,
2380
+ ...e
2381
+ }
2382
+ });
2383
+ return a.ok ? { ok: !0, data: { id: t } } : a;
2384
+ }
2385
+ /**
2386
+ * @example
2387
+ * ```ts
2388
+ * const res = await sdk.submitVerificationDetails(verificationDetails.id, {
2389
+ * idFrontImage: data.idFrontImage,
2390
+ * selfieImage: data.selfieImage,
2391
+ * });
2392
+ *
2393
+ * if (!res.ok) {
2394
+ * window.alert(res.error.message);
2395
+ * } else {
2396
+ * // Do something
2397
+ * }
2398
+ * ```
2399
+ */
2400
+ async updateVerificationDetails(e, t) {
2401
+ return await this.accountService.updateMemberVerification({
2402
+ input: {
2403
+ id: e,
2404
+ data: {
2405
+ ...t
2406
+ }
2407
+ }
2408
+ });
2409
+ }
2410
+ async resetPassword(e) {
2411
+ return await this.accountService.resetPassword({
2412
+ input: {
2413
+ mobileNumber: this.addAreaCode(e.mobileNumber),
2414
+ newPassword: await h(e.newPassword)
2415
+ },
2416
+ verificationCode: e.verificationCode
2417
+ });
2418
+ }
2419
+ async verifyMobileNumber(e) {
2420
+ return await this.accountService.verifyMobileNumber({
2421
+ input: {
2422
+ verificationCode: e
2423
+ }
2424
+ });
2425
+ }
2426
+ async profileCompletion() {
2427
+ const e = await this.accountService.profileCompletion();
2428
+ return e.ok ? {
2429
+ ok: !0,
2430
+ data: this.transformer.transform.profileCompletion(e.data)
2431
+ } : e;
2432
+ }
2433
+ async sendVerificationCode(e) {
2434
+ return await this.accountService.sendVerificationCode({
2435
+ input: {
2436
+ channel: "SMS",
2437
+ recipient: this.addAreaCode(e)
2438
+ }
2439
+ });
2440
+ }
2441
+ async wallet() {
2442
+ const e = await this.walletService.wallet();
2443
+ return e.ok ? {
2444
+ ok: !0,
2445
+ data: e.data ? this.transformer.transform.wallet(e.data) : null
2446
+ } : e;
2447
+ }
2448
+ /*
2449
+ * ========================================
2450
+ * Announcement
2451
+ * ========================================
2452
+ */
2453
+ async announcements(e) {
2454
+ const t = await this.accountService.announcements({
2455
+ ...e,
2456
+ filter: {
2457
+ visibility: {
2458
+ in: ["MEMBER", "GLOBAL"]
2459
+ },
2460
+ activationStartDateTime: {
2461
+ greaterThanOrEqual: /* @__PURE__ */ new Date()
2462
+ }
2463
+ }
2464
+ });
2465
+ return t.ok ? {
2466
+ ok: !0,
2467
+ data: {
2468
+ announcements: t.data.edges.map(({ cursor: a, node: n }) => ({
2469
+ ...this.transformer.transform.announcement(n),
2470
+ cursor: a
2471
+ })),
2472
+ totalCount: t.data.totalCount,
2473
+ nextCursor: t.data.pageInfo.endCursor ?? void 0,
2474
+ hasNextPage: t.data.pageInfo.hasNextPage
2475
+ }
2476
+ } : t;
2477
+ }
2478
+ /*
2479
+ * ========================================
2480
+ * Withdrawal
2481
+ * ========================================
2482
+ */
2483
+ /**
2484
+ * @example
2485
+ * ```ts
2486
+ * const res = await sdk.createWithdrawal({
2487
+ * id: ObjectId.generate(ObjectType.Withdrawal).toString(),
2488
+ * type: 'BANK',
2489
+ * amount: data.amount,
2490
+ * transactionPassword: data.transactionPassword,
2491
+ * });
2492
+ *
2493
+ * if (!res.ok) {
2494
+ * window.alert(res.error.message);
2495
+ * } else {
2496
+ * // Do something
2497
+ * }
2498
+ * ```
2499
+ */
2500
+ async createWithdrawal(e) {
2501
+ const t = e.id ?? g.generate(y.Withdrawal).toString();
2502
+ if (e.type === "BANK") {
2503
+ const a = await this.walletService.createBankWithdrawal({
2504
+ input: {
2505
+ id: t,
2506
+ amount: e.amount.toString(),
2507
+ transactionPassword: await h(e.transactionPassword)
2508
+ }
2509
+ });
2510
+ if (!a.ok) return a;
2511
+ }
2512
+ if (e.type === "GCASH") {
2513
+ const a = await this.walletService.createGCashWithdrawal({
2514
+ input: {
2515
+ id: t,
2516
+ amount: e.amount.toString(),
2517
+ transactionPassword: await h(e.transactionPassword),
2518
+ recipientMobileNumber: this.addAreaCode(e.recipientMobileNumber)
2519
+ }
2520
+ });
2521
+ if (!a.ok) return a;
2522
+ }
2523
+ if (e.type === "MAYA") {
2524
+ const a = await this.walletService.createMayaWithdrawal({
2525
+ input: {
2526
+ id: t,
2527
+ amount: e.amount.toString(),
2528
+ transactionPassword: await h(e.transactionPassword),
2529
+ recipientMobileNumber: this.addAreaCode(e.recipientMobileNumber)
2530
+ }
2531
+ });
2532
+ if (!a.ok) return a;
2533
+ }
2534
+ if (e.type === "MAYA_APP") {
2535
+ const a = await this.walletService.createMayaAppWithdrawal({
2536
+ input: {
2537
+ id: t,
2538
+ amount: e.amount.toString(),
2539
+ transactionPassword: await h(e.transactionPassword)
2540
+ }
2541
+ });
2542
+ if (!a.ok) return a;
2543
+ }
2544
+ return { ok: !0, data: { id: t } };
2545
+ }
2546
+ async withdrawalRecords(e) {
2547
+ const t = await this.reportService.withdrawalRecords(e);
2548
+ return t.ok ? {
2549
+ ok: !0,
2550
+ data: {
2551
+ withdrawalRecords: t.data.edges.map(({ cursor: a, node: n }) => ({
2552
+ ...this.transformer.transform.withdrawalRecord(n),
2553
+ cursor: a
2554
+ })),
2555
+ totalCount: t.data.totalCount,
2556
+ nextCursor: t.data.pageInfo.endCursor ?? void 0,
2557
+ hasNextPage: t.data.pageInfo.hasNextPage
2558
+ }
2559
+ } : t;
2560
+ }
2561
+ async remainingDailyWithdrawalsCount() {
2562
+ return await this.walletService.remainingDailyWithdrawalsCount();
2563
+ }
2564
+ /*
2565
+ * ========================================
2566
+ * Deposit
2567
+ * ========================================
2568
+ */
2569
+ /**
2570
+ * @example
2571
+ * ```ts
2572
+ * const res = await sdk.createDeposit({
2573
+ * id: ObjectId.generate(ObjectType.Deposit).toString(),
2574
+ * type: 'GCASH',
2575
+ * amount: data.amount,
2576
+ * promo: data.promo,
2577
+ * });
2578
+ *
2579
+ * if (!res.ok) {
2580
+ * window.alert(res.error.message);
2581
+ * } else {
2582
+ * // Do something
2583
+ * }
2584
+ * ```
2585
+ */
2586
+ async createDeposit(e) {
2587
+ const t = e.id ?? g.generate(y.Deposit).toString();
2588
+ if (e.type === "MAYA") {
2589
+ const a = await this.walletService.createMayaDeposit({
2590
+ input: {
2591
+ id: t,
2592
+ amount: e.amount.toString(),
2593
+ promo: e.promo
2594
+ }
2595
+ });
2596
+ if (!a.ok) return a;
2597
+ }
2598
+ if (e.type === "MAYA_APP") {
2599
+ const a = await this.walletService.createMayaAppDeposit({
2600
+ input: {
2601
+ id: t,
2602
+ amount: e.amount.toString(),
2603
+ promo: e.promo
2604
+ }
2605
+ });
2606
+ if (!a.ok) return a;
2607
+ }
2608
+ if (e.type === "GCASH") {
2609
+ const a = await this.walletService.createGCashDeposit({
2610
+ input: {
2611
+ id: t,
2612
+ amount: e.amount.toString(),
2613
+ promo: e.promo
2614
+ }
2615
+ });
2616
+ if (!a.ok) return a;
2617
+ }
2618
+ return { ok: !0, data: { id: t } };
2619
+ }
2620
+ async deposit(e) {
2621
+ const t = await this.walletService.deposit({ id: e });
2622
+ return t.ok ? {
2623
+ ok: !0,
2624
+ data: t.data ? this.transformer.transform.deposit(t.data) : null
2625
+ } : t;
2626
+ }
2627
+ async depositRecords(e) {
2628
+ const t = await this.reportService.depositRecords(e);
2629
+ return t.ok ? {
2630
+ ok: !0,
2631
+ data: {
2632
+ depositRecords: t.data.edges.map(({ cursor: a, node: n }) => ({
2633
+ ...this.transformer.transform.depositRecord(n),
2634
+ cursor: a
2635
+ })),
2636
+ totalCount: t.data.totalCount,
2637
+ nextCursor: t.data.pageInfo.endCursor ?? void 0,
2638
+ hasNextPage: t.data.pageInfo.hasNextPage
2639
+ }
2640
+ } : t;
2641
+ }
2642
+ async depositsCount() {
2643
+ return await this.reportService.depositsCount();
2644
+ }
2645
+ /*
2646
+ * ========================================
2647
+ * Bet
2648
+ * ========================================
2649
+ */
2650
+ async betRecords(e) {
2651
+ const t = await this.reportService.betRecords(e);
2652
+ return t.ok ? {
2653
+ ok: !0,
2654
+ data: {
2655
+ betRecords: t.data.edges.map(({ cursor: a, node: n }) => ({
2656
+ ...this.transformer.transform.betRecord(n),
2657
+ cursor: a
2658
+ })),
2659
+ totalCount: t.data.totalCount,
2660
+ nextCursor: t.data.pageInfo.endCursor ?? void 0,
2661
+ hasNextPage: t.data.pageInfo.hasNextPage
2662
+ }
2663
+ } : t;
2664
+ }
2665
+ async latestBetRecords() {
2666
+ const e = await this.portalService.latestBetRecords();
2667
+ return e.ok ? {
2668
+ ok: !0,
2669
+ data: e.data.map(this.transformer.transform.latestBetRecord)
2670
+ } : e;
2671
+ }
2672
+ /*
2673
+ * ========================================
2674
+ * Transaction
2675
+ * ========================================
2676
+ */
2677
+ async transactionRecords(e) {
2678
+ const t = await this.reportService.transactionRecords(e);
2679
+ return t.ok ? {
2680
+ ok: !0,
2681
+ data: {
2682
+ transactionRecords: t.data.edges.map(({ cursor: a, node: n }) => ({
2683
+ ...this.transformer.transform.transactionRecord(n),
2684
+ cursor: a
2685
+ })),
2686
+ totalCount: t.data.totalCount,
2687
+ nextCursor: t.data.pageInfo.endCursor ?? void 0,
2688
+ hasNextPage: t.data.pageInfo.hasNextPage
2689
+ }
2690
+ } : t;
2691
+ }
2692
+ /*
2693
+ * ========================================
2694
+ * Promos
2695
+ * ========================================
2696
+ */
2697
+ async promos() {
2698
+ const e = await this.walletService.promos();
2699
+ return e.ok ? {
2700
+ ok: !0,
2701
+ data: e.data.map(this.transformer.transform.promo)
2702
+ } : e;
2703
+ }
2704
+ async availablePromos() {
2705
+ const e = await this.walletService.availablePromos();
2706
+ return e.ok ? {
2707
+ ok: !0,
2708
+ data: e.data.map(this.transformer.transform.promo)
2709
+ } : e;
2710
+ }
2711
+ async cashbacks() {
2712
+ const e = await this.walletService.cashbacks();
2713
+ return e.ok ? {
2714
+ ok: !0,
2715
+ data: e.data.map(this.transformer.transform.cashback)
2716
+ } : e;
2717
+ }
2718
+ async bonus() {
2719
+ const e = await this.walletService.bonus();
2720
+ return e.ok ? {
2721
+ ok: !0,
2722
+ data: e.data ? this.transformer.transform.bonus(e.data) : null
2723
+ } : e;
2724
+ }
2725
+ async cashbackBonuses() {
2726
+ const e = await this.walletService.cashbackBonuses();
2727
+ return e.ok ? {
2728
+ ok: !0,
2729
+ data: e.data.map(this.transformer.transform.cashbackBonus)
2730
+ } : e;
2731
+ }
2732
+ async claimCashbackBonus(e) {
2733
+ return await this.walletService.claimCashbackBonus({ input: { id: e } });
2734
+ }
2735
+ /*
2736
+ * ========================================
2737
+ * Game
2738
+ * ========================================
2739
+ */
2740
+ async games(e) {
2741
+ const t = await this.gameService.games(e);
2742
+ return t.ok ? {
2743
+ ok: !0,
2744
+ data: {
2745
+ games: t.data.edges.map(({ cursor: a, node: n }) => ({
2746
+ ...this.transformer.transform.game(n),
2747
+ cursor: a
2748
+ })),
2749
+ totalCount: t.data.totalCount,
2750
+ nextCursor: t.data.pageInfo.endCursor ?? void 0,
2751
+ hasNextPage: t.data.pageInfo.hasNextPage
2752
+ }
2753
+ } : t;
2754
+ }
2755
+ async gamesByName(e) {
2756
+ const t = await this.gameService.gamesByName(e);
2757
+ return t.ok ? {
2758
+ ok: !0,
2759
+ data: t.data.map(this.transformer.transform.game)
2760
+ } : t;
2761
+ }
2762
+ async gamesByName__next(e) {
2763
+ const t = await this.walletService.gamesByName(e);
2764
+ return t.ok ? {
2765
+ ok: !0,
2766
+ data: t.data.map(this.transformer.transform.game)
2767
+ } : t;
2768
+ }
2769
+ async games__next(e) {
2770
+ const t = await this.walletService.games(e);
2771
+ return t.ok ? {
2772
+ ok: !0,
2773
+ data: {
2774
+ games: t.data.edges.map(({ cursor: a, node: n }) => ({
2775
+ ...this.transformer.transform.game(n),
2776
+ cursor: a
2777
+ })),
2778
+ totalCount: t.data.totalCount,
2779
+ nextCursor: t.data.pageInfo.endCursor ?? void 0,
2780
+ hasNextPage: t.data.pageInfo.hasNextPage
2781
+ }
2782
+ } : t;
2783
+ }
2784
+ /**
2785
+ * @example
2786
+ * ```ts
2787
+ * const res = await sdk.createGameSession({
2788
+ * id: ObjectId.generate(ObjectType.GameSession).toString(),
2789
+ * game: game.id,
2790
+ * });
2791
+ *
2792
+ * if (!res.ok) {
2793
+ * window.alert(res.error.message);
2794
+ * } else {
2795
+ * // Do something
2796
+ * }
2797
+ * ```
2798
+ */
2799
+ async createGameSession(e) {
2800
+ const t = e.id ?? g.generate(y.GameSession).toString(), a = await this.gameService.createGameSession({
2801
+ input: {
2802
+ id: t,
2803
+ game: e.game
2804
+ }
2805
+ });
2806
+ return a.ok ? { ok: !0, data: { id: t } } : a;
2807
+ }
2808
+ /**
2809
+ * @example
2810
+ * ```ts
2811
+ * const res = await sdk.createGameSession({
2812
+ * id: ObjectId.generate(ObjectType.GameSession).toString(),
2813
+ * game: game.id,
2814
+ * });
2815
+ *
2816
+ * if (!res.ok) {
2817
+ * window.alert(res.error.message);
2818
+ * } else {
2819
+ * // Do something
2820
+ * }
2821
+ * ```
2822
+ */
2823
+ async createGameSession__next(e) {
2824
+ const t = e.id ?? g.generate(y.GameSession).toString(), a = await this.walletService.createGameSession({
2825
+ input: {
2826
+ id: t,
2827
+ game: e.game
2828
+ }
2829
+ });
2830
+ return a.ok ? { ok: !0, data: { id: t } } : a;
2831
+ }
2832
+ async gameSession(e) {
2833
+ const t = await this.gameService.gameSession({ id: e });
2834
+ return t.ok ? {
2835
+ ok: !0,
2836
+ data: t.data ? this.transformer.transform.gameSession(t.data) : null
2837
+ } : t;
2838
+ }
2839
+ async gameSession__next(e) {
2840
+ const t = await this.walletService.gameSession({ id: e });
2841
+ return t.ok ? {
2842
+ ok: !0,
2843
+ data: t.data ? this.transformer.transform.gameSession(t.data) : null
2844
+ } : t;
2845
+ }
2846
+ async endGameSession(e) {
2847
+ return await this.gameService.endGameSession({ input: { id: e } });
2848
+ }
2849
+ async endGameSession__next(e) {
2850
+ return await this.walletService.endGameSession({ input: { id: e } });
2851
+ }
2852
+ /*
2853
+ * ========================================
2854
+ * File
2855
+ * ========================================
2856
+ */
2857
+ async file(e) {
2858
+ const t = await this.fileService.file({ id: e });
2859
+ return t.ok ? {
2860
+ ok: !0,
2861
+ data: t.data ? this.transformer.transform.file(t.data) : null
2862
+ } : t;
2863
+ }
2864
+ /**
2865
+ * @example
2866
+ * ```ts
2867
+ * const res = await sdk.uploadImageFile({
2868
+ * id: ObjectId.generate(ObjectType.File).toString(),
2869
+ * file: data.file,
2870
+ * });
2871
+ *
2872
+ * if (!res.ok) {
2873
+ * window.alert(res.error.message);
2874
+ * } else {
2875
+ * // Do something
2876
+ * }
2877
+ * ```
2878
+ */
2879
+ async uploadImageFile(e) {
2880
+ const t = e.id ?? g.generate(y.File).toString(), a = await this.fileService.uploadPrivateImageFile({
2881
+ input: {
2882
+ id: t,
2883
+ file: e.file
2884
+ }
2885
+ });
2886
+ return a.ok ? { ok: !0, data: { id: t } } : a;
2887
+ }
2888
+ /*
2889
+ * ========================================
2890
+ * Points
2891
+ * ========================================
2892
+ */
2893
+ async pointsWallet() {
2894
+ const e = await this.walletService.pointsWallet();
2895
+ return e.ok ? {
2896
+ ok: !0,
2897
+ data: e.data ? this.transformer.transform.pointsWallet(e.data) : null
2898
+ } : e;
2899
+ }
2900
+ async pointsToCashConversion(e) {
2901
+ return await this.walletService.pointsToCashConversion({
2902
+ input: {
2903
+ amount: e.toString()
2904
+ }
2905
+ });
2906
+ }
2907
+ addAreaCode(e) {
2908
+ return e.startsWith("+63") ? e : e.startsWith("63") ? `+${e}` : e.startsWith("0") ? `+63${e.substring(1)}` : `+63${e}`;
2909
+ }
2910
+ }
2911
+ export {
2912
+ Ct as ObjectId,
2913
+ y as ObjectType,
2914
+ At as Sdk
2915
+ };
2916
+ //# sourceMappingURL=index.mjs.map