@opexa/portal-sdk 0.0.13 → 0.0.15
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 +50 -50
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +320 -312
- package/dist/index.mjs.map +1 -1
- package/dist/utils/flatten.d.ts +4 -0
- package/dist/utils/graphql-client.d.ts +0 -1
- package/dist/utils/is-plain-object.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(l,
|
|
1
|
+
(function(l,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("@opexa/object-id")):typeof define=="function"&&define.amd?define(["exports","@opexa/object-id"],u):(l=typeof globalThis<"u"?globalThis:l||self,u(l.sdk={},l.objectId))})(this,function(l,u){"use strict";var _t=Object.defineProperty;var vt=(l,u,f)=>u in l?_t(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f;var m=(l,u,f)=>vt(l,typeof u!="symbol"?u+"":u,f);const f={Account:8,Deposit:9,Withdrawal:14,Verification:15,File:16,GameSession:204,MayaSession:230};function i(o,...e){let t="";for(const[a,r]of o.entries()){const s=e.at(a)??"";t=`${t}${r}${s}`}return t.trim()}const ge=i`
|
|
2
2
|
query Announcements($first: Int, $after: Cursor, $filter: AnnouncementFilterInput) {
|
|
3
3
|
announcements(first: $first, after: $after, filter: $filter) {
|
|
4
4
|
edges {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
name
|
|
32
32
|
provider
|
|
33
33
|
}
|
|
34
|
-
`,
|
|
34
|
+
`,Ee=i`
|
|
35
35
|
${E}
|
|
36
36
|
|
|
37
37
|
query Game($id: ObjectId!) {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
`,
|
|
44
|
+
`,Ae=i`
|
|
45
45
|
${E}
|
|
46
46
|
|
|
47
47
|
query Games($after: Cursor, $first: Int, $filter: GameFilterInput) {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
`,
|
|
64
|
+
`,Se=i`
|
|
65
65
|
${E}
|
|
66
66
|
|
|
67
67
|
query GamesByName($search: String!, $filter: GameFilterInput, $first: Int) {
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
...GameFragment
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
`,
|
|
72
|
+
`,ke=i`
|
|
73
73
|
query GameSession($id: ObjectId!) {
|
|
74
74
|
node(id: $id) {
|
|
75
75
|
... on GameSession {
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
`,
|
|
84
|
+
`,Ce=i`
|
|
85
85
|
mutation CreateGameSession($input: CreateGameSessionInput!) {
|
|
86
86
|
createGameSession(input: $input) {
|
|
87
87
|
... on GameDoesNotExistError {
|
|
@@ -89,11 +89,11 @@
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
`,
|
|
92
|
+
`,Te=i`
|
|
93
93
|
mutation EndGameSession($input: EndGameSessionInput!) {
|
|
94
94
|
endGameSession(input: $input)
|
|
95
95
|
}
|
|
96
|
-
`,
|
|
96
|
+
`,_e=i`
|
|
97
97
|
${E}
|
|
98
98
|
|
|
99
99
|
query BetRecords($first: Int, $after: Cursor, $filter: BetRecordFilterInput) {
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
-
`,
|
|
136
|
+
`,ve=i`
|
|
137
137
|
query LatestBetRecords {
|
|
138
138
|
latestBetRecords {
|
|
139
139
|
id
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
status
|
|
161
161
|
dateTimeCreated
|
|
162
162
|
}
|
|
163
|
-
`,
|
|
163
|
+
`,Me=i`
|
|
164
164
|
${T}
|
|
165
165
|
|
|
166
166
|
query File($id: ObjectId!) {
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
|
|
173
|
+
`,De=i`
|
|
174
174
|
mutation UploadPrivateImageFile($input: UploadFileInput!) {
|
|
175
175
|
uploadPrivateImageFile(input: $input) {
|
|
176
176
|
... on FileFormatNotSupportedError {
|
|
@@ -184,7 +184,7 @@
|
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
|
|
187
|
+
`,N=i`
|
|
188
188
|
${T}
|
|
189
189
|
|
|
190
190
|
fragment CashbackFragment on Cashback {
|
|
@@ -200,8 +200,8 @@
|
|
|
200
200
|
dateTimeCreated
|
|
201
201
|
dateTimeLastUpdated
|
|
202
202
|
}
|
|
203
|
-
`,
|
|
204
|
-
${
|
|
203
|
+
`,Ne=i`
|
|
204
|
+
${N}
|
|
205
205
|
|
|
206
206
|
query Cashbacks {
|
|
207
207
|
cashbacks {
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
dateTimeCreated
|
|
228
228
|
dateTimeLastUpdated
|
|
229
229
|
}
|
|
230
|
-
`,
|
|
230
|
+
`,Ie=i`
|
|
231
231
|
${v}
|
|
232
232
|
|
|
233
233
|
query Promos {
|
|
@@ -235,7 +235,7 @@
|
|
|
235
235
|
...PromoFragment
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
`,
|
|
238
|
+
`,Re=i`
|
|
239
239
|
${v}
|
|
240
240
|
|
|
241
241
|
query AvailablePromos($filter: PromoFilterInput) {
|
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
...PromoFragment
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
`,
|
|
246
|
+
`,Pe=i`
|
|
247
247
|
${v}
|
|
248
248
|
|
|
249
249
|
query Bonus {
|
|
@@ -273,7 +273,7 @@
|
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
`,xe=i`
|
|
276
|
-
${
|
|
276
|
+
${N}
|
|
277
277
|
|
|
278
278
|
query CashbackBonuses {
|
|
279
279
|
cashbackBonuses {
|
|
@@ -286,7 +286,7 @@
|
|
|
286
286
|
dateTimeLastUpdated
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
|
-
`,
|
|
289
|
+
`,Ge=i`
|
|
290
290
|
mutation ClaimCashbackBonus($input: ClaimCashbackBonusInput!) {
|
|
291
291
|
claimCashbackBonus(input: $input) {
|
|
292
292
|
... on CashbackBonusDoesNotExistError {
|
|
@@ -294,7 +294,7 @@
|
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
|
-
|
|
297
|
+
`,$e=i`
|
|
298
298
|
query DepositRecords($after: Cursor, $first: Int, $filter: DepositRecordFilterInput) {
|
|
299
299
|
member {
|
|
300
300
|
depositRecords(after: $after, first: $first, filter: $filter) {
|
|
@@ -323,7 +323,7 @@
|
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
|
-
|
|
326
|
+
`,Be=i`
|
|
327
327
|
mutation CreateGCashDeposit($input: CreateGCashDepositInput!) {
|
|
328
328
|
createGCashDeposit(input: $input) {
|
|
329
329
|
... on DepositPromoMaximumAmountExceededError {
|
|
@@ -352,7 +352,7 @@
|
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
|
-
`,
|
|
355
|
+
`,We=i`
|
|
356
356
|
mutation CreateMayaDeposit($input: CreateMayaDepositInput!) {
|
|
357
357
|
createMayaDeposit(input: $input) {
|
|
358
358
|
... on DepositPromoMaximumAmountExceededError {
|
|
@@ -381,7 +381,7 @@
|
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
|
-
`,
|
|
384
|
+
`,Ue=i`
|
|
385
385
|
mutation CreateMayaAppDeposit($input: CreateMayaAppDepositInput!) {
|
|
386
386
|
createMayaAppDeposit(input: $input) {
|
|
387
387
|
... on DepositPromoMaximumAmountExceededError {
|
|
@@ -410,7 +410,7 @@
|
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
`,
|
|
413
|
+
`,Oe=i`
|
|
414
414
|
query Deposit($id: ObjectId!) {
|
|
415
415
|
node(id: $id) {
|
|
416
416
|
... on GCashDeposit {
|
|
@@ -450,19 +450,19 @@
|
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
`,
|
|
453
|
+
`,qe=i`
|
|
454
454
|
query DepositsCount {
|
|
455
455
|
member {
|
|
456
456
|
depositsCount
|
|
457
457
|
}
|
|
458
458
|
}
|
|
459
|
-
`,
|
|
459
|
+
`,Fe=i`
|
|
460
460
|
query Member {
|
|
461
461
|
member {
|
|
462
462
|
dateTimeLastActive
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
|
-
`,
|
|
465
|
+
`,Le=i`
|
|
466
466
|
query MemberAccount {
|
|
467
467
|
memberAccount: self {
|
|
468
468
|
... on MemberAccount {
|
|
@@ -486,7 +486,7 @@
|
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
488
|
}
|
|
489
|
-
`,
|
|
489
|
+
`,Ve=i`
|
|
490
490
|
${T}
|
|
491
491
|
|
|
492
492
|
query MemberVerification {
|
|
@@ -510,7 +510,7 @@
|
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
|
-
`,
|
|
513
|
+
`,Ye=i`
|
|
514
514
|
mutation RegisterMemberAccount(
|
|
515
515
|
$input: RegisterMemberAccountInput!
|
|
516
516
|
$referralCode: String
|
|
@@ -546,7 +546,7 @@
|
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
|
-
`,
|
|
549
|
+
`,He=i`
|
|
550
550
|
mutation UpdateMemberAccount($input: UpdateMemberAccountInput!) {
|
|
551
551
|
updateMemberAccount(input: $input) {
|
|
552
552
|
... on AccountNameNotAvailableError {
|
|
@@ -572,7 +572,7 @@
|
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
574
|
}
|
|
575
|
-
`,
|
|
575
|
+
`,je=i`
|
|
576
576
|
mutation ResetPassword($input: ResetPasswordInput!, $verificationCode: String) {
|
|
577
577
|
resetPassword(input: $input, verificationCode: $verificationCode) {
|
|
578
578
|
... on AccountNotFoundError {
|
|
@@ -583,11 +583,11 @@
|
|
|
583
583
|
}
|
|
584
584
|
}
|
|
585
585
|
}
|
|
586
|
-
`,
|
|
586
|
+
`,Qe=i`
|
|
587
587
|
mutation DeleteMemberAccount($input: DeleteMemberAccountInput!) {
|
|
588
588
|
deleteMemberAccount(input: $input)
|
|
589
589
|
}
|
|
590
|
-
`,
|
|
590
|
+
`,Ke=i`
|
|
591
591
|
mutation SendVerificationCode($input: SendVerificationCodeInput!) {
|
|
592
592
|
sendVerificationCode(input: $input) {
|
|
593
593
|
... on InvalidPlatformError {
|
|
@@ -598,7 +598,7 @@
|
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
600
|
}
|
|
601
|
-
`,
|
|
601
|
+
`,ze=i`
|
|
602
602
|
mutation VerifyMobileNumber($input: VerifyMobileNumberInput!) {
|
|
603
603
|
verifyMobileNumber(input: $input) {
|
|
604
604
|
... on InvalidSMSVerificationCodeError {
|
|
@@ -609,7 +609,7 @@
|
|
|
609
609
|
}
|
|
610
610
|
}
|
|
611
611
|
}
|
|
612
|
-
`,
|
|
612
|
+
`,Je=i`
|
|
613
613
|
mutation CreateMemberVerification($input: CreateMemberVerificationInput!) {
|
|
614
614
|
createMemberVerification(input: $input) {
|
|
615
615
|
... on FileDoesNotExistError {
|
|
@@ -623,7 +623,7 @@
|
|
|
623
623
|
}
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
|
-
`,
|
|
626
|
+
`,Xe=i`
|
|
627
627
|
mutation UpdateMemberVerification($input: UpdateMemberVerificationInput!) {
|
|
628
628
|
updateMemberVerification(input: $input) {
|
|
629
629
|
... on FileDoesNotExistError {
|
|
@@ -640,7 +640,7 @@
|
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
642
|
}
|
|
643
|
-
`,
|
|
643
|
+
`,Ze=i`
|
|
644
644
|
query ProfileCompletion {
|
|
645
645
|
profileCompletion {
|
|
646
646
|
completionPercentage
|
|
@@ -651,7 +651,7 @@
|
|
|
651
651
|
accountPassword
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
|
-
`,
|
|
654
|
+
`,et=i`
|
|
655
655
|
fragment DepositGatewaySettingsCoreData on DepositGatewaySettings {
|
|
656
656
|
minimumAmount
|
|
657
657
|
maximumAmount
|
|
@@ -705,7 +705,7 @@
|
|
|
705
705
|
multiplier
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
|
-
`,
|
|
708
|
+
`,tt=i`
|
|
709
709
|
query PointsWallet {
|
|
710
710
|
pointsWallet {
|
|
711
711
|
id
|
|
@@ -714,7 +714,7 @@
|
|
|
714
714
|
dateTimeCreated
|
|
715
715
|
}
|
|
716
716
|
}
|
|
717
|
-
`,
|
|
717
|
+
`,at=i`
|
|
718
718
|
mutation PointsToCashConversion($input: PointsToCashConversionInput!) {
|
|
719
719
|
pointsToCashConversion(input: $input) {
|
|
720
720
|
... on InsufficientPointsError {
|
|
@@ -722,7 +722,7 @@
|
|
|
722
722
|
}
|
|
723
723
|
}
|
|
724
724
|
}
|
|
725
|
-
`,
|
|
725
|
+
`,rt=i`
|
|
726
726
|
query MayaSession($id: ObjectId!) {
|
|
727
727
|
mayaSession(id: $id) {
|
|
728
728
|
id
|
|
@@ -730,7 +730,7 @@
|
|
|
730
730
|
dateTimeCreated
|
|
731
731
|
}
|
|
732
732
|
}
|
|
733
|
-
`,
|
|
733
|
+
`,nt=i`
|
|
734
734
|
query TransactionRecords($first: Int, $after: Cursor, $filter: TransactionRecordFilter) {
|
|
735
735
|
member {
|
|
736
736
|
transactionRecords(first: $first, after: $after, filter: $filter) {
|
|
@@ -756,7 +756,7 @@
|
|
|
756
756
|
}
|
|
757
757
|
}
|
|
758
758
|
}
|
|
759
|
-
`,
|
|
759
|
+
`,it=i`
|
|
760
760
|
query Wallet {
|
|
761
761
|
wallet {
|
|
762
762
|
id
|
|
@@ -766,7 +766,7 @@
|
|
|
766
766
|
dateTimeLastUpdated
|
|
767
767
|
}
|
|
768
768
|
}
|
|
769
|
-
`,
|
|
769
|
+
`,ot=i`
|
|
770
770
|
query WithdrawalRecords($first: Int, $after: Cursor, $filter: WithdrawalRecordFilterInput) {
|
|
771
771
|
member {
|
|
772
772
|
withdrawalRecords(first: $first, after: $after, filter: $filter) {
|
|
@@ -833,7 +833,7 @@
|
|
|
833
833
|
}
|
|
834
834
|
}
|
|
835
835
|
}
|
|
836
|
-
`,
|
|
836
|
+
`,st=i`
|
|
837
837
|
mutation CreateGCashWithdrawal($input: CreateGCashWithdrawalInput!) {
|
|
838
838
|
createGCashWithdrawal(input: $input) {
|
|
839
839
|
... on AccountNotVerifiedError {
|
|
@@ -856,7 +856,7 @@
|
|
|
856
856
|
}
|
|
857
857
|
}
|
|
858
858
|
}
|
|
859
|
-
`,
|
|
859
|
+
`,dt=i`
|
|
860
860
|
mutation CreateMayaWithdrawal($input: CreateMayaWithdrawalInput!) {
|
|
861
861
|
createMayaWithdrawal(input: $input) {
|
|
862
862
|
... on AccountNotVerifiedError {
|
|
@@ -879,7 +879,7 @@
|
|
|
879
879
|
}
|
|
880
880
|
}
|
|
881
881
|
}
|
|
882
|
-
`,
|
|
882
|
+
`,mt=i`
|
|
883
883
|
mutation CreateMayaAppWithdrawal($input: CreateMayaAppWithdrawalInput!) {
|
|
884
884
|
createMayaAppWithdrawal(input: $input) {
|
|
885
885
|
... on AccountNotVerifiedError {
|
|
@@ -899,7 +899,7 @@
|
|
|
899
899
|
}
|
|
900
900
|
}
|
|
901
901
|
}
|
|
902
|
-
`,
|
|
902
|
+
`,ct=i`
|
|
903
903
|
mutation CreateBankWithdrawal($input: CreateBankWithdrawalInput!) {
|
|
904
904
|
createBankWithdrawal(input: $input) {
|
|
905
905
|
... on MobileNumberNotVerifiedError {
|
|
@@ -922,9 +922,9 @@
|
|
|
922
922
|
}
|
|
923
923
|
}
|
|
924
924
|
}
|
|
925
|
-
`,
|
|
925
|
+
`,ut=i`
|
|
926
926
|
query RemainingDailyWithdrawalsCount {
|
|
927
927
|
remainingDailyWithdrawalsCount
|
|
928
928
|
}
|
|
929
|
-
`;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",AccountBlacklisted:"Account is blacklisted",AccountNotFound:"Account not found",InvalidToken:"Invalid token",InvalidTokenOrSecretAnswer:"Invalid token or secret answer",SessionExpired:"Session expired"}[o]}}class ut{constructor(e){d(this,"client");this.client=e}async memberAccount(){const e=await this.client.request(Fe);return e.ok?{ok:!0,data:e.data.memberAccount}:e}async registerMemberAccount(e){const t=await this.client.request(Ve,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(Ye,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(je,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(He,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(Xe);return e.ok?{ok:!0,data:e.data.profileCompletion}:e}async platform(){return await this.client.request(Ze)}async sendVerificationCode(e){const t=await this.client.request(Qe,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(Ke,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(ze,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(Je,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(Le);return e.ok?{ok:!0,data:e.data.memberAccount.verification}:e}async announcements(e){const t=await this.client.request(Ee,e);return t.ok?{ok:!0,data:t.data.announcements}:t}}function p(o,e){const t=M[o]?M[o]:M[500];return{name:t.name,message:e??t.message}}const M={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 lt{constructor(e){d(this,"url");d(this,"platform");this.url=e.url,this.platform=e.platform}async createSession(e){const t=new Headers({"Content-Type":"application/json","Platform-Code":this.platform,Role:"MEMBER"});switch(e.type){case"NAME_AND_PASSWORD":{const a=`${e.name}:${e.password}`,r=Buffer.from(a).toString("base64");t.set("Authorization",`Basic ${r}`);break}case"MOBILE_NUMBER":{const a=`${e.mobileNumber}:${e.verificationCode}`,r=Buffer.from(a).toString("base64");t.set("Authorization",`MobileNumberOTP ${r}`);break}case"MAYA":{t.set("Authorization",`Maya ${e.sessionId}`);break}}try{const a=await fetch(`${this.url}/sessions`,{method:"POST",headers:t}),r=await a.json();return a.ok?{ok:!0,data:r}:r.code==="ACCOUNT_BLACKLISTED"?{ok:!1,error:m("AccountBlacklisted")}:{ok:!1,error:p(a.status)}}catch{return{ok:!1,error:p(500)}}}async authenticate(e){const t=new Headers({"Content-Type":"application/json","Platform-Code":this.platform,Role:"MEMBER"});if(e.type==="SECURITY_QUESTION"){t.set("Authorization",`Bearer ${e.token}`);try{const a=await fetch(`${this.url}/session/${e.token}/authenticate`,{method:"POST",headers:t,body:JSON.stringify({secretAnswer:e.secretAnswer})}),r=await a.json();return a.ok?{ok:!0,data:r}:a.status===401||a.status===403?{ok:!1,error:m("InvalidTokenOrSecretAnswer")}:{ok:!1,error:p(a.status)}}catch{return{ok:!1,error:p(500)}}}throw new Error("Invalid input 'type'")}async refreshSession(e){try{const t=await fetch(`${this.url}/session:refresh`,{method:"POST",headers:{"Content-Type":"application/json","Platform-Code":this.platform,Role:"MEMBER",Authorization:`Bearer ${e}`}}),a=await t.json();return t.ok?{ok:!0,data:a}:a.code==="ACCOUNT_BLACKLISTED"?{ok:!1,error:m("AccountBlacklisted")}:t.status===403||t.status===401?{ok:!1,error:m("InvalidToken")}:{ok:!1,error:p(t.status)}}catch{return{ok:!1,error:p(500)}}}async destroySession(e){try{const t=await fetch(`${this.url}/session`,{method:"DELETE",headers:{"Content-Type":"application/json","Platform-Code":this.platform,Role:"MEMBER",Authorization:`Bearer ${e}`}});return t.ok?{ok:!0}:{ok:!1,error:p(t.status)}}catch{return{ok:!1,error:p(500)}}}async verifySession(e){try{return(await fetch(`${this.url}/session`,{method:"GET",headers:{"Content-Type":"application/json","Platform-Code":this.platform,Role:"MEMBER",Authorization:`Bearer ${e}`}})).ok}catch{return!0}}}class pt{constructor(e){d(this,"client");this.client=e}async file(e){const t=await this.client.request(N,e);return t.ok?{ok:!0,data:t.data.node}:t}async uploadPrivateImageFile(e){const t=await this.client.upload(N,e);return t.ok?t.data.uploadPrivateImageFile?{ok:!1,error:m(t.data.uploadPrivateImageFile.__typename)}:{ok:!0}:t}}class R{constructor(e){d(this,"client");this.client=e}async game(e){const t=await this.client.request(Ae,e);return t.ok?{ok:!0,data:t.data.node}:t}async games(e){const t=await this.client.request(Se,e);return t.ok?{ok:!0,data:t.data.games}:t}async gamesByName(e){const t=await this.client.request(ke,e);return t.ok?{ok:!0,data:t.data.gamesByName}:t}async gameSession(e){const t=await this.client.request(Ce,e);return t.ok?{ok:!0,data:t.data.node}:t}async createGameSession(e){const t=await this.client.request(Te,e);return t.ok?t.data.createGameSession?{ok:!1,error:m(t.data.createGameSession.__typename)}:{ok:!0}:t}async endGameSession(e){const t=await this.client.request(_e,e);return t.ok?t.data.endGameSession?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:t}}class ft{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(rt,e);return t.ok?{ok:t.ok,data:t.data.member.transactionRecords}:t}async withdrawalRecords(e){const t=await this.client.request(it,e);return t.ok?{ok:t.ok,data:t.data.member.withdrawalRecords}:t}async depositRecords(e){const t=await this.client.request(Ge,e);return t.ok?{ok:t.ok,data:t.data.member.depositRecords}:t}async depositsCount(){const e=await this.client.request(Oe);return e.ok?{ok:e.ok,data:e.data.member.depositsCount}:e}async member(){const e=await this.client.request(qe);return e.ok?{ok:e.ok,data:e.data.member}:e}}class ht{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 wt extends R{async promos(){const e=await this.client.request(Ne);return e.ok?{ok:e.ok,data:e.data.promos}:e}async cashbacks(){const e=await this.client.request(De);return e.ok?{ok:e.ok,data:e.data.cashbacks}:e}async availablePromos(e){const t=await this.client.request(Ie,e);return t.ok?{ok:t.ok,data:t.data.availablePromos}:t}async cashbackBonuses(){const e=await this.client.request(xe);return e.ok?{ok:e.ok,data:e.data.cashbackBonuses}:e}async claimCashbackBonus(e){const t=await this.client.request(Pe,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(Re);return e.ok?{ok:e.ok,data:e.data.bonus}:e}async wallet(){const e=await this.client.request(nt);return e.ok?{ok:e.ok,data:e.data.wallet}:e}async deposit(e){const t=await this.client.request(Ue,e);return t.ok?{ok:t.ok,data:t.data.node}:t}async createGCashDeposit(e){const t=await this.client.request($e,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(Be,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(We,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(ot,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(st,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(dt,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(mt,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(ct);return e.ok?{ok:e.ok,data:e.data.remainingDailyWithdrawalsCount}:e}async pointsWallet(){const e=await this.client.request(et);return e.ok?{ok:e.ok,data:e.data.pointsWallet}:e}async pointsToCashConversion(e){const t=await this.client.request(tt,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(at,e);return t.ok?{ok:t.ok,data:t.data.mayaSession}:t}}class yt{constructor(e){d(this,"client");this.client=e}async latestBetRecords(){const e=await this.client.request(Me);return e.ok?{ok:!0,data:e.data.latestBetRecords}:e}}class g{constructor(e,t){d(this,"url");d(this,"options");d(this,"middlewares");var r;const a=new Headers((r=t==null?void 0:t.fetchOptions)==null?void 0:r.headers);this.url=e,this.options={...t==null?void 0:t.fetchOptions,headers:a},this.middlewares=(t==null?void 0:t.middlewares)??[]}async request(e,t){const a=JSON.stringify({query:e,variables:t}),r=new Headers(this.options.headers);r.set("Content-Type","application/json"),r.set("Accept","application/json");const s=await this.runMiddlewares(new Request(this.url,{...this.options,body:a,headers:r,method:"POST"}));return await this.exec(s)}async upload(e,t){const a=this.createUploadBody(e,t),r=new Headers(this.options.headers);r.set("Accept","application/json"),r.delete("Content-Type");const s=await this.runMiddlewares(new Request(this.url,{...this.options,body:a,headers:r,method:"POST"}));return await this.exec(s)}async exec(e){var t,a,r,s,u,b;try{const w=await fetch(e);if(!w.ok)return{ok:!1,error:p(w.status)};const C=await w.json(),_=C.data,h=(t=C.errors)==null?void 0:t.at(0);return h?((a=h.extensions)==null?void 0:a.code)==="FORBIDDEN"||((r=h.extensions)==null?void 0:r.code)==="ACCESS_TOKEN_EXPIRED"?{ok:!1,error:p(403,h.message)}:((s=h.extensions)==null?void 0:s.code)==="UNAUTHORIZED"?{ok:!1,error:p(401,h.message)}:((u=h.extensions)==null?void 0:u.code)==="BAD_USER_INPUT"||((b=h.extensions)==null?void 0:b.code)==="BAD_REQUEST"?{ok:!1,error:p(400,h.message)}:{ok:!1,error:p(500,h.message)}:{ok:!0,data:_}}catch{return{ok:!1,error:p(500)}}}async runMiddlewares(e){let t=e.clone();for(const a of this.middlewares)t=await a(t);return t}createUploadBody(e,t){const{files:a,others:r}=this.extractFiles(t),s=new FormData;s.append("operations",JSON.stringify({query:e,variables:t})),Object.entries(r).forEach(([b,w])=>{s.append(b,JSON.stringify(w))});const u={};return Object.keys(a).forEach((b,w)=>{u[w.toString()]=`variables.${b}`}),s.append("map",JSON.stringify(u)),Object.values(a).forEach((b,w)=>{s.append(w.toString(),b)}),s}extractFiles(e){const t={},a={};return Object.entries(e).forEach(([r,s])=>{s instanceof File||s instanceof Blob?t[r]=s:a[r]=s}),{files:t,others:a}}}async function y(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 x{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 D(o){return new Date(o.getTime())}function A(o,e){const t=D(o);return t.setDate(t.getDate()+e),t}function S(o,e){const t=D(o);return t.setMinutes(t.getMinutes()+e),t}function P(o,e){return o.getTime()>e.getTime()}function bt(o){return new Promise(e=>{setTimeout(e,o)})}function k(o,e){const t=D(o);return t.setMinutes(t.getMinutes()-e),t}class gt{constructor(e){d(this,"logger");d(this,"storageKey","session");d(this,"authService");d(this,"_refreshing",!1);this.authService=new lt(e),this.logger=new x({enabled:e.log??!1})}get refreshing(){return this._refreshing}set refreshing(e){this._refreshing=e}async create(e){if(this.isServer)return this.logger.warn("'localStorage' is not available on the server."),{ok:!1,error:{name:"UnknownError",message:"Server sign in is not supported."}};if(e.type==="MAYA"){const r=await this.authService.createSession(e);if(r.ok){const s=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...r.data,maya:!0,accessTokenExpiresAt:S(s,8).getTime(),refreshTokenExpiresAt:k(A(s,30),2).getTime()})),{ok:!0,data:null}}return r}if(e.type==="MOBILE_NUMBER"){const r=await this.authService.createSession(e);if(r.ok){const s=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...r.data,accessTokenExpiresAt:S(s,8).getTime(),refreshTokenExpiresAt:k(A(s,30),2).getTime()})),{ok:!0,data:null}}return r}const t=await this.authService.createSession(e);if(!t.ok)return t;if(t.data.authenticator)return{ok:!0,data:{authenticator:t.data.authenticator}};const a=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...t.data,accessTokenExpiresAt:S(a,8).getTime(),refreshTokenExpiresAt:k(A(a,30),2).getTime()})),{ok:!0,data:null}}async createFromAuthenticator(e){const t=await this.authService.authenticate(e);if(t.ok){const a=new Date;return this.isServer?this.logger.warn("'localStorage' is not available on the server."):window.localStorage.setItem(this.storageKey,JSON.stringify({...t.data,accessTokenExpiresAt:S(a,8).getTime(),refreshTokenExpiresAt:k(A(a,30),2).getTime()})),{ok:!0}}else return t}async get(){if(this.isServer)return this.logger.warn("'localStorage' is not available on the server."),{ok:!0,data:null};if(this.refreshing)return await bt(1e3),await this.get();const e=window.localStorage.getItem(this.storageKey);if(!e)return{ok:!0,data:null};try{let t=JSON.parse(e),a=new Date;const r=new Date(t.accessTokenExpiresAt),s=new Date(t.refreshTokenExpiresAt);if(P(a,s))return this.logger.warn("Session expired. Logging out.."),window.localStorage.removeItem(this.storageKey),{ok:!1,error:{name:"SessionExpired",message:"Session expired."}};if(P(a,r)){this.logger.info("Refreshing session..."),this.refreshing=!0;const u=await this.authService.refreshSession(t.refreshToken);if(this.refreshing=!1,!u.ok)return this.logger.error(`Failed to refresh session: ${u.error.message}`),u.error.name==="InvalidToken"||u.error.name==="AccountBlacklisted"?(window.localStorage.removeItem(this.storageKey),{ok:!1,error:u.error}):(this.logger.warn("Old session returned."),{ok:!0,data:t});this.logger.success("Session refreshed!"),a=new Date,t={...t,...u.data,accessTokenExpiresAt:S(a,8).getTime(),refreshTokenExpiresAt:k(A(a,30),2).getTime()},window.localStorage.setItem(this.storageKey,JSON.stringify(t))}return{ok:!0,data:t}}catch{return{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}}}async destroy(){var t;if(this.isServer){this.logger.warn("'localStorage' is not available on the server.");return}const e=await this.get();(t=e.data)!=null&&t.accessToken&&await this.authService.destroySession(e.data.accessToken),window.localStorage.removeItem(this.storageKey)}async verify(){var a,r,s;if(this.isServer)return this.logger.warn("'localStorage' is not available on the server."),!0;const e=await this.get();if(((a=e.error)==null?void 0:a.name)==="InvalidToken"||((r=e.error)==null?void 0:r.name)==="SessionExpired"||((s=e.error)==null?void 0:s.name)==="AccountBlacklisted")return!1;if(!e.data)return!0;const t=await this.authService.verifySession(e.data.accessToken);return t||window.localStorage.removeItem(this.storageKey),t}get isServer(){return typeof window>"u"}}function n(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 Et{constructor(e){d(this,"staticService");const t=(e==null?void 0:e.environment)==="development";this.staticService=new ht({url:t?"https://static.development.opexa.io":"https://static.opexa.io"})}get transform(){return{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)}}platform(e){var t,a,r,s,u,b,w,C,_,h,G,$,B,W,U,O,q,F,L,V,Y,H,j,Q,K,z,J,X,Z,ee,te,ae,re,ne,ie,oe,se,de,me,ce,ue,le,pe,fe,he,we,ye,be,ge;return{paymentSettings:{minimumFirstDepositAmount:n(e.minimumFirstDepositAmount),restrictWithdrawalsToVerifiedMembers:e.restrictWithdrawalsToVerifiedMembers,depositGateway:{bank:{androidEnabled:((t=e.bankDepositGatewaySettings)==null?void 0:t.androidEnabled)??!1,iosEnabled:((a=e.bankDepositGatewaySettings)==null?void 0:a.iosEnabled)??!1,webEnabled:((r=e.bankDepositGatewaySettings)==null?void 0:r.webEnabled)??!1,mobileWebEnabled:((s=e.bankDepositGatewaySettings)==null?void 0:s.mobileWebEnabled)??!1,minimumAmount:n((u=e.bankDepositGatewaySettings)==null?void 0:u.minimumAmount),maximumAmount:n((b=e.bankDepositGatewaySettings)==null?void 0:b.maximumAmount)},gcash:{androidEnabled:((w=e.gcashDepositGatewaySettings)==null?void 0:w.androidEnabled)??!1,iosEnabled:((C=e.gcashDepositGatewaySettings)==null?void 0:C.iosEnabled)??!1,webEnabled:((_=e.gcashDepositGatewaySettings)==null?void 0:_.webEnabled)??!1,mobileWebEnabled:((h=e.gcashDepositGatewaySettings)==null?void 0:h.mobileWebEnabled)??!1,minimumAmount:n((G=e.gcashDepositGatewaySettings)==null?void 0:G.minimumAmount),maximumAmount:n(($=e.gcashDepositGatewaySettings)==null?void 0:$.maximumAmount)},maya:{androidEnabled:((B=e.mayaDepositGatewaySettings)==null?void 0:B.androidEnabled)??!1,iosEnabled:((W=e.mayaDepositGatewaySettings)==null?void 0:W.iosEnabled)??!1,webEnabled:((U=e.mayaDepositGatewaySettings)==null?void 0:U.webEnabled)??!1,mobileWebEnabled:((O=e.mayaDepositGatewaySettings)==null?void 0:O.mobileWebEnabled)??!1,minimumAmount:n((q=e.mayaDepositGatewaySettings)==null?void 0:q.minimumAmount),maximumAmount:n((F=e.mayaDepositGatewaySettings)==null?void 0:F.maximumAmount)},mayaApp:{androidEnabled:((L=e.mayaAppDepositGatewaySettings)==null?void 0:L.androidEnabled)??!1,iosEnabled:((V=e.mayaAppDepositGatewaySettings)==null?void 0:V.iosEnabled)??!1,webEnabled:((Y=e.mayaAppDepositGatewaySettings)==null?void 0:Y.webEnabled)??!1,mobileWebEnabled:((H=e.mayaAppDepositGatewaySettings)==null?void 0:H.mobileWebEnabled)??!1,minimumAmount:n((j=e.mayaAppDepositGatewaySettings)==null?void 0:j.minimumAmount),maximumAmount:n((Q=e.mayaAppDepositGatewaySettings)==null?void 0:Q.maximumAmount)}},withdrawalGateway:{bank:{androidEnabled:((K=e.bankWithdrawalGatewaySettings)==null?void 0:K.androidEnabled)??!1,iosEnabled:((z=e.bankWithdrawalGatewaySettings)==null?void 0:z.iosEnabled)??!1,webEnabled:((J=e.bankWithdrawalGatewaySettings)==null?void 0:J.webEnabled)??!1,mobileWebEnabled:((X=e.bankWithdrawalGatewaySettings)==null?void 0:X.mobileWebEnabled)??!1,minimumAmount:n((Z=e.bankWithdrawalGatewaySettings)==null?void 0:Z.minimumAmount),maximumAmount:n((ee=e.bankWithdrawalGatewaySettings)==null?void 0:ee.maximumAmount)},gcash:{androidEnabled:((te=e.gcashWithdrawalGatewaySettings)==null?void 0:te.androidEnabled)??!1,iosEnabled:((ae=e.gcashWithdrawalGatewaySettings)==null?void 0:ae.iosEnabled)??!1,webEnabled:((re=e.gcashWithdrawalGatewaySettings)==null?void 0:re.webEnabled)??!1,mobileWebEnabled:((ne=e.gcashWithdrawalGatewaySettings)==null?void 0:ne.mobileWebEnabled)??!1,minimumAmount:n((ie=e.gcashWithdrawalGatewaySettings)==null?void 0:ie.minimumAmount),maximumAmount:n((oe=e.gcashWithdrawalGatewaySettings)==null?void 0:oe.maximumAmount,1e6)},maya:{androidEnabled:((se=e.mayaWithdrawalGatewaySettings)==null?void 0:se.androidEnabled)??!1,iosEnabled:((de=e.mayaWithdrawalGatewaySettings)==null?void 0:de.iosEnabled)??!1,webEnabled:((me=e.mayaWithdrawalGatewaySettings)==null?void 0:me.webEnabled)??!1,mobileWebEnabled:((ce=e.mayaWithdrawalGatewaySettings)==null?void 0:ce.mobileWebEnabled)??!1,minimumAmount:n((ue=e.mayaWithdrawalGatewaySettings)==null?void 0:ue.minimumAmount),maximumAmount:n((le=e.mayaWithdrawalGatewaySettings)==null?void 0:le.maximumAmount)},mayaApp:{androidEnabled:((pe=e.mayaAppWithdrawalGatewaySettings)==null?void 0:pe.androidEnabled)??!1,iosEnabled:((fe=e.mayaAppWithdrawalGatewaySettings)==null?void 0:fe.iosEnabled)??!1,webEnabled:((he=e.mayaAppWithdrawalGatewaySettings)==null?void 0:he.webEnabled)??!1,mobileWebEnabled:((we=e.mayaAppWithdrawalGatewaySettings)==null?void 0:we.mobileWebEnabled)??!1,minimumAmount:n((ye=e.mayaAppWithdrawalGatewaySettings)==null?void 0:ye.minimumAmount),maximumAmount:n((be=e.mayaAppWithdrawalGatewaySettings)==null?void 0:be.maximumAmount,1e6)}}},pointsClubSettings:{multiplier:n((ge=e.pointsClubSettings)==null?void 0:ge.multiplier,0)}}}account(e){return{id:e.id,name:e.name,status:e.status,verified:e.verified,nickName:e.nickName??void 0,realName:e.realName??void 0,dateOfBirth:e.birthDay?new Date(e.birthDay):void 0,emailAddress:e.emailAddress??void 0,mobileNumber:e.mobileNumber??void 0,mobileNumberVerified:e.mobileNumberVerified??!1,mobileNumberVerificationRequired:e.mobileNumberVerificationRequired??!1,validId:e.validId??void 0,verificationStatus:e.verificationStatus,transactionPassword:e.transactionPassword,secretAnswerSubmitted:e.secretAnswerSubmitted??!1,dateTimeLastActive:e.dateTimeLastActive?new Date(e.dateTimeLastActive):void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}wallet(e){return{...e,balance:n(e.balance,0),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}verificationDetails(e){return{...e,idFrontImage:{...e.idFrontImage,url:e.idFrontImage.url??void 0,dateTimeCreated:new Date(e.idFrontImage.dateTimeCreated)},selfieImage:{...e.selfieImage,url:e.selfieImage.url??void 0,dateTimeCreated:new Date(e.selfieImage.dateTimeCreated)}}}profileCompletion(e){return{...e,completionPercentage:n(e,0)}}announcement(e){return{...e,activationEndDateTime:new Date(e.activationEndDateTime),activationStartDateTime:new Date(e.activationStartDateTime),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}withdrawalRecord(e){return{...e,amount:n(e.amount,0),netAmount:n(e.netAmount,0),fee:n(e.fee,0),reference:e.reference??void 0,bank:e.bank??void 0,recipientMobileNumber:e.recipientMobileNumber??void 0,dateTimeConfirmed:e.dateTimeConfirmed?new Date(e.dateTimeConfirmed):void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}deposit(e){return{...e,fee:n(e.fee,0),amount:n(e.amount,0),netAmount:n(e.netAmount,0),reference:e.reference??void 0,checkoutUrl:e.checkoutUrl??void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}depositRecord(e){return{...e,amount:n(e.amount,0),fee:n(e.fee,0),netAmount:n(e.netAmount,0),reference:e.reference??void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}betRecord(e){var t;return{...e,bet:n(e.bet,0),payout:n(e.payout,0),jackpotContribution:n(e.jackpotContribution,0),jackpotPayout:n(e.jackpotPayout,0),winloss:n(e.winloss),validBet:n(e.validBet,0),vendorRoundId:e.vendorRoundId??void 0,game:this.game(e.game),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:((t=e.metadata)==null?void 0:t.odds)??void 0}}}latestBetRecord(e){return{...e,game:this.game(e.game),bet:n(e.bet,0),payout:n(e.payout,0),validBet:n(e.validBet,0),dateTimeSettled:new Date(e.dateTimeSettled),dateTimeCreated:new Date(e.dateTimeCreated)}}transactionRecord(e){return{...e,amount:n(e.amount,0),content:e.content??void 0,currentBalance:n(e.currentBalance,0),dateTimeCreated:new Date(e.dateTimeCreated)}}game(e){const t=this.staticService.gameThumbnails(e);return{...e,images:t}}gameSession(e){return{...e,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}promo(e){return{...e,banner:{...e.banner,dateTimeCreated:new Date(e.banner.dateTimeCreated)},maximumBonusAmount:n(e.maximumBonusAmount),minimumBonusAmount:n(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{...e,banner:{...e.banner,dateTimeCreated:new Date(e.banner.dateTimeCreated)},activationEndDateTime:new Date(e.activationEndDateTime),activationStartDateTime:new Date(e.activationStartDateTime),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}bonus(e){return{...e,promo:this.promo(e.promo),deposit:e.deposit?{...e.deposit,fee:n(e.deposit.fee,0),amount:n(e.deposit.amount,0),netAmount:n(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:n(e.balance,0),amount:n(e.amount,0),expiration:new Date(e.expiration),turnoverRequirement:n(e.turnoverRequirement,0),currentTurnoverRequirementContribution:n(e.currentTurnoverRequirementContribution,0),currentTurnoverRequirementContributionPercentage:n(e.currentTurnoverRequirementContributionPercentage,0),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}cashbackBonus(e){return{id:e.id,balance:n(e.balance,0),cashback:this.cashback(e.cashback),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}file(e){return{...e,url:e.url??void 0,dateTimeCreated:new Date(e.dateTimeCreated)}}pointsWallet(e){return{id:e.id,points:n(e.points,0),account:e.account,dateTimeCreated:new Date(e.dateTimeCreated)}}}class At{constructor(e){d(this,"gameService");d(this,"fileService");d(this,"walletService");d(this,"reportService");d(this,"portalService");d(this,"accountService");d(this,"sessionManager");d(this,"transformer");d(this,"logger");const t=e.environment==="development";this.sessionManager=new gt({...e,url:t?"https://auth.development.opexa.io":"https://auth.opexa.io"});const a={middlewares:[this.authMiddleware],fetchOptions:{headers:{Role:"MEMBER","Platform-Code":e.platform}}};this.gameService=new R(new g(t?"https://game.development.opexa.io/graphql":"https://game.opexa.io/graphql",a)),this.fileService=new pt(new g(t?"https://file.development.opexa.io/graphql":"https://file.opexa.io/graphql",a)),this.walletService=new wt(new g(t?"https://wallet.development.opexa.io/graphql":"https://wallet.opexa.io/graphql",a)),this.reportService=new ft(new g(t?"https://report.development.opexa.io/graphql":"https://report.opexa.io/graphql",a)),this.accountService=new ut(new g(t?"https://account.development.opexa.io/graphql":"https://account.opexa.io/graphql",a)),this.portalService=new yt(new g(t?"https://portal.development.opexa.io/graphql":"https://portal.opexa.io/graphql",a)),this.transformer=new Et(e),this.logger=new x({enabled:e.log??!1})}get authMiddleware(){return async e=>{this.logger.info("Checking for session");const t=await this.sessionManager.get();return t.data?(e.headers.append("Authorization",`Bearer ${t.data.accessToken}`),this.logger.info("Session found"),this.logger.success("Added 'Authorization' header")):this.logger.info("No session found"),e}}async signIn(e){switch(e.type){case"NAME_AND_PASSWORD":{const t=await this.sessionManager.create({...e,password:await y(e.password)});return t.data?{ok:!0,data:{"2FAEnabled":!0,authenticator:t.data.authenticator}}:{ok:!0,data:{"2FAEnabled":!1}}}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 y(e.secretAnswer)});default:return{ok:!1,error:{name:"HttpBadRequest",message:"Invalid input 'type'"}}}}async signOut(){await this.sessionManager.destroy()}watchSession(e){const t=e.interval??3e4,a=e.onInvalid;let r=null;const s=()=>setTimeout(async()=>{await this.sessionManager.verify()||await a(),r=s()},t);return r=s(),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 platform(){const e=await this.accountService.platform();return e.ok?{ok:!0,data:this.transformer.transform.platform(e.data)}:e}async account(){const[e,t]=await Promise.all([this.accountService.memberAccount(),this.reportService.member()]);return e.ok?t.ok?{ok:!0,data:this.transformer.transform.account({...e.data,...t.data})}:{ok:!1,error:t.error}:{ok:!1,error:e.error}}async createAccount(e){const t=e.id??c.ObjectId.generate(f.Account).toString(),a=await this.accountService.registerMemberAccount({input:{id:t,name:e.name,birthDay:typeof e.dateOfBirth=="string"?e.dateOfBirth:e.dateOfBirth.toISOString(),password:await y(e.password),mobileNumber:this.addAreaCode(e.mobileNumber),domain:e.domain,btag:e.btag},verificationCode:e.verificationCode,reCAPTCHAResponse:e.reCAPTCHAResponse});return a.ok?{ok:!0,data:{id:t}}:a}async updateAccount(e,t){return await this.accountService.updateMemberAccount({input:{id:e,data:{...t,password:t.password?await y(t.password):void 0,transactionPassword:t.transactionPassword?await y(t.transactionPassword):void 0,...t.mobileNumber&&{mobileNumber:this.addAreaCode(t.mobileNumber)},secretAnswer:t.secretAnswer?await y(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??c.ObjectId.generate(f.Verification).toString(),a=await this.accountService.createMemberVerification({input:{id:t,...e}});return a.ok?{ok:!0,data:{id:t}}:a}async updateVerificationDetails(e,t){return await this.accountService.updateMemberVerification({input:{id:e,data:{...t}}})}async resetPassword(e){return await this.accountService.resetPassword({input:{mobileNumber:this.addAreaCode(e.mobileNumber),newPassword:await y(e.newPassword)},verificationCode:e.verificationCode})}async verifyMobileNumber(e){return await this.accountService.verifyMobileNumber({input:{verificationCode:e}})}async profileCompletion(){const e=await this.accountService.profileCompletion();return e.ok?{ok:!0,data:this.transformer.transform.profileCompletion(e.data)}:e}async sendVerificationCode(e){return await this.accountService.sendVerificationCode({input:{channel:"SMS",recipient:this.addAreaCode(e)}})}async wallet(){const e=await this.walletService.wallet();return e.ok?{ok:!0,data:e.data?this.transformer.transform.wallet(e.data):null}:e}async announcements(e){const t=await this.accountService.announcements({...e,filter:{visibility:{in:["MEMBER","GLOBAL"]},activationStartDateTime:{greaterThanOrEqual:new Date}}});return t.ok?{ok:!0,data:{announcements:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.announcement(r),cursor:a})),totalCount:t.data.totalCount,nextCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async createWithdrawal(e){const t=e.id??c.ObjectId.generate(f.Withdrawal).toString();if(e.type==="BANK"){const a=await this.walletService.createBankWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await y(e.transactionPassword)}});if(!a.ok)return a}if(e.type==="GCASH"){const a=await this.walletService.createGCashWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await y(e.transactionPassword),recipientMobileNumber:this.addAreaCode(e.recipientMobileNumber)}});if(!a.ok)return a}if(e.type==="MAYA"){const a=await this.walletService.createMayaWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await y(e.transactionPassword),recipientMobileNumber:this.addAreaCode(e.recipientMobileNumber)}});if(!a.ok)return a}if(e.type==="MAYA_APP"){const a=await this.walletService.createMayaAppWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await y(e.transactionPassword)}});if(!a.ok)return a}return{ok:!0,data:{id:t}}}async withdrawalRecords(e){const t=await this.reportService.withdrawalRecords(e);return t.ok?{ok:!0,data:{withdrawalRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.withdrawalRecord(r),cursor:a})),totalCount:t.data.totalCount,nextCursor: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??c.ObjectId.generate(f.Deposit).toString();if(e.type==="MAYA"){const a=await this.walletService.createMayaDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}if(e.type==="MAYA_APP"){const a=await this.walletService.createMayaAppDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}if(e.type==="GCASH"){const a=await this.walletService.createGCashDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}return{ok:!0,data:{id:t}}}async deposit(e){const t=await this.walletService.deposit({id:e});return t.ok?{ok:!0,data:t.data?this.transformer.transform.deposit(t.data):null}:t}async depositRecords(e){const t=await this.reportService.depositRecords(e);return t.ok?{ok:!0,data:{depositRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.depositRecord(r),cursor:a})),totalCount:t.data.totalCount,nextCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async depositsCount(){return await this.reportService.depositsCount()}async betRecords(e){const t=await this.reportService.betRecords(e);return t.ok?{ok:!0,data:{betRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.betRecord(r),cursor:a})),totalCount:t.data.totalCount,nextCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async latestBetRecords(){const e=await this.portalService.latestBetRecords();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.latestBetRecord)}:e}async transactionRecords(e){const t=await this.reportService.transactionRecords(e);return t.ok?{ok:!0,data:{transactionRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.transactionRecord(r),cursor:a})),totalCount:t.data.totalCount,nextCursor: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 games(e){const t=await this.gameService.games(e);return t.ok?{ok:!0,data:{games:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.game(r),cursor:a})),totalCount:t.data.totalCount,nextCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async gamesByName(e){const t=await this.gameService.gamesByName(e);return t.ok?{ok:!0,data:t.data.map(this.transformer.transform.game)}:t}async gamesByName__next(e){const t=await this.walletService.gamesByName(e);return t.ok?{ok:!0,data:t.data.map(this.transformer.transform.game)}:t}async games__next(e){const t=await this.walletService.games(e);return t.ok?{ok:!0,data:{games:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.game(r),cursor:a})),totalCount:t.data.totalCount,nextCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async createGameSession(e){const t=e.id??c.ObjectId.generate(f.GameSession).toString(),a=await this.gameService.createGameSession({input:{id:t,game:e.game}});return a.ok?{ok:!0,data:{id:t}}:a}async createGameSession__next(e){const t=e.id??c.ObjectId.generate(f.GameSession).toString(),a=await this.walletService.createGameSession({input:{id:t,game:e.game}});return a.ok?{ok:!0,data:{id:t}}:a}async gameSession(e){const t=await this.gameService.gameSession({id:e});return t.ok?{ok:!0,data:t.data?this.transformer.transform.gameSession(t.data):null}:t}async gameSession__next(e){const t=await this.walletService.gameSession({id:e});return t.ok?{ok:!0,data:t.data?this.transformer.transform.gameSession(t.data):null}:t}async endGameSession(e){return await this.gameService.endGameSession({input:{id:e}})}async endGameSession__next(e){return await this.walletService.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??c.ObjectId.generate(f.File).toString(),a=await this.fileService.uploadPrivateImageFile({input:{id:t,file:e.file}});return a.ok?{ok:!0,data:{id:t}}:a}async pointsWallet(){const e=await this.walletService.pointsWallet();return e.ok?{ok:!0,data:e.data?this.transformer.transform.pointsWallet(e.data):null}:e}async pointsToCashConversion(e){return await this.walletService.pointsToCashConversion({input:{amount:e.toString()}})}addAreaCode(e){return e.startsWith("+63")?e:e.startsWith("63")?`+${e}`:e.startsWith("0")?`+63${e.substring(1)}`:`+63${e}`}}Object.defineProperty(l,"ObjectId",{enumerable:!0,get:()=>c.ObjectId}),l.ObjectType=f,l.Sdk=At,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
929
|
+
`;function c(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",AccountBlacklisted:"Account is blacklisted",AccountNotFound:"Account not found",InvalidToken:"Invalid token",InvalidTokenOrSecretAnswer:"Invalid token or secret answer",SessionExpired:"Session expired"}[o]}}class lt{constructor(e){m(this,"client");this.client=e}async memberAccount(){const e=await this.client.request(Le);return e.ok?{ok:!0,data:e.data.memberAccount}:e}async registerMemberAccount(e){const t=await this.client.request(Ye,e);return t.ok?t.data.registerMemberAccount?{ok:!1,error:c(t.data.registerMemberAccount.__typename)}:{ok:!0}:t}async updateMemberAccount(e){const t=await this.client.request(He,e);return t.ok?t.data.updateMemberAccount?{ok:!1,error:c(t.data.updateMemberAccount.__typename)}:{ok:!0}:t}async deleteMemberAccount(e){const t=await this.client.request(Qe,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(je,e);return t.ok?t.data.resetPassword?{ok:!1,error:c(t.data.resetPassword.__typename)}:{ok:!0}:t}async profileCompletion(){const e=await this.client.request(Ze);return e.ok?{ok:!0,data:e.data.profileCompletion}:e}async platform(){return await this.client.request(et)}async sendVerificationCode(e){const t=await this.client.request(Ke,e);return t.ok?t.data.sendVerificationCode?{ok:!1,error:c(t.data.sendVerificationCode.__typename)}:{ok:!0}:t}async verifyMobileNumber(e){const t=await this.client.request(ze,e);return t.ok?t.data.verifyMobileNumber?{ok:!1,error:c(t.data.verifyMobileNumber.__typename)}:{ok:!0}:t}async createMemberVerification(e){const t=await this.client.request(Je,e);return t.ok?t.data.createMemberVerification?{ok:!1,error:c(t.data.createMemberVerification.__typename)}:{ok:!0}:t}async updateMemberVerification(e){const t=await this.client.request(Xe,e);return t.ok?t.data.updateMemberVerification?{ok:!1,error:c(t.data.updateMemberVerification.__typename)}:{ok:!0}:t}async memberVerification(){const e=await this.client.request(Ve);return e.ok?{ok:!0,data:e.data.memberAccount.verification}:e}async announcements(e){const t=await this.client.request(ge,e);return t.ok?{ok:!0,data:t.data.announcements}:t}}function p(o,e){const t=M[o]?M[o]:M[500];return{name:t.name,message:e??t.message}}const M={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 pt{constructor(e){m(this,"url");m(this,"platform");this.url=e.url,this.platform=e.platform}async createSession(e){const t=new Headers({"Content-Type":"application/json","Platform-Code":this.platform,Role:"MEMBER"});switch(e.type){case"NAME_AND_PASSWORD":{const a=`${e.name}:${e.password}`,r=Buffer.from(a).toString("base64");t.set("Authorization",`Basic ${r}`);break}case"MOBILE_NUMBER":{const a=`${e.mobileNumber}:${e.verificationCode}`,r=Buffer.from(a).toString("base64");t.set("Authorization",`MobileNumberOTP ${r}`);break}case"MAYA":{t.set("Authorization",`Maya ${e.sessionId}`);break}}try{const a=await fetch(`${this.url}/sessions`,{method:"POST",headers:t}),r=await a.json();return a.ok?{ok:!0,data:r}:r.code==="ACCOUNT_BLACKLISTED"?{ok:!1,error:c("AccountBlacklisted")}:{ok:!1,error:p(a.status)}}catch{return{ok:!1,error:p(500)}}}async authenticate(e){const t=new Headers({"Content-Type":"application/json","Platform-Code":this.platform,Role:"MEMBER"});if(e.type==="SECURITY_QUESTION"){t.set("Authorization",`Bearer ${e.token}`);try{const a=await fetch(`${this.url}/session/${e.token}/authenticate`,{method:"POST",headers:t,body:JSON.stringify({secretAnswer:e.secretAnswer})}),r=await a.json();return a.ok?{ok:!0,data:r}:a.status===401||a.status===403?{ok:!1,error:c("InvalidTokenOrSecretAnswer")}:{ok:!1,error:p(a.status)}}catch{return{ok:!1,error:p(500)}}}throw new Error("Invalid input 'type'")}async refreshSession(e){try{const t=await fetch(`${this.url}/session:refresh`,{method:"POST",headers:{"Content-Type":"application/json","Platform-Code":this.platform,Role:"MEMBER",Authorization:`Bearer ${e}`}}),a=await t.json();return t.ok?{ok:!0,data:a}:a.code==="ACCOUNT_BLACKLISTED"?{ok:!1,error:c("AccountBlacklisted")}:t.status===403||t.status===401?{ok:!1,error:c("InvalidToken")}:{ok:!1,error:p(t.status)}}catch{return{ok:!1,error:p(500)}}}async destroySession(e){try{const t=await fetch(`${this.url}/session`,{method:"DELETE",headers:{"Content-Type":"application/json","Platform-Code":this.platform,Role:"MEMBER",Authorization:`Bearer ${e}`}});return t.ok?{ok:!0}:{ok:!1,error:p(t.status)}}catch{return{ok:!1,error:p(500)}}}async verifySession(e){try{return(await fetch(`${this.url}/session`,{method:"GET",headers:{"Content-Type":"application/json","Platform-Code":this.platform,Role:"MEMBER",Authorization:`Bearer ${e}`}})).ok}catch{return!0}}}class ft{constructor(e){m(this,"client");this.client=e}async file(e){const t=await this.client.request(Me,e);return t.ok?{ok:!0,data:t.data.node}:t}async uploadPrivateImageFile(e){const t=await this.client.upload(De,e);return t.ok?t.data.uploadPrivateImageFile?{ok:!1,error:c(t.data.uploadPrivateImageFile.__typename)}:{ok:!0}:t}}class I{constructor(e){m(this,"client");this.client=e}async game(e){const t=await this.client.request(Ee,e);return t.ok?{ok:!0,data:t.data.node}:t}async games(e){const t=await this.client.request(Ae,e);return t.ok?{ok:!0,data:t.data.games}:t}async gamesByName(e){const t=await this.client.request(Se,e);return t.ok?{ok:!0,data:t.data.gamesByName}:t}async gameSession(e){const t=await this.client.request(ke,e);return t.ok?{ok:!0,data:t.data.node}:t}async createGameSession(e){const t=await this.client.request(Ce,e);return t.ok?t.data.createGameSession?{ok:!1,error:c(t.data.createGameSession.__typename)}:{ok:!0}:t}async endGameSession(e){const t=await this.client.request(Te,e);return t.ok?t.data.endGameSession?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:t}}class ht{constructor(e){m(this,"client");this.client=e}async betRecords(e){const t=await this.client.request(_e,e);return t.ok?{ok:t.ok,data:t.data.member.betRecords}:t}async transactionRecords(e){const t=await this.client.request(nt,e);return t.ok?{ok:t.ok,data:t.data.member.transactionRecords}:t}async withdrawalRecords(e){const t=await this.client.request(ot,e);return t.ok?{ok:t.ok,data:t.data.member.withdrawalRecords}:t}async depositRecords(e){const t=await this.client.request($e,e);return t.ok?{ok:t.ok,data:t.data.member.depositRecords}:t}async depositsCount(){const e=await this.client.request(qe);return e.ok?{ok:e.ok,data:e.data.member.depositsCount}:e}async member(){const e=await this.client.request(Fe);return e.ok?{ok:e.ok,data:e.data.member}:e}}class wt{constructor(e){m(this,"url");this.url=e.url}gameThumbnails(e){return[`${this.url}/images/${e.provider.toLowerCase()}/thumbnail-${e.id}.webp`,`${this.url}/images/${e.provider.toLowerCase()}/thumbnail-${e.provider.toLowerCase()}.webp`]}}class yt extends I{async promos(){const e=await this.client.request(Ie);return e.ok?{ok:e.ok,data:e.data.promos}:e}async cashbacks(){const e=await this.client.request(Ne);return e.ok?{ok:e.ok,data:e.data.cashbacks}:e}async availablePromos(e){const t=await this.client.request(Re,e);return t.ok?{ok:t.ok,data:t.data.availablePromos}:t}async cashbackBonuses(){const e=await this.client.request(xe);return e.ok?{ok:e.ok,data:e.data.cashbackBonuses}:e}async claimCashbackBonus(e){const t=await this.client.request(Ge,e);return t.ok?t.data.claimCashbackBonus?{ok:!1,error:c(t.data.claimCashbackBonus.__typename)}:{ok:!0}:{ok:t.ok,error:t.error}}async bonus(){const e=await this.client.request(Pe);return e.ok?{ok:e.ok,data:e.data.bonus}:e}async wallet(){const e=await this.client.request(it);return e.ok?{ok:e.ok,data:e.data.wallet}:e}async deposit(e){const t=await this.client.request(Oe,e);return t.ok?{ok:t.ok,data:t.data.node}:t}async createGCashDeposit(e){const t=await this.client.request(Be,e);return t.ok?t.data.createGCashDeposit?{ok:!1,error:c(t.data.createGCashDeposit.__typename)}:{ok:!0}:t}async createMayaDeposit(e){const t=await this.client.request(We,e);return t.ok?t.data.createMayaDeposit?{ok:!1,error:c(t.data.createMayaDeposit.__typename)}:{ok:!0}:t}async createMayaAppDeposit(e){const t=await this.client.request(Ue,e);return t.ok?t.data.createMayaAppDeposit?{ok:!1,error:c(t.data.createMayaAppDeposit.__typename)}:{ok:!0}:t}async createGCashWithdrawal(e){const t=await this.client.request(st,e);return t.ok?t.data.createGCashWithdrawal?{ok:!1,error:c(t.data.createGCashWithdrawal.__typename)}:{ok:!0}:t}async createMayaWithdrawal(e){const t=await this.client.request(dt,e);return t.ok?t.data.createMayaWithdrawal?{ok:!1,error:c(t.data.createMayaWithdrawal.__typename)}:{ok:!0}:t}async createMayaAppWithdrawal(e){const t=await this.client.request(mt,e);return t.ok?t.data.createMayaAppWithdrawal?{ok:!1,error:c(t.data.createMayaAppWithdrawal.__typename)}:{ok:!0}:t}async createBankWithdrawal(e){const t=await this.client.request(ct,e);return t.ok?t.data.createBankWithdrawal?{ok:!1,error:c(t.data.createBankWithdrawal.__typename)}:{ok:!0}:t}async remainingDailyWithdrawalsCount(){const e=await this.client.request(ut);return e.ok?{ok:e.ok,data:e.data.remainingDailyWithdrawalsCount}:e}async pointsWallet(){const e=await this.client.request(tt);return e.ok?{ok:e.ok,data:e.data.pointsWallet}:e}async pointsToCashConversion(e){const t=await this.client.request(at,e);return t.ok?t.data.pointsToCashConversion?{ok:!1,error:c(t.data.pointsToCashConversion.__typename)}:{ok:!0}:t}async mayaSession(e){const t=await this.client.request(rt,e);return t.ok?{ok:t.ok,data:t.data.mayaSession}:t}}class bt{constructor(e){m(this,"client");this.client=e}async latestBetRecords(){const e=await this.client.request(ve);return e.ok?{ok:!0,data:e.data.latestBetRecords}:e}}function gt(o){return Object.prototype.toString.call(o)==="[object Object]"&&Object(o)===o}function Et(o){const e=[];function t(a,r=[]){for(const s in a){const d=a[s];gt(d)?t(d,[...r,s]):Array.isArray(d)?t(At(d),[...r,s]):e.push({key:[...r,s],value:d})}}return t(o),e}function At(o){return o.reduce((e,t,a)=>(e[a]=t,e),{})}class b{constructor(e,t){m(this,"url");m(this,"options");m(this,"middlewares");var r;const a=new Headers((r=t==null?void 0:t.fetchOptions)==null?void 0:r.headers);this.url=e,this.options={...t==null?void 0:t.fetchOptions,headers:a},this.middlewares=(t==null?void 0:t.middlewares)??[]}async request(e,t){const a=JSON.stringify({query:e,variables:t}),r=new Headers(this.options.headers);r.set("Content-Type","application/json"),r.set("Accept","application/json");const s=await this.runMiddlewares(new Request(this.url,{...this.options,body:a,headers:r,method:"POST"}));return await this.exec(s)}async upload(e,t){const a=this.createUploadBody(e,t),r=new Headers(this.options.headers);r.delete("Content-Type");const s=await this.runMiddlewares(new Request(this.url,{...this.options,body:a,headers:r,method:"POST"}));return await this.exec(s)}async exec(e){var t,a,r,s,d,y;try{const g=await fetch(e);if(!g.ok)return{ok:!1,error:p(g.status)};const C=await g.json(),_=C.data,h=(t=C.errors)==null?void 0:t.at(0);return h?((a=h.extensions)==null?void 0:a.code)==="FORBIDDEN"||((r=h.extensions)==null?void 0:r.code)==="ACCESS_TOKEN_EXPIRED"?{ok:!1,error:p(403,h.message)}:((s=h.extensions)==null?void 0:s.code)==="UNAUTHORIZED"?{ok:!1,error:p(401,h.message)}:((d=h.extensions)==null?void 0:d.code)==="BAD_USER_INPUT"||((y=h.extensions)==null?void 0:y.code)==="BAD_REQUEST"?{ok:!1,error:p(400,h.message)}:{ok:!1,error:p(500,h.message)}:{ok:!0,data:_}}catch{return{ok:!1,error:p(500)}}}async runMiddlewares(e){let t=e.clone();for(const a of this.middlewares)t=await a(t);return t}createUploadBody(e,t){const a=Et(t).filter(d=>d.value instanceof File||d.value instanceof Blob),r=new FormData;r.append("operations",JSON.stringify({query:e,variables:t}));const s={};return a.forEach((d,y)=>{s[y.toString()]=[`variables.${d.key.join(".")}`]}),r.append("map",JSON.stringify(s)),a.forEach((d,y)=>{r.append(y.toString(),d.value)}),r}}async function w(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 R{constructor(e){m(this,"enabled");this.enabled=(e==null?void 0:e.enabled)??!0}info(e){this.enabled&&console.log(`\x1B[34m[info] ${e}`)}warn(e){this.enabled&&console.log(`\x1B[33m[warn] ${e}`)}error(e){this.enabled&&console.log(`\x1B[31m[error] ${e}`)}success(e){this.enabled&&console.log(`\x1B[32m[success] ${e}`)}}function D(o){return new Date(o.getTime())}function A(o,e){const t=D(o);return t.setDate(t.getDate()+e),t}function S(o,e){const t=D(o);return t.setMinutes(t.getMinutes()+e),t}function P(o,e){return o.getTime()>e.getTime()}function St(o){return new Promise(e=>{setTimeout(e,o)})}function k(o,e){const t=D(o);return t.setMinutes(t.getMinutes()-e),t}class kt{constructor(e){m(this,"logger");m(this,"storageKey","session");m(this,"authService");m(this,"_refreshing",!1);this.authService=new pt(e),this.logger=new R({enabled:e.log??!1})}get refreshing(){return this._refreshing}set refreshing(e){this._refreshing=e}async create(e){if(this.isServer)return this.logger.warn("'localStorage' is not available on the server."),{ok:!1,error:{name:"UnknownError",message:"Server sign in is not supported."}};if(e.type==="MAYA"){const r=await this.authService.createSession(e);if(r.ok){const s=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...r.data,maya:!0,accessTokenExpiresAt:S(s,8).getTime(),refreshTokenExpiresAt:k(A(s,30),2).getTime()})),{ok:!0,data:null}}return r}if(e.type==="MOBILE_NUMBER"){const r=await this.authService.createSession(e);if(r.ok){const s=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...r.data,accessTokenExpiresAt:S(s,8).getTime(),refreshTokenExpiresAt:k(A(s,30),2).getTime()})),{ok:!0,data:null}}return r}const t=await this.authService.createSession(e);if(!t.ok)return t;if(t.data.authenticator)return{ok:!0,data:{authenticator:t.data.authenticator}};const a=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...t.data,accessTokenExpiresAt:S(a,8).getTime(),refreshTokenExpiresAt:k(A(a,30),2).getTime()})),{ok:!0,data:null}}async createFromAuthenticator(e){const t=await this.authService.authenticate(e);if(t.ok){const a=new Date;return this.isServer?this.logger.warn("'localStorage' is not available on the server."):window.localStorage.setItem(this.storageKey,JSON.stringify({...t.data,accessTokenExpiresAt:S(a,8).getTime(),refreshTokenExpiresAt:k(A(a,30),2).getTime()})),{ok:!0}}else return t}async get(){if(this.isServer)return this.logger.warn("'localStorage' is not available on the server."),{ok:!0,data:null};if(this.refreshing)return await St(1e3),await this.get();const e=window.localStorage.getItem(this.storageKey);if(!e)return{ok:!0,data:null};try{let t=JSON.parse(e),a=new Date;const r=new Date(t.accessTokenExpiresAt),s=new Date(t.refreshTokenExpiresAt);if(P(a,s))return this.logger.warn("Session expired. Logging out.."),window.localStorage.removeItem(this.storageKey),{ok:!1,error:{name:"SessionExpired",message:"Session expired."}};if(P(a,r)){this.logger.info("Refreshing session..."),this.refreshing=!0;const d=await this.authService.refreshSession(t.refreshToken);if(this.refreshing=!1,!d.ok)return this.logger.error(`Failed to refresh session: ${d.error.message}`),d.error.name==="InvalidToken"||d.error.name==="AccountBlacklisted"?(window.localStorage.removeItem(this.storageKey),{ok:!1,error:d.error}):(this.logger.warn("Old session returned."),{ok:!0,data:t});this.logger.success("Session refreshed!"),a=new Date,t={...t,...d.data,accessTokenExpiresAt:S(a,8).getTime(),refreshTokenExpiresAt:k(A(a,30),2).getTime()},window.localStorage.setItem(this.storageKey,JSON.stringify(t))}return{ok:!0,data:t}}catch{return{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}}}async destroy(){var t;if(this.isServer){this.logger.warn("'localStorage' is not available on the server.");return}const e=await this.get();(t=e.data)!=null&&t.accessToken&&await this.authService.destroySession(e.data.accessToken),window.localStorage.removeItem(this.storageKey)}async verify(){var a,r,s;if(this.isServer)return this.logger.warn("'localStorage' is not available on the server."),!0;const e=await this.get();if(((a=e.error)==null?void 0:a.name)==="InvalidToken"||((r=e.error)==null?void 0:r.name)==="SessionExpired"||((s=e.error)==null?void 0:s.name)==="AccountBlacklisted")return!1;if(!e.data)return!0;const t=await this.authService.verifySession(e.data.accessToken);return t||window.localStorage.removeItem(this.storageKey),t}get isServer(){return typeof window>"u"}}function n(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 Ct{constructor(e){m(this,"staticService");const t=(e==null?void 0:e.environment)==="development";this.staticService=new wt({url:t?"https://static.development.opexa.io":"https://static.opexa.io"})}get transform(){return{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)}}platform(e){var t,a,r,s,d,y,g,C,_,h,x,G,$,B,W,U,O,q,F,L,V,Y,H,j,Q,K,z,J,X,Z,ee,te,ae,re,ne,ie,oe,se,de,me,ce,ue,le,pe,fe,he,we,ye,be;return{paymentSettings:{minimumFirstDepositAmount:n(e.minimumFirstDepositAmount),restrictWithdrawalsToVerifiedMembers:e.restrictWithdrawalsToVerifiedMembers,depositGateway:{bank:{androidEnabled:((t=e.bankDepositGatewaySettings)==null?void 0:t.androidEnabled)??!1,iosEnabled:((a=e.bankDepositGatewaySettings)==null?void 0:a.iosEnabled)??!1,webEnabled:((r=e.bankDepositGatewaySettings)==null?void 0:r.webEnabled)??!1,mobileWebEnabled:((s=e.bankDepositGatewaySettings)==null?void 0:s.mobileWebEnabled)??!1,minimumAmount:n((d=e.bankDepositGatewaySettings)==null?void 0:d.minimumAmount),maximumAmount:n((y=e.bankDepositGatewaySettings)==null?void 0:y.maximumAmount)},gcash:{androidEnabled:((g=e.gcashDepositGatewaySettings)==null?void 0:g.androidEnabled)??!1,iosEnabled:((C=e.gcashDepositGatewaySettings)==null?void 0:C.iosEnabled)??!1,webEnabled:((_=e.gcashDepositGatewaySettings)==null?void 0:_.webEnabled)??!1,mobileWebEnabled:((h=e.gcashDepositGatewaySettings)==null?void 0:h.mobileWebEnabled)??!1,minimumAmount:n((x=e.gcashDepositGatewaySettings)==null?void 0:x.minimumAmount),maximumAmount:n((G=e.gcashDepositGatewaySettings)==null?void 0:G.maximumAmount)},maya:{androidEnabled:(($=e.mayaDepositGatewaySettings)==null?void 0:$.androidEnabled)??!1,iosEnabled:((B=e.mayaDepositGatewaySettings)==null?void 0:B.iosEnabled)??!1,webEnabled:((W=e.mayaDepositGatewaySettings)==null?void 0:W.webEnabled)??!1,mobileWebEnabled:((U=e.mayaDepositGatewaySettings)==null?void 0:U.mobileWebEnabled)??!1,minimumAmount:n((O=e.mayaDepositGatewaySettings)==null?void 0:O.minimumAmount),maximumAmount:n((q=e.mayaDepositGatewaySettings)==null?void 0:q.maximumAmount)},mayaApp:{androidEnabled:((F=e.mayaAppDepositGatewaySettings)==null?void 0:F.androidEnabled)??!1,iosEnabled:((L=e.mayaAppDepositGatewaySettings)==null?void 0:L.iosEnabled)??!1,webEnabled:((V=e.mayaAppDepositGatewaySettings)==null?void 0:V.webEnabled)??!1,mobileWebEnabled:((Y=e.mayaAppDepositGatewaySettings)==null?void 0:Y.mobileWebEnabled)??!1,minimumAmount:n((H=e.mayaAppDepositGatewaySettings)==null?void 0:H.minimumAmount),maximumAmount:n((j=e.mayaAppDepositGatewaySettings)==null?void 0:j.maximumAmount)}},withdrawalGateway:{bank:{androidEnabled:((Q=e.bankWithdrawalGatewaySettings)==null?void 0:Q.androidEnabled)??!1,iosEnabled:((K=e.bankWithdrawalGatewaySettings)==null?void 0:K.iosEnabled)??!1,webEnabled:((z=e.bankWithdrawalGatewaySettings)==null?void 0:z.webEnabled)??!1,mobileWebEnabled:((J=e.bankWithdrawalGatewaySettings)==null?void 0:J.mobileWebEnabled)??!1,minimumAmount:n((X=e.bankWithdrawalGatewaySettings)==null?void 0:X.minimumAmount),maximumAmount:n((Z=e.bankWithdrawalGatewaySettings)==null?void 0:Z.maximumAmount)},gcash:{androidEnabled:((ee=e.gcashWithdrawalGatewaySettings)==null?void 0:ee.androidEnabled)??!1,iosEnabled:((te=e.gcashWithdrawalGatewaySettings)==null?void 0:te.iosEnabled)??!1,webEnabled:((ae=e.gcashWithdrawalGatewaySettings)==null?void 0:ae.webEnabled)??!1,mobileWebEnabled:((re=e.gcashWithdrawalGatewaySettings)==null?void 0:re.mobileWebEnabled)??!1,minimumAmount:n((ne=e.gcashWithdrawalGatewaySettings)==null?void 0:ne.minimumAmount),maximumAmount:n((ie=e.gcashWithdrawalGatewaySettings)==null?void 0:ie.maximumAmount,1e6)},maya:{androidEnabled:((oe=e.mayaWithdrawalGatewaySettings)==null?void 0:oe.androidEnabled)??!1,iosEnabled:((se=e.mayaWithdrawalGatewaySettings)==null?void 0:se.iosEnabled)??!1,webEnabled:((de=e.mayaWithdrawalGatewaySettings)==null?void 0:de.webEnabled)??!1,mobileWebEnabled:((me=e.mayaWithdrawalGatewaySettings)==null?void 0:me.mobileWebEnabled)??!1,minimumAmount:n((ce=e.mayaWithdrawalGatewaySettings)==null?void 0:ce.minimumAmount),maximumAmount:n((ue=e.mayaWithdrawalGatewaySettings)==null?void 0:ue.maximumAmount)},mayaApp:{androidEnabled:((le=e.mayaAppWithdrawalGatewaySettings)==null?void 0:le.androidEnabled)??!1,iosEnabled:((pe=e.mayaAppWithdrawalGatewaySettings)==null?void 0:pe.iosEnabled)??!1,webEnabled:((fe=e.mayaAppWithdrawalGatewaySettings)==null?void 0:fe.webEnabled)??!1,mobileWebEnabled:((he=e.mayaAppWithdrawalGatewaySettings)==null?void 0:he.mobileWebEnabled)??!1,minimumAmount:n((we=e.mayaAppWithdrawalGatewaySettings)==null?void 0:we.minimumAmount),maximumAmount:n((ye=e.mayaAppWithdrawalGatewaySettings)==null?void 0:ye.maximumAmount,1e6)}}},pointsClubSettings:{multiplier:n((be=e.pointsClubSettings)==null?void 0:be.multiplier,0)}}}account(e){return{id:e.id,name:e.name,status:e.status,verified:e.verified,nickName:e.nickName??void 0,realName:e.realName??void 0,dateOfBirth:e.birthDay?new Date(e.birthDay):void 0,emailAddress:e.emailAddress??void 0,mobileNumber:e.mobileNumber??void 0,mobileNumberVerified:e.mobileNumberVerified??!1,mobileNumberVerificationRequired:e.mobileNumberVerificationRequired??!1,validId:e.validId??void 0,verificationStatus:e.verificationStatus,transactionPassword:e.transactionPassword,secretAnswerSubmitted:e.secretAnswerSubmitted??!1,dateTimeLastActive:e.dateTimeLastActive?new Date(e.dateTimeLastActive):void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}wallet(e){return{...e,balance:n(e.balance,0),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}verificationDetails(e){return{...e,idFrontImage:{...e.idFrontImage,url:e.idFrontImage.url??void 0,dateTimeCreated:new Date(e.idFrontImage.dateTimeCreated)},selfieImage:{...e.selfieImage,url:e.selfieImage.url??void 0,dateTimeCreated:new Date(e.selfieImage.dateTimeCreated)}}}profileCompletion(e){return{...e,completionPercentage:n(e,0)}}announcement(e){return{...e,activationEndDateTime:new Date(e.activationEndDateTime),activationStartDateTime:new Date(e.activationStartDateTime),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}withdrawalRecord(e){return{...e,amount:n(e.amount,0),netAmount:n(e.netAmount,0),fee:n(e.fee,0),reference:e.reference??void 0,bank:e.bank??void 0,recipientMobileNumber:e.recipientMobileNumber??void 0,dateTimeConfirmed:e.dateTimeConfirmed?new Date(e.dateTimeConfirmed):void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}deposit(e){return{...e,fee:n(e.fee,0),amount:n(e.amount,0),netAmount:n(e.netAmount,0),reference:e.reference??void 0,checkoutUrl:e.checkoutUrl??void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}depositRecord(e){return{...e,amount:n(e.amount,0),fee:n(e.fee,0),netAmount:n(e.netAmount,0),reference:e.reference??void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}betRecord(e){var t;return{...e,bet:n(e.bet,0),payout:n(e.payout,0),jackpotContribution:n(e.jackpotContribution,0),jackpotPayout:n(e.jackpotPayout,0),winloss:n(e.winloss),validBet:n(e.validBet,0),vendorRoundId:e.vendorRoundId??void 0,game:this.game(e.game),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:((t=e.metadata)==null?void 0:t.odds)??void 0}}}latestBetRecord(e){return{...e,game:this.game(e.game),bet:n(e.bet,0),payout:n(e.payout,0),validBet:n(e.validBet,0),dateTimeSettled:new Date(e.dateTimeSettled),dateTimeCreated:new Date(e.dateTimeCreated)}}transactionRecord(e){return{...e,amount:n(e.amount,0),content:e.content??void 0,currentBalance:n(e.currentBalance,0),dateTimeCreated:new Date(e.dateTimeCreated)}}game(e){const t=this.staticService.gameThumbnails(e);return{...e,images:t}}gameSession(e){return{...e,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}promo(e){return{...e,banner:{...e.banner,dateTimeCreated:new Date(e.banner.dateTimeCreated)},maximumBonusAmount:n(e.maximumBonusAmount),minimumBonusAmount:n(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{...e,banner:{...e.banner,dateTimeCreated:new Date(e.banner.dateTimeCreated)},activationEndDateTime:new Date(e.activationEndDateTime),activationStartDateTime:new Date(e.activationStartDateTime),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}bonus(e){return{...e,promo:this.promo(e.promo),deposit:e.deposit?{...e.deposit,fee:n(e.deposit.fee,0),amount:n(e.deposit.amount,0),netAmount:n(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:n(e.balance,0),amount:n(e.amount,0),expiration:new Date(e.expiration),turnoverRequirement:n(e.turnoverRequirement,0),currentTurnoverRequirementContribution:n(e.currentTurnoverRequirementContribution,0),currentTurnoverRequirementContributionPercentage:n(e.currentTurnoverRequirementContributionPercentage,0),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}cashbackBonus(e){return{id:e.id,balance:n(e.balance,0),cashback:this.cashback(e.cashback),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}file(e){return{...e,url:e.url??void 0,dateTimeCreated:new Date(e.dateTimeCreated)}}pointsWallet(e){return{id:e.id,points:n(e.points,0),account:e.account,dateTimeCreated:new Date(e.dateTimeCreated)}}}class Tt{constructor(e){m(this,"gameService");m(this,"fileService");m(this,"walletService");m(this,"reportService");m(this,"portalService");m(this,"accountService");m(this,"sessionManager");m(this,"transformer");m(this,"logger");const t=e.environment==="development";this.sessionManager=new kt({...e,url:t?"https://auth.development.opexa.io":"https://auth.opexa.io"});const a={middlewares:[this.authMiddleware],fetchOptions:{headers:{Role:"MEMBER","Platform-Code":e.platform}}};this.gameService=new I(new b(t?"https://game.development.opexa.io/graphql":"https://game.opexa.io/graphql",a)),this.fileService=new ft(new b(t?"https://file.development.opexa.io/graphql":"https://file.opexa.io/graphql",a)),this.walletService=new yt(new b(t?"https://wallet.development.opexa.io/graphql":"https://wallet.opexa.io/graphql",a)),this.reportService=new ht(new b(t?"https://report.development.opexa.io/graphql":"https://report.opexa.io/graphql",a)),this.accountService=new lt(new b(t?"https://account.development.opexa.io/graphql":"https://account.opexa.io/graphql",a)),this.portalService=new bt(new b(t?"https://portal.development.opexa.io/graphql":"https://portal.opexa.io/graphql",a)),this.transformer=new Ct(e),this.logger=new R({enabled:e.log??!1})}get authMiddleware(){return async e=>{this.logger.info("Checking for session");const t=await this.sessionManager.get();return t.data?(e.headers.append("Authorization",`Bearer ${t.data.accessToken}`),this.logger.info("Session found"),this.logger.success("Added 'Authorization' header")):this.logger.info("No session found"),e}}async signIn(e){switch(e.type){case"NAME_AND_PASSWORD":{const t=await this.sessionManager.create({...e,password:await w(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 w(e.secretAnswer)});default:return{ok:!1,error:{name:"HttpBadRequest",message:"Invalid input 'type'"}}}}async signOut(){await this.sessionManager.destroy()}watchSession(e){const t=e.interval??3e4,a=e.onInvalid;let r=null;const s=()=>setTimeout(async()=>{await this.sessionManager.verify()||await a(),r=s()},t);return r=s(),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 platform(){const e=await this.accountService.platform();return e.ok?{ok:!0,data:this.transformer.transform.platform(e.data)}:e}async account(){const[e,t]=await Promise.all([this.accountService.memberAccount(),this.reportService.member()]);return e.ok?t.ok?{ok:!0,data:this.transformer.transform.account({...e.data,...t.data})}:{ok:!1,error:t.error}:{ok:!1,error:e.error}}async createAccount(e){const t=e.id??u.ObjectId.generate(f.Account).toString(),a=await this.accountService.registerMemberAccount({input:{id:t,name:e.name,birthDay:typeof e.dateOfBirth=="string"?e.dateOfBirth:e.dateOfBirth.toISOString(),password:await w(e.password),mobileNumber:this.addAreaCode(e.mobileNumber),domain:e.domain,btag:e.btag},verificationCode:e.verificationCode,reCAPTCHAResponse:e.reCAPTCHAResponse});return a.ok?{ok:!0,data:{id:t}}:a}async updateAccount(e,t){return await this.accountService.updateMemberAccount({input:{id:e,data:{...t,password:t.password?await w(t.password):void 0,transactionPassword:t.transactionPassword?await w(t.transactionPassword):void 0,...t.mobileNumber&&{mobileNumber:this.addAreaCode(t.mobileNumber)},secretAnswer:t.secretAnswer?await w(t.secretAnswer):void 0}}})}async deleteAccount(e){return await this.accountService.deleteMemberAccount({input:{id:e}})}async verificationDetails(){const e=await this.accountService.memberVerification();return e.ok?{ok:!0,data:e.data?this.transformer.transform.verificationDetails(e.data):null}:e}async submitVerificationDetails(e){const t=e.id??u.ObjectId.generate(f.Verification).toString(),a=await this.accountService.createMemberVerification({input:{id:t,...e}});return a.ok?{ok:!0,data:{id:t}}:a}async updateVerificationDetails(e,t){return await this.accountService.updateMemberVerification({input:{id:e,data:{...t}}})}async resetPassword(e){return await this.accountService.resetPassword({input:{mobileNumber:this.addAreaCode(e.mobileNumber),newPassword:await w(e.newPassword)},verificationCode:e.verificationCode})}async verifyMobileNumber(e){return await this.accountService.verifyMobileNumber({input:{verificationCode:e}})}async profileCompletion(){const e=await this.accountService.profileCompletion();return e.ok?{ok:!0,data:this.transformer.transform.profileCompletion(e.data)}:e}async sendVerificationCode(e){return await this.accountService.sendVerificationCode({input:{channel:"SMS",recipient:this.addAreaCode(e)}})}async wallet(){const e=await this.walletService.wallet();return e.ok?{ok:!0,data:e.data?this.transformer.transform.wallet(e.data):null}:e}async announcements(e){const t=await this.accountService.announcements({...e,filter:{visibility:{in:["MEMBER","GLOBAL"]},activationStartDateTime:{greaterThanOrEqual:new Date}}});return t.ok?{ok:!0,data:{announcements:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.announcement(r),cursor:a})),totalCount:t.data.totalCount,nextCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async createWithdrawal(e){const t=e.id??u.ObjectId.generate(f.Withdrawal).toString();if(e.type==="BANK"){const a=await this.walletService.createBankWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await w(e.transactionPassword)}});if(!a.ok)return a}if(e.type==="GCASH"){const a=await this.walletService.createGCashWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await w(e.transactionPassword),recipientMobileNumber:this.addAreaCode(e.recipientMobileNumber)}});if(!a.ok)return a}if(e.type==="MAYA"){const a=await this.walletService.createMayaWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await w(e.transactionPassword),recipientMobileNumber:this.addAreaCode(e.recipientMobileNumber)}});if(!a.ok)return a}if(e.type==="MAYA_APP"){const a=await this.walletService.createMayaAppWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await w(e.transactionPassword)}});if(!a.ok)return a}return{ok:!0,data:{id:t}}}async withdrawalRecords(e){const t=await this.reportService.withdrawalRecords(e);return t.ok?{ok:!0,data:{withdrawalRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.withdrawalRecord(r),cursor:a})),totalCount:t.data.totalCount,nextCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async remainingDailyWithdrawalsCount(){return await this.walletService.remainingDailyWithdrawalsCount()}async createDeposit(e){const t=e.id??u.ObjectId.generate(f.Deposit).toString();if(e.type==="MAYA"){const a=await this.walletService.createMayaDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}if(e.type==="MAYA_APP"){const a=await this.walletService.createMayaAppDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}if(e.type==="GCASH"){const a=await this.walletService.createGCashDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}return{ok:!0,data:{id:t}}}async deposit(e){const t=await this.walletService.deposit({id:e});return t.ok?{ok:!0,data:t.data?this.transformer.transform.deposit(t.data):null}:t}async depositRecords(e){const t=await this.reportService.depositRecords(e);return t.ok?{ok:!0,data:{depositRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.depositRecord(r),cursor:a})),totalCount:t.data.totalCount,nextCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async depositsCount(){return await this.reportService.depositsCount()}async betRecords(e){const t=await this.reportService.betRecords(e);return t.ok?{ok:!0,data:{betRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.betRecord(r),cursor:a})),totalCount:t.data.totalCount,nextCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async latestBetRecords(){const e=await this.portalService.latestBetRecords();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.latestBetRecord)}:e}async transactionRecords(e){const t=await this.reportService.transactionRecords(e);return t.ok?{ok:!0,data:{transactionRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.transactionRecord(r),cursor:a})),totalCount:t.data.totalCount,nextCursor: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 games(e){const t=await this.gameService.games(e);return t.ok?{ok:!0,data:{games:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.game(r),cursor:a})),totalCount:t.data.totalCount,nextCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async gamesByName(e){const t=await this.gameService.gamesByName(e);return t.ok?{ok:!0,data:t.data.map(this.transformer.transform.game)}:t}async gamesByName__next(e){const t=await this.walletService.gamesByName(e);return t.ok?{ok:!0,data:t.data.map(this.transformer.transform.game)}:t}async games__next(e){const t=await this.walletService.games(e);return t.ok?{ok:!0,data:{games:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.game(r),cursor:a})),totalCount:t.data.totalCount,nextCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async createGameSession(e){const t=e.id??u.ObjectId.generate(f.GameSession).toString(),a=await this.gameService.createGameSession({input:{id:t,game:e.game}});return a.ok?{ok:!0,data:{id:t}}:a}async createGameSession__next(e){const t=e.id??u.ObjectId.generate(f.GameSession).toString(),a=await this.walletService.createGameSession({input:{id:t,game:e.game}});return a.ok?{ok:!0,data:{id:t}}:a}async gameSession(e){const t=await this.gameService.gameSession({id:e});return t.ok?{ok:!0,data:t.data?this.transformer.transform.gameSession(t.data):null}:t}async gameSession__next(e){const t=await this.walletService.gameSession({id:e});return t.ok?{ok:!0,data:t.data?this.transformer.transform.gameSession(t.data):null}:t}async endGameSession(e){return await this.gameService.endGameSession({input:{id:e}})}async endGameSession__next(e){return await this.walletService.endGameSession({input:{id:e}})}async file(e){const t=await this.fileService.file({id:e});return t.ok?{ok:!0,data:t.data?this.transformer.transform.file(t.data):null}:t}async uploadImageFile(e){const t=e.id??u.ObjectId.generate(f.File).toString(),a=await this.fileService.uploadPrivateImageFile({input:{id:t,file:e.file}});return a.ok?{ok:!0,data:{id:t}}:a}async pointsWallet(){const e=await this.walletService.pointsWallet();return e.ok?{ok:!0,data:e.data?this.transformer.transform.pointsWallet(e.data):null}:e}async pointsToCashConversion(e){return await this.walletService.pointsToCashConversion({input:{amount:e.toString()}})}addAreaCode(e){return e.startsWith("+63")?e:e.startsWith("63")?`+${e}`:e.startsWith("0")?`+63${e.substring(1)}`:`+63${e}`}}Object.defineProperty(l,"ObjectId",{enumerable:!0,get:()=>u.ObjectId}),l.ObjectType=f,l.Sdk=Tt,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
930
930
|
//# sourceMappingURL=index.js.map
|