@opexa/portal-sdk 0.0.24 → 0.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +76 -95
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +436 -417
- package/dist/index.mjs.map +1 -1
- package/dist/sdk/object-type.d.ts +1 -0
- package/dist/sdk/sdk.d.ts +26 -3
- package/dist/sdk/transformer.d.ts +3 -0
- package/dist/sdk/types.d.ts +21 -3
- package/dist/services/cms-portal.service.d.ts +5 -4
- package/dist/services/game.service.d.ts +2 -0
- package/dist/services/queries.d.ts +2 -2
- package/dist/services/types.d.ts +31 -10
- package/dist/services/wallet.service.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
(function(y,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("@opexa/object-id")):typeof define=="function"&&define.amd?define(["exports","@opexa/object-id"],u):(y=typeof globalThis<"u"?globalThis:y||self,u(y.sdk={},y.objectId))})(this,function(y,u){"use strict";var
|
|
1
|
+
(function(y,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("@opexa/object-id")):typeof define=="function"&&define.amd?define(["exports","@opexa/object-id"],u):(y=typeof globalThis<"u"?globalThis:y||self,u(y.sdk={},y.objectId))})(this,function(y,u){"use strict";var Mt=Object.defineProperty;var Dt=(y,u,g)=>u in y?Mt(y,u,{enumerable:!0,configurable:!0,writable:!0,value:g}):y[u]=g;var m=(y,u,g)=>Dt(y,typeof u!="symbol"?u+"":u,g);const g={Account:8,Deposit:9,Withdrawal:14,Verification:15,File:16,Game:203,GameSession:204,MayaSession:230};function n(o,...e){let t="";for(const[a,r]of o.entries()){const s=e.at(a)??"";t=`${t}${r}${s}`}return t.trim()}const O=n`
|
|
2
2
|
fragment FileFragment on File {
|
|
3
3
|
id
|
|
4
4
|
url
|
|
5
5
|
status
|
|
6
6
|
dateTimeCreated
|
|
7
7
|
}
|
|
8
|
-
`,Ce=
|
|
9
|
-
${
|
|
8
|
+
`,Ce=n`
|
|
9
|
+
${O}
|
|
10
10
|
|
|
11
11
|
query File($id: ObjectId!) {
|
|
12
12
|
node(id: $id) {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
`,
|
|
18
|
+
`,ve=n`
|
|
19
19
|
mutation UploadPrivateImageFile($input: UploadFileInput!) {
|
|
20
20
|
uploadPrivateImageFile(input: $input) {
|
|
21
21
|
... on FileFormatNotSupportedError {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
`,
|
|
32
|
+
`,Ne=n`
|
|
33
33
|
query Wallet {
|
|
34
34
|
wallet {
|
|
35
35
|
id
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
dateTimeLastUpdated
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
`,
|
|
42
|
+
`,Ie=n`
|
|
43
43
|
query PointsWallet {
|
|
44
44
|
pointsWallet {
|
|
45
45
|
id
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
dateTimeCreated
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
`,
|
|
51
|
+
`,Me=n`
|
|
52
52
|
mutation PointsToCashConversion($input: PointsToCashConversionInput!) {
|
|
53
53
|
pointsToCashConversion(input: $input) {
|
|
54
54
|
... on InsufficientPointsError {
|
|
@@ -56,23 +56,17 @@
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
`,
|
|
60
|
-
fragment GameFragment on Game {
|
|
61
|
-
id
|
|
62
|
-
type
|
|
63
|
-
name
|
|
64
|
-
provider
|
|
65
|
-
}
|
|
66
|
-
`,Z=o`
|
|
67
|
-
${Q}
|
|
68
|
-
|
|
59
|
+
`,W=n`
|
|
69
60
|
query Games($first: Int, $after: Cursor, $filter: GameFilterInput) {
|
|
70
61
|
games(first: $first, after: $after, filter: $filter) {
|
|
71
62
|
edges {
|
|
72
63
|
cursor
|
|
73
64
|
node {
|
|
74
65
|
... on Game {
|
|
75
|
-
|
|
66
|
+
id
|
|
67
|
+
type
|
|
68
|
+
name
|
|
69
|
+
provider
|
|
76
70
|
}
|
|
77
71
|
}
|
|
78
72
|
}
|
|
@@ -83,20 +77,22 @@
|
|
|
83
77
|
}
|
|
84
78
|
}
|
|
85
79
|
}
|
|
86
|
-
`,
|
|
87
|
-
${Q}
|
|
88
|
-
|
|
80
|
+
`,q=n`
|
|
89
81
|
query GamesByName($first: Int, $search: String!, $filter: GameFilterInput) {
|
|
90
82
|
gamesByName(first: $first, search: $search, filter: $filter) {
|
|
91
|
-
|
|
83
|
+
... on Game {
|
|
84
|
+
id
|
|
85
|
+
type
|
|
86
|
+
name
|
|
87
|
+
provider
|
|
88
|
+
}
|
|
92
89
|
}
|
|
93
90
|
}
|
|
94
|
-
`,
|
|
91
|
+
`,L=n`
|
|
95
92
|
query GameSession($id: ObjectId!) {
|
|
96
93
|
node(id: $id) {
|
|
97
94
|
... on GameSession {
|
|
98
95
|
id
|
|
99
|
-
game
|
|
100
96
|
status
|
|
101
97
|
launchUrl
|
|
102
98
|
dateTimeCreated
|
|
@@ -104,7 +100,7 @@
|
|
|
104
100
|
}
|
|
105
101
|
}
|
|
106
102
|
}
|
|
107
|
-
`,
|
|
103
|
+
`,V=n`
|
|
108
104
|
mutation CreateGameSession($input: CreateGameSessionInput!) {
|
|
109
105
|
createGameSession(input: $input) {
|
|
110
106
|
... on GameDoesNotExistError {
|
|
@@ -112,26 +108,11 @@
|
|
|
112
108
|
}
|
|
113
109
|
}
|
|
114
110
|
}
|
|
115
|
-
`,
|
|
111
|
+
`,De=n`
|
|
116
112
|
mutation EndGameSession($input: EndGameSessionInput!) {
|
|
117
113
|
endGameSession(input: $input)
|
|
118
114
|
}
|
|
119
|
-
`,
|
|
120
|
-
query GameSession($id: ObjectId!) {
|
|
121
|
-
node(id: $id) {
|
|
122
|
-
... on GameSession {
|
|
123
|
-
id
|
|
124
|
-
game {
|
|
125
|
-
id
|
|
126
|
-
}
|
|
127
|
-
status
|
|
128
|
-
launchUrl
|
|
129
|
-
dateTimeCreated
|
|
130
|
-
dateTimeLastUpdated
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
`,Oe=o`
|
|
115
|
+
`,Re=n`
|
|
135
116
|
mutation EndGameSession($input: EndGameSessionInput!) {
|
|
136
117
|
endGameSession(input: $input) {
|
|
137
118
|
... on GameSessionDoesNotExistError {
|
|
@@ -145,7 +126,7 @@
|
|
|
145
126
|
}
|
|
146
127
|
}
|
|
147
128
|
}
|
|
148
|
-
`,
|
|
129
|
+
`,Pe=n`
|
|
149
130
|
query Announcements($first: Int, $after: Cursor, $filter: AnnouncementFilterInput) {
|
|
150
131
|
announcements(first: $first, after: $after, filter: $filter) {
|
|
151
132
|
edges {
|
|
@@ -171,7 +152,7 @@
|
|
|
171
152
|
}
|
|
172
153
|
}
|
|
173
154
|
}
|
|
174
|
-
`,xe=
|
|
155
|
+
`,xe=n`
|
|
175
156
|
query WithdrawalRecords($first: Int, $after: Cursor, $filter: WithdrawalRecordFilterInput) {
|
|
176
157
|
member {
|
|
177
158
|
withdrawalRecords(first: $first, after: $after, filter: $filter) {
|
|
@@ -238,7 +219,7 @@
|
|
|
238
219
|
}
|
|
239
220
|
}
|
|
240
221
|
}
|
|
241
|
-
`,
|
|
222
|
+
`,Oe=n`
|
|
242
223
|
mutation CreateGCashWithdrawal($input: CreateGCashWithdrawalInput!) {
|
|
243
224
|
createGCashWithdrawal(input: $input) {
|
|
244
225
|
... on AccountNotVerifiedError {
|
|
@@ -261,7 +242,7 @@
|
|
|
261
242
|
}
|
|
262
243
|
}
|
|
263
244
|
}
|
|
264
|
-
|
|
245
|
+
`,Ge=n`
|
|
265
246
|
mutation CreateMayaWithdrawal($input: CreateMayaWithdrawalInput!) {
|
|
266
247
|
createMayaWithdrawal(input: $input) {
|
|
267
248
|
... on AccountNotVerifiedError {
|
|
@@ -284,7 +265,7 @@
|
|
|
284
265
|
}
|
|
285
266
|
}
|
|
286
267
|
}
|
|
287
|
-
`,
|
|
268
|
+
`,Ue=n`
|
|
288
269
|
mutation CreateMayaAppWithdrawal($input: CreateMayaAppWithdrawalInput!) {
|
|
289
270
|
createMayaAppWithdrawal(input: $input) {
|
|
290
271
|
... on AccountNotVerifiedError {
|
|
@@ -304,7 +285,7 @@
|
|
|
304
285
|
}
|
|
305
286
|
}
|
|
306
287
|
}
|
|
307
|
-
`,Be=
|
|
288
|
+
`,Be=n`
|
|
308
289
|
mutation CreateBankWithdrawal($input: CreateBankWithdrawalInput!) {
|
|
309
290
|
createBankWithdrawal(input: $input) {
|
|
310
291
|
... on MobileNumberNotVerifiedError {
|
|
@@ -327,11 +308,11 @@
|
|
|
327
308
|
}
|
|
328
309
|
}
|
|
329
310
|
}
|
|
330
|
-
|
|
311
|
+
`,$e=n`
|
|
331
312
|
query RemainingDailyWithdrawalsCount {
|
|
332
313
|
remainingDailyWithdrawalsCount
|
|
333
314
|
}
|
|
334
|
-
`,
|
|
315
|
+
`,We=n`
|
|
335
316
|
query DepositRecords($after: Cursor, $first: Int, $filter: DepositRecordFilterInput) {
|
|
336
317
|
member {
|
|
337
318
|
depositRecords(after: $after, first: $first, filter: $filter) {
|
|
@@ -360,7 +341,7 @@
|
|
|
360
341
|
}
|
|
361
342
|
}
|
|
362
343
|
}
|
|
363
|
-
`,
|
|
344
|
+
`,qe=n`
|
|
364
345
|
mutation CreateGCashDeposit($input: CreateGCashDepositInput!) {
|
|
365
346
|
createGCashDeposit(input: $input) {
|
|
366
347
|
... on DepositPromoMaximumAmountExceededError {
|
|
@@ -389,7 +370,7 @@
|
|
|
389
370
|
}
|
|
390
371
|
}
|
|
391
372
|
}
|
|
392
|
-
`,
|
|
373
|
+
`,Le=n`
|
|
393
374
|
mutation CreateMayaDeposit($input: CreateMayaDepositInput!) {
|
|
394
375
|
createMayaDeposit(input: $input) {
|
|
395
376
|
... on DepositPromoMaximumAmountExceededError {
|
|
@@ -418,7 +399,7 @@
|
|
|
418
399
|
}
|
|
419
400
|
}
|
|
420
401
|
}
|
|
421
|
-
`,
|
|
402
|
+
`,Ve=n`
|
|
422
403
|
mutation CreateMayaAppDeposit($input: CreateMayaAppDepositInput!) {
|
|
423
404
|
createMayaAppDeposit(input: $input) {
|
|
424
405
|
... on DepositPromoMaximumAmountExceededError {
|
|
@@ -447,7 +428,7 @@
|
|
|
447
428
|
}
|
|
448
429
|
}
|
|
449
430
|
}
|
|
450
|
-
`,
|
|
431
|
+
`,Fe=n`
|
|
451
432
|
query Deposit($id: ObjectId!) {
|
|
452
433
|
node(id: $id) {
|
|
453
434
|
... on GCashDeposit {
|
|
@@ -479,15 +460,13 @@
|
|
|
479
460
|
}
|
|
480
461
|
}
|
|
481
462
|
}
|
|
482
|
-
`,He=
|
|
463
|
+
`,He=n`
|
|
483
464
|
query DepositsCount {
|
|
484
465
|
member {
|
|
485
466
|
depositsCount
|
|
486
467
|
}
|
|
487
468
|
}
|
|
488
|
-
`,
|
|
489
|
-
${Q}
|
|
490
|
-
|
|
469
|
+
`,je=n`
|
|
491
470
|
query BetRecords($first: Int, $after: Cursor, $filter: BetRecordFilterInput) {
|
|
492
471
|
member {
|
|
493
472
|
betRecords(first: $first, after: $after, filter: $filter) {
|
|
@@ -499,7 +478,9 @@
|
|
|
499
478
|
id
|
|
500
479
|
serialCode
|
|
501
480
|
game {
|
|
502
|
-
|
|
481
|
+
name
|
|
482
|
+
type
|
|
483
|
+
provider
|
|
503
484
|
}
|
|
504
485
|
bet
|
|
505
486
|
payout
|
|
@@ -525,7 +506,7 @@
|
|
|
525
506
|
}
|
|
526
507
|
}
|
|
527
508
|
}
|
|
528
|
-
`,
|
|
509
|
+
`,Ye=n`
|
|
529
510
|
query LatestBetRecords {
|
|
530
511
|
latestBetRecords {
|
|
531
512
|
id
|
|
@@ -534,7 +515,9 @@
|
|
|
534
515
|
name
|
|
535
516
|
}
|
|
536
517
|
game {
|
|
537
|
-
|
|
518
|
+
name
|
|
519
|
+
type
|
|
520
|
+
provider
|
|
538
521
|
}
|
|
539
522
|
bet
|
|
540
523
|
payout
|
|
@@ -543,9 +526,7 @@
|
|
|
543
526
|
dateTimeCreated
|
|
544
527
|
}
|
|
545
528
|
}
|
|
546
|
-
|
|
547
|
-
${Q}
|
|
548
|
-
`,ze=o`
|
|
529
|
+
`,Qe=n`
|
|
549
530
|
query TransactionRecords($first: Int, $after: Cursor, $filter: TransactionRecordFilter) {
|
|
550
531
|
member {
|
|
551
532
|
transactionRecords(first: $first, after: $after, filter: $filter) {
|
|
@@ -571,8 +552,8 @@
|
|
|
571
552
|
}
|
|
572
553
|
}
|
|
573
554
|
}
|
|
574
|
-
`,
|
|
575
|
-
${
|
|
555
|
+
`,G=n`
|
|
556
|
+
${O}
|
|
576
557
|
|
|
577
558
|
fragment PromoFragment on Promo {
|
|
578
559
|
id
|
|
@@ -590,24 +571,24 @@
|
|
|
590
571
|
dateTimeCreated
|
|
591
572
|
dateTimeLastUpdated
|
|
592
573
|
}
|
|
593
|
-
`,
|
|
594
|
-
${
|
|
574
|
+
`,Ke=n`
|
|
575
|
+
${G}
|
|
595
576
|
|
|
596
577
|
query Promos {
|
|
597
578
|
promos {
|
|
598
579
|
...PromoFragment
|
|
599
580
|
}
|
|
600
581
|
}
|
|
601
|
-
`,
|
|
602
|
-
${
|
|
582
|
+
`,ze=n`
|
|
583
|
+
${G}
|
|
603
584
|
|
|
604
585
|
query AvailablePromos($filter: PromoFilterInput) {
|
|
605
586
|
availablePromos(filter: $filter) {
|
|
606
587
|
...PromoFragment
|
|
607
588
|
}
|
|
608
589
|
}
|
|
609
|
-
`,
|
|
610
|
-
${
|
|
590
|
+
`,F=n`
|
|
591
|
+
${O}
|
|
611
592
|
|
|
612
593
|
fragment CashbackFragment on Cashback {
|
|
613
594
|
id
|
|
@@ -622,16 +603,16 @@
|
|
|
622
603
|
dateTimeCreated
|
|
623
604
|
dateTimeLastUpdated
|
|
624
605
|
}
|
|
625
|
-
`,
|
|
626
|
-
${
|
|
606
|
+
`,Je=n`
|
|
607
|
+
${F}
|
|
627
608
|
|
|
628
609
|
query Cashbacks {
|
|
629
610
|
cashbacks {
|
|
630
611
|
...CashbackFragment
|
|
631
612
|
}
|
|
632
613
|
}
|
|
633
|
-
`,
|
|
634
|
-
${
|
|
614
|
+
`,Xe=n`
|
|
615
|
+
${G}
|
|
635
616
|
|
|
636
617
|
query Bonus {
|
|
637
618
|
bonus {
|
|
@@ -659,8 +640,8 @@
|
|
|
659
640
|
dateTimeLastUpdated
|
|
660
641
|
}
|
|
661
642
|
}
|
|
662
|
-
`,
|
|
663
|
-
${
|
|
643
|
+
`,Ze=n`
|
|
644
|
+
${F}
|
|
664
645
|
|
|
665
646
|
query CashbackBonuses {
|
|
666
647
|
cashbackBonuses {
|
|
@@ -673,7 +654,7 @@
|
|
|
673
654
|
dateTimeLastUpdated
|
|
674
655
|
}
|
|
675
656
|
}
|
|
676
|
-
`,
|
|
657
|
+
`,et=n`
|
|
677
658
|
mutation ClaimCashbackBonus($input: ClaimCashbackBonusInput!) {
|
|
678
659
|
claimCashbackBonus(input: $input) {
|
|
679
660
|
... on CashbackBonusDoesNotExistError {
|
|
@@ -681,13 +662,13 @@
|
|
|
681
662
|
}
|
|
682
663
|
}
|
|
683
664
|
}
|
|
684
|
-
`,
|
|
665
|
+
`,tt=n`
|
|
685
666
|
query Member {
|
|
686
667
|
member {
|
|
687
668
|
dateTimeLastActive
|
|
688
669
|
}
|
|
689
670
|
}
|
|
690
|
-
`,
|
|
671
|
+
`,at=n`
|
|
691
672
|
query MemberAccount {
|
|
692
673
|
memberAccount: self {
|
|
693
674
|
... on MemberAccount {
|
|
@@ -711,8 +692,8 @@
|
|
|
711
692
|
}
|
|
712
693
|
}
|
|
713
694
|
}
|
|
714
|
-
`,
|
|
715
|
-
${
|
|
695
|
+
`,rt=n`
|
|
696
|
+
${O}
|
|
716
697
|
|
|
717
698
|
query MemberVerification {
|
|
718
699
|
memberAccount: self {
|
|
@@ -735,7 +716,7 @@
|
|
|
735
716
|
}
|
|
736
717
|
}
|
|
737
718
|
}
|
|
738
|
-
`,
|
|
719
|
+
`,ot=n`
|
|
739
720
|
mutation RegisterMemberAccount(
|
|
740
721
|
$input: RegisterMemberAccountInput!
|
|
741
722
|
$referralCode: String
|
|
@@ -771,7 +752,7 @@
|
|
|
771
752
|
}
|
|
772
753
|
}
|
|
773
754
|
}
|
|
774
|
-
`,
|
|
755
|
+
`,nt=n`
|
|
775
756
|
mutation UpdateMemberAccount($input: UpdateMemberAccountInput!) {
|
|
776
757
|
updateMemberAccount(input: $input) {
|
|
777
758
|
... on AccountNameNotAvailableError {
|
|
@@ -797,7 +778,7 @@
|
|
|
797
778
|
}
|
|
798
779
|
}
|
|
799
780
|
}
|
|
800
|
-
`,
|
|
781
|
+
`,it=n`
|
|
801
782
|
mutation ResetPassword($input: ResetPasswordInput!, $verificationCode: String) {
|
|
802
783
|
resetPassword(input: $input, verificationCode: $verificationCode) {
|
|
803
784
|
... on AccountNotFoundError {
|
|
@@ -808,11 +789,11 @@
|
|
|
808
789
|
}
|
|
809
790
|
}
|
|
810
791
|
}
|
|
811
|
-
`,
|
|
792
|
+
`,st=n`
|
|
812
793
|
mutation DeleteMemberAccount($input: DeleteMemberAccountInput!) {
|
|
813
794
|
deleteMemberAccount(input: $input)
|
|
814
795
|
}
|
|
815
|
-
`,
|
|
796
|
+
`,ct=n`
|
|
816
797
|
mutation VerifyMobileNumber($input: VerifyMobileNumberInput!) {
|
|
817
798
|
verifyMobileNumber(input: $input) {
|
|
818
799
|
... on InvalidSMSVerificationCodeError {
|
|
@@ -823,7 +804,7 @@
|
|
|
823
804
|
}
|
|
824
805
|
}
|
|
825
806
|
}
|
|
826
|
-
`,
|
|
807
|
+
`,mt=n`
|
|
827
808
|
mutation CreateMemberVerification($input: CreateMemberVerificationInput!) {
|
|
828
809
|
createMemberVerification(input: $input) {
|
|
829
810
|
... on FileDoesNotExistError {
|
|
@@ -837,7 +818,7 @@
|
|
|
837
818
|
}
|
|
838
819
|
}
|
|
839
820
|
}
|
|
840
|
-
`,
|
|
821
|
+
`,dt=n`
|
|
841
822
|
mutation UpdateMemberVerification($input: UpdateMemberVerificationInput!) {
|
|
842
823
|
updateMemberVerification(input: $input) {
|
|
843
824
|
... on FileDoesNotExistError {
|
|
@@ -854,7 +835,7 @@
|
|
|
854
835
|
}
|
|
855
836
|
}
|
|
856
837
|
}
|
|
857
|
-
`,
|
|
838
|
+
`,ut=n`
|
|
858
839
|
query ProfileCompletion {
|
|
859
840
|
profileCompletion {
|
|
860
841
|
completionPercentage
|
|
@@ -865,7 +846,7 @@
|
|
|
865
846
|
accountPassword
|
|
866
847
|
}
|
|
867
848
|
}
|
|
868
|
-
`,
|
|
849
|
+
`,lt=n`
|
|
869
850
|
mutation SendVerificationCode($input: SendVerificationCodeInput!) {
|
|
870
851
|
sendVerificationCode(input: $input) {
|
|
871
852
|
... on InvalidPlatformError {
|
|
@@ -876,7 +857,7 @@
|
|
|
876
857
|
}
|
|
877
858
|
}
|
|
878
859
|
}
|
|
879
|
-
`,
|
|
860
|
+
`,pt=n`
|
|
880
861
|
fragment DepositGatewaySettingsCoreData on DepositGatewaySettings {
|
|
881
862
|
minimumAmount
|
|
882
863
|
maximumAmount
|
|
@@ -930,7 +911,7 @@
|
|
|
930
911
|
multiplier
|
|
931
912
|
}
|
|
932
913
|
}
|
|
933
|
-
`,
|
|
914
|
+
`,ft=n`
|
|
934
915
|
query MayaSession($id: ObjectId!) {
|
|
935
916
|
mayaSession(id: $id) {
|
|
936
917
|
id
|
|
@@ -938,5 +919,5 @@
|
|
|
938
919
|
dateTimeCreated
|
|
939
920
|
}
|
|
940
921
|
}
|
|
941
|
-
`;function d(n){return{name:n,message:{AccountNameNotAvailableError:"Username is no longer available",AccountNotFoundError:"Account does not exist",AccountNotVerifiedError:"Account is not verified",CashbackBonusDoesNotExistError:"Cashback bonus does not exists",DepositPromoMaximumAmountExceededError:"Deposit amount exceeds maximum amount",DepositPromoMinimumAmountNotMetError:"Deposit amount does not meet minimum amount",EmailAddressNotAvailableError:"Email is no longer available",FileDoesNotExistError:"File does not exist",FileFormatNotSupportedError:"File format is not supported",FileNameTooLongError:"File name is too long",FileNotReadyError:"File is not yet ready",FileSizeTooBigError:"File size is too big",GameDoesNotExistError:"Game does not exist",HasActiveBonusError:"Account has active bonus",InsufficientPointsError:"Insufficient points",InvalidPlatformError:"Invalid platform",InvalidReCAPTCHAResponseError:"Invalid reCAPTCHA",InvalidSMSVerificationCodeError:"Invalid SMS verification code",InvalidTransactionPasswordError:"Invalid transaction password",InvalidVerificationCodeError:"Invalid verification code",InvalidWithdrawalAmountError:"Invalid withdrawal amount",MaximumDepositAmountExceededError:"Maximum deposit amount exceeded",MemberVerificationAlreadyApprovedError:"Member verification is already approved",MemberVerificationAlreadyExistsError:"Member verification already exists",MemberVerificationDoesNotExistError:"Member verification does not exist",MinimumAgeRequirementError:"Minimum age requirement not met",MinimumDepositAmountNotMetError:"Minimum deposit amount not met",MinimumFirstDepositAmountNotMetError:"Minimum first deposit amount not met",MobileNumberAlreadyVerifiedError:"Mobile number is already verified",MobileNumberNotAvailableError:"Mobile number is no longer available",MobileNumberNotVerifiedError:"Mobile number is not verified",NickNameNotAvailableError:"Nickname is no longer available",NotEnoughBalanceError:"Insufficient balance",NotReadyToSendVerficationCodeError:"Not ready to send verification code",PromoNotEnabledError:"Promo is not enabled",RealNameAlreadySetError:"Real name is already set",ValidIdAlreadySetError:"Valid ID is already set",WalletDoesNotExistError:"Wallet does not exist",WithdrawalDailyLimitExceededError:"Daily withdrawal limit exceeded",GameProviderError:"Game provider error",GameSessionAlreadyClosedError:"Game session is already closed",GameSessionDoesNotExistError:"Game session does not exist",AccountBlacklisted:"Account is blacklisted",AccountNotFound:"Account not found",InvalidToken:"Invalid token",InvalidTokenOrSecretAnswer:"Invalid token or secret answer",SessionExpired:"Session expired"}[n]}}class yt{constructor(e){m(this,"client");this.client=e}async memberAccount(){const e=await this.client.request(nt);return e.ok?{ok:!0,data:e.data.memberAccount}:e}async registerMemberAccount(e){const t=await this.client.request(it,e);return t.ok?t.data.registerMemberAccount?{ok:!1,error:d(t.data.registerMemberAccount.__typename)}:{ok:!0}:t}async updateMemberAccount(e){const t=await this.client.request(st,e);return t.ok?t.data.updateMemberAccount?{ok:!1,error:d(t.data.updateMemberAccount.__typename)}:{ok:!0}:t}async deleteMemberAccount(e){const t=await this.client.request(mt,e);return t.ok?t.data.deleteMemberAccount?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:t}async resetPassword(e){const t=await this.client.request(ct,e);return t.ok?t.data.resetPassword?{ok:!1,error:d(t.data.resetPassword.__typename)}:{ok:!0}:t}async profileCompletion(){const e=await this.client.request(pt);return e.ok?{ok:!0,data:e.data.profileCompletion}:e}async platform(){return await this.client.request(ht)}async sendVerificationCode(e){const t=await this.client.request(ft,e);return t.ok?t.data.sendVerificationCode?{ok:!1,error:d(t.data.sendVerificationCode.__typename)}:{ok:!0}:t}async verifyMobileNumber(e){const t=await this.client.request(dt,e);return t.ok?t.data.verifyMobileNumber?{ok:!1,error:d(t.data.verifyMobileNumber.__typename)}:{ok:!0}:t}async createMemberVerification(e){const t=await this.client.request(ut,e);return t.ok?t.data.createMemberVerification?{ok:!1,error:d(t.data.createMemberVerification.__typename)}:{ok:!0}:t}async updateMemberVerification(e){const t=await this.client.request(lt,e);return t.ok?t.data.updateMemberVerification?{ok:!1,error:d(t.data.updateMemberVerification.__typename)}:{ok:!0}:t}async memberVerification(){const e=await this.client.request(ot);return e.ok?{ok:!0,data:e.data.memberAccount.verification}:e}async announcements(e){const t=await this.client.request(Ge,e);return t.ok?{ok:!0,data:t.data.announcements}:t}}function l(n,e){const t=z[n]?z[n]:z[500];return{name:t.name,message:e??t.message}}const z={400:{name:"HttpBadRequest",message:"Bad Request"},401:{name:"HttpUnauthorized",message:"Unauthorized"},403:{name:"HttpForbidden",message:"Forbidden"},404:{name:"HttpNotFound",message:"Not Found"},408:{name:"HttpRequestTimeout",message:"Request Timeout"},429:{name:"HttpTooManyRequests",message:"Too Many Requests"},500:{name:"HttpInternalServerError",message:"Internal Server Error"}};class gt{constructor(e){m(this,"url");m(this,"platform");this.url=e.url,this.platform=e.platform}async createSession(e){const t=new Headers({"Content-Type":"application/json","Platform-Code":this.platform,Role:"MEMBER"});if(e.name){const a=`${e.name}:${e.password}`,r=Buffer.from(a).toString("base64");t.set("Authorization",`Basic ${r}`)}if(e.mobileNumber){const a=`${e.mobileNumber}:${e.verificationCode}`,r=Buffer.from(a).toString("base64");t.set("Authorization",`MobileNumberOTP ${r}`)}e.sessionId&&t.set("Authorization",`Maya ${e.sessionId}`);try{const a=await fetch(`${this.url}/sessions`,{method:"POST",headers:t}),r=await a.json();return a.ok?{ok:!0,data:r}:r.code==="ACCOUNT_BLACKLISTED"?{ok:!1,error:d("AccountBlacklisted")}:{ok:!1,error:l(a.status)}}catch{return{ok:!1,error:l(500)}}}async authenticate(e){const t=new Headers({"Content-Type":"application/json","Platform-Code":this.platform,Role:"MEMBER"});if(e.type==="SECURITY_QUESTION"){t.set("Authorization",`Bearer ${e.token}`);try{const a=await fetch(`${this.url}/session/${e.token}/authenticate`,{method:"POST",headers:t,body:JSON.stringify({secretAnswer:e.secretAnswer})}),r=await a.json();return a.ok?{ok:!0,data:r}:a.status===401||a.status===403?{ok:!1,error:d("InvalidTokenOrSecretAnswer")}:{ok:!1,error:l(a.status)}}catch{return{ok:!1,error:l(500)}}}throw new Error("Invalid input 'type'")}async refreshSession(e){try{const t=await fetch(`${this.url}/session:refresh`,{method:"POST",headers:{"Content-Type":"application/json","Platform-Code":this.platform,Role:"MEMBER",Authorization:`Bearer ${e}`}}),a=await t.json();return t.ok?{ok:!0,data:a}:a.code==="ACCOUNT_BLACKLISTED"?{ok:!1,error:d("AccountBlacklisted")}:t.status===403||t.status===401?{ok:!1,error:d("InvalidToken")}:{ok:!1,error:l(t.status)}}catch{return{ok:!1,error:l(500)}}}async destroySession(e){try{const t=await fetch(`${this.url}/session`,{method:"DELETE",headers:{"Content-Type":"application/json","Platform-Code":this.platform,Role:"MEMBER",Authorization:`Bearer ${e}`}});return t.ok?{ok:!0}:{ok:!1,error:l(t.status)}}catch{return{ok:!1,error:l(500)}}}async verifySession(e){try{return(await fetch(`${this.url}/session`,{method:"GET",headers:{"Content-Type":"application/json","Platform-Code":this.platform,Role:"MEMBER",Authorization:`Bearer ${e}`}})).ok}catch{return!0}}}class Et{constructor(e){m(this,"client");this.client=e}async file(e){const t=await this.client.request(Ce,e);return t.ok?{ok:!0,data:t.data.node}:t}async uploadPrivateImageFile(e){const t=await this.client.upload(Ie,e);return t.ok?t.data.uploadPrivateImageFile?{ok:!1,error:d(t.data.uploadPrivateImageFile.__typename)}:{ok:!0}:t}}class At{constructor(e){m(this,"client");this.client=e}async betRecords(e){const t=await this.client.request(Qe,e);return t.ok?{ok:t.ok,data:t.data.member.betRecords}:t}async transactionRecords(e){const t=await this.client.request(ze,e);return t.ok?{ok:t.ok,data:t.data.member.transactionRecords}:t}async withdrawalRecords(e){const t=await this.client.request(xe,e);return t.ok?{ok:t.ok,data:t.data.member.withdrawalRecords}:t}async depositRecords(e){const t=await this.client.request(Le,e);return t.ok?{ok:t.ok,data:t.data.member.depositRecords}:t}async depositsCount(){const e=await this.client.request(He);return e.ok?{ok:e.ok,data:e.data.member.depositsCount}:e}async member(){const e=await this.client.request(rt);return e.ok?{ok:e.ok,data:e.data.member}:e}}class St{constructor(e){m(this,"url");this.url=e.url}gameThumbnails(e){return[`${this.url}/images/${e.provider.toLowerCase()}/thumbnail-${e.id}.webp`,`${this.url}/images/${e.provider.toLowerCase()}/thumbnail-${e.provider.toLowerCase()}.webp`]}}class re{constructor(e){m(this,"client");this.client=e}async promos(){const e=await this.client.request(Je);return e.ok?{ok:e.ok,data:e.data.promos}:e}async cashbacks(){const e=await this.client.request(Ze);return e.ok?{ok:e.ok,data:e.data.cashbacks}:e}async availablePromos(e){const t=await this.client.request(Xe,e);return t.ok?{ok:t.ok,data:t.data.availablePromos}:t}async cashbackBonuses(){const e=await this.client.request(tt);return e.ok?{ok:e.ok,data:e.data.cashbackBonuses}:e}async claimCashbackBonus(e){const t=await this.client.request(at,e);return t.ok?t.data.claimCashbackBonus?{ok:!1,error:d(t.data.claimCashbackBonus.__typename)}:{ok:!0}:{ok:t.ok,error:t.error}}async bonus(){const e=await this.client.request(et);return e.ok?{ok:e.ok,data:e.data.bonus}:e}async wallet(){const e=await this.client.request(Me);return e.ok?{ok:e.ok,data:e.data.wallet}:e}async deposit(e){const t=await this.client.request(Ye,e);return t.ok?{ok:t.ok,data:t.data.node}:t}async createGCashDeposit(e){const t=await this.client.request(Fe,e);return t.ok?t.data.createGCashDeposit?{ok:!1,error:d(t.data.createGCashDeposit.__typename)}:{ok:!0}:t}async createMayaDeposit(e){const t=await this.client.request(Ve,e);return t.ok?t.data.createMayaDeposit?{ok:!1,error:d(t.data.createMayaDeposit.__typename)}:{ok:!0}:t}async createMayaAppDeposit(e){const t=await this.client.request(je,e);return t.ok?t.data.createMayaAppDeposit?{ok:!1,error:d(t.data.createMayaAppDeposit.__typename)}:{ok:!0}:t}async createGCashWithdrawal(e){const t=await this.client.request(Ue,e);return t.ok?t.data.createGCashWithdrawal?{ok:!1,error:d(t.data.createGCashWithdrawal.__typename)}:{ok:!0}:t}async createMayaWithdrawal(e){const t=await this.client.request($e,e);return t.ok?t.data.createMayaWithdrawal?{ok:!1,error:d(t.data.createMayaWithdrawal.__typename)}:{ok:!0}:t}async createMayaAppWithdrawal(e){const t=await this.client.request(qe,e);return t.ok?t.data.createMayaAppWithdrawal?{ok:!1,error:d(t.data.createMayaAppWithdrawal.__typename)}:{ok:!0}:t}async createBankWithdrawal(e){const t=await this.client.request(Be,e);return t.ok?t.data.createBankWithdrawal?{ok:!1,error:d(t.data.createBankWithdrawal.__typename)}:{ok:!0}:t}async remainingDailyWithdrawalsCount(){const e=await this.client.request(We);return e.ok?{ok:e.ok,data:e.data.remainingDailyWithdrawalsCount}:e}async pointsWallet(){const e=await this.client.request(Ne);return e.ok?{ok:e.ok,data:e.data.pointsWallet}:e}async pointsToCashConversion(e){const t=await this.client.request(De,e);return t.ok?t.data.pointsToCashConversion?{ok:!1,error:d(t.data.pointsToCashConversion.__typename)}:{ok:!0}:t}async mayaSession(e){const t=await this.client.request(wt,e);return t.ok?{ok:t.ok,data:t.data.mayaSession}:t}async games(e){const t=await this.client.request(Z,e);return t.ok?{ok:t.ok,data:t.data.games}:t}async gamesByName(e){const t=await this.client.request(ee,e);return t.ok?{ok:t.ok,data:t.data.gamesByName}:t}async gameSession(e){const t=await this.client.request(ve,e);return t.ok?{ok:!0,data:t.data.node}:t}async createGameSession(e){const t=await this.client.request(te,e);return t.ok?t.data.createGameSession?{ok:!1,error:d(t.data.createGameSession.__typename)}:{ok:!0}:t}async endGameSession(e){const t=await this.client.request(Re,e);return t.ok?t.data.endGameSession?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:t}}class bt{constructor(e){m(this,"url");m(this,"siteId");m(this,"platformId");this.url=e.url,this.siteId=e.site,this.platformId=e.platform}async siteInfo(){const e=new Request(`${this.url}/sites/${this.siteId}`,{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json","Platform-ID":this.platformId}});try{const t=await fetch(e);if(!t.ok)return{ok:!1,error:l(t.status)};const{data:a}=await t.json();return{ok:!0,data:a}}catch{return{ok:!1,error:l(500)}}}async games(e){var r,s,c,p,h,f,S,w,M,N,D,v,R,P,O,G,x,U,$,q,B,W,L,F,V,j;const t=new URLSearchParams;e!=null&&e.first&&t.set("first",e.first.toString()),e!=null&&e.after&&t.set("after",e.after),(s=(r=e==null?void 0:e.filter)==null?void 0:r.name)!=null&&s.equal&&t.set("filter[name][eq]",e.filter.name.equal),(p=(c=e==null?void 0:e.filter)==null?void 0:c.name)!=null&&p.notEqual&&t.set("filter[name][neq]",e.filter.name.notEqual),(f=(h=e==null?void 0:e.filter)==null?void 0:h.name)!=null&&f.in&&t.set("filter[name][in]",e.filter.name.in.join(",")),(w=(S=e==null?void 0:e.filter)==null?void 0:S.name)!=null&&w.notIn&&t.set("filter[name][nin]",e.filter.name.notIn.join(",")),(N=(M=e==null?void 0:e.filter)==null?void 0:M.name)!=null&&N.contains&&t.set("filter[name][contains]",e.filter.name.contains),(v=(D=e==null?void 0:e.filter)==null?void 0:D.type)!=null&&v.equal&&t.set("filter[type][eq]",e.filter.type.equal),(P=(R=e==null?void 0:e.filter)==null?void 0:R.type)!=null&&P.notEqual&&t.set("filter[type][neq]",e.filter.type.notEqual),(G=(O=e==null?void 0:e.filter)==null?void 0:O.type)!=null&&G.in&&t.set("filter[type][in]",e.filter.type.in.join(",")),(U=(x=e==null?void 0:e.filter)==null?void 0:x.type)!=null&&U.notIn&&t.set("filter[type][nin]",e.filter.type.notIn.join(",")),(q=($=e==null?void 0:e.filter)==null?void 0:$.provider)!=null&&q.equal&&t.set("filter[provider][eq]",e.filter.provider.equal),(W=(B=e==null?void 0:e.filter)==null?void 0:B.provider)!=null&&W.notEqual&&t.set("filter[provider][neq]",e.filter.provider.notEqual),(F=(L=e==null?void 0:e.filter)==null?void 0:L.provider)!=null&&F.in&&t.set("filter[provider][in]",e.filter.provider.in.join(",")),(j=(V=e==null?void 0:e.filter)==null?void 0:V.provider)!=null&&j.notIn&&t.set("filter[provider][nin]",e.filter.provider.notIn.join(","));const a=new Request(`${this.url}/games?${t.toString()}`,{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json","Site-ID":this.siteId,"Platform-ID":this.platformId}});try{const _=await fetch(a);if(!_.ok)return{ok:!1,error:l(_.status)};const k=await _.json();return{ok:!0,data:{edges:k.data.map(Y=>({node:Y,cursor:Y.cursor})),pageInfo:{hasNextPage:!!k.next,endCursor:k.next},totalCount:k.totalCount}}}catch{return{ok:!1,error:l(500)}}}async game(e){const t=new Request(`${this.url}/games/${e}`,{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json","Site-ID":this.siteId,"Platform-ID":this.platformId}});try{const a=await fetch(t);if(a.status===404)return{ok:!0,data:null};if(!a.ok)return{ok:!1,error:l(a.status)};const{data:r}=await a.json();return{ok:!0,data:r}}catch{return{ok:!1,error:l(500)}}}}class kt{constructor(e){m(this,"client");this.client=e}async games(e){const t=await this.client.request(Z,e);return t.ok?{ok:t.ok,data:t.data.games}:t}async gamesByName(e){const t=await this.client.request(ee,e);return t.ok?{ok:t.ok,data:t.data.gamesByName}:t}async gameSession(e){const t=await this.client.request(Pe,e);return t.ok?{ok:!0,data:t.data.node}:t}async createGameSession(e){const t=await this.client.request(te,e);return t.ok?t.data.createGameSession?{ok:!1,error:d(t.data.createGameSession.__typename)}:{ok:!0}:t}async endGameSession(e){const t=await this.client.request(Oe,e);return t.ok?t.data.endGameSession?{ok:!1,error:d(t.data.endGameSession.__typename)}:{ok:!0}:t}}class _t{constructor(e){m(this,"client");this.client=e}async latestBetRecords(){const e=await this.client.request(Ke);return e.ok?{ok:!0,data:e.data.latestBetRecords}:e}}function Tt(n,e,t){return n<e?e:n>t?t:n}function J(n){return Object.prototype.toString.call(n)==="[object Object]"&&Object(n)===n}function Ct(n){const e=[];function t(a,r=[]){for(const s in a){const c=a[s];J(c)?t(c,[...r,s]):Array.isArray(c)?t(It(c),[...r,s]):e.push({key:[...r,s],value:c})}}return t(n),e}function It(n){return n.reduce((e,t,a)=>(e[a]=t,e),{})}class b{constructor(e,t){m(this,"url");m(this,"options");m(this,"middlewares");var r;const a=new Headers((r=t==null?void 0:t.fetchOptions)==null?void 0:r.headers);this.url=e,this.options={...t==null?void 0:t.fetchOptions,headers:a},this.middlewares=(t==null?void 0:t.middlewares)??[]}async request(e,t){const a=JSON.stringify({query:e,variables:t}),r=new Headers(this.options.headers);r.set("Content-Type","application/json"),r.set("Accept","application/json");const s=await this.runMiddlewares(new Request(this.url,{...this.options,body:a,headers:r,method:"POST"}));return await this.exec(s)}async upload(e,t){const a=this.createUploadBody(e,t),r=new Headers(this.options.headers);r.delete("Content-Type");const s=await this.runMiddlewares(new Request(this.url,{...this.options,body:a,headers:r,method:"POST"}));return await this.exec(s)}async exec(e){var t,a,r,s,c,p;try{const h=await fetch(e);if(!h.ok)return{ok:!1,error:l(h.status)};const f=await h.json(),S=f.data,w=(t=f.errors)==null?void 0:t.at(0);return w?((a=w.extensions)==null?void 0:a.code)==="FORBIDDEN"||((r=w.extensions)==null?void 0:r.code)==="ACCESS_TOKEN_EXPIRED"?{ok:!1,error:l(403,w.message)}:((s=w.extensions)==null?void 0:s.code)==="UNAUTHORIZED"?{ok:!1,error:l(401,w.message)}:((c=w.extensions)==null?void 0:c.code)==="BAD_USER_INPUT"||((p=w.extensions)==null?void 0:p.code)==="BAD_REQUEST"?{ok:!1,error:l(400,w.message)}:{ok:!1,error:l(500,w.message)}:{ok:!0,data:S}}catch{return{ok:!1,error:l(500)}}}async runMiddlewares(e){let t=e.clone();for(const a of this.middlewares)t=await a(t);return t}createUploadBody(e,t){const a=Ct(t).filter(c=>c.value instanceof File||c.value instanceof Blob),r=new FormData;r.append("operations",JSON.stringify({query:e,variables:t}));const s={};return a.forEach((c,p)=>{s[p.toString()]=[`variables.${c.key.join(".")}`]}),r.append("map",JSON.stringify(s)),a.forEach((c,p)=>{r.append(p.toString(),c.value)}),r}}async function A(n){const e=new TextEncoder().encode(n),t=await crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(t)).map(s=>s.toString(16).padStart(2,"0")).join("")}class ne{constructor(e){m(this,"enabled");this.enabled=(e==null?void 0:e.enabled)??!0}info(e){this.enabled&&console.log(`\x1B[34m[info] ${e}`)}warn(e){this.enabled&&console.log(`\x1B[33m[warn] ${e}`)}error(e){this.enabled&&console.log(`\x1B[31m[error] ${e}`)}success(e){this.enabled&&console.log(`\x1B[32m[success] ${e}`)}}function X(n){return new Date(n.getTime())}function T(n,e){const t=X(n);return t.setDate(t.getDate()+e),t}function C(n,e){const t=X(n);return t.setMinutes(t.getMinutes()+e),t}function oe(n,e){return n.getTime()>e.getTime()}function ie(n){return new Promise(e=>{setTimeout(e,n)})}function se(n,e){const{until:t,interval:a=1e3,maxAttempt:r=3}=e;async function s(c,p){const h=p??r,f=await n(...c);return t(f)?f:h>1?(await ie(a*((r-h)/2)),s(c,h-1)):f}return async(...c)=>await s(c)}function I(n,e){const t=X(n);return t.setMinutes(t.getMinutes()-e),t}class Mt{constructor(e){m(this,"logger");m(this,"storageKey","session");m(this,"authService");m(this,"walletService");m(this,"_refreshing",!1);this.authService=new gt({url:e.authUrl,platform:e.platform}),this.walletService=new re(new b(e.walletUrl,{middlewares:[t=>(t.headers.set("Platform",e.platform),t.headers.set("Role","MEMBER"),t)]})),this.logger=new ne({enabled:e.log??!1})}get refreshing(){return this._refreshing}set refreshing(e){this._refreshing=e}async create(e){if(this.isServer)return this.logger.warn("'localStorage' is not available on the server."),{ok:!1,error:{name:"UnknownError",message:"Server sign in is not supported."}};if(e.type==="MAYA"){const s=await se(()=>this.walletService.mayaSession({id:e.sessionId}),{until:f=>{var S;return f.ok&&((S=f.data)==null?void 0:S.member)!=null},interval:1e3,maxAttempt:5})();if(!s.ok)return s;const p=await se(()=>this.authService.createSession(e),{until:f=>f.ok,interval:1e3,maxAttempt:5})();if(!p.ok)return p;const h=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...p.data,accessTokenExpiresAt:C(h,8).getTime(),refreshTokenExpiresAt:I(T(h,30),2).getTime()})),{ok:!0,data:null}}if(e.type==="MOBILE_NUMBER"){const r=await this.authService.createSession(e);if(r.ok){const s=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...r.data,accessTokenExpiresAt:C(s,8).getTime(),refreshTokenExpiresAt:I(T(s,30),2).getTime()})),{ok:!0,data:null}}return r}const t=await this.authService.createSession(e);if(!t.ok)return t;if(t.data.authenticator)return{ok:!0,data:{authenticator:t.data.authenticator}};const a=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...t.data,accessTokenExpiresAt:C(a,8).getTime(),refreshTokenExpiresAt:I(T(a,30),2).getTime()})),{ok:!0,data:null}}async createFromAuthenticator(e){const t=await this.authService.authenticate(e);if(t.ok){const a=new Date;return this.isServer?this.logger.warn("'localStorage' is not available on the server."):window.localStorage.setItem(this.storageKey,JSON.stringify({...t.data,accessTokenExpiresAt:C(a,8).getTime(),refreshTokenExpiresAt:I(T(a,30),2).getTime()})),{ok:!0}}else return t}async get(){if(this.isServer)return this.logger.warn("'localStorage' is not available on the server."),{ok:!0,data:null};if(this.refreshing)return await ie(1e3),await this.get();const e=window.localStorage.getItem(this.storageKey);if(!e)return{ok:!0,data:null};try{let t=JSON.parse(e),a=new Date;const r=new Date(t.accessTokenExpiresAt),s=new Date(t.refreshTokenExpiresAt);if(oe(a,s))return this.logger.warn("Session expired. Logging out.."),window.localStorage.removeItem(this.storageKey),{ok:!1,error:{name:"SessionExpired",message:"Session expired."}};if(oe(a,r)){this.logger.info("Refreshing session..."),this.refreshing=!0;const c=await this.authService.refreshSession(t.refreshToken);if(this.refreshing=!1,!c.ok)return this.logger.error(`Failed to refresh session: ${c.error.message}`),c.error.name==="InvalidToken"||c.error.name==="AccountBlacklisted"?(window.localStorage.removeItem(this.storageKey),{ok:!1,error:c.error}):(this.logger.warn("Old session returned."),{ok:!0,data:t});this.logger.success("Session refreshed!"),a=new Date,t={...t,...c.data,accessTokenExpiresAt:C(a,8).getTime(),refreshTokenExpiresAt:I(T(a,30),2).getTime()},window.localStorage.setItem(this.storageKey,JSON.stringify(t))}return{ok:!0,data:t}}catch{return{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}}}async destroy(){var t;if(this.isServer){this.logger.warn("'localStorage' is not available on the server.");return}const e=await this.get();(t=e.data)!=null&&t.accessToken&&await this.authService.destroySession(e.data.accessToken),window.localStorage.removeItem(this.storageKey)}async verify(){var a,r,s;if(this.isServer)return this.logger.warn("'localStorage' is not available on the server."),!0;const e=await this.get();if(((a=e.error)==null?void 0:a.name)==="InvalidToken"||((r=e.error)==null?void 0:r.name)==="SessionExpired"||((s=e.error)==null?void 0:s.name)==="AccountBlacklisted")return!1;if(!e.data)return!0;const t=await this.authService.verifySession(e.data.accessToken);return t||window.localStorage.removeItem(this.storageKey),t}get isServer(){return typeof window>"u"}}function E(n){const e={};for(const t in n){const a=n[t];if(a!==null&&a!==void 0){if(J(a)){e[t]=E(a);continue}if(Array.isArray(a)){e[t]=a.map(r=>J(r)?E(r):r);continue}e[t]=a}}return e}function i(n,e){if(typeof n=="number"&&!Number.isNaN(n))return n;if(typeof n=="string"){const t=Number.parseFloat(n);if(!Number.isNaN(t))return t}return e}class Nt{constructor(e){m(this,"staticService");const t=(e==null?void 0:e.environment)==="development";this.staticService=new St({url:t?"https://static.development.opexa.io":"https://static.opexa.io"})}get transform(){return{site:this.site.bind(this),platform:this.platform.bind(this),account:this.account.bind(this),wallet:this.wallet.bind(this),verificationDetails:this.verificationDetails.bind(this),profileCompletion:this.profileCompletion.bind(this),announcement:this.announcement.bind(this),withdrawalRecord:this.withdrawalRecord.bind(this),deposit:this.deposit.bind(this),depositRecord:this.depositRecord.bind(this),betRecord:this.betRecord.bind(this),latestBetRecord:this.latestBetRecord.bind(this),transactionRecord:this.transactionRecord.bind(this),game:this.game.bind(this),gameSession:this.gameSession.bind(this),promo:this.promo.bind(this),cashback:this.cashback.bind(this),bonus:this.bonus.bind(this),cashbackBonus:this.cashbackBonus.bind(this),file:this.file.bind(this),pointsWallet:this.pointsWallet.bind(this)}}site(e){const t={id:e.id,name:e.name,logo:e.logo??void 0};return E(t)}platform(e){var t,a,r,s,c,p,h,f,S,w,M,N,D,v,R,P,O,G,x,U,$,q,B,W,L,F,V,j,_,k,Y,ce,me,de,ue,le,pe,fe,he,we,ye,ge,Ee,Ae,Se,be,ke,_e,Te;return{paymentSettings:{minimumFirstDepositAmount:i(e.minimumFirstDepositAmount),restrictWithdrawalsToVerifiedMembers:e.restrictWithdrawalsToVerifiedMembers,depositGateway:{bank:{androidEnabled:((t=e.bankDepositGatewaySettings)==null?void 0:t.androidEnabled)??!1,iosEnabled:((a=e.bankDepositGatewaySettings)==null?void 0:a.iosEnabled)??!1,webEnabled:((r=e.bankDepositGatewaySettings)==null?void 0:r.webEnabled)??!1,mobileWebEnabled:((s=e.bankDepositGatewaySettings)==null?void 0:s.mobileWebEnabled)??!1,minimumAmount:i((c=e.bankDepositGatewaySettings)==null?void 0:c.minimumAmount),maximumAmount:i((p=e.bankDepositGatewaySettings)==null?void 0:p.maximumAmount)},gcash:{androidEnabled:((h=e.gcashDepositGatewaySettings)==null?void 0:h.androidEnabled)??!1,iosEnabled:((f=e.gcashDepositGatewaySettings)==null?void 0:f.iosEnabled)??!1,webEnabled:((S=e.gcashDepositGatewaySettings)==null?void 0:S.webEnabled)??!1,mobileWebEnabled:((w=e.gcashDepositGatewaySettings)==null?void 0:w.mobileWebEnabled)??!1,minimumAmount:i((M=e.gcashDepositGatewaySettings)==null?void 0:M.minimumAmount),maximumAmount:i((N=e.gcashDepositGatewaySettings)==null?void 0:N.maximumAmount)},maya:{androidEnabled:((D=e.mayaDepositGatewaySettings)==null?void 0:D.androidEnabled)??!1,iosEnabled:((v=e.mayaDepositGatewaySettings)==null?void 0:v.iosEnabled)??!1,webEnabled:((R=e.mayaDepositGatewaySettings)==null?void 0:R.webEnabled)??!1,mobileWebEnabled:((P=e.mayaDepositGatewaySettings)==null?void 0:P.mobileWebEnabled)??!1,minimumAmount:i((O=e.mayaDepositGatewaySettings)==null?void 0:O.minimumAmount),maximumAmount:i((G=e.mayaDepositGatewaySettings)==null?void 0:G.maximumAmount)},mayaApp:{androidEnabled:((x=e.mayaAppDepositGatewaySettings)==null?void 0:x.androidEnabled)??!1,iosEnabled:((U=e.mayaAppDepositGatewaySettings)==null?void 0:U.iosEnabled)??!1,webEnabled:(($=e.mayaAppDepositGatewaySettings)==null?void 0:$.webEnabled)??!1,mobileWebEnabled:((q=e.mayaAppDepositGatewaySettings)==null?void 0:q.mobileWebEnabled)??!1,minimumAmount:i((B=e.mayaAppDepositGatewaySettings)==null?void 0:B.minimumAmount),maximumAmount:i((W=e.mayaAppDepositGatewaySettings)==null?void 0:W.maximumAmount)}},withdrawalGateway:{bank:{androidEnabled:((L=e.bankWithdrawalGatewaySettings)==null?void 0:L.androidEnabled)??!1,iosEnabled:((F=e.bankWithdrawalGatewaySettings)==null?void 0:F.iosEnabled)??!1,webEnabled:((V=e.bankWithdrawalGatewaySettings)==null?void 0:V.webEnabled)??!1,mobileWebEnabled:((j=e.bankWithdrawalGatewaySettings)==null?void 0:j.mobileWebEnabled)??!1,minimumAmount:i((_=e.bankWithdrawalGatewaySettings)==null?void 0:_.minimumAmount),maximumAmount:i((k=e.bankWithdrawalGatewaySettings)==null?void 0:k.maximumAmount)},gcash:{androidEnabled:((Y=e.gcashWithdrawalGatewaySettings)==null?void 0:Y.androidEnabled)??!1,iosEnabled:((ce=e.gcashWithdrawalGatewaySettings)==null?void 0:ce.iosEnabled)??!1,webEnabled:((me=e.gcashWithdrawalGatewaySettings)==null?void 0:me.webEnabled)??!1,mobileWebEnabled:((de=e.gcashWithdrawalGatewaySettings)==null?void 0:de.mobileWebEnabled)??!1,minimumAmount:i((ue=e.gcashWithdrawalGatewaySettings)==null?void 0:ue.minimumAmount),maximumAmount:i((le=e.gcashWithdrawalGatewaySettings)==null?void 0:le.maximumAmount,1e6)},maya:{androidEnabled:((pe=e.mayaWithdrawalGatewaySettings)==null?void 0:pe.androidEnabled)??!1,iosEnabled:((fe=e.mayaWithdrawalGatewaySettings)==null?void 0:fe.iosEnabled)??!1,webEnabled:((he=e.mayaWithdrawalGatewaySettings)==null?void 0:he.webEnabled)??!1,mobileWebEnabled:((we=e.mayaWithdrawalGatewaySettings)==null?void 0:we.mobileWebEnabled)??!1,minimumAmount:i((ye=e.mayaWithdrawalGatewaySettings)==null?void 0:ye.minimumAmount),maximumAmount:i((ge=e.mayaWithdrawalGatewaySettings)==null?void 0:ge.maximumAmount)},mayaApp:{androidEnabled:((Ee=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Ee.androidEnabled)??!1,iosEnabled:((Ae=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Ae.iosEnabled)??!1,webEnabled:((Se=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Se.webEnabled)??!1,mobileWebEnabled:((be=e.mayaAppWithdrawalGatewaySettings)==null?void 0:be.mobileWebEnabled)??!1,minimumAmount:i((ke=e.mayaAppWithdrawalGatewaySettings)==null?void 0:ke.minimumAmount),maximumAmount:i((_e=e.mayaAppWithdrawalGatewaySettings)==null?void 0:_e.maximumAmount,1e6)}}},pointsClubSettings:{multiplier:i((Te=e.pointsClubSettings)==null?void 0:Te.multiplier,0)}}}account(e){const t={id:e.id,name:e.name,status:e.status,verified:e.verified,nickName:e.nickName??void 0,realName:e.realName??void 0,dateOfBirth:e.birthDay?new Date(e.birthDay):void 0,emailAddress:e.emailAddress??void 0,mobileNumber:e.mobileNumber??void 0,mobileNumberVerified:e.mobileNumberVerified??!1,mobileNumberVerificationRequired:e.mobileNumberVerificationRequired??!1,validId:e.validId??void 0,verificationStatus:e.verificationStatus,transactionPassword:e.transactionPassword,secretAnswerSubmitted:e.secretAnswerSubmitted??!1,dateTimeLastActive:e.dateTimeLastActive?new Date(e.dateTimeLastActive):void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)};return E(t)}wallet(e){return{id:e.id,balance:i(e.balance,0),currency:e.currency,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}verificationDetails(e){return{id:e.id,status:e.status,address:e.address,nationality:e.nationality,natureOfWork:e.natureOfWork,placeOfBirth:e.placeOfBirth,sourceOfIncome:e.sourceOfIncome,selfieImage:this.file(e.selfieImage),idFrontImage:this.file(e.idFrontImage)}}profileCompletion(e){return{accountPassword:e.accountPassword??!1,accountVerification:e.accountVerification??!1,mobileNumberVerification:e.mobileNumberVerification??!1,personalInformation:e.personalInformation??!1,transactionPassword:e.transactionPassword??!1,completionPercentage:i(e,0)}}announcement(e){return{id:e.id,type:e.type,title:e.title,status:e.status,message:e.message,activationEndDateTime:new Date(e.activationEndDateTime),activationStartDateTime:new Date(e.activationStartDateTime),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}withdrawalRecord(e){const t={id:e.id,type:e.type,bank:e.bank,status:e.status,amount:i(e.amount,0),netAmount:i(e.netAmount,0),fee:i(e.fee,0),reference:e.reference??void 0,withdrawalNumber:e.withdrawalNumber,recipientMobileNumber:e.recipientMobileNumber??void 0,dateTimeConfirmed:e.dateTimeConfirmed?new Date(e.dateTimeConfirmed):void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)};return E(t)}deposit(e){const t={id:e.id,type:e.type,status:e.status,checkoutUrl:e.checkoutUrl??void 0};return E(t)}depositRecord(e){const t={id:e.id,type:e.type,status:e.status,amount:i(e.amount,0),fee:i(e.fee,0),netAmount:i(e.netAmount,0),reference:e.reference??void 0,depositNumber:e.depositNumber,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)};return E(t)}betRecord(e){var a;const t={id:e.id,bet:i(e.bet,0),payout:i(e.payout,0),status:e.status,jackpotContribution:i(e.jackpotContribution,0),jackpotPayout:i(e.jackpotPayout,0),winloss:i(e.winloss),validBet:i(e.validBet,0),vendorRoundId:e.vendorRoundId??void 0,game:this.game(e.game),serialCode:e.serialCode,dateTimeSettled:e.dateTimeSettled?new Date(e.dateTimeSettled):void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated),betContent:e.betContent??void 0,contestName:e.contestName??void 0,externalCategory:e.externalCategory??void 0,metadata:{odds:((a=e.metadata)==null?void 0:a.odds)??void 0}};return E(t)}latestBetRecord(e){return{id:e.id,member:e.member,game:this.game(e.game),bet:i(e.bet,0),payout:i(e.payout,0),validBet:i(e.validBet,0),dateTimeSettled:new Date(e.dateTimeSettled),dateTimeCreated:new Date(e.dateTimeCreated)}}transactionRecord(e){const t={id:e.id,type:e.type,amount:i(e.amount,0),content:e.content??void 0,currentBalance:i(e.currentBalance,0),referenceNumber:e.referenceNumber,dateTimeCreated:new Date(e.dateTimeCreated)};return E(t)}game(e){return{id:e.id,type:e.type,name:e.name,images:this.staticService.gameThumbnails(e),provider:e.provider}}gameSession(e){const t={id:e.id,status:e.status,launchUrl:e.launchUrl??void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)};return E(t)}promo(e){return{id:e.id,type:e.type,name:e.name,status:e.status,description:e.description,banner:this.file(e.banner),maximumBonusAmount:i(e.maximumBonusAmount),minimumBonusAmount:i(e.minimumBonusAmount),activationEndDateTime:new Date(e.activationEndDateTime),activationStartDateTime:new Date(e.activationStartDateTime),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}cashback(e){return{id:e.id,name:e.name,description:e.description,status:e.status,banner:this.file(e.banner),activationEndDateTime:new Date(e.activationEndDateTime),activationStartDateTime:new Date(e.activationStartDateTime),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}bonus(e){const t={id:e.id,promo:this.promo(e.promo),deposit:e.deposit?{type:e.deposit.type,status:e.deposit.status,fee:i(e.deposit.fee,0),amount:i(e.deposit.amount,0),netAmount:i(e.deposit.netAmount,0),reference:e.deposit.reference??void 0,dateTimeCreated:new Date(e.deposit.dateTimeCreated),dateTimeLastUpdated:new Date(e.deposit.dateTimeLastUpdated)}:void 0,balance:i(e.balance,0),amount:i(e.amount,0),expiration:new Date(e.expiration),turnoverRequirement:i(e.turnoverRequirement,0),currentTurnoverRequirementContribution:i(e.currentTurnoverRequirementContribution,0),currentTurnoverRequirementContributionPercentage:i(e.currentTurnoverRequirementContributionPercentage,0),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)};return E(t)}cashbackBonus(e){return{id:e.id,balance:i(e.balance,0),cashback:this.cashback(e.cashback),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}file(e){const t={id:e.id,url:e.url??void 0,status:e.status,dateTimeCreated:new Date(e.dateTimeCreated)};return E(t)}pointsWallet(e){return{id:e.id,points:i(e.points,0),account:e.account,dateTimeCreated:new Date(e.dateTimeCreated)}}}var Dt={VITE_AUTH_DEVELOPMENT_URL:"https://auth.development.opexa.io",VITE_AUTH_PRODUCTION_URL:"https://auth.opexa.io",VITE_GAME_DEVELOPMENT_URL:"https://game.development.opexa.io/graphql",VITE_GAME_PRODUCTION_URL:"https://game.opexa.io/graphql",VITE_FILE_DEVELOPMENT_URL:"https://file.development.opexa.io/graphql",VITE_FILE_PRODUCTION_URL:"https://file.opexa.io/graphql",VITE_REPORT_DEVELOPMENT_URL:"https://report.development.opexa.io/graphql",VITE_REPORT_PRODUCTION_URL:"https://report.opexa.io/graphql",VITE_WALLET_DEVELOPMENT_URL:"https://wallet.development.opexa.io/graphql",VITE_WALLET_PRODUCTION_URL:"https://wallet.opexa.io/graphql",VITE_ACCOUNT_DEVELOPMENT_URL:"https://account.development.opexa.io/graphql",VITE_ACCOUNT_PRODUCTION_URL:"https://account.opexa.io/graphql",VITE_PORTAL_DEVELOPMENT_URL:"https://portal.development.opexa.io/graphql",VITE_PORTAL_PRODUCTION_URL:"https://portal.opexa.io/graphql",VITE_STATIC_DEVELOPMENT_URL:"https://static.development.opexa.io",VITE_STATIC_PRODUCTION_URL:"https://static.opexa.io",VITE_CMS_PORTAL_DEVELOPMENT_URL:"https://portal-api.opexacms.io/v1",BASE_URL:"/",MODE:"library",DEV:!1,PROD:!0,SSR:!1};class vt{constructor(e){m(this,"gameService");m(this,"fileService");m(this,"walletService");m(this,"reportService");m(this,"portalService");m(this,"accountService");m(this,"cmsPortalService");m(this,"sessionManager");m(this,"transformer");m(this,"logger");const t=e.environment==="development";this.sessionManager=new Mt({authUrl:t?"https://auth.development.opexa.io":"https://auth.opexa.io",walletUrl:t?"https://wallet.development.opexa.io/graphql":"https://wallet.opexa.io/graphql",platform:e.platform,log:e.log}),this.cmsPortalService=new bt({url:t?"https://portal-api.opexacms.io/v1":Dt.VITE_CMS_PORTAL_PRODUCTION_URL,site:e.site,platform:e.sitePlatform});const a={middlewares:[this.authMiddleware],fetchOptions:{headers:{Role:"MEMBER","Platform-Code":e.platform}}};this.gameService=new kt(new b(t?"https://game.development.opexa.io/graphql":"https://game.opexa.io/graphql",a)),this.fileService=new Et(new b(t?"https://file.development.opexa.io/graphql":"https://file.opexa.io/graphql",a)),this.walletService=new re(new b(t?"https://wallet.development.opexa.io/graphql":"https://wallet.opexa.io/graphql",a)),this.reportService=new At(new b(t?"https://report.development.opexa.io/graphql":"https://report.opexa.io/graphql",a)),this.accountService=new yt(new b(t?"https://account.development.opexa.io/graphql":"https://account.opexa.io/graphql",a)),this.portalService=new _t(new b(t?"https://portal.development.opexa.io/graphql":"https://portal.opexa.io/graphql",a)),this.transformer=new Nt(e),this.logger=new ne({enabled:e.log??!1})}get authMiddleware(){return async e=>{this.logger.info("Checking for session");const t=await this.sessionManager.get();return t.data?(e.headers.append("Authorization",`Bearer ${t.data.accessToken}`),this.logger.info("Session found"),this.logger.success("Added 'Authorization' header")):this.logger.info("No session found"),e}}async signIn(e){switch(e.type){case"NAME_AND_PASSWORD":{const t=await this.sessionManager.create({...e,password:await A(e.password)});return t.ok?t.data?{ok:!0,data:{"2FAEnabled":!0,authenticator:t.data.authenticator}}:{ok:!0,data:{"2FAEnabled":!1}}:t}default:{const t=await this.sessionManager.create(e);return t.ok?{ok:!0}:t}}}async authenticate(e){switch(e.type){case"SECURITY_QUESTION":return await this.sessionManager.createFromAuthenticator({type:"SECURITY_QUESTION",token:e.token,secretAnswer:await A(e.secretAnswer)});default:return{ok:!1,error:{name:"HttpBadRequest",message:"Invalid input 'type'"}}}}async signOut(){await this.sessionManager.destroy()}watchSession(e){const t=Tt(e.interval??3e4,3e4,6e4);let a=null;const r=()=>setTimeout(async()=>{await this.sessionManager.verify()||await e.onInvalid(),a=r()},t);return a=r(),function(){a&&clearTimeout(a)}}async session(){const e=await this.sessionManager.get();return e.ok?{ok:!0,data:e.data?{id:e.data.session.id,dateTimeCreated:new Date(e.data.session.dateTimeCreated)}:null}:e}async site(){const e=await this.cmsPortalService.siteInfo();return e.ok?{ok:!0,data:this.transformer.transform.site(e.data)}:e}async platform(){const e=await this.accountService.platform();return e.ok?{ok:!0,data:this.transformer.transform.platform(e.data)}:e}async account(){const[e,t]=await Promise.all([this.accountService.memberAccount(),this.reportService.member()]);return e.ok?t.ok?{ok:!0,data:this.transformer.transform.account({...e.data,...t.data})}:{ok:!1,error:t.error}:{ok:!1,error:e.error}}async createAccount(e){const t=e.id??u.ObjectId.generate(g.Account).toString(),a=await this.accountService.registerMemberAccount({input:{id:t,name:e.name,birthDay:typeof e.dateOfBirth=="string"?e.dateOfBirth:e.dateOfBirth.toISOString(),password:await A(e.password),mobileNumber:this.addAreaCode(e.mobileNumber),domain:e.domain,btag:e.referralCode},verificationCode:e.verificationCode,reCAPTCHAResponse:e.reCAPTCHAResponse});return a.ok?{ok:!0,data:{id:t}}:a}async updateAccount(e,t){return await this.accountService.updateMemberAccount({input:{id:e,data:{...t,password:t.password?await A(t.password):void 0,transactionPassword:t.transactionPassword?await A(t.transactionPassword):void 0,...t.mobileNumber&&{mobileNumber:this.addAreaCode(t.mobileNumber)},secretAnswer:t.secretAnswer?await A(t.secretAnswer):void 0}}})}async deleteAccount(e){return await this.accountService.deleteMemberAccount({input:{id:e}})}async verificationDetails(){const e=await this.accountService.memberVerification();return e.ok?{ok:!0,data:e.data?this.transformer.transform.verificationDetails(e.data):null}:e}async submitVerificationDetails(e){const t=e.id??u.ObjectId.generate(g.Verification).toString(),a=await this.accountService.createMemberVerification({input:{id:t,...e}});return a.ok?{ok:!0,data:{id:t}}:a}async updateVerificationDetails(e,t){return await this.accountService.updateMemberVerification({input:{id:e,data:{...t}}})}async resetPassword(e){return await this.accountService.resetPassword({input:{mobileNumber:this.addAreaCode(e.mobileNumber),newPassword:await A(e.newPassword)},verificationCode:e.verificationCode})}async verifyMobileNumber(e){return await this.accountService.verifyMobileNumber({input:{verificationCode:e}})}async profileCompletion(){const e=await this.accountService.profileCompletion();return e.ok?{ok:!0,data:this.transformer.transform.profileCompletion(e.data)}:e}async sendVerificationCode(e){return await this.accountService.sendVerificationCode({input:{channel:"SMS",recipient:this.addAreaCode(e)}})}async wallet(){const e=await this.walletService.wallet();return e.ok?{ok:!0,data:e.data?this.transformer.transform.wallet(e.data):null}:e}async announcements(e){const t=await this.accountService.announcements({...e,filter:{visibility:{in:["MEMBER","GLOBAL"]},activationStartDateTime:{greaterThanOrEqual:new Date}}});return t.ok?{ok:!0,data:{announcements:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.announcement(r),cursor:a})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async createWithdrawal(e){const t=e.id??u.ObjectId.generate(g.Withdrawal).toString();if(e.type==="BANK"){const a=await this.walletService.createBankWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await A(e.transactionPassword)}});if(!a.ok)return a}if(e.type==="GCASH"){const a=await this.walletService.createGCashWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await A(e.transactionPassword),recipientMobileNumber:this.addAreaCode(e.recipientMobileNumber)}});if(!a.ok)return a}if(e.type==="MAYA"){const a=await this.walletService.createMayaWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await A(e.transactionPassword),recipientMobileNumber:this.addAreaCode(e.recipientMobileNumber)}});if(!a.ok)return a}if(e.type==="MAYA_APP"){const a=await this.walletService.createMayaAppWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await A(e.transactionPassword)}});if(!a.ok)return a}return{ok:!0,data:{id:t}}}async withdrawalRecords(e){const t=await this.reportService.withdrawalRecords(e);return t.ok?{ok:!0,data:{withdrawalRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.withdrawalRecord(r),cursor:a})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async remainingDailyWithdrawalsCount(){return await this.walletService.remainingDailyWithdrawalsCount()}async createDeposit(e){const t=e.id??u.ObjectId.generate(g.Deposit).toString();if(e.type==="MAYA"){const a=await this.walletService.createMayaDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}if(e.type==="MAYA_APP"){const a=await this.walletService.createMayaAppDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}if(e.type==="GCASH"){const a=await this.walletService.createGCashDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}return{ok:!0,data:{id:t}}}async deposit(e){const t=await this.walletService.deposit({id:e});return t.ok?{ok:!0,data:t.data?this.transformer.transform.deposit(t.data):null}:t}async depositRecords(e){const t=await this.reportService.depositRecords(e);return t.ok?{ok:!0,data:{depositRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.depositRecord(r),cursor:a})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async depositsCount(){return await this.reportService.depositsCount()}async betRecords(e){const t=await this.reportService.betRecords(e);return t.ok?{ok:!0,data:{betRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.betRecord(r),cursor:a})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async latestBetRecords(){const e=await this.portalService.latestBetRecords();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.latestBetRecord)}:e}async transactionRecords(e){const t=await this.reportService.transactionRecords(e);return t.ok?{ok:!0,data:{transactionRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.transactionRecord(r),cursor:a})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async promos(){const e=await this.walletService.promos();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.promo)}:e}async availablePromos(){const e=await this.walletService.availablePromos();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.promo)}:e}async cashbacks(){const e=await this.walletService.cashbacks();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.cashback)}:e}async bonus(){const e=await this.walletService.bonus();return e.ok?{ok:!0,data:e.data?this.transformer.transform.bonus(e.data):null}:e}async cashbackBonuses(){const e=await this.walletService.cashbackBonuses();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.cashbackBonus)}:e}async claimCashbackBonus(e){return await this.walletService.claimCashbackBonus({input:{id:e}})}async game(e){const t=await this.cmsPortalService.game(e);return t.ok?{ok:!0,data:t.data?this.transformer.transform.game(t.data):null}:t}async games(e){const t=await this.walletService.games(e);return t.ok?{ok:!0,data:{games:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.game(r),cursor:a})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async games__next(e){const t=await this.cmsPortalService.games(e);return t.ok?{ok:!0,data:{games:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.game(r),cursor:a})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async games__legacy(e){const t=await this.gameService.games(e);return t.ok?{ok:!0,data:{games:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.game(r),cursor:a})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async gamesByName(e){const t=await this.walletService.gamesByName(e);return t.ok?{ok:!0,data:t.data.map(this.transformer.transform.game)}:t}async gamesByName__legacy(e){const t=await this.gameService.gamesByName(e);return t.ok?{ok:!0,data:t.data.map(this.transformer.transform.game)}:t}async gameSession(e){const t=await this.walletService.gameSession({id:e});return t.ok?{ok:!0,data:t.data?this.transformer.transform.gameSession(t.data):null}:t}async gameSession__legacy(e){const t=await this.gameService.gameSession({id:e});return t.ok?{ok:!0,data:t.data?this.transformer.transform.gameSession({...t.data,game:t.data.game.id}):null}:t}async createGameSession(e){const t=e.id??u.ObjectId.generate(g.GameSession).toString(),a=await this.walletService.createGameSession({input:{id:t,game:e.game}});return a.ok?{ok:!0,data:{id:t}}:a}async createGameSession__legacy(e){const t=e.id??u.ObjectId.generate(g.GameSession).toString(),a=await this.gameService.createGameSession({input:{id:t,game:e.game}});return a.ok?{ok:!0,data:{id:t}}:a}async endGameSession(e){return await this.walletService.endGameSession({input:{id:e}})}async endGameSession__legacy(e){return await this.gameService.endGameSession({input:{id:e}})}async file(e){const t=await this.fileService.file({id:e});return t.ok?{ok:!0,data:t.data?this.transformer.transform.file(t.data):null}:t}async uploadImageFile(e){const t=e.id??u.ObjectId.generate(g.File).toString(),a=await this.fileService.uploadPrivateImageFile({input:{id:t,file:e.file}});return a.ok?{ok:!0,data:{id:t}}:a}async pointsWallet(){const e=await this.walletService.pointsWallet();return e.ok?{ok:!0,data:e.data?this.transformer.transform.pointsWallet(e.data):null}:e}async pointsToCashConversion(e){return await this.walletService.pointsToCashConversion({input:{amount:e.toString()}})}addAreaCode(e){return e.startsWith("+63")?e:e.startsWith("63")?`+${e}`:e.startsWith("0")?`+63${e.substring(1)}`:`+63${e}`}}Object.defineProperty(y,"ObjectId",{enumerable:!0,get:()=>u.ObjectId}),y.ObjectType=g,y.Sdk=vt,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
|
|
922
|
+
`;function d(o){return{name:o,message:{AccountNameNotAvailableError:"Username is no longer available",AccountNotFoundError:"Account does not exist",AccountNotVerifiedError:"Account is not verified",CashbackBonusDoesNotExistError:"Cashback bonus does not exists",DepositPromoMaximumAmountExceededError:"Deposit amount exceeds maximum amount",DepositPromoMinimumAmountNotMetError:"Deposit amount does not meet minimum amount",EmailAddressNotAvailableError:"Email is no longer available",FileDoesNotExistError:"File does not exist",FileFormatNotSupportedError:"File format is not supported",FileNameTooLongError:"File name is too long",FileNotReadyError:"File is not yet ready",FileSizeTooBigError:"File size is too big",GameDoesNotExistError:"Game does not exist",HasActiveBonusError:"Account has active bonus",InsufficientPointsError:"Insufficient points",InvalidPlatformError:"Invalid platform",InvalidReCAPTCHAResponseError:"Invalid reCAPTCHA",InvalidSMSVerificationCodeError:"Invalid SMS verification code",InvalidTransactionPasswordError:"Invalid transaction password",InvalidVerificationCodeError:"Invalid verification code",InvalidWithdrawalAmountError:"Invalid withdrawal amount",MaximumDepositAmountExceededError:"Maximum deposit amount exceeded",MemberVerificationAlreadyApprovedError:"Member verification is already approved",MemberVerificationAlreadyExistsError:"Member verification already exists",MemberVerificationDoesNotExistError:"Member verification does not exist",MinimumAgeRequirementError:"Minimum age requirement not met",MinimumDepositAmountNotMetError:"Minimum deposit amount not met",MinimumFirstDepositAmountNotMetError:"Minimum first deposit amount not met",MobileNumberAlreadyVerifiedError:"Mobile number is already verified",MobileNumberNotAvailableError:"Mobile number is no longer available",MobileNumberNotVerifiedError:"Mobile number is not verified",NickNameNotAvailableError:"Nickname is no longer available",NotEnoughBalanceError:"Insufficient balance",NotReadyToSendVerficationCodeError:"Not ready to send verification code",PromoNotEnabledError:"Promo is not enabled",RealNameAlreadySetError:"Real name is already set",ValidIdAlreadySetError:"Valid ID is already set",WalletDoesNotExistError:"Wallet does not exist",WithdrawalDailyLimitExceededError:"Daily withdrawal limit exceeded",GameProviderError:"Game provider error",GameSessionAlreadyClosedError:"Game session is already closed",GameSessionDoesNotExistError:"Game session does not exist",AccountBlacklisted:"Account is blacklisted",AccountNotFound:"Account not found",InvalidToken:"Invalid token",InvalidTokenOrSecretAnswer:"Invalid token or secret answer",SessionExpired:"Session expired"}[o]}}class ht{constructor(e){m(this,"client");this.client=e}async memberAccount(){const e=await this.client.request(at);return e.ok?{ok:!0,data:e.data.memberAccount}:e}async registerMemberAccount(e){const t=await this.client.request(ot,e);return t.ok?t.data.registerMemberAccount?{ok:!1,error:d(t.data.registerMemberAccount.__typename)}:{ok:!0}:t}async updateMemberAccount(e){const t=await this.client.request(nt,e);return t.ok?t.data.updateMemberAccount?{ok:!1,error:d(t.data.updateMemberAccount.__typename)}:{ok:!0}:t}async deleteMemberAccount(e){const t=await this.client.request(st,e);return t.ok?t.data.deleteMemberAccount?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:t}async resetPassword(e){const t=await this.client.request(it,e);return t.ok?t.data.resetPassword?{ok:!1,error:d(t.data.resetPassword.__typename)}:{ok:!0}:t}async profileCompletion(){const e=await this.client.request(ut);return e.ok?{ok:!0,data:e.data.profileCompletion}:e}async platform(){return await this.client.request(pt)}async sendVerificationCode(e){const t=await this.client.request(lt,e);return t.ok?t.data.sendVerificationCode?{ok:!1,error:d(t.data.sendVerificationCode.__typename)}:{ok:!0}:t}async verifyMobileNumber(e){const t=await this.client.request(ct,e);return t.ok?t.data.verifyMobileNumber?{ok:!1,error:d(t.data.verifyMobileNumber.__typename)}:{ok:!0}:t}async createMemberVerification(e){const t=await this.client.request(mt,e);return t.ok?t.data.createMemberVerification?{ok:!1,error:d(t.data.createMemberVerification.__typename)}:{ok:!0}:t}async updateMemberVerification(e){const t=await this.client.request(dt,e);return t.ok?t.data.updateMemberVerification?{ok:!1,error:d(t.data.updateMemberVerification.__typename)}:{ok:!0}:t}async memberVerification(){const e=await this.client.request(rt);return e.ok?{ok:!0,data:e.data.memberAccount.verification}:e}async announcements(e){const t=await this.client.request(Pe,e);return t.ok?{ok:!0,data:t.data.announcements}:t}}function h(o,e){const t=U[o]?U[o]:U[500];return{name:t.name,message:e??t.message}}const U={400:{name:"HttpBadRequest",message:"Bad Request"},401:{name:"HttpUnauthorized",message:"Unauthorized"},403:{name:"HttpForbidden",message:"Forbidden"},404:{name:"HttpNotFound",message:"Not Found"},408:{name:"HttpRequestTimeout",message:"Request Timeout"},429:{name:"HttpTooManyRequests",message:"Too Many Requests"},500:{name:"HttpInternalServerError",message:"Internal Server Error"}};class wt{constructor(e){m(this,"url");m(this,"platform");this.url=e.url,this.platform=e.platform}async createSession(e){const t=new Headers({"Content-Type":"application/json","Platform-Code":this.platform,Role:"MEMBER"});if(e.name){const a=`${e.name}:${e.password}`,r=Buffer.from(a).toString("base64");t.set("Authorization",`Basic ${r}`)}if(e.mobileNumber){const a=`${e.mobileNumber}:${e.verificationCode}`,r=Buffer.from(a).toString("base64");t.set("Authorization",`MobileNumberOTP ${r}`)}e.sessionId&&t.set("Authorization",`Maya ${e.sessionId}`);try{const a=await fetch(`${this.url}/sessions`,{method:"POST",headers:t}),r=await a.json();return a.ok?{ok:!0,data:r}:r.code==="ACCOUNT_BLACKLISTED"?{ok:!1,error:d("AccountBlacklisted")}:{ok:!1,error:h(a.status)}}catch{return{ok:!1,error:h(500)}}}async authenticate(e){const t=new Headers({"Content-Type":"application/json","Platform-Code":this.platform,Role:"MEMBER"});if(e.type==="SECURITY_QUESTION"){t.set("Authorization",`Bearer ${e.token}`);try{const a=await fetch(`${this.url}/session/${e.token}/authenticate`,{method:"POST",headers:t,body:JSON.stringify({secretAnswer:e.secretAnswer})}),r=await a.json();return a.ok?{ok:!0,data:r}:a.status===401||a.status===403?{ok:!1,error:d("InvalidTokenOrSecretAnswer")}:{ok:!1,error:h(a.status)}}catch{return{ok:!1,error:h(500)}}}throw new Error("Invalid input 'type'")}async refreshSession(e){try{const t=await fetch(`${this.url}/session:refresh`,{method:"POST",headers:{"Content-Type":"application/json","Platform-Code":this.platform,Role:"MEMBER",Authorization:`Bearer ${e}`}}),a=await t.json();return t.ok?{ok:!0,data:a}:a.code==="ACCOUNT_BLACKLISTED"?{ok:!1,error:d("AccountBlacklisted")}:t.status===403||t.status===401?{ok:!1,error:d("InvalidToken")}:{ok:!1,error:h(t.status)}}catch{return{ok:!1,error:h(500)}}}async destroySession(e){try{const t=await fetch(`${this.url}/session`,{method:"DELETE",headers:{"Content-Type":"application/json","Platform-Code":this.platform,Role:"MEMBER",Authorization:`Bearer ${e}`}});return t.ok?{ok:!0}:{ok:!1,error:h(t.status)}}catch{return{ok:!1,error:h(500)}}}async verifySession(e){try{return(await fetch(`${this.url}/session`,{method:"GET",headers:{"Content-Type":"application/json","Platform-Code":this.platform,Role:"MEMBER",Authorization:`Bearer ${e}`}})).ok}catch{return!0}}}class yt{constructor(e){m(this,"client");this.client=e}async file(e){const t=await this.client.request(Ce,e);return t.ok?{ok:!0,data:t.data.node}:t}async uploadPrivateImageFile(e){const t=await this.client.upload(ve,e);return t.ok?t.data.uploadPrivateImageFile?{ok:!1,error:d(t.data.uploadPrivateImageFile.__typename)}:{ok:!0}:t}}class gt{constructor(e){m(this,"client");this.client=e}async betRecords(e){const t=await this.client.request(je,e);return t.ok?{ok:t.ok,data:t.data.member.betRecords}:t}async transactionRecords(e){const t=await this.client.request(Qe,e);return t.ok?{ok:t.ok,data:t.data.member.transactionRecords}:t}async withdrawalRecords(e){const t=await this.client.request(xe,e);return t.ok?{ok:t.ok,data:t.data.member.withdrawalRecords}:t}async depositRecords(e){const t=await this.client.request(We,e);return t.ok?{ok:t.ok,data:t.data.member.depositRecords}:t}async depositsCount(){const e=await this.client.request(He);return e.ok?{ok:e.ok,data:e.data.member.depositsCount}:e}async member(){const e=await this.client.request(tt);return e.ok?{ok:e.ok,data:e.data.member}:e}}class Et{constructor(e){m(this,"url");this.url=e.url}gameThumbnails(e){return[`${this.url}/images/${e.provider.toLowerCase()}/thumbnail-${e.id}.webp`,`${this.url}/images/${e.provider.toLowerCase()}/thumbnail-${e.provider.toLowerCase()}.webp`]}}class H{constructor(e){m(this,"client");this.client=e}async promos(){const e=await this.client.request(Ke);return e.ok?{ok:e.ok,data:e.data.promos}:e}async cashbacks(){const e=await this.client.request(Je);return e.ok?{ok:e.ok,data:e.data.cashbacks}:e}async availablePromos(e){const t=await this.client.request(ze,e);return t.ok?{ok:t.ok,data:t.data.availablePromos}:t}async cashbackBonuses(){const e=await this.client.request(Ze);return e.ok?{ok:e.ok,data:e.data.cashbackBonuses}:e}async claimCashbackBonus(e){const t=await this.client.request(et,e);return t.ok?t.data.claimCashbackBonus?{ok:!1,error:d(t.data.claimCashbackBonus.__typename)}:{ok:!0}:{ok:t.ok,error:t.error}}async bonus(){const e=await this.client.request(Xe);return e.ok?{ok:e.ok,data:e.data.bonus}:e}async wallet(){const e=await this.client.request(Ne);return e.ok?{ok:e.ok,data:e.data.wallet}:e}async deposit(e){const t=await this.client.request(Fe,e);return t.ok?{ok:t.ok,data:t.data.node}:t}async createGCashDeposit(e){const t=await this.client.request(qe,e);return t.ok?t.data.createGCashDeposit?{ok:!1,error:d(t.data.createGCashDeposit.__typename)}:{ok:!0}:t}async createMayaDeposit(e){const t=await this.client.request(Le,e);return t.ok?t.data.createMayaDeposit?{ok:!1,error:d(t.data.createMayaDeposit.__typename)}:{ok:!0}:t}async createMayaAppDeposit(e){const t=await this.client.request(Ve,e);return t.ok?t.data.createMayaAppDeposit?{ok:!1,error:d(t.data.createMayaAppDeposit.__typename)}:{ok:!0}:t}async createGCashWithdrawal(e){const t=await this.client.request(Oe,e);return t.ok?t.data.createGCashWithdrawal?{ok:!1,error:d(t.data.createGCashWithdrawal.__typename)}:{ok:!0}:t}async createMayaWithdrawal(e){const t=await this.client.request(Ge,e);return t.ok?t.data.createMayaWithdrawal?{ok:!1,error:d(t.data.createMayaWithdrawal.__typename)}:{ok:!0}:t}async createMayaAppWithdrawal(e){const t=await this.client.request(Ue,e);return t.ok?t.data.createMayaAppWithdrawal?{ok:!1,error:d(t.data.createMayaAppWithdrawal.__typename)}:{ok:!0}:t}async createBankWithdrawal(e){const t=await this.client.request(Be,e);return t.ok?t.data.createBankWithdrawal?{ok:!1,error:d(t.data.createBankWithdrawal.__typename)}:{ok:!0}:t}async remainingDailyWithdrawalsCount(){const e=await this.client.request($e);return e.ok?{ok:e.ok,data:e.data.remainingDailyWithdrawalsCount}:e}async pointsWallet(){const e=await this.client.request(Ie);return e.ok?{ok:e.ok,data:e.data.pointsWallet}:e}async pointsToCashConversion(e){const t=await this.client.request(Me,e);return t.ok?t.data.pointsToCashConversion?{ok:!1,error:d(t.data.pointsToCashConversion.__typename)}:{ok:!0}:t}async mayaSession(e){const t=await this.client.request(ft,e);return t.ok?{ok:t.ok,data:t.data.mayaSession}:t}async games(e){const t=await this.client.request(W,e);return t.ok?{ok:t.ok,data:t.data.games}:t}async gamesByName(e){const t=await this.client.request(q,e);return t.ok?{ok:t.ok,data:t.data.gamesByName}:t}async gameSession(e){const t=await this.client.request(L,e);return t.ok?{ok:!0,data:t.data.node}:t}async createGameSession(e){const t=await this.client.request(V,e);return t.ok?t.data.createGameSession?{ok:!1,error:d(t.data.createGameSession.__typename)}:{ok:!0}:t}async endGameSession(e){const t=await this.client.request(De,e);return t.ok?t.data.endGameSession?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:t}}class bt{constructor(e){m(this,"url");m(this,"siteId");m(this,"platformId");this.url=e.url,this.siteId=e.site,this.platformId=e.platform}async self(){const e=await this.getJson(`/sites/${this.siteId}`);return e.ok?{ok:!0,data:e.data.data}:e}async games(e){var r,s,c,l,p,f,S,w,C,v,N,I,M,D,R,P;const t=new URLSearchParams;e!=null&&e.first&&t.set("first",e.first.toString()),e!=null&&e.after&&t.set("after",e.after),e!=null&&e.search&&t.set("search",e.search),(s=(r=e==null?void 0:e.filter)==null?void 0:r.type)!=null&&s.equal&&t.set("filter[type][eq]",e.filter.type.equal),(l=(c=e==null?void 0:e.filter)==null?void 0:c.type)!=null&&l.notEqual&&t.set("filter[type][neq]",e.filter.type.notEqual),(f=(p=e==null?void 0:e.filter)==null?void 0:p.type)!=null&&f.in&&t.set("filter[type][in]",e.filter.type.in.join(",")),(w=(S=e==null?void 0:e.filter)==null?void 0:S.type)!=null&&w.notIn&&t.set("filter[type][nin]",e.filter.type.notIn.join(",")),(v=(C=e==null?void 0:e.filter)==null?void 0:C.provider)!=null&&v.equal&&t.set("filter[provider][eq]",e.filter.provider.equal),(I=(N=e==null?void 0:e.filter)==null?void 0:N.provider)!=null&&I.notEqual&&t.set("filter[provider][neq]",e.filter.provider.notEqual),(D=(M=e==null?void 0:e.filter)==null?void 0:M.provider)!=null&&D.in&&t.set("filter[provider][in]",e.filter.provider.in.join(",")),(P=(R=e==null?void 0:e.filter)==null?void 0:R.provider)!=null&&P.notIn&&t.set("filter[provider][nin]",e.filter.provider.notIn.join(","));const a=await this.getJson("/games",t);return a.ok?{ok:!0,data:{edges:a.data.data.map(x=>({node:x,cursor:x.cursor})),totalCount:a.data.totalCount,pageInfo:{hasNextPage:!!a.data.next,endCursor:a.data.next}}}:a}async game(e){var a;const t=await this.getJson(`/games/${e}`);return((a=t.error)==null?void 0:a.name)==="HttpNotFound"?{ok:!0,data:null}:t.ok?{ok:!0,data:t.data.data}:t}async getJson(e,t){const a=new Request(`${this.url}${e}?${(t==null?void 0:t.toString())??""}`,{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json","Site-ID":this.siteId,"Platform-ID":this.platformId}});try{const r=await fetch(a);return r.ok?{ok:!0,data:await r.json()}:{ok:!1,error:h(r.status)}}catch{return{ok:!1,error:h(500)}}}}class St{constructor(e){m(this,"client");this.client=e}async games(e){const t=await this.client.request(W,e);return t.ok?{ok:t.ok,data:t.data.games}:t}async gamesByName(e){const t=await this.client.request(q,e);return t.ok?{ok:t.ok,data:t.data.gamesByName}:t}async gameSession(e){const t=await this.client.request(L,e);return t.ok?{ok:!0,data:t.data.node}:t}async createGameSession(e){const t=await this.client.request(V,e);return t.ok?t.data.createGameSession?{ok:!1,error:d(t.data.createGameSession.__typename)}:{ok:!0}:t}async endGameSession(e){const t=await this.client.request(Re,e);return t.ok?t.data.endGameSession?{ok:!1,error:d(t.data.endGameSession.__typename)}:{ok:!0}:t}}class At{constructor(e){m(this,"client");this.client=e}async latestBetRecords(){const e=await this.client.request(Ye);return e.ok?{ok:!0,data:e.data.latestBetRecords}:e}}function _t(o,e,t){return o<e?e:o>t?t:o}function B(o){return Object.prototype.toString.call(o)==="[object Object]"&&Object(o)===o}function kt(o){const e=[];function t(a,r=[]){for(const s in a){const c=a[s];B(c)?t(c,[...r,s]):Array.isArray(c)?t(Tt(c),[...r,s]):e.push({key:[...r,s],value:c})}}return t(o),e}function Tt(o){return o.reduce((e,t,a)=>(e[a]=t,e),{})}class A{constructor(e,t){m(this,"url");m(this,"options");m(this,"middlewares");var r;const a=new Headers((r=t==null?void 0:t.fetchOptions)==null?void 0:r.headers);this.url=e,this.options={...t==null?void 0:t.fetchOptions,headers:a},this.middlewares=(t==null?void 0:t.middlewares)??[]}async request(e,t){const a=JSON.stringify({query:e,variables:t}),r=new Headers(this.options.headers);r.set("Content-Type","application/json"),r.set("Accept","application/json");const s=await this.runMiddlewares(new Request(this.url,{...this.options,body:a,headers:r,method:"POST"}));return await this.exec(s)}async upload(e,t){const a=this.createUploadBody(e,t),r=new Headers(this.options.headers);r.delete("Content-Type");const s=await this.runMiddlewares(new Request(this.url,{...this.options,body:a,headers:r,method:"POST"}));return await this.exec(s)}async exec(e){var t,a,r,s,c,l;try{const p=await fetch(e);if(!p.ok)return{ok:!1,error:h(p.status)};const f=await p.json(),S=f.data,w=(t=f.errors)==null?void 0:t.at(0);return w?((a=w.extensions)==null?void 0:a.code)==="FORBIDDEN"||((r=w.extensions)==null?void 0:r.code)==="ACCESS_TOKEN_EXPIRED"?{ok:!1,error:h(403,w.message)}:((s=w.extensions)==null?void 0:s.code)==="UNAUTHORIZED"?{ok:!1,error:h(401,w.message)}:((c=w.extensions)==null?void 0:c.code)==="BAD_USER_INPUT"||((l=w.extensions)==null?void 0:l.code)==="BAD_REQUEST"?{ok:!1,error:h(400,w.message)}:{ok:!1,error:h(500,w.message)}:{ok:!0,data:S}}catch{return{ok:!1,error:h(500)}}}async runMiddlewares(e){let t=e.clone();for(const a of this.middlewares)t=await a(t);return t}createUploadBody(e,t){const a=kt(t).filter(c=>c.value instanceof File||c.value instanceof Blob),r=new FormData;r.append("operations",JSON.stringify({query:e,variables:t}));const s={};return a.forEach((c,l)=>{s[l.toString()]=[`variables.${c.key.join(".")}`]}),r.append("map",JSON.stringify(s)),a.forEach((c,l)=>{r.append(l.toString(),c.value)}),r}}async function b(o){const e=new TextEncoder().encode(o),t=await crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(t)).map(s=>s.toString(16).padStart(2,"0")).join("")}class j{constructor(e){m(this,"enabled");this.enabled=(e==null?void 0:e.enabled)??!0}info(e){this.enabled&&console.log(`\x1B[34m[info] ${e}`)}warn(e){this.enabled&&console.log(`\x1B[33m[warn] ${e}`)}error(e){this.enabled&&console.log(`\x1B[31m[error] ${e}`)}success(e){this.enabled&&console.log(`\x1B[32m[success] ${e}`)}}function $(o){return new Date(o.getTime())}function _(o,e){const t=$(o);return t.setDate(t.getDate()+e),t}function k(o,e){const t=$(o);return t.setMinutes(t.getMinutes()+e),t}function Y(o,e){return o.getTime()>e.getTime()}function Q(o){return new Promise(e=>{setTimeout(e,o)})}function K(o,e){const{until:t,interval:a=1e3,maxAttempt:r=3}=e;async function s(c,l){const p=l??r,f=await o(...c);return t(f)?f:p>1?(await Q(a*((r-p)/2)),s(c,p-1)):f}return async(...c)=>await s(c)}function T(o,e){const t=$(o);return t.setMinutes(t.getMinutes()-e),t}class Ct{constructor(e){m(this,"logger");m(this,"storageKey","session");m(this,"authService");m(this,"walletService");m(this,"_refreshing",!1);this.authService=new wt({url:e.authUrl,platform:e.platform}),this.walletService=new H(new A(e.walletUrl,{middlewares:[t=>(t.headers.set("Platform",e.platform),t.headers.set("Role","MEMBER"),t)]})),this.logger=new j({enabled:e.log??!1})}get refreshing(){return this._refreshing}set refreshing(e){this._refreshing=e}async create(e){if(this.isServer)return this.logger.warn("'localStorage' is not available on the server."),{ok:!1,error:{name:"UnknownError",message:"Server sign in is not supported."}};if(e.type==="MAYA"){const s=await K(()=>this.walletService.mayaSession({id:e.sessionId}),{until:f=>{var S;return f.ok&&((S=f.data)==null?void 0:S.member)!=null},interval:1e3,maxAttempt:5})();if(!s.ok)return s;const l=await K(()=>this.authService.createSession(e),{until:f=>f.ok,interval:1e3,maxAttempt:5})();if(!l.ok)return l;const p=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...l.data,accessTokenExpiresAt:k(p,8).getTime(),refreshTokenExpiresAt:T(_(p,30),2).getTime()})),{ok:!0,data:null}}if(e.type==="MOBILE_NUMBER"){const r=await this.authService.createSession(e);if(r.ok){const s=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...r.data,accessTokenExpiresAt:k(s,8).getTime(),refreshTokenExpiresAt:T(_(s,30),2).getTime()})),{ok:!0,data:null}}return r}const t=await this.authService.createSession(e);if(!t.ok)return t;if(t.data.authenticator)return{ok:!0,data:{authenticator:t.data.authenticator}};const a=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...t.data,accessTokenExpiresAt:k(a,8).getTime(),refreshTokenExpiresAt:T(_(a,30),2).getTime()})),{ok:!0,data:null}}async createFromAuthenticator(e){const t=await this.authService.authenticate(e);if(t.ok){const a=new Date;return this.isServer?this.logger.warn("'localStorage' is not available on the server."):window.localStorage.setItem(this.storageKey,JSON.stringify({...t.data,accessTokenExpiresAt:k(a,8).getTime(),refreshTokenExpiresAt:T(_(a,30),2).getTime()})),{ok:!0}}else return t}async get(){if(this.isServer)return this.logger.warn("'localStorage' is not available on the server."),{ok:!0,data:null};if(this.refreshing)return await Q(1e3),await this.get();const e=window.localStorage.getItem(this.storageKey);if(!e)return{ok:!0,data:null};try{let t=JSON.parse(e),a=new Date;const r=new Date(t.accessTokenExpiresAt),s=new Date(t.refreshTokenExpiresAt);if(Y(a,s))return this.logger.warn("Session expired. Logging out.."),window.localStorage.removeItem(this.storageKey),{ok:!1,error:{name:"SessionExpired",message:"Session expired."}};if(Y(a,r)){this.logger.info("Refreshing session..."),this.refreshing=!0;const c=await this.authService.refreshSession(t.refreshToken);if(this.refreshing=!1,!c.ok)return this.logger.error(`Failed to refresh session: ${c.error.message}`),c.error.name==="InvalidToken"||c.error.name==="AccountBlacklisted"?(window.localStorage.removeItem(this.storageKey),{ok:!1,error:c.error}):(this.logger.warn("Old session returned."),{ok:!0,data:t});this.logger.success("Session refreshed!"),a=new Date,t={...t,...c.data,accessTokenExpiresAt:k(a,8).getTime(),refreshTokenExpiresAt:T(_(a,30),2).getTime()},window.localStorage.setItem(this.storageKey,JSON.stringify(t))}return{ok:!0,data:t}}catch{return{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}}}async destroy(){var t;if(this.isServer){this.logger.warn("'localStorage' is not available on the server.");return}const e=await this.get();(t=e.data)!=null&&t.accessToken&&await this.authService.destroySession(e.data.accessToken),window.localStorage.removeItem(this.storageKey)}async verify(){var a,r,s;if(this.isServer)return this.logger.warn("'localStorage' is not available on the server."),!0;const e=await this.get();if(((a=e.error)==null?void 0:a.name)==="InvalidToken"||((r=e.error)==null?void 0:r.name)==="SessionExpired"||((s=e.error)==null?void 0:s.name)==="AccountBlacklisted")return!1;if(!e.data)return!0;const t=await this.authService.verifySession(e.data.accessToken);return t||window.localStorage.removeItem(this.storageKey),t}get isServer(){return typeof window>"u"}}function E(o){const e={};for(const t in o){const a=o[t];if(a!==null&&a!==void 0){if(B(a)){e[t]=E(a);continue}if(Array.isArray(a)){e[t]=a.map(r=>B(r)?E(r):r);continue}e[t]=a}}return e}function i(o,e){if(typeof o=="number"&&!Number.isNaN(o))return o;if(typeof o=="string"){const t=Number.parseFloat(o);if(!Number.isNaN(t))return t}return e}class vt{constructor(e){m(this,"staticService");const t=(e==null?void 0:e.environment)==="development";this.staticService=new Et({url:t?"https://static.development.opexa.io":"https://static.opexa.io"})}get transform(){return{site:this.site.bind(this),platform:this.platform.bind(this),account:this.account.bind(this),wallet:this.wallet.bind(this),verificationDetails:this.verificationDetails.bind(this),profileCompletion:this.profileCompletion.bind(this),announcement:this.announcement.bind(this),withdrawalRecord:this.withdrawalRecord.bind(this),deposit:this.deposit.bind(this),depositRecord:this.depositRecord.bind(this),betRecord:this.betRecord.bind(this),latestBetRecord:this.latestBetRecord.bind(this),transactionRecord:this.transactionRecord.bind(this),game:this.game.bind(this),game__next:this.game__next.bind(this),gameSession:this.gameSession.bind(this),promo:this.promo.bind(this),cashback:this.cashback.bind(this),bonus:this.bonus.bind(this),cashbackBonus:this.cashbackBonus.bind(this),file:this.file.bind(this),pointsWallet:this.pointsWallet.bind(this)}}site(e){const t={id:e.id,name:e.name,logo:e.logo??void 0};return E(t)}platform(e){var t,a,r,s,c,l,p,f,S,w,C,v,N,I,M,D,R,P,x,z,J,X,Z,ee,te,ae,re,oe,ne,ie,se,ce,me,de,ue,le,pe,fe,he,we,ye,ge,Ee,be,Se,Ae,_e,ke,Te;return{paymentSettings:{minimumFirstDepositAmount:i(e.minimumFirstDepositAmount),restrictWithdrawalsToVerifiedMembers:e.restrictWithdrawalsToVerifiedMembers,depositGateway:{bank:{androidEnabled:((t=e.bankDepositGatewaySettings)==null?void 0:t.androidEnabled)??!1,iosEnabled:((a=e.bankDepositGatewaySettings)==null?void 0:a.iosEnabled)??!1,webEnabled:((r=e.bankDepositGatewaySettings)==null?void 0:r.webEnabled)??!1,mobileWebEnabled:((s=e.bankDepositGatewaySettings)==null?void 0:s.mobileWebEnabled)??!1,minimumAmount:i((c=e.bankDepositGatewaySettings)==null?void 0:c.minimumAmount),maximumAmount:i((l=e.bankDepositGatewaySettings)==null?void 0:l.maximumAmount)},gcash:{androidEnabled:((p=e.gcashDepositGatewaySettings)==null?void 0:p.androidEnabled)??!1,iosEnabled:((f=e.gcashDepositGatewaySettings)==null?void 0:f.iosEnabled)??!1,webEnabled:((S=e.gcashDepositGatewaySettings)==null?void 0:S.webEnabled)??!1,mobileWebEnabled:((w=e.gcashDepositGatewaySettings)==null?void 0:w.mobileWebEnabled)??!1,minimumAmount:i((C=e.gcashDepositGatewaySettings)==null?void 0:C.minimumAmount),maximumAmount:i((v=e.gcashDepositGatewaySettings)==null?void 0:v.maximumAmount)},maya:{androidEnabled:((N=e.mayaDepositGatewaySettings)==null?void 0:N.androidEnabled)??!1,iosEnabled:((I=e.mayaDepositGatewaySettings)==null?void 0:I.iosEnabled)??!1,webEnabled:((M=e.mayaDepositGatewaySettings)==null?void 0:M.webEnabled)??!1,mobileWebEnabled:((D=e.mayaDepositGatewaySettings)==null?void 0:D.mobileWebEnabled)??!1,minimumAmount:i((R=e.mayaDepositGatewaySettings)==null?void 0:R.minimumAmount),maximumAmount:i((P=e.mayaDepositGatewaySettings)==null?void 0:P.maximumAmount)},mayaApp:{androidEnabled:((x=e.mayaAppDepositGatewaySettings)==null?void 0:x.androidEnabled)??!1,iosEnabled:((z=e.mayaAppDepositGatewaySettings)==null?void 0:z.iosEnabled)??!1,webEnabled:((J=e.mayaAppDepositGatewaySettings)==null?void 0:J.webEnabled)??!1,mobileWebEnabled:((X=e.mayaAppDepositGatewaySettings)==null?void 0:X.mobileWebEnabled)??!1,minimumAmount:i((Z=e.mayaAppDepositGatewaySettings)==null?void 0:Z.minimumAmount),maximumAmount:i((ee=e.mayaAppDepositGatewaySettings)==null?void 0:ee.maximumAmount)}},withdrawalGateway:{bank:{androidEnabled:((te=e.bankWithdrawalGatewaySettings)==null?void 0:te.androidEnabled)??!1,iosEnabled:((ae=e.bankWithdrawalGatewaySettings)==null?void 0:ae.iosEnabled)??!1,webEnabled:((re=e.bankWithdrawalGatewaySettings)==null?void 0:re.webEnabled)??!1,mobileWebEnabled:((oe=e.bankWithdrawalGatewaySettings)==null?void 0:oe.mobileWebEnabled)??!1,minimumAmount:i((ne=e.bankWithdrawalGatewaySettings)==null?void 0:ne.minimumAmount),maximumAmount:i((ie=e.bankWithdrawalGatewaySettings)==null?void 0:ie.maximumAmount)},gcash:{androidEnabled:((se=e.gcashWithdrawalGatewaySettings)==null?void 0:se.androidEnabled)??!1,iosEnabled:((ce=e.gcashWithdrawalGatewaySettings)==null?void 0:ce.iosEnabled)??!1,webEnabled:((me=e.gcashWithdrawalGatewaySettings)==null?void 0:me.webEnabled)??!1,mobileWebEnabled:((de=e.gcashWithdrawalGatewaySettings)==null?void 0:de.mobileWebEnabled)??!1,minimumAmount:i((ue=e.gcashWithdrawalGatewaySettings)==null?void 0:ue.minimumAmount),maximumAmount:i((le=e.gcashWithdrawalGatewaySettings)==null?void 0:le.maximumAmount,1e6)},maya:{androidEnabled:((pe=e.mayaWithdrawalGatewaySettings)==null?void 0:pe.androidEnabled)??!1,iosEnabled:((fe=e.mayaWithdrawalGatewaySettings)==null?void 0:fe.iosEnabled)??!1,webEnabled:((he=e.mayaWithdrawalGatewaySettings)==null?void 0:he.webEnabled)??!1,mobileWebEnabled:((we=e.mayaWithdrawalGatewaySettings)==null?void 0:we.mobileWebEnabled)??!1,minimumAmount:i((ye=e.mayaWithdrawalGatewaySettings)==null?void 0:ye.minimumAmount),maximumAmount:i((ge=e.mayaWithdrawalGatewaySettings)==null?void 0:ge.maximumAmount)},mayaApp:{androidEnabled:((Ee=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Ee.androidEnabled)??!1,iosEnabled:((be=e.mayaAppWithdrawalGatewaySettings)==null?void 0:be.iosEnabled)??!1,webEnabled:((Se=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Se.webEnabled)??!1,mobileWebEnabled:((Ae=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Ae.mobileWebEnabled)??!1,minimumAmount:i((_e=e.mayaAppWithdrawalGatewaySettings)==null?void 0:_e.minimumAmount),maximumAmount:i((ke=e.mayaAppWithdrawalGatewaySettings)==null?void 0:ke.maximumAmount,1e6)}}},pointsClubSettings:{multiplier:i((Te=e.pointsClubSettings)==null?void 0:Te.multiplier,0)}}}account(e){const t={id:e.id,name:e.name,status:e.status,verified:e.verified,nickName:e.nickName??void 0,realName:e.realName??void 0,dateOfBirth:e.birthDay?new Date(e.birthDay):void 0,emailAddress:e.emailAddress??void 0,mobileNumber:e.mobileNumber??void 0,mobileNumberVerified:e.mobileNumberVerified??!1,mobileNumberVerificationRequired:e.mobileNumberVerificationRequired??!1,validId:e.validId||void 0,verificationStatus:e.verificationStatus,transactionPassword:e.transactionPassword,secretAnswerSubmitted:e.secretAnswerSubmitted??!1,dateTimeLastActive:e.dateTimeLastActive?new Date(e.dateTimeLastActive):void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)};return E(t)}wallet(e){return{id:e.id,balance:i(e.balance,0),currency:e.currency,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}verificationDetails(e){return{id:e.id,status:e.status,address:e.address,nationality:e.nationality,natureOfWork:e.natureOfWork,placeOfBirth:e.placeOfBirth,sourceOfIncome:e.sourceOfIncome,selfieImage:this.file(e.selfieImage),idFrontImage:this.file(e.idFrontImage)}}profileCompletion(e){return{accountPassword:e.accountPassword??!1,accountVerification:e.accountVerification??!1,mobileNumberVerification:e.mobileNumberVerification??!1,personalInformation:e.personalInformation??!1,transactionPassword:e.transactionPassword??!1,completionPercentage:i(e,0)}}announcement(e){return{id:e.id,type:e.type,title:e.title,status:e.status,message:e.message,activationEndDateTime:new Date(e.activationEndDateTime),activationStartDateTime:new Date(e.activationStartDateTime),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}withdrawalRecord(e){const t={id:e.id,type:e.type,bank:e.bank,status:e.status,amount:i(e.amount,0),netAmount:i(e.netAmount,0),fee:i(e.fee,0),reference:e.reference??void 0,withdrawalNumber:e.withdrawalNumber,recipientMobileNumber:e.recipientMobileNumber??void 0,dateTimeConfirmed:e.dateTimeConfirmed?new Date(e.dateTimeConfirmed):void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)};return E(t)}deposit(e){const t={id:e.id,type:e.type,status:e.status,checkoutUrl:e.checkoutUrl??void 0};return E(t)}depositRecord(e){const t={id:e.id,type:e.type,status:e.status,amount:i(e.amount,0),fee:i(e.fee,0),netAmount:i(e.netAmount,0),reference:e.reference??void 0,depositNumber:e.depositNumber,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)};return E(t)}betRecord(e){var a;const t={id:e.id,bet:i(e.bet,0),payout:i(e.payout,0),status:e.status,jackpotContribution:i(e.jackpotContribution,0),jackpotPayout:i(e.jackpotPayout,0),winloss:i(e.winloss),validBet:i(e.validBet,0),vendorRoundId:e.vendorRoundId??void 0,game:e.game,serialCode:e.serialCode,dateTimeSettled:e.dateTimeSettled?new Date(e.dateTimeSettled):void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated),betContent:e.betContent??void 0,contestName:e.contestName??void 0,externalCategory:e.externalCategory??void 0,metadata:{odds:((a=e.metadata)==null?void 0:a.odds)??void 0}};return E(t)}latestBetRecord(e){return{id:e.id,member:e.member,game:e.game,bet:i(e.bet,0),payout:i(e.payout,0),validBet:i(e.validBet,0),dateTimeSettled:new Date(e.dateTimeSettled),dateTimeCreated:new Date(e.dateTimeCreated)}}transactionRecord(e){const t={id:e.id,type:e.type,amount:i(e.amount,0),content:e.content??void 0,currentBalance:i(e.currentBalance,0),referenceNumber:e.referenceNumber,dateTimeCreated:new Date(e.dateTimeCreated)};return E(t)}game(e){return{id:e.id,type:e.type,name:e.name,images:this.staticService.gameThumbnails(e),provider:e.provider}}game__next(e){return{id:e.id,type:e.type,name:e.name,images:this.staticService.gameThumbnails({id:e.externalId,provider:e.provider}),provider:e.provider,externalId:e.externalId}}gameSession(e){const t={id:e.id,status:e.status,launchUrl:e.launchUrl??void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)};return E(t)}promo(e){return{id:e.id,type:e.type,name:e.name,status:e.status,description:e.description,banner:this.file(e.banner),maximumBonusAmount:i(e.maximumBonusAmount),minimumBonusAmount:i(e.minimumBonusAmount),activationEndDateTime:new Date(e.activationEndDateTime),activationStartDateTime:new Date(e.activationStartDateTime),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}cashback(e){return{id:e.id,name:e.name,description:e.description,status:e.status,banner:this.file(e.banner),activationEndDateTime:new Date(e.activationEndDateTime),activationStartDateTime:new Date(e.activationStartDateTime),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}bonus(e){const t={id:e.id,promo:this.promo(e.promo),deposit:e.deposit?{type:e.deposit.type,status:e.deposit.status,fee:i(e.deposit.fee,0),amount:i(e.deposit.amount,0),netAmount:i(e.deposit.netAmount,0),reference:e.deposit.reference??void 0,dateTimeCreated:new Date(e.deposit.dateTimeCreated),dateTimeLastUpdated:new Date(e.deposit.dateTimeLastUpdated)}:void 0,balance:i(e.balance,0),amount:i(e.amount,0),expiration:new Date(e.expiration),turnoverRequirement:i(e.turnoverRequirement,0),currentTurnoverRequirementContribution:i(e.currentTurnoverRequirementContribution,0),currentTurnoverRequirementContributionPercentage:i(e.currentTurnoverRequirementContributionPercentage,0),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)};return E(t)}cashbackBonus(e){return{id:e.id,balance:i(e.balance,0),cashback:this.cashback(e.cashback),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}file(e){const t={id:e.id,url:e.url??void 0,status:e.status,dateTimeCreated:new Date(e.dateTimeCreated)};return E(t)}pointsWallet(e){return{id:e.id,points:i(e.points,0),account:e.account,dateTimeCreated:new Date(e.dateTimeCreated)}}}var Nt={VITE_AUTH_DEVELOPMENT_URL:"https://auth.development.opexa.io",VITE_AUTH_PRODUCTION_URL:"https://auth.opexa.io",VITE_GAME_DEVELOPMENT_URL:"https://game.development.opexa.io/graphql",VITE_GAME_PRODUCTION_URL:"https://game.opexa.io/graphql",VITE_FILE_DEVELOPMENT_URL:"https://file.development.opexa.io/graphql",VITE_FILE_PRODUCTION_URL:"https://file.opexa.io/graphql",VITE_REPORT_DEVELOPMENT_URL:"https://report.development.opexa.io/graphql",VITE_REPORT_PRODUCTION_URL:"https://report.opexa.io/graphql",VITE_WALLET_DEVELOPMENT_URL:"https://wallet.development.opexa.io/graphql",VITE_WALLET_PRODUCTION_URL:"https://wallet.opexa.io/graphql",VITE_ACCOUNT_DEVELOPMENT_URL:"https://account.development.opexa.io/graphql",VITE_ACCOUNT_PRODUCTION_URL:"https://account.opexa.io/graphql",VITE_PORTAL_DEVELOPMENT_URL:"https://portal.development.opexa.io/graphql",VITE_PORTAL_PRODUCTION_URL:"https://portal.opexa.io/graphql",VITE_STATIC_DEVELOPMENT_URL:"https://static.development.opexa.io",VITE_STATIC_PRODUCTION_URL:"https://static.opexa.io",VITE_CMS_PORTAL_DEVELOPMENT_URL:"https://portal-api.opexacms.io/v1",BASE_URL:"/",MODE:"library",DEV:!1,PROD:!0,SSR:!1};class It{constructor(e){m(this,"gameService");m(this,"fileService");m(this,"walletService");m(this,"reportService");m(this,"portalService");m(this,"accountService");m(this,"cmsPortalService");m(this,"sessionManager");m(this,"transformer");m(this,"logger");const t=e.environment==="development";this.sessionManager=new Ct({authUrl:t?"https://auth.development.opexa.io":"https://auth.opexa.io",walletUrl:t?"https://wallet.development.opexa.io/graphql":"https://wallet.opexa.io/graphql",platform:e.platform,log:e.log}),this.cmsPortalService=new bt({url:t?"https://portal-api.opexacms.io/v1":Nt.VITE_CMS_PORTAL_PRODUCTION_URL,site:e.site,platform:e.sitePlatform});const a={middlewares:[this.authMiddleware],fetchOptions:{headers:{Role:"MEMBER","Platform-Code":e.platform}}};this.gameService=new St(new A(t?"https://game.development.opexa.io/graphql":"https://game.opexa.io/graphql",a)),this.fileService=new yt(new A(t?"https://file.development.opexa.io/graphql":"https://file.opexa.io/graphql",a)),this.walletService=new H(new A(t?"https://wallet.development.opexa.io/graphql":"https://wallet.opexa.io/graphql",a)),this.reportService=new gt(new A(t?"https://report.development.opexa.io/graphql":"https://report.opexa.io/graphql",a)),this.accountService=new ht(new A(t?"https://account.development.opexa.io/graphql":"https://account.opexa.io/graphql",a)),this.portalService=new At(new A(t?"https://portal.development.opexa.io/graphql":"https://portal.opexa.io/graphql",a)),this.transformer=new vt(e),this.logger=new j({enabled:e.log??!1})}get authMiddleware(){return async e=>{this.logger.info("Checking for session");const t=await this.sessionManager.get();return t.data?(e.headers.append("Authorization",`Bearer ${t.data.accessToken}`),this.logger.info("Session found"),this.logger.success("Added 'Authorization' header")):this.logger.info("No session found"),e}}async signIn(e){switch(e.type){case"NAME_AND_PASSWORD":{const t=await this.sessionManager.create({...e,password:await b(e.password)});return t.ok?t.data?{ok:!0,data:{"2FAEnabled":!0,authenticator:t.data.authenticator}}:{ok:!0,data:{"2FAEnabled":!1}}:t}default:{const t=await this.sessionManager.create(e);return t.ok?{ok:!0}:t}}}async authenticate(e){switch(e.type){case"SECURITY_QUESTION":return await this.sessionManager.createFromAuthenticator({type:"SECURITY_QUESTION",token:e.token,secretAnswer:await b(e.secretAnswer)});default:return{ok:!1,error:{name:"HttpBadRequest",message:"Invalid input 'type'"}}}}async signOut(){await this.sessionManager.destroy()}watchSession(e){const t=_t(e.interval??3e4,3e4,6e4);let a=null;const r=()=>setTimeout(async()=>{await this.sessionManager.verify()||await e.onInvalid(),a=r()},t);return a=r(),function(){a&&clearTimeout(a)}}async session(){const e=await this.sessionManager.get();return e.ok?{ok:!0,data:e.data?{id:e.data.session.id,dateTimeCreated:new Date(e.data.session.dateTimeCreated)}:null}:e}async site(){const e=await this.cmsPortalService.self();return e.ok?{ok:!0,data:this.transformer.transform.site(e.data)}:e}async platform(){const e=await this.accountService.platform();return e.ok?{ok:!0,data:this.transformer.transform.platform(e.data)}:e}async account(){const[e,t]=await Promise.all([this.accountService.memberAccount(),this.reportService.member()]);return e.ok?t.ok?{ok:!0,data:this.transformer.transform.account({...e.data,...t.data})}:{ok:!1,error:t.error}:{ok:!1,error:e.error}}async createAccount(e){const t=e.id??u.ObjectId.generate(g.Account).toString(),a=await this.accountService.registerMemberAccount({input:{id:t,name:e.name,birthDay:typeof e.dateOfBirth=="string"?e.dateOfBirth:e.dateOfBirth.toISOString(),password:await b(e.password),mobileNumber:this.addAreaCode(e.mobileNumber),domain:e.domain,btag:e.referralCode},verificationCode:e.verificationCode,reCAPTCHAResponse:e.reCAPTCHAResponse});return a.ok?{ok:!0,data:{id:t}}:a}async updateAccount(e,t){return await this.accountService.updateMemberAccount({input:{id:e,data:{...t,password:t.password?await b(t.password):void 0,transactionPassword:t.transactionPassword?await b(t.transactionPassword):void 0,...t.mobileNumber&&{mobileNumber:this.addAreaCode(t.mobileNumber)},secretAnswer:t.secretAnswer?await b(t.secretAnswer):void 0}}})}async deleteAccount(e){return await this.accountService.deleteMemberAccount({input:{id:e}})}async verificationDetails(){const e=await this.accountService.memberVerification();return e.ok?{ok:!0,data:e.data?this.transformer.transform.verificationDetails(e.data):null}:e}async submitVerificationDetails(e){const t=e.id??u.ObjectId.generate(g.Verification).toString(),a=await this.accountService.createMemberVerification({input:{id:t,...e}});return a.ok?{ok:!0,data:{id:t}}:a}async updateVerificationDetails(e,t){return await this.accountService.updateMemberVerification({input:{id:e,data:{...t}}})}async resetPassword(e){return await this.accountService.resetPassword({input:{mobileNumber:this.addAreaCode(e.mobileNumber),newPassword:await b(e.newPassword)},verificationCode:e.verificationCode})}async verifyMobileNumber(e){return await this.accountService.verifyMobileNumber({input:{verificationCode:e}})}async profileCompletion(){const e=await this.accountService.profileCompletion();return e.ok?{ok:!0,data:this.transformer.transform.profileCompletion(e.data)}:e}async sendVerificationCode(e){return await this.accountService.sendVerificationCode({input:{channel:"SMS",recipient:this.addAreaCode(e)}})}async wallet(){const e=await this.walletService.wallet();return e.ok?{ok:!0,data:e.data?this.transformer.transform.wallet(e.data):null}:e}async announcements(e){const t=await this.accountService.announcements({...e,filter:{visibility:{in:["MEMBER","GLOBAL"]},activationStartDateTime:{greaterThanOrEqual:new Date}}});return t.ok?{ok:!0,data:{announcements:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.announcement(r),cursor:a})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async createWithdrawal(e){const t=e.id??u.ObjectId.generate(g.Withdrawal).toString();if(e.type==="BANK"){const a=await this.walletService.createBankWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await b(e.transactionPassword)}});if(!a.ok)return a}if(e.type==="GCASH"){const a=await this.walletService.createGCashWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await b(e.transactionPassword),recipientMobileNumber:this.addAreaCode(e.recipientMobileNumber)}});if(!a.ok)return a}if(e.type==="MAYA"){const a=await this.walletService.createMayaWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await b(e.transactionPassword),recipientMobileNumber:this.addAreaCode(e.recipientMobileNumber)}});if(!a.ok)return a}if(e.type==="MAYA_APP"){const a=await this.walletService.createMayaAppWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await b(e.transactionPassword)}});if(!a.ok)return a}return{ok:!0,data:{id:t}}}async withdrawalRecords(e){const t=await this.reportService.withdrawalRecords(e);return t.ok?{ok:!0,data:{withdrawalRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.withdrawalRecord(r),cursor:a})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async remainingDailyWithdrawalsCount(){return await this.walletService.remainingDailyWithdrawalsCount()}async createDeposit(e){const t=e.id??u.ObjectId.generate(g.Deposit).toString();if(e.type==="MAYA"){const a=await this.walletService.createMayaDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}if(e.type==="MAYA_APP"){const a=await this.walletService.createMayaAppDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}if(e.type==="GCASH"){const a=await this.walletService.createGCashDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}return{ok:!0,data:{id:t}}}async deposit(e){const t=await this.walletService.deposit({id:e});return t.ok?{ok:!0,data:t.data?this.transformer.transform.deposit(t.data):null}:t}async depositRecords(e){const t=await this.reportService.depositRecords(e);return t.ok?{ok:!0,data:{depositRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.depositRecord(r),cursor:a})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async depositsCount(){return await this.reportService.depositsCount()}async betRecords(e){const t=await this.reportService.betRecords(e);return t.ok?{ok:!0,data:{betRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.betRecord(r),cursor:a})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async latestBetRecords(){const e=await this.portalService.latestBetRecords();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.latestBetRecord)}:e}async transactionRecords(e){const t=await this.reportService.transactionRecords(e);return t.ok?{ok:!0,data:{transactionRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.transactionRecord(r),cursor:a})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async promos(){const e=await this.walletService.promos();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.promo)}:e}async availablePromos(){const e=await this.walletService.availablePromos();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.promo)}:e}async cashbacks(){const e=await this.walletService.cashbacks();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.cashback)}:e}async bonus(){const e=await this.walletService.bonus();return e.ok?{ok:!0,data:e.data?this.transformer.transform.bonus(e.data):null}:e}async cashbackBonuses(){const e=await this.walletService.cashbackBonuses();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.cashbackBonus)}:e}async claimCashbackBonus(e){return await this.walletService.claimCashbackBonus({input:{id:e}})}async game(e){return this.game__next(e)}async game__next(e){const t=await this.cmsPortalService.game(e);return t.ok?{ok:!0,data:t.data?this.transformer.transform.game__next(t.data):null}:t}async games(e){const t=await this.walletService.games(e);return t.ok?{ok:!0,data:{games:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.game(r),cursor:a})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async games__next(e){const t=await this.cmsPortalService.games(e);return t.ok?{ok:!0,data:{games:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.game__next(r),cursor:a})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async games__legacy(e){const t=await this.gameService.games(e);return t.ok?{ok:!0,data:{games:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.game(r),cursor:a})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async gamesByName(e){const t=await this.walletService.gamesByName(e);return t.ok?{ok:!0,data:t.data.map(this.transformer.transform.game)}:t}async gamesByName__legacy(e){const t=await this.gameService.gamesByName(e);return t.ok?{ok:!0,data:t.data.map(this.transformer.transform.game)}:t}async gameSession(e){const t=await this.walletService.gameSession({id:e});return t.ok?{ok:!0,data:t.data?this.transformer.transform.gameSession(t.data):null}:t}async gameSession__legacy(e){const t=await this.gameService.gameSession({id:e});return t.ok?{ok:!0,data:t.data?this.transformer.transform.gameSession(t.data):null}:t}async gameSession__next(e){const t=await this.walletService.gameSession({id:e});if(!t.ok)return t;if(t.data)return{ok:!0,data:this.transformer.transform.gameSession(t.data)};const a=await this.walletService.gameSession({id:e});return a.ok?{ok:!0,data:a.data?this.transformer.transform.gameSession(a.data):null}:a}async createGameSession(e){const t=e.id??u.ObjectId.generate(g.GameSession).toString(),a=await this.walletService.createGameSession({input:{id:t,game:e.game}});return a.ok?{ok:!0,data:{id:t}}:a}async createGameSession__legacy(e){const t=e.id??u.ObjectId.generate(g.GameSession).toString(),a=await this.gameService.createGameSession({input:{id:t,game:e.game}});return a.ok?{ok:!0,data:{id:t}}:a}async createGameSession__next(e){const t=await this.game__next(e.game);if(!t.data)return{ok:!1,error:{name:"GameDoesNotExistError",message:"Game does not exist"}};const{type:a,provider:r,externalId:s}=t.data,c=a==="SPORTS"?e.id??(await u.ObjectId.generateFromKey(g.Game,`SPORTS:${r}`)).toString():e.id??u.ObjectId.generate(g.GameSession).toString(),p=["RTG","DARWIN","DRBINGO","MEGABALL","EVOLUTION","EVOLUTION_NETENT","EVOLUTION_REDTIGER"].includes(r)?await this.walletService.createGameSession({input:{id:c,game:s}}):await this.gameService.createGameSession({input:{id:c,game:s}});return p.ok?{ok:!0,data:{id:c}}:p}async endGameSession(e){return await this.walletService.endGameSession({input:{id:e}})}async endGameSession__legacy(e){return await this.gameService.endGameSession({input:{id:e}})}async endGameSession__next(e){const t=await this.walletService.endGameSession({input:{id:e}});return t.ok?t:await this.gameService.endGameSession({input:{id:e}})}async file(e){const t=await this.fileService.file({id:e});return t.ok?{ok:!0,data:t.data?this.transformer.transform.file(t.data):null}:t}async uploadImageFile(e){const t=e.id??u.ObjectId.generate(g.File).toString(),a=await this.fileService.uploadPrivateImageFile({input:{id:t,file:e.file}});return a.ok?{ok:!0,data:{id:t}}:a}async pointsWallet(){const e=await this.walletService.pointsWallet();return e.ok?{ok:!0,data:e.data?this.transformer.transform.pointsWallet(e.data):null}:e}async pointsToCashConversion(e){return await this.walletService.pointsToCashConversion({input:{amount:e.toString()}})}addAreaCode(e){return e.startsWith("+63")?e:e.startsWith("63")?`+${e}`:e.startsWith("0")?`+63${e.substring(1)}`:`+63${e}`}}Object.defineProperty(y,"ObjectId",{enumerable:!0,get:()=>u.ObjectId}),y.ObjectType=g,y.Sdk=It,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
|
|
942
923
|
//# sourceMappingURL=index.js.map
|