@opexa/portal-sdk 0.0.75 → 0.0.76
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 +90 -59
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +168 -115
- package/dist/index.mjs.map +1 -1
- package/dist/sdk/sdk.d.ts +5 -1
- package/dist/sdk/transformer.d.ts +4 -4
- package/dist/sdk/types.d.ts +5 -2
- package/dist/services/queries.d.ts +1 -0
- package/dist/services/report.service.d.ts +2 -1
- package/dist/services/types.d.ts +12 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
(function(y,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("@opexa/object-id")):typeof define=="function"&&define.amd?define(["exports","@opexa/object-id"],p):(y=typeof globalThis<"u"?globalThis:y||self,p(y.sdk={},y.objectId))})(this,function(y,p){"use strict";var
|
|
1
|
+
(function(y,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("@opexa/object-id")):typeof define=="function"&&define.amd?define(["exports","@opexa/object-id"],p):(y=typeof globalThis<"u"?globalThis:y||self,p(y.sdk={},y.objectId))})(this,function(y,p){"use strict";var Ut=Object.defineProperty;var Wt=(y,p,b)=>p in y?Ut(y,p,{enumerable:!0,configurable:!0,writable:!0,value:b}):y[p]=b;var d=(y,p,b)=>Wt(y,typeof p!="symbol"?p+"":p,b);const b={Account:8,Deposit:9,Withdrawal:14,Verification:15,File:16,Game:203,GameSession:204,MayaSession:230};function n(o,...e){let t="";for(const[r,a]of o.entries()){const s=e.at(r)??"";t=`${t}${a}${s}`}return t.trim()}const V=n`
|
|
2
2
|
fragment FileFragment on File {
|
|
3
3
|
id
|
|
4
4
|
url
|
|
5
5
|
status
|
|
6
6
|
dateTimeCreated
|
|
7
7
|
}
|
|
8
|
-
`,Te=
|
|
8
|
+
`,Te=n`
|
|
9
9
|
${V}
|
|
10
10
|
|
|
11
11
|
query File($id: ObjectId!) {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
`,_e=
|
|
18
|
+
`,_e=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
|
-
`,ve=
|
|
32
|
+
`,ve=n`
|
|
33
33
|
query Wallet {
|
|
34
34
|
wallet {
|
|
35
35
|
id
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
dateTimeLastUpdated
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
`,Me=
|
|
42
|
+
`,Me=n`
|
|
43
43
|
query PointsWallet {
|
|
44
44
|
pointsWallet {
|
|
45
45
|
id
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
dateTimeCreated
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
`,
|
|
51
|
+
`,Re=n`
|
|
52
52
|
mutation PointsToCashConversion($input: PointsToCashConversionInput!) {
|
|
53
53
|
pointsToCashConversion(input: $input) {
|
|
54
54
|
... on InsufficientPointsError {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
`,
|
|
59
|
+
`,Ne=n`
|
|
60
60
|
query PointsWalletTransactions(
|
|
61
61
|
$first: Int
|
|
62
62
|
$after: Cursor
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
`,K={current:
|
|
87
|
+
`,K={current:n`
|
|
88
88
|
query GameSession($id: ObjectId!) {
|
|
89
89
|
node(id: $id) {
|
|
90
90
|
... on GameSession {
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
`,legacy:
|
|
100
|
+
`,legacy:n`
|
|
101
101
|
query GameSession($id: ObjectId!) {
|
|
102
102
|
node(id: $id) {
|
|
103
103
|
... on GameSession {
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
`},J=
|
|
115
|
+
`},J=n`
|
|
116
116
|
mutation CreateGameSession($input: CreateGameSessionInput!) {
|
|
117
117
|
createGameSession(input: $input) {
|
|
118
118
|
... on GameDoesNotExistError {
|
|
@@ -120,11 +120,11 @@
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
`,z={current:
|
|
123
|
+
`,z={current:n`
|
|
124
124
|
mutation EndGameSession($input: EndGameSessionInput!) {
|
|
125
125
|
endGameSession(input: $input)
|
|
126
126
|
}
|
|
127
|
-
`,legacy:
|
|
127
|
+
`,legacy:n`
|
|
128
128
|
mutation EndGameSession($input: EndGameSessionInput!) {
|
|
129
129
|
endGameSession(input: $input) {
|
|
130
130
|
... on GameSessionDoesNotExistError {
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
`},Ie=
|
|
141
|
+
`},Ie=n`
|
|
142
142
|
query Announcements($first: Int, $after: Cursor, $filter: AnnouncementFilterInput) {
|
|
143
143
|
announcements(first: $first, after: $after, filter: $filter) {
|
|
144
144
|
edges {
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
`,De=
|
|
167
|
+
`,De=n`
|
|
168
168
|
query WithdrawalRecords($first: Int, $after: Cursor, $filter: WithdrawalRecordFilterInput) {
|
|
169
169
|
member {
|
|
170
170
|
withdrawalRecords(first: $first, after: $after, filter: $filter) {
|
|
@@ -231,7 +231,7 @@
|
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
|
-
`,Pe=
|
|
234
|
+
`,Pe=n`
|
|
235
235
|
mutation CreateGCashWithdrawal($input: CreateGCashWithdrawalInput!) {
|
|
236
236
|
createGCashWithdrawal(input: $input) {
|
|
237
237
|
... on AccountNotVerifiedError {
|
|
@@ -254,7 +254,7 @@
|
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
`,$e=
|
|
257
|
+
`,$e=n`
|
|
258
258
|
mutation CreateMayaWithdrawal($input: CreateMayaWithdrawalInput!) {
|
|
259
259
|
createMayaWithdrawal(input: $input) {
|
|
260
260
|
... on AccountNotVerifiedError {
|
|
@@ -277,7 +277,7 @@
|
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
-
`,xe=
|
|
280
|
+
`,xe=n`
|
|
281
281
|
mutation CreateMayaAppWithdrawal($input: CreateMayaAppWithdrawalInput!) {
|
|
282
282
|
createMayaAppWithdrawal(input: $input) {
|
|
283
283
|
... on AccountNotVerifiedError {
|
|
@@ -297,7 +297,7 @@
|
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
|
-
`,
|
|
300
|
+
`,Oe=n`
|
|
301
301
|
mutation CreateBankWithdrawal($input: CreateBankWithdrawalInput!) {
|
|
302
302
|
createBankWithdrawal(input: $input) {
|
|
303
303
|
... on MobileNumberNotVerifiedError {
|
|
@@ -320,11 +320,11 @@
|
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
|
-
`,
|
|
323
|
+
`,Ge=n`
|
|
324
324
|
query RemainingDailyWithdrawalsCount {
|
|
325
325
|
remainingDailyWithdrawalsCount
|
|
326
326
|
}
|
|
327
|
-
`,Ue=
|
|
327
|
+
`,Ue=n`
|
|
328
328
|
query DepositRecords($after: Cursor, $first: Int, $filter: DepositRecordFilterInput) {
|
|
329
329
|
member {
|
|
330
330
|
depositRecords(after: $after, first: $first, filter: $filter) {
|
|
@@ -353,7 +353,7 @@
|
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
|
-
`,We=
|
|
356
|
+
`,We=n`
|
|
357
357
|
mutation CreateGCashDeposit($input: CreateGCashDepositInput!) {
|
|
358
358
|
createGCashDeposit(input: $input) {
|
|
359
359
|
... on DepositPromoMaximumAmountExceededError {
|
|
@@ -382,7 +382,7 @@
|
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
|
-
`,qe=
|
|
385
|
+
`,qe=n`
|
|
386
386
|
mutation CreateMayaDeposit($input: CreateMayaDepositInput!) {
|
|
387
387
|
createMayaDeposit(input: $input) {
|
|
388
388
|
... on DepositPromoMaximumAmountExceededError {
|
|
@@ -411,7 +411,7 @@
|
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
`,Be=
|
|
414
|
+
`,Be=n`
|
|
415
415
|
mutation CreateMayaAppDeposit($input: CreateMayaAppDepositInput!) {
|
|
416
416
|
createMayaAppDeposit(input: $input) {
|
|
417
417
|
... on DepositPromoMaximumAmountExceededError {
|
|
@@ -440,7 +440,7 @@
|
|
|
440
440
|
}
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
|
-
`,Fe=
|
|
443
|
+
`,Fe=n`
|
|
444
444
|
query Deposit($id: ObjectId!) {
|
|
445
445
|
node(id: $id) {
|
|
446
446
|
... on GCashDeposit {
|
|
@@ -472,13 +472,13 @@
|
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
|
-
`,Le=
|
|
475
|
+
`,Le=n`
|
|
476
476
|
query DepositsCount {
|
|
477
477
|
member {
|
|
478
478
|
depositsCount
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
|
-
`,Ve=
|
|
481
|
+
`,Ve=n`
|
|
482
482
|
query BetRecords($first: Int, $after: Cursor, $filter: BetRecordFilterInput) {
|
|
483
483
|
member {
|
|
484
484
|
betRecords(first: $first, after: $after, filter: $filter) {
|
|
@@ -519,7 +519,7 @@
|
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
|
-
`,He=
|
|
522
|
+
`,He=n`
|
|
523
523
|
query LatestBetRecords {
|
|
524
524
|
latestBetRecords {
|
|
525
525
|
id
|
|
@@ -539,7 +539,7 @@
|
|
|
539
539
|
dateTimeCreated
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
|
-
`,
|
|
542
|
+
`,Ye=n`
|
|
543
543
|
query TransactionRecords($first: Int, $after: Cursor, $filter: TransactionRecordFilter) {
|
|
544
544
|
member {
|
|
545
545
|
transactionRecords(first: $first, after: $after, filter: $filter) {
|
|
@@ -565,7 +565,7 @@
|
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
|
-
`,H=
|
|
568
|
+
`,H=n`
|
|
569
569
|
${V}
|
|
570
570
|
|
|
571
571
|
fragment PromoFragment on Promo {
|
|
@@ -584,7 +584,7 @@
|
|
|
584
584
|
dateTimeCreated
|
|
585
585
|
dateTimeLastUpdated
|
|
586
586
|
}
|
|
587
|
-
`,
|
|
587
|
+
`,je=n`
|
|
588
588
|
${H}
|
|
589
589
|
|
|
590
590
|
query Promos {
|
|
@@ -592,7 +592,7 @@
|
|
|
592
592
|
...PromoFragment
|
|
593
593
|
}
|
|
594
594
|
}
|
|
595
|
-
`,Qe=
|
|
595
|
+
`,Qe=n`
|
|
596
596
|
${H}
|
|
597
597
|
|
|
598
598
|
query AvailablePromos($filter: PromoFilterInput) {
|
|
@@ -600,7 +600,7 @@
|
|
|
600
600
|
...PromoFragment
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
|
-
`,X=
|
|
603
|
+
`,X=n`
|
|
604
604
|
${V}
|
|
605
605
|
|
|
606
606
|
fragment CashbackFragment on Cashback {
|
|
@@ -617,7 +617,7 @@
|
|
|
617
617
|
dateTimeCreated
|
|
618
618
|
dateTimeLastUpdated
|
|
619
619
|
}
|
|
620
|
-
`,Ke=
|
|
620
|
+
`,Ke=n`
|
|
621
621
|
${X}
|
|
622
622
|
|
|
623
623
|
query Cashbacks {
|
|
@@ -625,7 +625,7 @@
|
|
|
625
625
|
...CashbackFragment
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
|
-
`,Je=
|
|
628
|
+
`,Je=n`
|
|
629
629
|
${H}
|
|
630
630
|
|
|
631
631
|
query Bonus {
|
|
@@ -654,7 +654,7 @@
|
|
|
654
654
|
dateTimeLastUpdated
|
|
655
655
|
}
|
|
656
656
|
}
|
|
657
|
-
`,ze=
|
|
657
|
+
`,ze=n`
|
|
658
658
|
${X}
|
|
659
659
|
|
|
660
660
|
query CashbackBonuses {
|
|
@@ -668,7 +668,7 @@
|
|
|
668
668
|
dateTimeLastUpdated
|
|
669
669
|
}
|
|
670
670
|
}
|
|
671
|
-
`,Xe=
|
|
671
|
+
`,Xe=n`
|
|
672
672
|
mutation ClaimCashbackBonus($input: ClaimCashbackBonusInput!) {
|
|
673
673
|
claimCashbackBonus(input: $input) {
|
|
674
674
|
... on CashbackBonusDoesNotExistError {
|
|
@@ -676,13 +676,13 @@
|
|
|
676
676
|
}
|
|
677
677
|
}
|
|
678
678
|
}
|
|
679
|
-
`;
|
|
679
|
+
`;n`
|
|
680
680
|
query Member {
|
|
681
681
|
member {
|
|
682
682
|
dateTimeLastActive
|
|
683
683
|
}
|
|
684
684
|
}
|
|
685
|
-
`;const Ze=
|
|
685
|
+
`;const Ze=n`
|
|
686
686
|
query MemberAccount {
|
|
687
687
|
memberAccount: self {
|
|
688
688
|
... on MemberAccount {
|
|
@@ -706,7 +706,7 @@
|
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
|
-
`,et=
|
|
709
|
+
`,et=n`
|
|
710
710
|
${V}
|
|
711
711
|
|
|
712
712
|
query MemberVerification {
|
|
@@ -731,7 +731,7 @@
|
|
|
731
731
|
}
|
|
732
732
|
}
|
|
733
733
|
}
|
|
734
|
-
`,tt=
|
|
734
|
+
`,tt=n`
|
|
735
735
|
mutation RegisterMemberAccount(
|
|
736
736
|
$input: RegisterMemberAccountInput!
|
|
737
737
|
$referralCode: String
|
|
@@ -767,7 +767,7 @@
|
|
|
767
767
|
}
|
|
768
768
|
}
|
|
769
769
|
}
|
|
770
|
-
`,rt=
|
|
770
|
+
`,rt=n`
|
|
771
771
|
mutation RegisterMemberAccountViaMobile(
|
|
772
772
|
$input: RegisterMemberAccountViaMobileInput!
|
|
773
773
|
$referralCode: String
|
|
@@ -794,7 +794,7 @@
|
|
|
794
794
|
}
|
|
795
795
|
}
|
|
796
796
|
}
|
|
797
|
-
`,at=
|
|
797
|
+
`,at=n`
|
|
798
798
|
mutation RegisterMemberAccount(
|
|
799
799
|
$input: RegisterMemberAccountInput_next!
|
|
800
800
|
$reCAPTCHAResponse: String
|
|
@@ -826,7 +826,7 @@
|
|
|
826
826
|
}
|
|
827
827
|
}
|
|
828
828
|
}
|
|
829
|
-
`,
|
|
829
|
+
`,ot=n`
|
|
830
830
|
mutation RegisterMayaMemberAccount($input: RegisterMayaMemberAccountInput!) {
|
|
831
831
|
registerMayaMemberAccount(input: $input) {
|
|
832
832
|
... on AccountNameNotAvailableError {
|
|
@@ -834,7 +834,7 @@
|
|
|
834
834
|
}
|
|
835
835
|
}
|
|
836
836
|
}
|
|
837
|
-
`,
|
|
837
|
+
`,nt=n`
|
|
838
838
|
mutation UpdateMemberAccount($input: UpdateMemberAccountInput!) {
|
|
839
839
|
updateMemberAccount(input: $input) {
|
|
840
840
|
... on AccountNameNotAvailableError {
|
|
@@ -860,7 +860,7 @@
|
|
|
860
860
|
}
|
|
861
861
|
}
|
|
862
862
|
}
|
|
863
|
-
`,it=
|
|
863
|
+
`,it=n`
|
|
864
864
|
mutation ResetPassword($input: ResetPasswordInput!, $verificationCode: String) {
|
|
865
865
|
resetPassword(input: $input, verificationCode: $verificationCode) {
|
|
866
866
|
... on AccountNotFoundError {
|
|
@@ -871,11 +871,11 @@
|
|
|
871
871
|
}
|
|
872
872
|
}
|
|
873
873
|
}
|
|
874
|
-
`,st=
|
|
874
|
+
`,st=n`
|
|
875
875
|
mutation DeleteMemberAccount($input: DeleteMemberAccountInput!) {
|
|
876
876
|
deleteMemberAccount(input: $input)
|
|
877
877
|
}
|
|
878
|
-
`,ct=
|
|
878
|
+
`,ct=n`
|
|
879
879
|
mutation VerifyMobileNumber($input: VerifyMobileNumberInput!) {
|
|
880
880
|
verifyMobileNumber(input: $input) {
|
|
881
881
|
... on InvalidSMSVerificationCodeError {
|
|
@@ -886,7 +886,7 @@
|
|
|
886
886
|
}
|
|
887
887
|
}
|
|
888
888
|
}
|
|
889
|
-
`,dt=
|
|
889
|
+
`,dt=n`
|
|
890
890
|
mutation CreateMemberVerification($input: CreateMemberVerificationInput!) {
|
|
891
891
|
createMemberVerification(input: $input) {
|
|
892
892
|
... on FileDoesNotExistError {
|
|
@@ -900,7 +900,7 @@
|
|
|
900
900
|
}
|
|
901
901
|
}
|
|
902
902
|
}
|
|
903
|
-
`,
|
|
903
|
+
`,mt=n`
|
|
904
904
|
mutation UpdateMemberVerification($input: UpdateMemberVerificationInput!) {
|
|
905
905
|
updateMemberVerification(input: $input) {
|
|
906
906
|
... on FileDoesNotExistError {
|
|
@@ -917,7 +917,7 @@
|
|
|
917
917
|
}
|
|
918
918
|
}
|
|
919
919
|
}
|
|
920
|
-
`,
|
|
920
|
+
`,ut=n`
|
|
921
921
|
query ProfileCompletion {
|
|
922
922
|
profileCompletion {
|
|
923
923
|
completionPercentage
|
|
@@ -928,7 +928,7 @@
|
|
|
928
928
|
accountPassword
|
|
929
929
|
}
|
|
930
930
|
}
|
|
931
|
-
`,lt=
|
|
931
|
+
`,lt=n`
|
|
932
932
|
mutation SendVerificationCode($input: SendVerificationCodeInput!) {
|
|
933
933
|
sendVerificationCode(input: $input) {
|
|
934
934
|
... on InvalidPlatformError {
|
|
@@ -939,7 +939,7 @@
|
|
|
939
939
|
}
|
|
940
940
|
}
|
|
941
941
|
}
|
|
942
|
-
`,pt=
|
|
942
|
+
`,pt=n`
|
|
943
943
|
fragment DepositGatewaySettingsCoreData on DepositGatewaySettings {
|
|
944
944
|
minimumAmount
|
|
945
945
|
maximumAmount
|
|
@@ -993,7 +993,7 @@
|
|
|
993
993
|
multiplier
|
|
994
994
|
}
|
|
995
995
|
}
|
|
996
|
-
`,ft=
|
|
996
|
+
`,ft=n`
|
|
997
997
|
query MayaSession($id: ObjectId!) {
|
|
998
998
|
mayaSession(id: $id) {
|
|
999
999
|
id
|
|
@@ -1001,11 +1001,11 @@
|
|
|
1001
1001
|
dateTimeCreated
|
|
1002
1002
|
}
|
|
1003
1003
|
}
|
|
1004
|
-
`,ht=
|
|
1004
|
+
`,ht=n`
|
|
1005
1005
|
mutation ValidateMayaSession {
|
|
1006
1006
|
validateMayaSession: validMayaSession
|
|
1007
1007
|
}
|
|
1008
|
-
`,wt=
|
|
1008
|
+
`,wt=n`
|
|
1009
1009
|
query ActivityRecords($after: Cursor, $first: Int, $filter: ActivityRecordsFilterInput) {
|
|
1010
1010
|
member {
|
|
1011
1011
|
activityRecords(after: $after, first: $first, filter: $filter) {
|
|
@@ -1030,11 +1030,11 @@
|
|
|
1030
1030
|
}
|
|
1031
1031
|
}
|
|
1032
1032
|
}
|
|
1033
|
-
`,yt=
|
|
1033
|
+
`,yt=n`
|
|
1034
1034
|
query ReferralCode {
|
|
1035
1035
|
referralCode
|
|
1036
1036
|
}
|
|
1037
|
-
`,gt=
|
|
1037
|
+
`,gt=n`
|
|
1038
1038
|
mutation UpdateReferralCode($input: UpdateReferralCodeInput!) {
|
|
1039
1039
|
updateReferralCode(input: $input) {
|
|
1040
1040
|
... on ReferralCodeNotAvailableError {
|
|
@@ -1042,7 +1042,7 @@
|
|
|
1042
1042
|
}
|
|
1043
1043
|
}
|
|
1044
1044
|
}
|
|
1045
|
-
`,bt=
|
|
1045
|
+
`,bt=n`
|
|
1046
1046
|
query Referrals($first: Int, $after: Cursor, $filter: ReferralFilterInput) {
|
|
1047
1047
|
member {
|
|
1048
1048
|
referrals(first: $first, after: $after, filter: $filter) {
|
|
@@ -1076,5 +1076,36 @@
|
|
|
1076
1076
|
}
|
|
1077
1077
|
}
|
|
1078
1078
|
}
|
|
1079
|
-
`;function u(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",ReferralCodeNotAvailableError:"Referral code is no longer available",AccountBlacklisted:"Account is blacklisted",AccountNotFound:"Account not found",InvalidToken:"Invalid token",InvalidTokenOrSecretAnswer:"Invalid token or secret answer",SessionExpired:"Session expired"}[n]}}class At{constructor(e){d(this,"client");this.client=e}async memberAccount(){const e=await this.client.request(Ze);return e.ok?{ok:!0,data:e.data.memberAccount}:e}async registerMemberAccount(e){const t=await this.client.request(tt,e);return t.ok?t.data.registerMemberAccount?{ok:!1,error:u(t.data.registerMemberAccount.__typename)}:{ok:!0}:t}async registerMemberAccountViaMobile(e){const t=await this.client.request(rt,e);return t.ok?t.data.registerMemberAccountViaMobile?{ok:!1,error:u(t.data.registerMemberAccountViaMobile.__typename)}:{ok:!0}:t}async registerMemberAccount__next(e){const t=await this.client.request(at,e);return t.ok?t.data.registerMemberAccount?{ok:!1,error:u(t.data.registerMemberAccount.__typename)}:{ok:!0}:t}async updateMemberAccount(e){const t=await this.client.request(ot,e);return t.ok?t.data.updateMemberAccount?{ok:!1,error:u(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:u(t.data.resetPassword.__typename)}:{ok:!0}:t}async profileCompletion(){const e=await this.client.request(mt);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:u(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:u(t.data.verifyMobileNumber.__typename)}:{ok:!0}:t}async createMemberVerification(e){const t=await this.client.request(dt,e);return t.ok?t.data.createMemberVerification?{ok:!1,error:u(t.data.createMemberVerification.__typename)}:{ok:!0}:t}async updateMemberVerification(e){const t=await this.client.request(ut,e);return t.ok?t.data.updateMemberVerification?{ok:!1,error:u(t.data.updateMemberVerification.__typename)}:{ok:!0}:t}async memberVerification(){const e=await this.client.request(et);return e.ok?{ok:!0,data:e.data.memberAccount.verification}:e}async announcements(e){const t=await this.client.request(Ie,e);return t.ok?{ok:!0,data:t.data.announcements}:t}async registerMayaMemberAccount(e){const t=await this.client.request(nt,e);return t.ok?t.data.registerMayaMemberAccount?{ok:!1,error:u(t.data.registerMayaMemberAccount.__typename)}:{ok:!0}:t}async referralCode(){const e=await this.client.request(yt);return e.ok?{ok:!0,data:e.data.referralCode}:e}async updateReferralCode(e){const t=await this.client.request(gt,e);return t.ok?t.data.updateReferralCode?{ok:!1,error:u(t.data.updateReferralCode.__typename)}:{ok:!0}:t}}function C(n){return n.startsWith("+63")?n:n.startsWith("63")?`+${n}`:n.startsWith("0")?`+63${n.substring(1)}`:`+63${n}`}function h(n,e){const t=j[n]?j[n]:j[500];return{name:t.name,message:e??t.message}}const j={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 Et{constructor(e){d(this,"url");d(this,"platform");this.url=e.url,this.platform=e.platform}get headers(){const e=new Headers;return e.append("Accept","application/json, text/plain"),e.append("Content-Type","application/json"),e.append("Platform-Code",this.platform),e.append("Role","MEMBER"),e}async createSession(e){const t=new Headers(this.headers);if(e.name){const r=`${e.name}:${e.password}`,a=Buffer.from(r).toString("base64");t.set("Authorization",`Basic ${a}`)}if(e.mobileNumber){const a=`${C(e.mobileNumber)}:${e.verificationCode}`,s=Buffer.from(a).toString("base64");console.log(`MobileNumberOTP ${s}`),t.set("Authorization",`MobileNumberOTP ${s}`)}e.sessionId&&t.set("Authorization",`MayaSession ${e.sessionId}`);try{const r=await fetch(`${this.url}/sessions`,{method:"POST",headers:t}),a=await r.json();return r.ok?{ok:!0,data:a}:a.code==="ACCOUNT_BLACKLISTED"?{ok:!1,error:u("AccountBlacklisted")}:{ok:!1,error:h(r.status)}}catch{return{ok:!1,error:h(500)}}}async authenticate(e){const t=new Headers(this.headers);if(e.type==="SECURITY_QUESTION"){t.set("Authorization",`Bearer ${e.token}`);try{const r=await fetch(`${this.url}/session/${e.token}/authenticate`,{method:"POST",headers:t,body:JSON.stringify({secretAnswer:e.secretAnswer})}),a=await r.json();return r.ok?{ok:!0,data:a}:r.status===401||r.status===403?{ok:!1,error:u("InvalidTokenOrSecretAnswer")}:{ok:!1,error:h(r.status)}}catch{return{ok:!1,error:h(500)}}}throw new Error("Invalid input 'type'")}async refreshSession(e){const t=new Headers(this.headers);t.append("Authorization",`Bearer ${e}`);try{const r=await fetch(`${this.url}/session:refresh`,{method:"POST",headers:t}),a=await r.json();return r.ok?{ok:!0,data:a}:a.code==="ACCOUNT_BLACKLISTED"?{ok:!1,error:u("AccountBlacklisted")}:r.status===403||r.status===401?{ok:!1,error:u("InvalidToken")}:{ok:!1,error:h(r.status)}}catch{return{ok:!1,error:h(500)}}}async destroySession(e){const t=new Headers(this.headers);t.append("Authorization",`Bearer ${e}`);try{const r=await fetch(`${this.url}/session`,{method:"DELETE",headers:t});return r.ok?{ok:!0}:{ok:!1,error:h(r.status)}}catch{return{ok:!1,error:h(500)}}}async verifySession(e){const t=new Headers(this.headers);t.append("Authorization",`Bearer ${e}`);try{return(await fetch(`${this.url}/session`,{method:"GET",headers:t})).ok}catch{return!0}}async sendVerificationCode(e){if(e.channel==="EMAIL")throw new Error("Email channel is not yet supported");try{const t=await fetch(`${this.url}/otps`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(t.status===403){const r=await t.json();return{ok:!1,error:h(t.status,r.message)}}return t.ok?{ok:!0}:{ok:!1,error:h(t.status)}}catch{return{ok:!1,error:h(500)}}}}class St{constructor(e){d(this,"url");d(this,"siteId");d(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 a,s,c,m,l,w,g,f,v,M,N,R,I,S,D,P,T,$,x,G,_,O,F,L;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=(a=e==null?void 0:e.filter)==null?void 0:a.type)!=null&&s.equal&&t.set("filter[type][eq]",e.filter.type.equal),(m=(c=e==null?void 0:e.filter)==null?void 0:c.type)!=null&&m.notEqual&&t.set("filter[type][neq]",e.filter.type.notEqual),(w=(l=e==null?void 0:e.filter)==null?void 0:l.type)!=null&&w.in&&t.set("filter[type][in]",e.filter.type.in.join(",")),(f=(g=e==null?void 0:e.filter)==null?void 0:g.type)!=null&&f.notIn&&t.set("filter[type][nin]",e.filter.type.notIn.join(",")),(M=(v=e==null?void 0:e.filter)==null?void 0:v.provider)!=null&&M.equal&&t.set("filter[provider][eq]",e.filter.provider.equal),(R=(N=e==null?void 0:e.filter)==null?void 0:N.provider)!=null&&R.notEqual&&t.set("filter[provider][neq]",e.filter.provider.notEqual),(S=(I=e==null?void 0:e.filter)==null?void 0:I.provider)!=null&&S.in&&t.set("filter[provider][in]",e.filter.provider.in.join(",")),(P=(D=e==null?void 0:e.filter)==null?void 0:D.provider)!=null&&P.notIn&&t.set("filter[provider][nin]",e.filter.provider.notIn.join(",")),($=(T=e==null?void 0:e.filter)==null?void 0:T.tags)!=null&&$.equal&&t.set("filter[tags][eq]",e.filter.tags.equal.toLowerCase()),(G=(x=e==null?void 0:e.filter)==null?void 0:x.tags)!=null&&G.notEqual&&t.set("filter[tags][neq]",e.filter.tags.notEqual.toLowerCase()),(O=(_=e==null?void 0:e.filter)==null?void 0:_.tags)!=null&&O.in&&t.set("filter[tags][in]",e.filter.tags.in.map(k=>k.toLowerCase()).join(",")),(L=(F=e==null?void 0:e.filter)==null?void 0:F.tags)!=null&&L.notIn&&t.set("filter[tags][nin]",e.filter.tags.notIn.map(k=>k.toLowerCase()).join(","));const r=await this.getJson("/games",t);return r.ok?{ok:!0,data:{edges:r.data.data.map(k=>({node:k,cursor:k.cursor})),totalCount:r.data.totalCount??0,pageInfo:{hasNextPage:!!r.data.next,endCursor:r.data.next}}}:r}async game(e){var r;const t=await this.getJson(`/games/${e}`);return((r=t.error)==null?void 0:r.name)==="HttpNotFound"?{ok:!0,data:null}:t.ok?{ok:!0,data:t.data.data}:t}async getJson(e,t){const r=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 a=await fetch(r);return a.ok?{ok:!0,data:await a.json()}:{ok:!1,error:h(a.status)}}catch{return{ok:!1,error:h(500)}}}}class Ct{constructor(e){d(this,"client");this.client=e}async file(e){const t=await this.client.request(Te,e);return t.ok?{ok:!0,data:t.data.node}:t}async uploadPrivateImageFile(e){const t=await this.client.upload(_e,e);return t.ok?t.data.uploadPrivateImageFile?{ok:!1,error:u(t.data.uploadPrivateImageFile.__typename)}:{ok:!0}:t}}class kt{constructor(e){d(this,"client");this.client=e}async gameSession(e){const t=await this.client.request(K.legacy,e);return t.ok?{ok:!0,data:t.data.node?{...t.data.node,game:t.data.node.game.id}:null}:t}async createGameSession(e){const t=await this.client.request(J,e);return t.ok?t.data.createGameSession?{ok:!1,error:u(t.data.createGameSession.__typename)}:{ok:!0}:t}async endGameSession(e){const t=await this.client.request(z.legacy,e);return t.ok?t.data.endGameSession?{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:{ok:!0}:t}}class Tt{constructor(e){d(this,"client");this.client=e}async latestBetRecords(){const e=await this.client.request(He);return e.ok?{ok:!0,data:e.data.latestBetRecords}:e}}class _t{constructor(e){d(this,"client");this.client=e}async betRecords(e){const t=await this.client.request(Ve,e);return t.ok?{ok:t.ok,data:t.data.member.betRecords}:t}async transactionRecords(e){const t=await this.client.request(je,e);return t.ok?{ok:t.ok,data:t.data.member.transactionRecords}:t}async withdrawalRecords(e){const t=await this.client.request(De,e);return t.ok?{ok:t.ok,data:t.data.member.withdrawalRecords}:t}async depositRecords(e){const t=await this.client.request(Ue,e);return t.ok?{ok:t.ok,data:t.data.member.depositRecords}:t}async depositsCount(){const e=await this.client.request(Le);return e.ok?{ok:e.ok,data:e.data.member.depositsCount}:e}async pointsWalletTransactions(e){const t=await this.client.request(Re,e);return t.ok?{ok:t.ok,data:t.data.member.pointsWalletTransactions}:t}async activityRecords(e){const t=await this.client.request(wt,e);return t.ok?{ok:t.ok,data:t.data.member.activityRecords}:t}async referrals(e){const t=await this.client.request(bt,e);return t.ok?{ok:t.ok,data:t.data.member.referrals}:t}}class vt{constructor(e){d(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 Mt{constructor(e){d(this,"client");this.client=e}async promos(){const e=await this.client.request(Ye);return e.ok?{ok:e.ok,data:e.data.promos}:e}async cashbacks(){const e=await this.client.request(Ke);return e.ok?{ok:e.ok,data:e.data.cashbacks}:e}async availablePromos(e){const t=await this.client.request(Qe,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(Xe,e);return t.ok?t.data.claimCashbackBonus?{ok:!1,error:u(t.data.claimCashbackBonus.__typename)}:{ok:!0}:{ok:t.ok,error:t.error}}async bonus(){const e=await this.client.request(Je);return e.ok?{ok:e.ok,data:e.data.bonus}:e}async wallet(){const e=await this.client.request(ve);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(We,e);return t.ok?t.data.createGCashDeposit?{ok:!1,error:u(t.data.createGCashDeposit.__typename)}:{ok:!0}:t}async createMayaDeposit(e){const t=await this.client.request(qe,e);return t.ok?t.data.createMayaDeposit?{ok:!1,error:u(t.data.createMayaDeposit.__typename)}:{ok:!0}:t}async createMayaAppDeposit(e){const t=await this.client.request(Be,e);return t.ok?t.data.createMayaAppDeposit?{ok:!1,error:u(t.data.createMayaAppDeposit.__typename)}:{ok:!0}:t}async createGCashWithdrawal(e){const t=await this.client.request(Pe,e);return t.ok?t.data.createGCashWithdrawal?{ok:!1,error:u(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:u(t.data.createMayaWithdrawal.__typename)}:{ok:!0}:t}async createMayaAppWithdrawal(e){const t=await this.client.request(xe,e);return t.ok?t.data.createMayaAppWithdrawal?{ok:!1,error:u(t.data.createMayaAppWithdrawal.__typename)}:{ok:!0}:t}async createBankWithdrawal(e){const t=await this.client.request(Ge,e);return t.ok?t.data.createBankWithdrawal?{ok:!1,error:u(t.data.createBankWithdrawal.__typename)}:{ok:!0}:t}async remainingDailyWithdrawalsCount(){const e=await this.client.request(Oe);return e.ok?{ok:e.ok,data:e.data.remainingDailyWithdrawalsCount}:e}async pointsWallet(){const e=await this.client.request(Me);return e.ok?{ok:e.ok,data:e.data.pointsWallet}:e}async pointsToCashConversion(e){const t=await this.client.request(Ne,e);return t.ok?t.data.pointsToCashConversion?{ok:!1,error:u(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 gameSession(e){const t=await this.client.request(K.current,e);return t.ok?{ok:!0,data:t.data.node}:t}async createGameSession(e){const t=await this.client.request(J,e);return t.ok?t.data.createGameSession?{ok:!1,error:u(t.data.createGameSession.__typename)}:{ok:!0}:t}async endGameSession(e){const t=await this.client.request(z.current,e);return t.ok?t.data.endGameSession?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:t}async validateMayaSession(){const e=await this.client.request(ht);return e.ok?e.data.validateMayaSession?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:e}}function Nt(n,e,t){return n<e?e:n>t?t:n}function Y(n){return Object.prototype.toString.call(n)==="[object Object]"&&Object(n)===n}function Rt(n){const e=[];function t(r,a=[]){for(const s in r){const c=r[s];Y(c)?t(c,[...a,s]):Array.isArray(c)?t(It(c),[...a,s]):e.push({key:[...a,s],value:c})}}return t(n),e}function It(n){return n.reduce((e,t,r)=>(e[r]=t,e),{})}class U{constructor(e,t){d(this,"url");d(this,"options");d(this,"middlewares");var a;const r=new Headers((a=t==null?void 0:t.fetchOptions)==null?void 0:a.headers);this.url=e,this.options={...t==null?void 0:t.fetchOptions,headers:r},this.middlewares=(t==null?void 0:t.middlewares)??[]}async request(e,t){const r=JSON.stringify({query:e,variables:t}),a=new Headers(this.options.headers);a.set("Content-Type","application/json"),a.set("Accept","application/json");const s=await this.runMiddlewares(new Request(this.url,{...this.options,body:r,headers:a,method:"POST"}));return await this.exec(s)}async upload(e,t){const r=this.createUploadBody(e,t),a=new Headers(this.options.headers);a.delete("Content-Type");const s=await this.runMiddlewares(new Request(this.url,{...this.options,body:r,headers:a,method:"POST"}));return await this.exec(s)}async exec(e){var t,r,a,s,c,m;try{const l=await fetch(e);if(!l.ok)return{ok:!1,error:h(l.status)};const w=await l.json(),g=w.data,f=(t=w.errors)==null?void 0:t.at(0);return f?((r=f.extensions)==null?void 0:r.code)==="FORBIDDEN"||((a=f.extensions)==null?void 0:a.code)==="ACCESS_TOKEN_EXPIRED"?{ok:!1,error:h(403,f.message)}:((s=f.extensions)==null?void 0:s.code)==="UNAUTHORIZED"?{ok:!1,error:h(401,f.message)}:((c=f.extensions)==null?void 0:c.code)==="BAD_USER_INPUT"||((m=f.extensions)==null?void 0:m.code)==="BAD_REQUEST"?{ok:!1,error:h(400,f.message)}:{ok:!1,error:h(500,f.message)}:{ok:!0,data:g}}catch{return{ok:!1,error:h(500)}}}async runMiddlewares(e){let t=e.clone();for(const r of this.middlewares)t=await r(t);return t}createUploadBody(e,t){const r=Rt(t).filter(c=>c.value instanceof File||c.value instanceof Blob),a=new FormData;a.append("operations",JSON.stringify({query:e,variables:t}));const s={};return r.forEach((c,m)=>{s[m.toString()]=[`variables.${c.key.join(".")}`]}),a.append("map",JSON.stringify(s)),r.forEach((c,m)=>{a.append(m.toString(),c.value)}),a}}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 Z{constructor(e){d(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 Q(n){return new Date(n.getTime())}function W(n,e){const t=Q(n);return t.setDate(t.getDate()+e),t}function q(n,e){const t=Q(n);return t.setMinutes(t.getMinutes()+e),t}function ee(n,e){return n.getTime()>e.getTime()}function te(n){return new Promise(e=>{setTimeout(e,n)})}function re(n,e){const{until:t,interval:r=1e3,maxAttempt:a=3}=e;async function s(c,m){const l=m??a,w=await n(...c);return t(w)?w:l>1?(await te(r*((a-l)/2)),s(c,l-1)):w}return async(...c)=>await s(c)}function B(n,e){const t=Q(n);return t.setMinutes(t.getMinutes()-e),t}class Dt{constructor(e){d(this,"logger");d(this,"storageKey","session");d(this,"authService");d(this,"walletService");d(this,"_refreshing",!1);this.authService=e.authService,this.walletService=e.walletService,this.logger=new Z({enabled:e.logs??!1})}get refreshing(){return this._refreshing}set refreshing(e){this._refreshing=e}async create(e){var a;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 c=await re(()=>this.walletService.mayaSession({id:e.sessionId}),{until:g=>{var f;return g.ok&&((f=g.data)==null?void 0:f.member)!=null},interval:1e3,maxAttempt:5})();if(!c.ok)return c;if(!((a=c.data)!=null&&a.member))return{ok:!1,error:{name:"HttpForbidden",message:"Forbidden"}};const l=await re(()=>this.authService.createSession(e),{until:g=>g.ok,interval:1e3,maxAttempt:5})();if(!l.ok)return l;const w=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...l.data,accessTokenExpiresAt:q(w,8).getTime(),refreshTokenExpiresAt:B(W(w,30),2).getTime()})),{ok:!0,data:null}}if(e.type==="MOBILE_NUMBER"){const s=await this.authService.createSession(e);if(s.ok){const c=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...s.data,accessTokenExpiresAt:q(c,8).getTime(),refreshTokenExpiresAt:B(W(c,30),2).getTime()})),{ok:!0,data:null}}return s}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 r=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...t.data,accessTokenExpiresAt:q(r,8).getTime(),refreshTokenExpiresAt:B(W(r,30),2).getTime()})),{ok:!0,data:null}}async createFromAuthenticator(e){const t=await this.authService.authenticate(e);if(t.ok){const r=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:q(r,8).getTime(),refreshTokenExpiresAt:B(W(r,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 te(1e3),await this.get();const e=window.localStorage.getItem(this.storageKey);if(!e)return{ok:!0,data:null};try{let t=JSON.parse(e),r=new Date;const a=new Date(t.accessTokenExpiresAt),s=new Date(t.refreshTokenExpiresAt);if(ee(r,s))return this.logger.warn("Session expired. Logging out.."),window.localStorage.removeItem(this.storageKey),{ok:!1,error:{name:"SessionExpired",message:"Session expired."}};if(ee(r,a)){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!"),r=new Date,t={...t,...c.data,accessTokenExpiresAt:q(r,8).getTime(),refreshTokenExpiresAt:B(W(r,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 r,a,s;if(this.isServer)return this.logger.warn("'localStorage' is not available on the server."),!0;const e=await this.get();if(((r=e.error)==null?void 0:r.name)==="InvalidToken"||((a=e.error)==null?void 0:a.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 r=n[t];if(r!==null&&r!==void 0){if(Y(r)){e[t]=E(r);continue}if(Array.isArray(r)){e[t]=r.map(a=>Y(a)?E(a):a);continue}e[t]=r}}return e}function o(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 Pt{constructor(e){d(this,"staticService");const t=(e==null?void 0:e.environment)==="development";this.staticService=new vt({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),pointsWalletTransaction:this.pointsWalletTransaction.bind(this),activityRecord:this.activityRecord.bind(this),referrals:this.referrals.bind(this),referralComission:this.referralComission.bind(this)}}site(e){const t={id:e.id,name:e.name,logo:e.logo??void 0,fields:e.config.fields};return E(t)}platform(e){var t,r,a,s,c,m,l,w,g,f,v,M,N,R,I,S,D,P,T,$,x,G,_,O,F,L,k,ae,ne,oe,ie,se,ce,de,ue,me,le,pe,fe,he,we,ye,ge,be,Ae,Ee,Se,Ce,ke;return{paymentSettings:{minimumFirstDepositAmount:o(e.minimumFirstDepositAmount),restrictWithdrawalsToVerifiedMembers:e.restrictWithdrawalsToVerifiedMembers,depositGateway:{bank:{androidEnabled:((t=e.bankDepositGatewaySettings)==null?void 0:t.androidEnabled)??!1,iosEnabled:((r=e.bankDepositGatewaySettings)==null?void 0:r.iosEnabled)??!1,webEnabled:((a=e.bankDepositGatewaySettings)==null?void 0:a.webEnabled)??!1,mobileWebEnabled:((s=e.bankDepositGatewaySettings)==null?void 0:s.mobileWebEnabled)??!1,minimumAmount:o((c=e.bankDepositGatewaySettings)==null?void 0:c.minimumAmount),maximumAmount:o((m=e.bankDepositGatewaySettings)==null?void 0:m.maximumAmount)},gcash:{androidEnabled:((l=e.gcashDepositGatewaySettings)==null?void 0:l.androidEnabled)??!1,iosEnabled:((w=e.gcashDepositGatewaySettings)==null?void 0:w.iosEnabled)??!1,webEnabled:((g=e.gcashDepositGatewaySettings)==null?void 0:g.webEnabled)??!1,mobileWebEnabled:((f=e.gcashDepositGatewaySettings)==null?void 0:f.mobileWebEnabled)??!1,minimumAmount:o((v=e.gcashDepositGatewaySettings)==null?void 0:v.minimumAmount),maximumAmount:o((M=e.gcashDepositGatewaySettings)==null?void 0:M.maximumAmount)},maya:{androidEnabled:((N=e.mayaDepositGatewaySettings)==null?void 0:N.androidEnabled)??!1,iosEnabled:((R=e.mayaDepositGatewaySettings)==null?void 0:R.iosEnabled)??!1,webEnabled:((I=e.mayaDepositGatewaySettings)==null?void 0:I.webEnabled)??!1,mobileWebEnabled:((S=e.mayaDepositGatewaySettings)==null?void 0:S.mobileWebEnabled)??!1,minimumAmount:o((D=e.mayaDepositGatewaySettings)==null?void 0:D.minimumAmount),maximumAmount:o((P=e.mayaDepositGatewaySettings)==null?void 0:P.maximumAmount)},mayaApp:{androidEnabled:((T=e.mayaAppDepositGatewaySettings)==null?void 0:T.androidEnabled)??!1,iosEnabled:(($=e.mayaAppDepositGatewaySettings)==null?void 0:$.iosEnabled)??!1,webEnabled:((x=e.mayaAppDepositGatewaySettings)==null?void 0:x.webEnabled)??!1,mobileWebEnabled:((G=e.mayaAppDepositGatewaySettings)==null?void 0:G.mobileWebEnabled)??!1,minimumAmount:o((_=e.mayaAppDepositGatewaySettings)==null?void 0:_.minimumAmount),maximumAmount:o((O=e.mayaAppDepositGatewaySettings)==null?void 0:O.maximumAmount)}},withdrawalGateway:{bank:{androidEnabled:((F=e.bankWithdrawalGatewaySettings)==null?void 0:F.androidEnabled)??!1,iosEnabled:((L=e.bankWithdrawalGatewaySettings)==null?void 0:L.iosEnabled)??!1,webEnabled:((k=e.bankWithdrawalGatewaySettings)==null?void 0:k.webEnabled)??!1,mobileWebEnabled:((ae=e.bankWithdrawalGatewaySettings)==null?void 0:ae.mobileWebEnabled)??!1,minimumAmount:o((ne=e.bankWithdrawalGatewaySettings)==null?void 0:ne.minimumAmount),maximumAmount:o((oe=e.bankWithdrawalGatewaySettings)==null?void 0:oe.maximumAmount)},gcash:{androidEnabled:((ie=e.gcashWithdrawalGatewaySettings)==null?void 0:ie.androidEnabled)??!1,iosEnabled:((se=e.gcashWithdrawalGatewaySettings)==null?void 0:se.iosEnabled)??!1,webEnabled:((ce=e.gcashWithdrawalGatewaySettings)==null?void 0:ce.webEnabled)??!1,mobileWebEnabled:((de=e.gcashWithdrawalGatewaySettings)==null?void 0:de.mobileWebEnabled)??!1,minimumAmount:o((ue=e.gcashWithdrawalGatewaySettings)==null?void 0:ue.minimumAmount),maximumAmount:o((me=e.gcashWithdrawalGatewaySettings)==null?void 0:me.maximumAmount,1e6)},maya:{androidEnabled:((le=e.mayaWithdrawalGatewaySettings)==null?void 0:le.androidEnabled)??!1,iosEnabled:((pe=e.mayaWithdrawalGatewaySettings)==null?void 0:pe.iosEnabled)??!1,webEnabled:((fe=e.mayaWithdrawalGatewaySettings)==null?void 0:fe.webEnabled)??!1,mobileWebEnabled:((he=e.mayaWithdrawalGatewaySettings)==null?void 0:he.mobileWebEnabled)??!1,minimumAmount:o((we=e.mayaWithdrawalGatewaySettings)==null?void 0:we.minimumAmount),maximumAmount:o((ye=e.mayaWithdrawalGatewaySettings)==null?void 0:ye.maximumAmount)},mayaApp:{androidEnabled:((ge=e.mayaAppWithdrawalGatewaySettings)==null?void 0:ge.androidEnabled)??!1,iosEnabled:((be=e.mayaAppWithdrawalGatewaySettings)==null?void 0:be.iosEnabled)??!1,webEnabled:((Ae=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Ae.webEnabled)??!1,mobileWebEnabled:((Ee=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Ee.mobileWebEnabled)??!1,minimumAmount:o((Se=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Se.minimumAmount),maximumAmount:o((Ce=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Ce.maximumAmount,1e6)}}},pointsClubSettings:{multiplier:o((ke=e.pointsClubSettings)==null?void 0:ke.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,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)};return E(t)}wallet(e){return{id:e.id,balance:o(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,permanentAddress:e.permanentAddress,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:o(e.completionPercentage,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:o(e.amount,0),netAmount:o(e.netAmount,0),fee:o(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:o(e.amount,0),fee:o(e.fee,0),netAmount:o(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 r;const t={id:e.id,bet:o(e.bet,0),payout:o(e.payout,0),status:e.status,jackpotContribution:o(e.jackpotContribution,0),jackpotPayout:o(e.jackpotPayout,0),winloss:o(e.winloss),validBet:o(e.validBet,0),vendorRoundId:e.vendorRoundId??void 0,game:{name:e.game.name,type:e.game.type,images:this.staticService.gameThumbnails(e.game),provider:e.game.provider},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:((r=e.metadata)==null?void 0:r.odds)??void 0}};return E(t)}latestBetRecord(e){return{id:e.id,member:e.member,game:{name:e.game.name,type:e.game.type,images:this.staticService.gameThumbnails(e.game),provider:e.game.provider},bet:o(e.bet,0),payout:o(e.payout,0),validBet:o(e.validBet,0),dateTimeSettled:new Date(e.dateTimeSettled),dateTimeCreated:new Date(e.dateTimeCreated)}}transactionRecord(e){const t={id:e.id,type:e.type,amount:o(e.amount,0),content:e.content??void 0,currentBalance:o(e.currentBalance,0),referenceNumber:e.referenceNumber,dateTimeCreated:new Date(e.dateTimeCreated)};return E(t)}game(e){return{id:e.id,type:e.type,tags:e.tags??[],name:e.name,images:[e.customImage,e.image].filter(Boolean),provider:e.provider,reference:e.reference}}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:o(e.maximumBonusAmount),minimumBonusAmount:o(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),turnoverContributionPercentagePerGameProvider:Object.entries(e.turnoverContributionPercentagePerGameProvider).reduce((r,[a,s])=>(r[a]=o(s,0),r),{})}}bonus(e){const t={id:e.id,promo:this.promo(e.promo),deposit:e.deposit?{type:e.deposit.type,status:e.deposit.status,fee:o(e.deposit.fee,0),amount:o(e.deposit.amount,0),netAmount:o(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:o(e.balance,0),amount:o(e.amount,0),expiration:new Date(e.expiration),turnoverRequirement:o(e.turnoverRequirement,0),currentTurnoverRequirementContribution:o(e.currentTurnoverRequirementContribution,0),currentTurnoverRequirementContributionPercentage:o(e.currentTurnoverRequirementContributionPercentage,0),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)};return E(t)}cashbackBonus(e){return{id:e.id,balance:o(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:o(e.points,0),account:e.account,dateTimeCreated:new Date(e.dateTimeCreated)}}pointsWalletTransaction(e){return{id:e.id,type:e.type,amount:o(e.amount,0),balance:o(e.balance,0),dateTimeCreated:new Date(e.dateTimeCreated)}}activityRecord(e){const t={id:e.id,type:e.type,amount:e.amount?o(e.amount,0):void 0,domain:e.domain??void 0,details:e.details,dateTimeCreated:new Date(e.dateTimeCreated)};return E(t)}referrals(e){return{id:e.id,level:e.level,upline:e.upline,downline:e.downline,turnover:o(e.turnover,0),commision:o(e.commision,0),dateTimeCreated:new Date(e.dateTimeCreated)}}referralComission(e){return{id:e.id,commission:o(e.commission,0),level1Commission:o(e.level1Commission,0),level2Commission:o(e.level2Commission,0),level3Commission:o(e.level3Commission,0),referralsCount:e.referralsCount,level1ReferralsCount:e.level1ReferralsCount,level2ReferralsCount:e.level2ReferralsCount,level3ReferralsCount:e.level3ReferralsCount,referralCode:e.referralCode,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}}class $t{constructor(e){d(this,"cmsPortalService");d(this,"authService");d(this,"gameService");d(this,"fileService");d(this,"walletService");d(this,"accountService");d(this,"reportService");d(this,"portalService");d(this,"sessionManager");d(this,"transformer");d(this,"logger");const{site:t,sitePlatform:r,platform:a,environment:s,logs:c}=e,m=s==="production";this.transformer=new Pt({environment:s}),this.logger=new Z({enabled:c??!1});const l=m?"https://auth.opexa.io":"https://auth.development.opexa.io",w=m?"https://wallet.opexa.io/graphql":"https://wallet.development.opexa.io/graphql",g=m?"https://report.opexa.io/graphql":"https://report.development.opexa.io/graphql",f=m?"https://account.opexa.io/graphql":"https://account.development.opexa.io/graphql",v=m?"https://portal.opexa.io/graphql":"https://portal.development.opexa.io/graphql",M=m?"https://file.opexa.io/graphql":"https://file.development.opexa.io/graphql",N=m?"https://game.opexa.io/graphql":"https://game.development.opexa.io/graphql",R=m?"https://portal-api.opexacms.io/v1":"https://portal-api.development.opexacms.io/v1",I=new St({url:R,site:t,platform:r}),S={middlewares:[this.authMiddleware],fetchOptions:{headers:{Role:"MEMBER","Platform-Code":a}}},D=new kt(new U(N,S)),P=new Ct(new U(M,S)),T=new Mt(new U(w,S)),$=new At(new U(f,S)),x=new _t(new U(g,S)),G=new Tt(new U(v,S)),_=new Et({url:l,platform:a}),O=new Dt({logs:c,authService:_,walletService:T});this.authService=_,this.gameService=D,this.fileService=P,this.walletService=T,this.accountService=$,this.reportService=x,this.portalService=G,this.sessionManager=O,this.cmsPortalService=I}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=Nt(e.interval??3e4,3e4,6e4);let r=null;const a=()=>setTimeout(async()=>{await this.sessionManager.verify()||await e.onInvalid(),r=a()},t);return r=a(),function(){r&&clearTimeout(r)}}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 validateMayaSession(){return await this.walletService.validateMayaSession()}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=await this.accountService.memberAccount();return e.ok?{ok:!0,data:this.transformer.transform.account(e.data)}:e}async createAccount(e){const t=e.id??p.ObjectId.generate(b.Account).toString(),r=await this.accountService.registerMemberAccount({input:{id:t,btag:e.btag,name:e.name,domain:e.domain,birthDay:typeof e.dateOfBirth=="string"?e.dateOfBirth:e.dateOfBirth.toISOString(),password:await A(e.password),mobileNumber:C(e.mobileNumber)},referralCode:e.referralCode,verificationCode:e.verificationCode,reCAPTCHAResponse:e.reCAPTCHAResponse});return r.ok?{ok:!0,data:{id:t}}:r}async createAccount__next(e){const t=e.id??p.ObjectId.generate(b.Account).toString();if(e.type==="MOBILE_NUMBER"){const a=await this.accountService.registerMemberAccountViaMobile({input:{id:t,mobileNumber:C(e.mobileNumber)},referralCode:e.referralCode,reCAPTCHAResponse:e.reCAPTCHAResponse,verificationCode:e.verificationCode});return a.ok?{ok:!0,data:{id:t}}:a}const r=await this.accountService.registerMemberAccount__next({input:{id:t,name:e.name,password:await A(e.password),mobileNumber:e.mobileNumber?C(e.mobileNumber):void 0},reCAPTCHAResponse:e.reCAPTCHAResponse});return r.ok?{ok:!0,data:{id:t}}:r}async registerMayaAccount(e){return await this.accountService.registerMayaMemberAccount({input:{name:e.name,password:await A(e.password),domain:e.domain}})}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:C(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??p.ObjectId.generate(b.Verification).toString(),r=await this.accountService.createMemberVerification({input:{id:t,...e}});return r.ok?{ok:!0,data:{id:t}}:r}async updateVerificationDetails(e,t){return await this.accountService.updateMemberVerification({input:{id:e,data:{...t}}})}async resetPassword(e){return await this.accountService.resetPassword({input:{mobileNumber:C(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:C(e)}})}async sendVerificationCode__next(e){return this.authService.sendVerificationCode({channel:"SMS",recipient:C(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:r,node:a})=>({...this.transformer.transform.announcement(a),cursor:r})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async createWithdrawal(e){const t=e.id??p.ObjectId.generate(b.Withdrawal).toString();if(e.type==="BANK"){const r=await this.walletService.createBankWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await A(e.transactionPassword)}});if(!r.ok)return r}if(e.type==="GCASH"){const r=await this.walletService.createGCashWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await A(e.transactionPassword),recipientMobileNumber:C(e.recipientMobileNumber)}});if(!r.ok)return r}if(e.type==="MAYA"){const r=await this.walletService.createMayaWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await A(e.transactionPassword),recipientMobileNumber:C(e.recipientMobileNumber)}});if(!r.ok)return r}if(e.type==="MAYA_APP"){const r=await this.walletService.createMayaAppWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await A(e.transactionPassword)}});if(!r.ok)return r}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:r,node:a})=>({...this.transformer.transform.withdrawalRecord(a),cursor:r})),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??p.ObjectId.generate(b.Deposit).toString();if(e.type==="MAYA"){const r=await this.walletService.createMayaDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!r.ok)return r}if(e.type==="MAYA_APP"){const r=await this.walletService.createMayaAppDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!r.ok)return r}if(e.type==="GCASH"){const r=await this.walletService.createGCashDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!r.ok)return r}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:r,node:a})=>({...this.transformer.transform.depositRecord(a),cursor:r})),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,...(e==null?void 0:e.filter)&&{filter:{...e.filter.status&&{game:e.filter.status},...e.filter.serialCode&&{game:e.filter.serialCode},...e.filter.vendorRoundId&&{game:e.filter.vendorRoundId},...e.filter.dateTimeCreated&&{dateTimeCreated:e.filter.dateTimeCreated},...e.filter.gameType&&{game__type:e.filter.gameType},...e.filter.gameProvider&&{game__provider:e.filter.gameProvider}}}});return t.ok?{ok:!0,data:{betRecords:t.data.edges.map(({cursor:r,node:a})=>({...this.transformer.transform.betRecord(a),cursor:r})),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:r,node:a})=>({...this.transformer.transform.transactionRecord(a),cursor:r})),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.cmsPortalService.games(e);return t.ok?{ok:!0,data:{games:t.data.edges.map(({cursor:r,node:a})=>({...this.transformer.transform.game(a),cursor:r})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async gameSession(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 r=await this.gameService.gameSession({id:e});return r.ok?{ok:!0,data:r.data?this.transformer.transform.gameSession(r.data):null}:r}async createGameSession(e){const t=e.id??p.ObjectId.generate(b.GameSession).toString();if(e.game.startsWith("SPORTS:")){const m=await p.ObjectId.generateFromKey(b.Game,e.game).then(w=>w.toString()),l=await this.gameService.createGameSession({input:{id:t,game:m}});return l.ok?{ok:!0,data:{id:t}}:l}const r=await this.game(e.game);if(!r.data)return{ok:!1,error:{name:"GameDoesNotExistError",message:"Game does not exist"}};const{provider:a,reference:s}=r.data,c=Gt(a)?await this.walletService.createGameSession({input:{id:t,game:s}}):await this.gameService.createGameSession({input:{id:t,game:s}});return c.ok?{ok:!0,data:{id:t}}:c}async endGameSession(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??p.ObjectId.generate(b.File).toString(),r=await this.fileService.uploadPrivateImageFile({input:{id:t,file:e.file}});return r.ok?{ok:!0,data:{id:t}}:r}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()}})}async pointsWalletTransactions(e){const t=await this.reportService.pointsWalletTransactions(e);return t.ok?{ok:!0,data:{pointsWalletTransactions:t.data.edges.map(({cursor:r,node:a})=>({...this.transformer.transform.pointsWalletTransaction(a),cursor:r})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async activityRecords(e){const t=await this.reportService.activityRecords(e);return t.ok?{ok:!0,data:{activityRecords:t.data.edges.map(({cursor:r,node:a})=>({...this.transformer.transform.activityRecord(a),cursor:r})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async referralCode(){const e=await this.accountService.referralCode();return e.ok?{ok:!0,data:e.data??null}:e}async updateReferralCode(e){return await this.accountService.updateReferralCode({input:e})}async referrals(e){const t=await this.reportService.referrals(e);return t.ok?{ok:!0,data:{referrals:t.data.edges.map(({cursor:r,node:a})=>({...this.transformer.transform.referrals(a),cursor:r})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}}const xt=["RTG","DARWIN","DRBINGO","MEGABALL","EVOLUTION","EVOLUTION_NETENT","EVOLUTION_REDTIGER"];function Gt(n){return xt.some(e=>e===n)}Object.defineProperty(y,"ObjectId",{enumerable:!0,get:()=>p.ObjectId}),y.ObjectType=b,y.Sdk=$t,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
|
|
1079
|
+
`,At=n`
|
|
1080
|
+
query ReferralCommissions($after: Cursor, $first: Int, $filter: ReferralCommissionFilterInput) {
|
|
1081
|
+
member {
|
|
1082
|
+
referralCommissions(after: $after, first: $first, filter: $filter) {
|
|
1083
|
+
edges {
|
|
1084
|
+
cursor
|
|
1085
|
+
node {
|
|
1086
|
+
... on ReferralCommission {
|
|
1087
|
+
id
|
|
1088
|
+
commission
|
|
1089
|
+
dateTimeCreated
|
|
1090
|
+
dateTimeLastUpdated
|
|
1091
|
+
level1Commission
|
|
1092
|
+
level1ReferralsCount
|
|
1093
|
+
level2Commission
|
|
1094
|
+
level2ReferralsCount
|
|
1095
|
+
level3Commission
|
|
1096
|
+
level3ReferralsCount
|
|
1097
|
+
referralCode
|
|
1098
|
+
referralsCount
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
totalCount
|
|
1103
|
+
pageInfo {
|
|
1104
|
+
endCursor
|
|
1105
|
+
hasNextPage
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
`;function m(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",ReferralCodeNotAvailableError:"Referral code is no longer available",AccountBlacklisted:"Account is blacklisted",AccountNotFound:"Account not found",InvalidToken:"Invalid token",InvalidTokenOrSecretAnswer:"Invalid token or secret answer",SessionExpired:"Session expired"}[o]}}class Ct{constructor(e){d(this,"client");this.client=e}async memberAccount(){const e=await this.client.request(Ze);return e.ok?{ok:!0,data:e.data.memberAccount}:e}async registerMemberAccount(e){const t=await this.client.request(tt,e);return t.ok?t.data.registerMemberAccount?{ok:!1,error:m(t.data.registerMemberAccount.__typename)}:{ok:!0}:t}async registerMemberAccountViaMobile(e){const t=await this.client.request(rt,e);return t.ok?t.data.registerMemberAccountViaMobile?{ok:!1,error:m(t.data.registerMemberAccountViaMobile.__typename)}:{ok:!0}:t}async registerMemberAccount__next(e){const t=await this.client.request(at,e);return t.ok?t.data.registerMemberAccount?{ok:!1,error:m(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:m(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:m(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:m(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:m(t.data.verifyMobileNumber.__typename)}:{ok:!0}:t}async createMemberVerification(e){const t=await this.client.request(dt,e);return t.ok?t.data.createMemberVerification?{ok:!1,error:m(t.data.createMemberVerification.__typename)}:{ok:!0}:t}async updateMemberVerification(e){const t=await this.client.request(mt,e);return t.ok?t.data.updateMemberVerification?{ok:!1,error:m(t.data.updateMemberVerification.__typename)}:{ok:!0}:t}async memberVerification(){const e=await this.client.request(et);return e.ok?{ok:!0,data:e.data.memberAccount.verification}:e}async announcements(e){const t=await this.client.request(Ie,e);return t.ok?{ok:!0,data:t.data.announcements}:t}async registerMayaMemberAccount(e){const t=await this.client.request(ot,e);return t.ok?t.data.registerMayaMemberAccount?{ok:!1,error:m(t.data.registerMayaMemberAccount.__typename)}:{ok:!0}:t}async referralCode(){const e=await this.client.request(yt);return e.ok?{ok:!0,data:e.data.referralCode}:e}async updateReferralCode(e){const t=await this.client.request(gt,e);return t.ok?t.data.updateReferralCode?{ok:!1,error:m(t.data.updateReferralCode.__typename)}:{ok:!0}:t}}function S(o){return o.startsWith("+63")?o:o.startsWith("63")?`+${o}`:o.startsWith("0")?`+63${o.substring(1)}`:`+63${o}`}function h(o,e){const t=Y[o]?Y[o]:Y[500];return{name:t.name,message:e??t.message}}const Y={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 Et{constructor(e){d(this,"url");d(this,"platform");this.url=e.url,this.platform=e.platform}get headers(){const e=new Headers;return e.append("Accept","application/json, text/plain"),e.append("Content-Type","application/json"),e.append("Platform-Code",this.platform),e.append("Role","MEMBER"),e}async createSession(e){const t=new Headers(this.headers);if(e.name){const r=`${e.name}:${e.password}`,a=Buffer.from(r).toString("base64");t.set("Authorization",`Basic ${a}`)}if(e.mobileNumber){const a=`${S(e.mobileNumber)}:${e.verificationCode}`,s=Buffer.from(a).toString("base64");console.log(`MobileNumberOTP ${s}`),t.set("Authorization",`MobileNumberOTP ${s}`)}e.sessionId&&t.set("Authorization",`MayaSession ${e.sessionId}`);try{const r=await fetch(`${this.url}/sessions`,{method:"POST",headers:t}),a=await r.json();return r.ok?{ok:!0,data:a}:a.code==="ACCOUNT_BLACKLISTED"?{ok:!1,error:m("AccountBlacklisted")}:{ok:!1,error:h(r.status)}}catch{return{ok:!1,error:h(500)}}}async authenticate(e){const t=new Headers(this.headers);if(e.type==="SECURITY_QUESTION"){t.set("Authorization",`Bearer ${e.token}`);try{const r=await fetch(`${this.url}/session/${e.token}/authenticate`,{method:"POST",headers:t,body:JSON.stringify({secretAnswer:e.secretAnswer})}),a=await r.json();return r.ok?{ok:!0,data:a}:r.status===401||r.status===403?{ok:!1,error:m("InvalidTokenOrSecretAnswer")}:{ok:!1,error:h(r.status)}}catch{return{ok:!1,error:h(500)}}}throw new Error("Invalid input 'type'")}async refreshSession(e){const t=new Headers(this.headers);t.append("Authorization",`Bearer ${e}`);try{const r=await fetch(`${this.url}/session:refresh`,{method:"POST",headers:t}),a=await r.json();return r.ok?{ok:!0,data:a}:a.code==="ACCOUNT_BLACKLISTED"?{ok:!1,error:m("AccountBlacklisted")}:r.status===403||r.status===401?{ok:!1,error:m("InvalidToken")}:{ok:!1,error:h(r.status)}}catch{return{ok:!1,error:h(500)}}}async destroySession(e){const t=new Headers(this.headers);t.append("Authorization",`Bearer ${e}`);try{const r=await fetch(`${this.url}/session`,{method:"DELETE",headers:t});return r.ok?{ok:!0}:{ok:!1,error:h(r.status)}}catch{return{ok:!1,error:h(500)}}}async verifySession(e){const t=new Headers(this.headers);t.append("Authorization",`Bearer ${e}`);try{return(await fetch(`${this.url}/session`,{method:"GET",headers:t})).ok}catch{return!0}}async sendVerificationCode(e){if(e.channel==="EMAIL")throw new Error("Email channel is not yet supported");try{const t=await fetch(`${this.url}/otps`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(t.status===403){const r=await t.json();return{ok:!1,error:h(t.status,r.message)}}return t.ok?{ok:!0}:{ok:!1,error:h(t.status)}}catch{return{ok:!1,error:h(500)}}}}class St{constructor(e){d(this,"url");d(this,"siteId");d(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 a,s,c,u,l,w,g,f,v,M,R,N,I,E,D,P,T,$,x,O,_,G,F,L;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=(a=e==null?void 0:e.filter)==null?void 0:a.type)!=null&&s.equal&&t.set("filter[type][eq]",e.filter.type.equal),(u=(c=e==null?void 0:e.filter)==null?void 0:c.type)!=null&&u.notEqual&&t.set("filter[type][neq]",e.filter.type.notEqual),(w=(l=e==null?void 0:e.filter)==null?void 0:l.type)!=null&&w.in&&t.set("filter[type][in]",e.filter.type.in.join(",")),(f=(g=e==null?void 0:e.filter)==null?void 0:g.type)!=null&&f.notIn&&t.set("filter[type][nin]",e.filter.type.notIn.join(",")),(M=(v=e==null?void 0:e.filter)==null?void 0:v.provider)!=null&&M.equal&&t.set("filter[provider][eq]",e.filter.provider.equal),(N=(R=e==null?void 0:e.filter)==null?void 0:R.provider)!=null&&N.notEqual&&t.set("filter[provider][neq]",e.filter.provider.notEqual),(E=(I=e==null?void 0:e.filter)==null?void 0:I.provider)!=null&&E.in&&t.set("filter[provider][in]",e.filter.provider.in.join(",")),(P=(D=e==null?void 0:e.filter)==null?void 0:D.provider)!=null&&P.notIn&&t.set("filter[provider][nin]",e.filter.provider.notIn.join(",")),($=(T=e==null?void 0:e.filter)==null?void 0:T.tags)!=null&&$.equal&&t.set("filter[tags][eq]",e.filter.tags.equal.toLowerCase()),(O=(x=e==null?void 0:e.filter)==null?void 0:x.tags)!=null&&O.notEqual&&t.set("filter[tags][neq]",e.filter.tags.notEqual.toLowerCase()),(G=(_=e==null?void 0:e.filter)==null?void 0:_.tags)!=null&&G.in&&t.set("filter[tags][in]",e.filter.tags.in.map(k=>k.toLowerCase()).join(",")),(L=(F=e==null?void 0:e.filter)==null?void 0:F.tags)!=null&&L.notIn&&t.set("filter[tags][nin]",e.filter.tags.notIn.map(k=>k.toLowerCase()).join(","));const r=await this.getJson("/games",t);return r.ok?{ok:!0,data:{edges:r.data.data.map(k=>({node:k,cursor:k.cursor})),totalCount:r.data.totalCount??0,pageInfo:{hasNextPage:!!r.data.next,endCursor:r.data.next}}}:r}async game(e){var r;const t=await this.getJson(`/games/${e}`);return((r=t.error)==null?void 0:r.name)==="HttpNotFound"?{ok:!0,data:null}:t.ok?{ok:!0,data:t.data.data}:t}async getJson(e,t){const r=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 a=await fetch(r);return a.ok?{ok:!0,data:await a.json()}:{ok:!1,error:h(a.status)}}catch{return{ok:!1,error:h(500)}}}}class kt{constructor(e){d(this,"client");this.client=e}async file(e){const t=await this.client.request(Te,e);return t.ok?{ok:!0,data:t.data.node}:t}async uploadPrivateImageFile(e){const t=await this.client.upload(_e,e);return t.ok?t.data.uploadPrivateImageFile?{ok:!1,error:m(t.data.uploadPrivateImageFile.__typename)}:{ok:!0}:t}}class Tt{constructor(e){d(this,"client");this.client=e}async gameSession(e){const t=await this.client.request(K.legacy,e);return t.ok?{ok:!0,data:t.data.node?{...t.data.node,game:t.data.node.game.id}:null}:t}async createGameSession(e){const t=await this.client.request(J,e);return t.ok?t.data.createGameSession?{ok:!1,error:m(t.data.createGameSession.__typename)}:{ok:!0}:t}async endGameSession(e){const t=await this.client.request(z.legacy,e);return t.ok?t.data.endGameSession?{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:{ok:!0}:t}}class _t{constructor(e){d(this,"client");this.client=e}async latestBetRecords(){const e=await this.client.request(He);return e.ok?{ok:!0,data:e.data.latestBetRecords}:e}}class vt{constructor(e){d(this,"client");this.client=e}async betRecords(e){const t=await this.client.request(Ve,e);return t.ok?{ok:t.ok,data:t.data.member.betRecords}:t}async transactionRecords(e){const t=await this.client.request(Ye,e);return t.ok?{ok:t.ok,data:t.data.member.transactionRecords}:t}async withdrawalRecords(e){const t=await this.client.request(De,e);return t.ok?{ok:t.ok,data:t.data.member.withdrawalRecords}:t}async depositRecords(e){const t=await this.client.request(Ue,e);return t.ok?{ok:t.ok,data:t.data.member.depositRecords}:t}async depositsCount(){const e=await this.client.request(Le);return e.ok?{ok:e.ok,data:e.data.member.depositsCount}:e}async pointsWalletTransactions(e){const t=await this.client.request(Ne,e);return t.ok?{ok:t.ok,data:t.data.member.pointsWalletTransactions}:t}async activityRecords(e){const t=await this.client.request(wt,e);return t.ok?{ok:t.ok,data:t.data.member.activityRecords}:t}async referrals(e){const t=await this.client.request(bt,e);return t.ok?{ok:t.ok,data:t.data.member.referrals}:t}async referralCommissions(e){const t=await this.client.request(At,e);return t.ok?{ok:t.ok,data:t.data.member.referralCommissions}:t}}class Mt{constructor(e){d(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 Rt{constructor(e){d(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(Ke);return e.ok?{ok:e.ok,data:e.data.cashbacks}:e}async availablePromos(e){const t=await this.client.request(Qe,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(Xe,e);return t.ok?t.data.claimCashbackBonus?{ok:!1,error:m(t.data.claimCashbackBonus.__typename)}:{ok:!0}:{ok:t.ok,error:t.error}}async bonus(){const e=await this.client.request(Je);return e.ok?{ok:e.ok,data:e.data.bonus}:e}async wallet(){const e=await this.client.request(ve);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(We,e);return t.ok?t.data.createGCashDeposit?{ok:!1,error:m(t.data.createGCashDeposit.__typename)}:{ok:!0}:t}async createMayaDeposit(e){const t=await this.client.request(qe,e);return t.ok?t.data.createMayaDeposit?{ok:!1,error:m(t.data.createMayaDeposit.__typename)}:{ok:!0}:t}async createMayaAppDeposit(e){const t=await this.client.request(Be,e);return t.ok?t.data.createMayaAppDeposit?{ok:!1,error:m(t.data.createMayaAppDeposit.__typename)}:{ok:!0}:t}async createGCashWithdrawal(e){const t=await this.client.request(Pe,e);return t.ok?t.data.createGCashWithdrawal?{ok:!1,error:m(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:m(t.data.createMayaWithdrawal.__typename)}:{ok:!0}:t}async createMayaAppWithdrawal(e){const t=await this.client.request(xe,e);return t.ok?t.data.createMayaAppWithdrawal?{ok:!1,error:m(t.data.createMayaAppWithdrawal.__typename)}:{ok:!0}:t}async createBankWithdrawal(e){const t=await this.client.request(Oe,e);return t.ok?t.data.createBankWithdrawal?{ok:!1,error:m(t.data.createBankWithdrawal.__typename)}:{ok:!0}:t}async remainingDailyWithdrawalsCount(){const e=await this.client.request(Ge);return e.ok?{ok:e.ok,data:e.data.remainingDailyWithdrawalsCount}:e}async pointsWallet(){const e=await this.client.request(Me);return e.ok?{ok:e.ok,data:e.data.pointsWallet}:e}async pointsToCashConversion(e){const t=await this.client.request(Re,e);return t.ok?t.data.pointsToCashConversion?{ok:!1,error:m(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 gameSession(e){const t=await this.client.request(K.current,e);return t.ok?{ok:!0,data:t.data.node}:t}async createGameSession(e){const t=await this.client.request(J,e);return t.ok?t.data.createGameSession?{ok:!1,error:m(t.data.createGameSession.__typename)}:{ok:!0}:t}async endGameSession(e){const t=await this.client.request(z.current,e);return t.ok?t.data.endGameSession?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:t}async validateMayaSession(){const e=await this.client.request(ht);return e.ok?e.data.validateMayaSession?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:e}}function Nt(o,e,t){return o<e?e:o>t?t:o}function j(o){return Object.prototype.toString.call(o)==="[object Object]"&&Object(o)===o}function It(o){const e=[];function t(r,a=[]){for(const s in r){const c=r[s];j(c)?t(c,[...a,s]):Array.isArray(c)?t(Dt(c),[...a,s]):e.push({key:[...a,s],value:c})}}return t(o),e}function Dt(o){return o.reduce((e,t,r)=>(e[r]=t,e),{})}class U{constructor(e,t){d(this,"url");d(this,"options");d(this,"middlewares");var a;const r=new Headers((a=t==null?void 0:t.fetchOptions)==null?void 0:a.headers);this.url=e,this.options={...t==null?void 0:t.fetchOptions,headers:r},this.middlewares=(t==null?void 0:t.middlewares)??[]}async request(e,t){const r=JSON.stringify({query:e,variables:t}),a=new Headers(this.options.headers);a.set("Content-Type","application/json"),a.set("Accept","application/json");const s=await this.runMiddlewares(new Request(this.url,{...this.options,body:r,headers:a,method:"POST"}));return await this.exec(s)}async upload(e,t){const r=this.createUploadBody(e,t),a=new Headers(this.options.headers);a.delete("Content-Type");const s=await this.runMiddlewares(new Request(this.url,{...this.options,body:r,headers:a,method:"POST"}));return await this.exec(s)}async exec(e){var t,r,a,s,c,u;try{const l=await fetch(e);if(!l.ok)return{ok:!1,error:h(l.status)};const w=await l.json(),g=w.data,f=(t=w.errors)==null?void 0:t.at(0);return f?((r=f.extensions)==null?void 0:r.code)==="FORBIDDEN"||((a=f.extensions)==null?void 0:a.code)==="ACCESS_TOKEN_EXPIRED"?{ok:!1,error:h(403,f.message)}:((s=f.extensions)==null?void 0:s.code)==="UNAUTHORIZED"?{ok:!1,error:h(401,f.message)}:((c=f.extensions)==null?void 0:c.code)==="BAD_USER_INPUT"||((u=f.extensions)==null?void 0:u.code)==="BAD_REQUEST"?{ok:!1,error:h(400,f.message)}:{ok:!1,error:h(500,f.message)}:{ok:!0,data:g}}catch{return{ok:!1,error:h(500)}}}async runMiddlewares(e){let t=e.clone();for(const r of this.middlewares)t=await r(t);return t}createUploadBody(e,t){const r=It(t).filter(c=>c.value instanceof File||c.value instanceof Blob),a=new FormData;a.append("operations",JSON.stringify({query:e,variables:t}));const s={};return r.forEach((c,u)=>{s[u.toString()]=[`variables.${c.key.join(".")}`]}),a.append("map",JSON.stringify(s)),r.forEach((c,u)=>{a.append(u.toString(),c.value)}),a}}async function A(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 Z{constructor(e){d(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 Q(o){return new Date(o.getTime())}function W(o,e){const t=Q(o);return t.setDate(t.getDate()+e),t}function q(o,e){const t=Q(o);return t.setMinutes(t.getMinutes()+e),t}function ee(o,e){return o.getTime()>e.getTime()}function te(o){return new Promise(e=>{setTimeout(e,o)})}function re(o,e){const{until:t,interval:r=1e3,maxAttempt:a=3}=e;async function s(c,u){const l=u??a,w=await o(...c);return t(w)?w:l>1?(await te(r*((a-l)/2)),s(c,l-1)):w}return async(...c)=>await s(c)}function B(o,e){const t=Q(o);return t.setMinutes(t.getMinutes()-e),t}class Pt{constructor(e){d(this,"logger");d(this,"storageKey","session");d(this,"authService");d(this,"walletService");d(this,"_refreshing",!1);this.authService=e.authService,this.walletService=e.walletService,this.logger=new Z({enabled:e.logs??!1})}get refreshing(){return this._refreshing}set refreshing(e){this._refreshing=e}async create(e){var a;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 c=await re(()=>this.walletService.mayaSession({id:e.sessionId}),{until:g=>{var f;return g.ok&&((f=g.data)==null?void 0:f.member)!=null},interval:1e3,maxAttempt:5})();if(!c.ok)return c;if(!((a=c.data)!=null&&a.member))return{ok:!1,error:{name:"HttpForbidden",message:"Forbidden"}};const l=await re(()=>this.authService.createSession(e),{until:g=>g.ok,interval:1e3,maxAttempt:5})();if(!l.ok)return l;const w=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...l.data,accessTokenExpiresAt:q(w,8).getTime(),refreshTokenExpiresAt:B(W(w,30),2).getTime()})),{ok:!0,data:null}}if(e.type==="MOBILE_NUMBER"){const s=await this.authService.createSession(e);if(s.ok){const c=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...s.data,accessTokenExpiresAt:q(c,8).getTime(),refreshTokenExpiresAt:B(W(c,30),2).getTime()})),{ok:!0,data:null}}return s}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 r=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...t.data,accessTokenExpiresAt:q(r,8).getTime(),refreshTokenExpiresAt:B(W(r,30),2).getTime()})),{ok:!0,data:null}}async createFromAuthenticator(e){const t=await this.authService.authenticate(e);if(t.ok){const r=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:q(r,8).getTime(),refreshTokenExpiresAt:B(W(r,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 te(1e3),await this.get();const e=window.localStorage.getItem(this.storageKey);if(!e)return{ok:!0,data:null};try{let t=JSON.parse(e),r=new Date;const a=new Date(t.accessTokenExpiresAt),s=new Date(t.refreshTokenExpiresAt);if(ee(r,s))return this.logger.warn("Session expired. Logging out.."),window.localStorage.removeItem(this.storageKey),{ok:!1,error:{name:"SessionExpired",message:"Session expired."}};if(ee(r,a)){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!"),r=new Date,t={...t,...c.data,accessTokenExpiresAt:q(r,8).getTime(),refreshTokenExpiresAt:B(W(r,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 r,a,s;if(this.isServer)return this.logger.warn("'localStorage' is not available on the server."),!0;const e=await this.get();if(((r=e.error)==null?void 0:r.name)==="InvalidToken"||((a=e.error)==null?void 0:a.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 C(o){const e={};for(const t in o){const r=o[t];if(r!==null&&r!==void 0){if(j(r)){e[t]=C(r);continue}if(Array.isArray(r)){e[t]=r.map(a=>j(a)?C(a):a);continue}e[t]=r}}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 $t{constructor(e){d(this,"staticService");const t=(e==null?void 0:e.environment)==="development";this.staticService=new Mt({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),pointsWalletTransaction:this.pointsWalletTransaction.bind(this),activityRecord:this.activityRecord.bind(this),referral:this.referral.bind(this),referralCommission:this.referralCommission.bind(this)}}site(e){const t={id:e.id,name:e.name,logo:e.logo??void 0,fields:e.config.fields};return C(t)}platform(e){var t,r,a,s,c,u,l,w,g,f,v,M,R,N,I,E,D,P,T,$,x,O,_,G,F,L,k,ae,oe,ne,ie,se,ce,de,me,ue,le,pe,fe,he,we,ye,ge,be,Ae,Ce,Ee,Se,ke;return{paymentSettings:{minimumFirstDepositAmount:i(e.minimumFirstDepositAmount),restrictWithdrawalsToVerifiedMembers:e.restrictWithdrawalsToVerifiedMembers,depositGateway:{bank:{androidEnabled:((t=e.bankDepositGatewaySettings)==null?void 0:t.androidEnabled)??!1,iosEnabled:((r=e.bankDepositGatewaySettings)==null?void 0:r.iosEnabled)??!1,webEnabled:((a=e.bankDepositGatewaySettings)==null?void 0:a.webEnabled)??!1,mobileWebEnabled:((s=e.bankDepositGatewaySettings)==null?void 0:s.mobileWebEnabled)??!1,minimumAmount:i((c=e.bankDepositGatewaySettings)==null?void 0:c.minimumAmount),maximumAmount:i((u=e.bankDepositGatewaySettings)==null?void 0:u.maximumAmount)},gcash:{androidEnabled:((l=e.gcashDepositGatewaySettings)==null?void 0:l.androidEnabled)??!1,iosEnabled:((w=e.gcashDepositGatewaySettings)==null?void 0:w.iosEnabled)??!1,webEnabled:((g=e.gcashDepositGatewaySettings)==null?void 0:g.webEnabled)??!1,mobileWebEnabled:((f=e.gcashDepositGatewaySettings)==null?void 0:f.mobileWebEnabled)??!1,minimumAmount:i((v=e.gcashDepositGatewaySettings)==null?void 0:v.minimumAmount),maximumAmount:i((M=e.gcashDepositGatewaySettings)==null?void 0:M.maximumAmount)},maya:{androidEnabled:((R=e.mayaDepositGatewaySettings)==null?void 0:R.androidEnabled)??!1,iosEnabled:((N=e.mayaDepositGatewaySettings)==null?void 0:N.iosEnabled)??!1,webEnabled:((I=e.mayaDepositGatewaySettings)==null?void 0:I.webEnabled)??!1,mobileWebEnabled:((E=e.mayaDepositGatewaySettings)==null?void 0:E.mobileWebEnabled)??!1,minimumAmount:i((D=e.mayaDepositGatewaySettings)==null?void 0:D.minimumAmount),maximumAmount:i((P=e.mayaDepositGatewaySettings)==null?void 0:P.maximumAmount)},mayaApp:{androidEnabled:((T=e.mayaAppDepositGatewaySettings)==null?void 0:T.androidEnabled)??!1,iosEnabled:(($=e.mayaAppDepositGatewaySettings)==null?void 0:$.iosEnabled)??!1,webEnabled:((x=e.mayaAppDepositGatewaySettings)==null?void 0:x.webEnabled)??!1,mobileWebEnabled:((O=e.mayaAppDepositGatewaySettings)==null?void 0:O.mobileWebEnabled)??!1,minimumAmount:i((_=e.mayaAppDepositGatewaySettings)==null?void 0:_.minimumAmount),maximumAmount:i((G=e.mayaAppDepositGatewaySettings)==null?void 0:G.maximumAmount)}},withdrawalGateway:{bank:{androidEnabled:((F=e.bankWithdrawalGatewaySettings)==null?void 0:F.androidEnabled)??!1,iosEnabled:((L=e.bankWithdrawalGatewaySettings)==null?void 0:L.iosEnabled)??!1,webEnabled:((k=e.bankWithdrawalGatewaySettings)==null?void 0:k.webEnabled)??!1,mobileWebEnabled:((ae=e.bankWithdrawalGatewaySettings)==null?void 0:ae.mobileWebEnabled)??!1,minimumAmount:i((oe=e.bankWithdrawalGatewaySettings)==null?void 0:oe.minimumAmount),maximumAmount:i((ne=e.bankWithdrawalGatewaySettings)==null?void 0:ne.maximumAmount)},gcash:{androidEnabled:((ie=e.gcashWithdrawalGatewaySettings)==null?void 0:ie.androidEnabled)??!1,iosEnabled:((se=e.gcashWithdrawalGatewaySettings)==null?void 0:se.iosEnabled)??!1,webEnabled:((ce=e.gcashWithdrawalGatewaySettings)==null?void 0:ce.webEnabled)??!1,mobileWebEnabled:((de=e.gcashWithdrawalGatewaySettings)==null?void 0:de.mobileWebEnabled)??!1,minimumAmount:i((me=e.gcashWithdrawalGatewaySettings)==null?void 0:me.minimumAmount),maximumAmount:i((ue=e.gcashWithdrawalGatewaySettings)==null?void 0:ue.maximumAmount,1e6)},maya:{androidEnabled:((le=e.mayaWithdrawalGatewaySettings)==null?void 0:le.androidEnabled)??!1,iosEnabled:((pe=e.mayaWithdrawalGatewaySettings)==null?void 0:pe.iosEnabled)??!1,webEnabled:((fe=e.mayaWithdrawalGatewaySettings)==null?void 0:fe.webEnabled)??!1,mobileWebEnabled:((he=e.mayaWithdrawalGatewaySettings)==null?void 0:he.mobileWebEnabled)??!1,minimumAmount:i((we=e.mayaWithdrawalGatewaySettings)==null?void 0:we.minimumAmount),maximumAmount:i((ye=e.mayaWithdrawalGatewaySettings)==null?void 0:ye.maximumAmount)},mayaApp:{androidEnabled:((ge=e.mayaAppWithdrawalGatewaySettings)==null?void 0:ge.androidEnabled)??!1,iosEnabled:((be=e.mayaAppWithdrawalGatewaySettings)==null?void 0:be.iosEnabled)??!1,webEnabled:((Ae=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Ae.webEnabled)??!1,mobileWebEnabled:((Ce=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Ce.mobileWebEnabled)??!1,minimumAmount:i((Ee=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Ee.minimumAmount),maximumAmount:i((Se=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Se.maximumAmount,1e6)}}},pointsClubSettings:{multiplier:i((ke=e.pointsClubSettings)==null?void 0:ke.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,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)};return C(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,permanentAddress:e.permanentAddress,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.completionPercentage,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 C(t)}deposit(e){const t={id:e.id,type:e.type,status:e.status,checkoutUrl:e.checkoutUrl??void 0};return C(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 C(t)}betRecord(e){var r;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:{name:e.game.name,type:e.game.type,images:this.staticService.gameThumbnails(e.game),provider:e.game.provider},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:((r=e.metadata)==null?void 0:r.odds)??void 0}};return C(t)}latestBetRecord(e){return{id:e.id,member:e.member,game:{name:e.game.name,type:e.game.type,images:this.staticService.gameThumbnails(e.game),provider:e.game.provider},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 C(t)}game(e){return{id:e.id,type:e.type,tags:e.tags??[],name:e.name,images:[e.customImage,e.image].filter(Boolean),provider:e.provider,reference:e.reference}}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 C(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),turnoverContributionPercentagePerGameProvider:Object.entries(e.turnoverContributionPercentagePerGameProvider).reduce((r,[a,s])=>(r[a]=i(s,0),r),{})}}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 C(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 C(t)}pointsWallet(e){return{id:e.id,points:i(e.points,0),account:e.account,dateTimeCreated:new Date(e.dateTimeCreated)}}pointsWalletTransaction(e){return{id:e.id,type:e.type,amount:i(e.amount,0),balance:i(e.balance,0),dateTimeCreated:new Date(e.dateTimeCreated)}}activityRecord(e){const t={id:e.id,type:e.type,amount:e.amount?i(e.amount,0):void 0,domain:e.domain??void 0,details:e.details,dateTimeCreated:new Date(e.dateTimeCreated)};return C(t)}referral(e){return{id:e.id,level:e.level,upline:e.upline,downline:e.downline,turnover:i(e.turnover,0),commision:i(e.commision,0),dateTimeCreated:new Date(e.dateTimeCreated)}}referralCommission(e){return{id:e.id,commission:i(e.commission,0),level1Commission:i(e.level1Commission,0),level2Commission:i(e.level2Commission,0),level3Commission:i(e.level3Commission,0),referralsCount:e.referralsCount,level1ReferralsCount:e.level1ReferralsCount,level2ReferralsCount:e.level2ReferralsCount,level3ReferralsCount:e.level3ReferralsCount,referralCode:e.referralCode,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}}class xt{constructor(e){d(this,"cmsPortalService");d(this,"authService");d(this,"gameService");d(this,"fileService");d(this,"walletService");d(this,"accountService");d(this,"reportService");d(this,"portalService");d(this,"sessionManager");d(this,"transformer");d(this,"logger");const{site:t,sitePlatform:r,platform:a,environment:s,logs:c}=e,u=s==="production";this.transformer=new $t({environment:s}),this.logger=new Z({enabled:c??!1});const l=u?"https://auth.opexa.io":"https://auth.development.opexa.io",w=u?"https://wallet.opexa.io/graphql":"https://wallet.development.opexa.io/graphql",g=u?"https://report.opexa.io/graphql":"https://report.development.opexa.io/graphql",f=u?"https://account.opexa.io/graphql":"https://account.development.opexa.io/graphql",v=u?"https://portal.opexa.io/graphql":"https://portal.development.opexa.io/graphql",M=u?"https://file.opexa.io/graphql":"https://file.development.opexa.io/graphql",R=u?"https://game.opexa.io/graphql":"https://game.development.opexa.io/graphql",N=u?"https://portal-api.opexacms.io/v1":"https://portal-api.development.opexacms.io/v1",I=new St({url:N,site:t,platform:r}),E={middlewares:[this.authMiddleware],fetchOptions:{headers:{Role:"MEMBER","Platform-Code":a}}},D=new Tt(new U(R,E)),P=new kt(new U(M,E)),T=new Rt(new U(w,E)),$=new Ct(new U(f,E)),x=new vt(new U(g,E)),O=new _t(new U(v,E)),_=new Et({url:l,platform:a}),G=new Pt({logs:c,authService:_,walletService:T});this.authService=_,this.gameService=D,this.fileService=P,this.walletService=T,this.accountService=$,this.reportService=x,this.portalService=O,this.sessionManager=G,this.cmsPortalService=I}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=Nt(e.interval??3e4,3e4,6e4);let r=null;const a=()=>setTimeout(async()=>{await this.sessionManager.verify()||await e.onInvalid(),r=a()},t);return r=a(),function(){r&&clearTimeout(r)}}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 validateMayaSession(){return await this.walletService.validateMayaSession()}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=await this.accountService.memberAccount();return e.ok?{ok:!0,data:this.transformer.transform.account(e.data)}:e}async createAccount(e){const t=e.id??p.ObjectId.generate(b.Account).toString(),r=await this.accountService.registerMemberAccount({input:{id:t,btag:e.btag,name:e.name,domain:e.domain,birthDay:typeof e.dateOfBirth=="string"?e.dateOfBirth:e.dateOfBirth.toISOString(),password:await A(e.password),mobileNumber:S(e.mobileNumber)},referralCode:e.referralCode,verificationCode:e.verificationCode,reCAPTCHAResponse:e.reCAPTCHAResponse});return r.ok?{ok:!0,data:{id:t}}:r}async createAccount__next(e){const t=e.id??p.ObjectId.generate(b.Account).toString();if(e.type==="MOBILE_NUMBER"){const a=await this.accountService.registerMemberAccountViaMobile({input:{id:t,mobileNumber:S(e.mobileNumber)},referralCode:e.referralCode,reCAPTCHAResponse:e.reCAPTCHAResponse,verificationCode:e.verificationCode});return a.ok?{ok:!0,data:{id:t}}:a}const r=await this.accountService.registerMemberAccount__next({input:{id:t,name:e.name,password:await A(e.password),mobileNumber:e.mobileNumber?S(e.mobileNumber):void 0},reCAPTCHAResponse:e.reCAPTCHAResponse});return r.ok?{ok:!0,data:{id:t}}:r}async registerMayaAccount(e){return await this.accountService.registerMayaMemberAccount({input:{name:e.name,password:await A(e.password),domain:e.domain}})}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:S(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??p.ObjectId.generate(b.Verification).toString(),r=await this.accountService.createMemberVerification({input:{id:t,...e}});return r.ok?{ok:!0,data:{id:t}}:r}async updateVerificationDetails(e,t){return await this.accountService.updateMemberVerification({input:{id:e,data:{...t}}})}async resetPassword(e){return await this.accountService.resetPassword({input:{mobileNumber:S(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:S(e)}})}async sendVerificationCode__next(e){return this.authService.sendVerificationCode({channel:"SMS",recipient:S(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:r,node:a})=>({...this.transformer.transform.announcement(a),cursor:r})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async createWithdrawal(e){const t=e.id??p.ObjectId.generate(b.Withdrawal).toString();if(e.type==="BANK"){const r=await this.walletService.createBankWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await A(e.transactionPassword)}});if(!r.ok)return r}if(e.type==="GCASH"){const r=await this.walletService.createGCashWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await A(e.transactionPassword),recipientMobileNumber:S(e.recipientMobileNumber)}});if(!r.ok)return r}if(e.type==="MAYA"){const r=await this.walletService.createMayaWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await A(e.transactionPassword),recipientMobileNumber:S(e.recipientMobileNumber)}});if(!r.ok)return r}if(e.type==="MAYA_APP"){const r=await this.walletService.createMayaAppWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await A(e.transactionPassword)}});if(!r.ok)return r}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:r,node:a})=>({...this.transformer.transform.withdrawalRecord(a),cursor:r})),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??p.ObjectId.generate(b.Deposit).toString();if(e.type==="MAYA"){const r=await this.walletService.createMayaDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!r.ok)return r}if(e.type==="MAYA_APP"){const r=await this.walletService.createMayaAppDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!r.ok)return r}if(e.type==="GCASH"){const r=await this.walletService.createGCashDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!r.ok)return r}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:r,node:a})=>({...this.transformer.transform.depositRecord(a),cursor:r})),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,...(e==null?void 0:e.filter)&&{filter:{...e.filter.status&&{game:e.filter.status},...e.filter.serialCode&&{game:e.filter.serialCode},...e.filter.vendorRoundId&&{game:e.filter.vendorRoundId},...e.filter.dateTimeCreated&&{dateTimeCreated:e.filter.dateTimeCreated},...e.filter.gameType&&{game__type:e.filter.gameType},...e.filter.gameProvider&&{game__provider:e.filter.gameProvider}}}});return t.ok?{ok:!0,data:{betRecords:t.data.edges.map(({cursor:r,node:a})=>({...this.transformer.transform.betRecord(a),cursor:r})),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:r,node:a})=>({...this.transformer.transform.transactionRecord(a),cursor:r})),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.cmsPortalService.games(e);return t.ok?{ok:!0,data:{games:t.data.edges.map(({cursor:r,node:a})=>({...this.transformer.transform.game(a),cursor:r})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async gameSession(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 r=await this.gameService.gameSession({id:e});return r.ok?{ok:!0,data:r.data?this.transformer.transform.gameSession(r.data):null}:r}async createGameSession(e){const t=e.id??p.ObjectId.generate(b.GameSession).toString();if(e.game.startsWith("SPORTS:")){const u=await p.ObjectId.generateFromKey(b.Game,e.game).then(w=>w.toString()),l=await this.gameService.createGameSession({input:{id:t,game:u}});return l.ok?{ok:!0,data:{id:t}}:l}const r=await this.game(e.game);if(!r.data)return{ok:!1,error:{name:"GameDoesNotExistError",message:"Game does not exist"}};const{provider:a,reference:s}=r.data,c=Gt(a)?await this.walletService.createGameSession({input:{id:t,game:s}}):await this.gameService.createGameSession({input:{id:t,game:s}});return c.ok?{ok:!0,data:{id:t}}:c}async endGameSession(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??p.ObjectId.generate(b.File).toString(),r=await this.fileService.uploadPrivateImageFile({input:{id:t,file:e.file}});return r.ok?{ok:!0,data:{id:t}}:r}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()}})}async pointsWalletTransactions(e){const t=await this.reportService.pointsWalletTransactions(e);return t.ok?{ok:!0,data:{pointsWalletTransactions:t.data.edges.map(({cursor:r,node:a})=>({...this.transformer.transform.pointsWalletTransaction(a),cursor:r})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async activityRecords(e){const t=await this.reportService.activityRecords(e);return t.ok?{ok:!0,data:{activityRecords:t.data.edges.map(({cursor:r,node:a})=>({...this.transformer.transform.activityRecord(a),cursor:r})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async referralCode(){const e=await this.accountService.referralCode();return e.ok?{ok:!0,data:e.data??null}:e}async updateReferralCode(e){return await this.accountService.updateReferralCode({input:e})}async referrals(e){const t=await this.reportService.referrals(e);return t.ok?{ok:!0,data:{referrals:t.data.edges.map(({cursor:r,node:a})=>({...this.transformer.transform.referral(a),cursor:r})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async referralCommissions(e){const t=await this.reportService.referralCommissions(e);return t.ok?{ok:!0,data:{referralCommissions:t.data.edges.map(({cursor:r,node:a})=>({...this.transformer.transform.referralCommission(a),cursor:r})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}}const Ot=["RTG","DARWIN","DRBINGO","MEGABALL","EVOLUTION","EVOLUTION_NETENT","EVOLUTION_REDTIGER"];function Gt(o){return Ot.some(e=>e===o)}Object.defineProperty(y,"ObjectId",{enumerable:!0,get:()=>p.ObjectId}),y.ObjectType=b,y.Sdk=xt,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
|
|
1080
1111
|
//# sourceMappingURL=index.js.map
|