@opexa/portal-sdk 0.0.9 → 0.0.10
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 +147 -227
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +590 -698
- package/dist/index.mjs.map +1 -1
- package/dist/sdk/types.d.ts +1 -0
- package/dist/services/auth.service.d.ts +2 -1
- package/dist/services/bonus.d.ts +4 -3
- package/dist/services/deposit.d.ts +10 -5
- package/dist/services/file.d.ts +4 -3
- package/dist/services/game.d.ts +4 -3
- package/dist/services/member.d.ts +28 -15
- package/dist/services/points.d.ts +4 -3
- package/dist/services/session.d.ts +3 -4
- package/dist/services/utils.d.ts +13 -0
- package/dist/services/withdrawal.d.ts +13 -6
- package/dist/utils/graphql-client.d.ts +0 -1
- package/dist/utils/status-code-to-operation-error.d.ts +3 -0
- package/dist/utils/types.d.ts +7 -7
- package/package.json +1 -1
- package/dist/utils/rest-client.d.ts +0 -34
- package/dist/utils/status-code-to-error.d.ts +0 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(l,
|
|
1
|
+
(function(l,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@opexa/object-id")):typeof define=="function"&&define.amd?define(["exports","@opexa/object-id"],c):(l=typeof globalThis<"u"?globalThis:l||self,c(l.sdk={},l.objectId))})(this,function(l,c){"use strict";var St=Object.defineProperty;var kt=(l,c,h)=>c in l?St(l,c,{enumerable:!0,configurable:!0,writable:!0,value:h}):l[c]=h;var d=(l,c,h)=>kt(l,typeof c!="symbol"?c+"":c,h);const h={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 Ee=i`
|
|
2
2
|
query Announcements($first: Int, $after: Cursor, $filter: AnnouncementFilterInput) {
|
|
3
3
|
announcements(first: $first, after: $after, filter: $filter) {
|
|
4
4
|
edges {
|
|
@@ -24,15 +24,15 @@
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
`,
|
|
27
|
+
`,g=i`
|
|
28
28
|
fragment GameFragment on Game {
|
|
29
29
|
id
|
|
30
30
|
type
|
|
31
31
|
name
|
|
32
32
|
provider
|
|
33
33
|
}
|
|
34
|
-
`,
|
|
35
|
-
${
|
|
34
|
+
`,Ae=i`
|
|
35
|
+
${g}
|
|
36
36
|
|
|
37
37
|
query Game($id: ObjectId!) {
|
|
38
38
|
node(id: $id) {
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
`,
|
|
45
|
-
${
|
|
44
|
+
`,Se=i`
|
|
45
|
+
${g}
|
|
46
46
|
|
|
47
47
|
query Games($after: Cursor, $first: Int, $filter: GameFilterInput) {
|
|
48
48
|
games(after: $after, first: $first, filter: $filter) {
|
|
@@ -61,16 +61,16 @@
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
`,
|
|
65
|
-
${
|
|
64
|
+
`,ke=i`
|
|
65
|
+
${g}
|
|
66
66
|
|
|
67
67
|
query GamesByName($search: String!, $filter: GameFilterInput, $first: Int) {
|
|
68
68
|
gamesByName(search: $search, filter: $filter, first: $first) {
|
|
69
69
|
...GameFragment
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
`,
|
|
73
|
-
${
|
|
72
|
+
`,Ce=i`
|
|
73
|
+
${g}
|
|
74
74
|
|
|
75
75
|
query GameSession($id: ObjectId!) {
|
|
76
76
|
node(id: $id) {
|
|
@@ -86,21 +86,20 @@
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
`,
|
|
89
|
+
`,Te=i`
|
|
90
90
|
mutation CreateGameSession($input: CreateGameSessionInput!) {
|
|
91
91
|
createGameSession(input: $input) {
|
|
92
92
|
... on GameDoesNotExistError {
|
|
93
|
-
|
|
94
|
-
message
|
|
93
|
+
__typename
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
96
|
}
|
|
98
|
-
`,
|
|
97
|
+
`,_e=i`
|
|
99
98
|
mutation EndGameSession($input: EndGameSessionInput!) {
|
|
100
99
|
endGameSession(input: $input)
|
|
101
100
|
}
|
|
102
|
-
`,
|
|
103
|
-
${
|
|
101
|
+
`,ve=i`
|
|
102
|
+
${g}
|
|
104
103
|
|
|
105
104
|
query BetRecords($first: Int, $after: Cursor, $filter: BetRecordFilterInput) {
|
|
106
105
|
member {
|
|
@@ -139,7 +138,7 @@
|
|
|
139
138
|
}
|
|
140
139
|
}
|
|
141
140
|
}
|
|
142
|
-
`,
|
|
141
|
+
`,Me=i`
|
|
143
142
|
query LatestBetRecords {
|
|
144
143
|
latestBetRecords {
|
|
145
144
|
id
|
|
@@ -158,16 +157,16 @@
|
|
|
158
157
|
}
|
|
159
158
|
}
|
|
160
159
|
|
|
161
|
-
${
|
|
162
|
-
`,
|
|
160
|
+
${g}
|
|
161
|
+
`,T=i`
|
|
163
162
|
fragment FileFragment on File {
|
|
164
163
|
id
|
|
165
164
|
url
|
|
166
165
|
status
|
|
167
166
|
dateTimeCreated
|
|
168
167
|
}
|
|
169
|
-
`,
|
|
170
|
-
${
|
|
168
|
+
`,N=i`
|
|
169
|
+
${T}
|
|
171
170
|
|
|
172
171
|
query File($id: ObjectId!) {
|
|
173
172
|
node(id: $id) {
|
|
@@ -176,25 +175,22 @@
|
|
|
176
175
|
}
|
|
177
176
|
}
|
|
178
177
|
}
|
|
179
|
-
`;
|
|
178
|
+
`;i`
|
|
180
179
|
mutation UploadPrivateImageFile($input: UploadFileInput!) {
|
|
181
180
|
uploadPrivateImageFile(input: $input) {
|
|
182
181
|
... on FileFormatNotSupportedError {
|
|
183
|
-
|
|
184
|
-
message
|
|
182
|
+
__typename
|
|
185
183
|
}
|
|
186
184
|
... on FileNameTooLongError {
|
|
187
|
-
|
|
188
|
-
message
|
|
185
|
+
__typename
|
|
189
186
|
}
|
|
190
187
|
... on FileSizeTooBigError {
|
|
191
|
-
|
|
192
|
-
message
|
|
188
|
+
__typename
|
|
193
189
|
}
|
|
194
190
|
}
|
|
195
191
|
}
|
|
196
|
-
`;const
|
|
197
|
-
${
|
|
192
|
+
`;const I=i`
|
|
193
|
+
${T}
|
|
198
194
|
|
|
199
195
|
fragment CashbackFragment on Cashback {
|
|
200
196
|
id
|
|
@@ -209,16 +205,16 @@
|
|
|
209
205
|
dateTimeCreated
|
|
210
206
|
dateTimeLastUpdated
|
|
211
207
|
}
|
|
212
|
-
`,De=
|
|
213
|
-
${
|
|
208
|
+
`,De=i`
|
|
209
|
+
${I}
|
|
214
210
|
|
|
215
211
|
query Cashbacks {
|
|
216
212
|
cashbacks {
|
|
217
213
|
...CashbackFragment
|
|
218
214
|
}
|
|
219
215
|
}
|
|
220
|
-
`,
|
|
221
|
-
${
|
|
216
|
+
`,v=i`
|
|
217
|
+
${T}
|
|
222
218
|
|
|
223
219
|
fragment PromoFragment on Promo {
|
|
224
220
|
id
|
|
@@ -236,24 +232,24 @@
|
|
|
236
232
|
dateTimeCreated
|
|
237
233
|
dateTimeLastUpdated
|
|
238
234
|
}
|
|
239
|
-
`,
|
|
240
|
-
${
|
|
235
|
+
`,Ne=i`
|
|
236
|
+
${v}
|
|
241
237
|
|
|
242
238
|
query Promos {
|
|
243
239
|
promos {
|
|
244
240
|
...PromoFragment
|
|
245
241
|
}
|
|
246
242
|
}
|
|
247
|
-
`,
|
|
248
|
-
${
|
|
243
|
+
`,Ie=i`
|
|
244
|
+
${v}
|
|
249
245
|
|
|
250
246
|
query AvailablePromos($filter: PromoFilterInput) {
|
|
251
247
|
availablePromos(filter: $filter) {
|
|
252
248
|
...PromoFragment
|
|
253
249
|
}
|
|
254
250
|
}
|
|
255
|
-
`,Re=
|
|
256
|
-
${
|
|
251
|
+
`,Re=i`
|
|
252
|
+
${v}
|
|
257
253
|
|
|
258
254
|
query Bonus {
|
|
259
255
|
bonus {
|
|
@@ -281,8 +277,8 @@
|
|
|
281
277
|
dateTimeLastUpdated
|
|
282
278
|
}
|
|
283
279
|
}
|
|
284
|
-
`,
|
|
285
|
-
${
|
|
280
|
+
`,xe=i`
|
|
281
|
+
${I}
|
|
286
282
|
|
|
287
283
|
query CashbackBonuses {
|
|
288
284
|
cashbackBonuses {
|
|
@@ -295,16 +291,15 @@
|
|
|
295
291
|
dateTimeLastUpdated
|
|
296
292
|
}
|
|
297
293
|
}
|
|
298
|
-
`,
|
|
294
|
+
`,Pe=i`
|
|
299
295
|
mutation ClaimCashbackBonus($input: ClaimCashbackBonusInput!) {
|
|
300
296
|
claimCashbackBonus(input: $input) {
|
|
301
297
|
... on CashbackBonusDoesNotExistError {
|
|
302
|
-
|
|
303
|
-
message
|
|
298
|
+
__typename
|
|
304
299
|
}
|
|
305
300
|
}
|
|
306
301
|
}
|
|
307
|
-
`,
|
|
302
|
+
`,Ge=i`
|
|
308
303
|
query DepositRecords($after: Cursor, $first: Int, $filter: DepositRecordFilterInput) {
|
|
309
304
|
member {
|
|
310
305
|
depositRecords(after: $after, first: $first, filter: $filter) {
|
|
@@ -333,118 +328,94 @@
|
|
|
333
328
|
}
|
|
334
329
|
}
|
|
335
330
|
}
|
|
336
|
-
`,$e=
|
|
331
|
+
`,$e=i`
|
|
337
332
|
mutation CreateGCashDeposit($input: CreateGCashDepositInput!) {
|
|
338
333
|
createGCashDeposit(input: $input) {
|
|
339
334
|
... on DepositPromoMaximumAmountExceededError {
|
|
340
|
-
|
|
341
|
-
message
|
|
335
|
+
__typename
|
|
342
336
|
}
|
|
343
337
|
... on DepositPromoMinimumAmountNotMetError {
|
|
344
|
-
|
|
345
|
-
message
|
|
338
|
+
__typename
|
|
346
339
|
}
|
|
347
340
|
... on HasActiveBonusError {
|
|
348
|
-
|
|
349
|
-
message
|
|
341
|
+
__typename
|
|
350
342
|
}
|
|
351
343
|
... on MaximumDepositAmountExceededError {
|
|
352
|
-
|
|
353
|
-
message
|
|
344
|
+
__typename
|
|
354
345
|
}
|
|
355
346
|
... on MinimumDepositAmountNotMetError {
|
|
356
|
-
|
|
357
|
-
message
|
|
347
|
+
__typename
|
|
358
348
|
}
|
|
359
349
|
... on MinimumFirstDepositAmountNotMetError {
|
|
360
|
-
|
|
361
|
-
message
|
|
350
|
+
__typename
|
|
362
351
|
}
|
|
363
352
|
... on PromoNotEnabledError {
|
|
364
|
-
|
|
365
|
-
message
|
|
353
|
+
__typename
|
|
366
354
|
}
|
|
367
355
|
... on WalletDoesNotExistError {
|
|
368
|
-
|
|
369
|
-
message
|
|
356
|
+
__typename
|
|
370
357
|
}
|
|
371
358
|
}
|
|
372
359
|
}
|
|
373
|
-
`,
|
|
360
|
+
`,Be=i`
|
|
374
361
|
mutation CreateMayaDeposit($input: CreateMayaDepositInput!) {
|
|
375
362
|
createMayaDeposit(input: $input) {
|
|
376
363
|
... on DepositPromoMaximumAmountExceededError {
|
|
377
|
-
|
|
378
|
-
message
|
|
364
|
+
__typename
|
|
379
365
|
}
|
|
380
366
|
... on DepositPromoMinimumAmountNotMetError {
|
|
381
|
-
|
|
382
|
-
message
|
|
367
|
+
__typename
|
|
383
368
|
}
|
|
384
369
|
... on HasActiveBonusError {
|
|
385
|
-
|
|
386
|
-
message
|
|
370
|
+
__typename
|
|
387
371
|
}
|
|
388
372
|
... on MaximumDepositAmountExceededError {
|
|
389
|
-
|
|
390
|
-
message
|
|
373
|
+
__typename
|
|
391
374
|
}
|
|
392
375
|
... on MinimumDepositAmountNotMetError {
|
|
393
|
-
|
|
394
|
-
message
|
|
376
|
+
__typename
|
|
395
377
|
}
|
|
396
378
|
... on MinimumFirstDepositAmountNotMetError {
|
|
397
|
-
|
|
398
|
-
message
|
|
379
|
+
__typename
|
|
399
380
|
}
|
|
400
381
|
... on PromoNotEnabledError {
|
|
401
|
-
|
|
402
|
-
message
|
|
382
|
+
__typename
|
|
403
383
|
}
|
|
404
384
|
... on WalletDoesNotExistError {
|
|
405
|
-
|
|
406
|
-
message
|
|
385
|
+
__typename
|
|
407
386
|
}
|
|
408
387
|
}
|
|
409
388
|
}
|
|
410
|
-
`,
|
|
389
|
+
`,We=i`
|
|
411
390
|
mutation CreateMayaAppDeposit($input: CreateMayaAppDepositInput!) {
|
|
412
391
|
createMayaAppDeposit(input: $input) {
|
|
413
392
|
... on DepositPromoMaximumAmountExceededError {
|
|
414
|
-
|
|
415
|
-
message
|
|
393
|
+
__typename
|
|
416
394
|
}
|
|
417
395
|
... on DepositPromoMinimumAmountNotMetError {
|
|
418
|
-
|
|
419
|
-
message
|
|
396
|
+
__typename
|
|
420
397
|
}
|
|
421
398
|
... on HasActiveBonusError {
|
|
422
|
-
|
|
423
|
-
message
|
|
399
|
+
__typename
|
|
424
400
|
}
|
|
425
401
|
... on MaximumDepositAmountExceededError {
|
|
426
|
-
|
|
427
|
-
message
|
|
402
|
+
__typename
|
|
428
403
|
}
|
|
429
404
|
... on MinimumDepositAmountNotMetError {
|
|
430
|
-
|
|
431
|
-
message
|
|
405
|
+
__typename
|
|
432
406
|
}
|
|
433
407
|
... on MinimumFirstDepositAmountNotMetError {
|
|
434
|
-
|
|
435
|
-
message
|
|
408
|
+
__typename
|
|
436
409
|
}
|
|
437
410
|
... on PromoNotEnabledError {
|
|
438
|
-
|
|
439
|
-
message
|
|
411
|
+
__typename
|
|
440
412
|
}
|
|
441
413
|
... on WalletDoesNotExistError {
|
|
442
|
-
|
|
443
|
-
message
|
|
414
|
+
__typename
|
|
444
415
|
}
|
|
445
416
|
}
|
|
446
417
|
}
|
|
447
|
-
`,
|
|
418
|
+
`,Ue=i`
|
|
448
419
|
query Deposit($id: ObjectId!) {
|
|
449
420
|
node(id: $id) {
|
|
450
421
|
... on GCashDeposit {
|
|
@@ -484,19 +455,19 @@
|
|
|
484
455
|
}
|
|
485
456
|
}
|
|
486
457
|
}
|
|
487
|
-
`,
|
|
458
|
+
`,Oe=i`
|
|
488
459
|
query DepositsCount {
|
|
489
460
|
member {
|
|
490
461
|
depositsCount
|
|
491
462
|
}
|
|
492
463
|
}
|
|
493
|
-
`,
|
|
464
|
+
`,qe=i`
|
|
494
465
|
query Member {
|
|
495
466
|
member {
|
|
496
467
|
dateTimeLastActive
|
|
497
468
|
}
|
|
498
469
|
}
|
|
499
|
-
`,
|
|
470
|
+
`,Fe=i`
|
|
500
471
|
query MemberAccount {
|
|
501
472
|
memberAccount: self {
|
|
502
473
|
... on MemberAccount {
|
|
@@ -520,8 +491,8 @@
|
|
|
520
491
|
}
|
|
521
492
|
}
|
|
522
493
|
}
|
|
523
|
-
`,
|
|
524
|
-
${
|
|
494
|
+
`,Le=i`
|
|
495
|
+
${T}
|
|
525
496
|
|
|
526
497
|
query MemberVerification {
|
|
527
498
|
memberAccount: self {
|
|
@@ -544,7 +515,7 @@
|
|
|
544
515
|
}
|
|
545
516
|
}
|
|
546
517
|
}
|
|
547
|
-
`,
|
|
518
|
+
`,Ve=i`
|
|
548
519
|
mutation RegisterMemberAccount(
|
|
549
520
|
$input: RegisterMemberAccountInput!
|
|
550
521
|
$referralCode: String
|
|
@@ -558,150 +529,123 @@
|
|
|
558
529
|
reCAPTCHAResponse: $reCAPTCHAResponse
|
|
559
530
|
) {
|
|
560
531
|
... on AccountNameNotAvailableError {
|
|
561
|
-
|
|
562
|
-
message
|
|
532
|
+
__typename
|
|
563
533
|
}
|
|
564
534
|
... on InvalidPlatformError {
|
|
565
|
-
|
|
566
|
-
message
|
|
535
|
+
__typename
|
|
567
536
|
}
|
|
568
537
|
... on InvalidPlatformError {
|
|
569
|
-
|
|
570
|
-
message
|
|
538
|
+
__typename
|
|
571
539
|
}
|
|
572
540
|
... on InvalidReCAPTCHAResponseError {
|
|
573
|
-
|
|
574
|
-
message
|
|
541
|
+
__typename
|
|
575
542
|
}
|
|
576
543
|
... on InvalidSMSVerificationCodeError {
|
|
577
|
-
|
|
578
|
-
message
|
|
544
|
+
__typename
|
|
579
545
|
}
|
|
580
546
|
... on MinimumAgeRequirementError {
|
|
581
|
-
|
|
582
|
-
message
|
|
547
|
+
__typename
|
|
583
548
|
}
|
|
584
549
|
... on MobileNumberNotAvailableError {
|
|
585
|
-
|
|
586
|
-
message
|
|
550
|
+
__typename
|
|
587
551
|
}
|
|
588
552
|
}
|
|
589
553
|
}
|
|
590
|
-
`,
|
|
554
|
+
`,Ye=i`
|
|
591
555
|
mutation UpdateMemberAccount($input: UpdateMemberAccountInput!) {
|
|
592
556
|
updateMemberAccount(input: $input) {
|
|
593
557
|
... on AccountNameNotAvailableError {
|
|
594
|
-
|
|
595
|
-
message
|
|
558
|
+
__typename
|
|
596
559
|
}
|
|
597
560
|
... on EmailAddressNotAvailableError {
|
|
598
|
-
|
|
599
|
-
message
|
|
561
|
+
__typename
|
|
600
562
|
}
|
|
601
563
|
... on InvalidTransactionPasswordError {
|
|
602
|
-
|
|
603
|
-
message
|
|
564
|
+
__typename
|
|
604
565
|
}
|
|
605
566
|
... on MobileNumberNotAvailableError {
|
|
606
|
-
|
|
607
|
-
message
|
|
567
|
+
__typename
|
|
608
568
|
}
|
|
609
569
|
... on NickNameNotAvailableError {
|
|
610
|
-
|
|
611
|
-
message
|
|
570
|
+
__typename
|
|
612
571
|
}
|
|
613
572
|
... on RealNameAlreadySetError {
|
|
614
|
-
|
|
615
|
-
message
|
|
573
|
+
__typename
|
|
616
574
|
}
|
|
617
575
|
... on ValidIdAlreadySetError {
|
|
618
|
-
|
|
619
|
-
message
|
|
576
|
+
__typename
|
|
620
577
|
}
|
|
621
578
|
}
|
|
622
579
|
}
|
|
623
|
-
`,He=
|
|
580
|
+
`,He=i`
|
|
624
581
|
mutation ResetPassword($input: ResetPasswordInput!, $verificationCode: String) {
|
|
625
582
|
resetPassword(input: $input, verificationCode: $verificationCode) {
|
|
626
583
|
... on AccountNotFoundError {
|
|
627
|
-
|
|
628
|
-
message
|
|
584
|
+
__typename
|
|
629
585
|
}
|
|
630
586
|
... on InvalidVerificationCodeError {
|
|
631
|
-
|
|
632
|
-
message
|
|
587
|
+
__typename
|
|
633
588
|
}
|
|
634
589
|
}
|
|
635
590
|
}
|
|
636
|
-
`,
|
|
591
|
+
`,je=i`
|
|
637
592
|
mutation DeleteMemberAccount($input: DeleteMemberAccountInput!) {
|
|
638
593
|
deleteMemberAccount(input: $input)
|
|
639
594
|
}
|
|
640
|
-
`,
|
|
595
|
+
`,Qe=i`
|
|
641
596
|
mutation SendVerificationCode($input: SendVerificationCodeInput!) {
|
|
642
597
|
sendVerificationCode(input: $input) {
|
|
643
598
|
... on InvalidPlatformError {
|
|
644
|
-
|
|
645
|
-
message
|
|
599
|
+
__typename
|
|
646
600
|
}
|
|
647
601
|
... on NotReadyToSendVerficationCodeError {
|
|
648
|
-
|
|
649
|
-
message
|
|
602
|
+
__typename
|
|
650
603
|
}
|
|
651
604
|
}
|
|
652
605
|
}
|
|
653
|
-
`,
|
|
606
|
+
`,Ke=i`
|
|
654
607
|
mutation VerifyMobileNumber($input: VerifyMobileNumberInput!) {
|
|
655
608
|
verifyMobileNumber(input: $input) {
|
|
656
609
|
... on InvalidSMSVerificationCodeError {
|
|
657
|
-
|
|
658
|
-
message
|
|
610
|
+
__typename
|
|
659
611
|
}
|
|
660
612
|
... on MobileNumberAlreadyVerifiedError {
|
|
661
|
-
|
|
662
|
-
message
|
|
613
|
+
__typename
|
|
663
614
|
}
|
|
664
615
|
}
|
|
665
616
|
}
|
|
666
|
-
`,
|
|
617
|
+
`,ze=i`
|
|
667
618
|
mutation CreateMemberVerification($input: CreateMemberVerificationInput!) {
|
|
668
619
|
createMemberVerification(input: $input) {
|
|
669
620
|
... on FileDoesNotExistError {
|
|
670
|
-
|
|
671
|
-
message
|
|
621
|
+
__typename
|
|
672
622
|
}
|
|
673
623
|
... on FileNotReadyError {
|
|
674
|
-
|
|
675
|
-
message
|
|
624
|
+
__typename
|
|
676
625
|
}
|
|
677
626
|
... on MemberVerificationAlreadyExistsError {
|
|
678
|
-
|
|
679
|
-
message
|
|
627
|
+
__typename
|
|
680
628
|
}
|
|
681
629
|
}
|
|
682
630
|
}
|
|
683
|
-
`,
|
|
631
|
+
`,Je=i`
|
|
684
632
|
mutation UpdateMemberVerification($input: UpdateMemberVerificationInput!) {
|
|
685
633
|
updateMemberVerification(input: $input) {
|
|
686
634
|
... on FileDoesNotExistError {
|
|
687
|
-
|
|
688
|
-
message
|
|
635
|
+
__typename
|
|
689
636
|
}
|
|
690
637
|
... on FileNotReadyError {
|
|
691
|
-
|
|
692
|
-
message
|
|
638
|
+
__typename
|
|
693
639
|
}
|
|
694
640
|
... on MemberVerificationAlreadyApprovedError {
|
|
695
|
-
|
|
696
|
-
message
|
|
641
|
+
__typename
|
|
697
642
|
}
|
|
698
643
|
... on MemberVerificationDoesNotExistError {
|
|
699
|
-
|
|
700
|
-
message
|
|
644
|
+
__typename
|
|
701
645
|
}
|
|
702
646
|
}
|
|
703
647
|
}
|
|
704
|
-
`,
|
|
648
|
+
`,Xe=i`
|
|
705
649
|
query ProfileCompletion {
|
|
706
650
|
profileCompletion {
|
|
707
651
|
completionPercentage
|
|
@@ -712,7 +656,7 @@
|
|
|
712
656
|
accountPassword
|
|
713
657
|
}
|
|
714
658
|
}
|
|
715
|
-
`,
|
|
659
|
+
`,Ze=i`
|
|
716
660
|
fragment DepositGatewaySettingsCoreData on DepositGatewaySettings {
|
|
717
661
|
minimumAmount
|
|
718
662
|
maximumAmount
|
|
@@ -766,7 +710,7 @@
|
|
|
766
710
|
multiplier
|
|
767
711
|
}
|
|
768
712
|
}
|
|
769
|
-
`,
|
|
713
|
+
`,et=i`
|
|
770
714
|
query PointsWallet {
|
|
771
715
|
pointsWallet {
|
|
772
716
|
id
|
|
@@ -775,16 +719,15 @@
|
|
|
775
719
|
dateTimeCreated
|
|
776
720
|
}
|
|
777
721
|
}
|
|
778
|
-
`,
|
|
722
|
+
`,tt=i`
|
|
779
723
|
mutation PointsToCashConversion($input: PointsToCashConversionInput!) {
|
|
780
724
|
pointsToCashConversion(input: $input) {
|
|
781
725
|
... on InsufficientPointsError {
|
|
782
|
-
|
|
783
|
-
message
|
|
726
|
+
__typename
|
|
784
727
|
}
|
|
785
728
|
}
|
|
786
729
|
}
|
|
787
|
-
`,
|
|
730
|
+
`,at=i`
|
|
788
731
|
query MayaSession($id: ObjectId!) {
|
|
789
732
|
mayaSession(id: $id) {
|
|
790
733
|
id
|
|
@@ -792,7 +735,7 @@
|
|
|
792
735
|
dateTimeCreated
|
|
793
736
|
}
|
|
794
737
|
}
|
|
795
|
-
`,
|
|
738
|
+
`,rt=i`
|
|
796
739
|
query TransactionRecords($first: Int, $after: Cursor, $filter: TransactionRecordFilter) {
|
|
797
740
|
member {
|
|
798
741
|
transactionRecords(first: $first, after: $after, filter: $filter) {
|
|
@@ -818,7 +761,7 @@
|
|
|
818
761
|
}
|
|
819
762
|
}
|
|
820
763
|
}
|
|
821
|
-
`,
|
|
764
|
+
`,nt=i`
|
|
822
765
|
query Wallet {
|
|
823
766
|
wallet {
|
|
824
767
|
id
|
|
@@ -828,7 +771,7 @@
|
|
|
828
771
|
dateTimeLastUpdated
|
|
829
772
|
}
|
|
830
773
|
}
|
|
831
|
-
`,
|
|
774
|
+
`,it=i`
|
|
832
775
|
query WithdrawalRecords($first: Int, $after: Cursor, $filter: WithdrawalRecordFilterInput) {
|
|
833
776
|
member {
|
|
834
777
|
withdrawalRecords(first: $first, after: $after, filter: $filter) {
|
|
@@ -895,121 +838,98 @@
|
|
|
895
838
|
}
|
|
896
839
|
}
|
|
897
840
|
}
|
|
898
|
-
`,
|
|
841
|
+
`,ot=i`
|
|
899
842
|
mutation CreateGCashWithdrawal($input: CreateGCashWithdrawalInput!) {
|
|
900
843
|
createGCashWithdrawal(input: $input) {
|
|
901
844
|
... on AccountNotVerifiedError {
|
|
902
|
-
|
|
903
|
-
message
|
|
845
|
+
__typename
|
|
904
846
|
}
|
|
905
847
|
... on InvalidTransactionPasswordError {
|
|
906
|
-
|
|
907
|
-
message
|
|
848
|
+
__typename
|
|
908
849
|
}
|
|
909
850
|
... on InvalidWithdrawalAmountError {
|
|
910
|
-
|
|
911
|
-
message
|
|
851
|
+
__typename
|
|
912
852
|
}
|
|
913
853
|
... on MobileNumberNotVerifiedError {
|
|
914
|
-
|
|
915
|
-
message
|
|
854
|
+
__typename
|
|
916
855
|
}
|
|
917
856
|
... on NotEnoughBalanceError {
|
|
918
|
-
|
|
919
|
-
message
|
|
857
|
+
__typename
|
|
920
858
|
}
|
|
921
859
|
... on WithdrawalDailyLimitExceededError {
|
|
922
|
-
|
|
923
|
-
message
|
|
860
|
+
__typename
|
|
924
861
|
}
|
|
925
862
|
}
|
|
926
863
|
}
|
|
927
|
-
`,
|
|
864
|
+
`,st=i`
|
|
928
865
|
mutation CreateMayaWithdrawal($input: CreateMayaWithdrawalInput!) {
|
|
929
866
|
createMayaWithdrawal(input: $input) {
|
|
930
867
|
... on AccountNotVerifiedError {
|
|
931
|
-
|
|
932
|
-
message
|
|
868
|
+
__typename
|
|
933
869
|
}
|
|
934
870
|
... on InvalidTransactionPasswordError {
|
|
935
|
-
|
|
936
|
-
message
|
|
871
|
+
__typename
|
|
937
872
|
}
|
|
938
873
|
... on InvalidWithdrawalAmountError {
|
|
939
|
-
|
|
940
|
-
message
|
|
874
|
+
__typename
|
|
941
875
|
}
|
|
942
876
|
... on MobileNumberNotVerifiedError {
|
|
943
|
-
|
|
944
|
-
message
|
|
877
|
+
__typename
|
|
945
878
|
}
|
|
946
879
|
... on NotEnoughBalanceError {
|
|
947
|
-
|
|
948
|
-
message
|
|
880
|
+
__typename
|
|
949
881
|
}
|
|
950
882
|
... on WithdrawalDailyLimitExceededError {
|
|
951
|
-
|
|
952
|
-
message
|
|
883
|
+
__typename
|
|
953
884
|
}
|
|
954
885
|
}
|
|
955
886
|
}
|
|
956
|
-
`,
|
|
887
|
+
`,dt=i`
|
|
957
888
|
mutation CreateMayaAppWithdrawal($input: CreateMayaAppWithdrawalInput!) {
|
|
958
889
|
createMayaAppWithdrawal(input: $input) {
|
|
959
890
|
... on AccountNotVerifiedError {
|
|
960
|
-
|
|
961
|
-
message
|
|
891
|
+
__typename
|
|
962
892
|
}
|
|
963
893
|
... on InvalidTransactionPasswordError {
|
|
964
|
-
|
|
965
|
-
message
|
|
894
|
+
__typename
|
|
966
895
|
}
|
|
967
896
|
... on InvalidWithdrawalAmountError {
|
|
968
|
-
|
|
969
|
-
message
|
|
897
|
+
__typename
|
|
970
898
|
}
|
|
971
899
|
... on NotEnoughBalanceError {
|
|
972
|
-
|
|
973
|
-
message
|
|
900
|
+
__typename
|
|
974
901
|
}
|
|
975
902
|
... on WithdrawalDailyLimitExceededError {
|
|
976
|
-
|
|
977
|
-
message
|
|
903
|
+
__typename
|
|
978
904
|
}
|
|
979
905
|
}
|
|
980
906
|
}
|
|
981
|
-
`,
|
|
907
|
+
`,mt=i`
|
|
982
908
|
mutation CreateBankWithdrawal($input: CreateBankWithdrawalInput!) {
|
|
983
909
|
createBankWithdrawal(input: $input) {
|
|
984
910
|
... on MobileNumberNotVerifiedError {
|
|
985
|
-
|
|
986
|
-
message
|
|
911
|
+
__typename
|
|
987
912
|
}
|
|
988
913
|
... on AccountNotVerifiedError {
|
|
989
|
-
|
|
990
|
-
message
|
|
914
|
+
__typename
|
|
991
915
|
}
|
|
992
916
|
... on InvalidWithdrawalAmountError {
|
|
993
|
-
|
|
994
|
-
message
|
|
917
|
+
__typename
|
|
995
918
|
}
|
|
996
919
|
... on WithdrawalDailyLimitExceededError {
|
|
997
|
-
|
|
998
|
-
message
|
|
920
|
+
__typename
|
|
999
921
|
}
|
|
1000
922
|
... on InvalidTransactionPasswordError {
|
|
1001
|
-
|
|
1002
|
-
message
|
|
923
|
+
__typename
|
|
1003
924
|
}
|
|
1004
925
|
... on NotEnoughBalanceError {
|
|
1005
|
-
|
|
1006
|
-
message
|
|
926
|
+
__typename
|
|
1007
927
|
}
|
|
1008
928
|
}
|
|
1009
929
|
}
|
|
1010
|
-
`,ct=
|
|
930
|
+
`,ct=i`
|
|
1011
931
|
query RemainingDailyWithdrawalsCount {
|
|
1012
932
|
remainingDailyWithdrawalsCount
|
|
1013
933
|
}
|
|
1014
|
-
`;class mt{constructor(e){c(this,"client");this.client=e}async memberAccount(){const e=await this.client.request(qe);return e.ok?{ok:!0,data:e.data.memberAccount}:e}async registerMemberAccount(e){const t=await this.client.request(Le,e);return t.ok?t.data.registerMemberAccount?{ok:!1,error:t.data.registerMemberAccount}:{ok:!0}:t}async updateMemberAccount(e){const t=await this.client.request(Ve,e);return t.ok?t.data.updateMemberAccount?{ok:!1,error:t.data.updateMemberAccount}:{ok:!0}:t}async deleteMemberAccount(e){const t=await this.client.request(Ye,e);return t.ok?t.data.deleteMemberAccount?{ok:!0}:{ok:!1,error:{code:"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:t.data.resetPassword}:{ok:!0}:t}async profileCompletion(){const e=await this.client.request(Je);return e.ok?{ok:!0,data:e.data.profileCompletion}:e}async platform(){return await this.client.request(Xe)}async sendVerificationCode(e){const t=await this.client.request(je,e);return t.ok?t.data.sendVerificationCode?{ok:!1,error:t.data.sendVerificationCode}:{ok:!0}:t}async verifyMobileNumber(e){const t=await this.client.request(Qe,e);return t.ok?t.data.verifyMobileNumber?{ok:!1,error:t.data.verifyMobileNumber}:{ok:!0}:t}async createMemberVerification(e){const t=await this.client.request(Ke,e);return t.ok?t.data.createMemberVerification?{ok:!1,error:t.data.createMemberVerification}:{ok:!0}:t}async updateMemberVerification(e){const t=await this.client.request(ze,e);return t.ok?t.data.updateMemberVerification?{ok:!1,error:t.data.updateMemberVerification}:{ok:!0}:t}async memberVerification(){const e=await this.client.request(Fe);return e.ok?{ok:!0,data:e.data.memberAccount.verification}:e}async announcements(e){const t=await this.client.request(be,e);return t.ok?{ok:!0,data:t.data.announcements}:t}}function g(i,e){const t=v[i]?v[i]:v[500];return{code:t.code,message:e??t.message}}const v={400:{code:"HttpBadRequest",message:"Bad Request"},401:{code:"HttpUnauthorized",message:"Unauthorized"},403:{code:"HttpForbidden",message:"Forbidden"},404:{code:"HttpNotFound",message:"Not Found"},408:{code:"HttpRequestTimeout",message:"Request Timeout"},429:{code:"HttpTooManyRequests",message:"Too Many Requests"},500:{code:"HttpInternalServerError",message:"Internal Server Error"}};class ut{constructor(e,t){c(this,"url");c(this,"options");c(this,"middlewares");var r;const a=new Headers((r=t==null?void 0:t.fetchOptions)==null?void 0:r.headers);a.append("Content-Type","application/json"),this.url=e,this.options={...t==null?void 0:t.fetchOptions,headers:a},this.middlewares=(t==null?void 0:t.middlewares)??[]}async post(e,t){const a=new URL(this.url);a.pathname=e,t!=null&&t.searchParams&&t.searchParams.forEach((d,u)=>{a.searchParams.append(u,d)});const r=t!=null&&t.body?JSON.stringify(t.body):void 0,n=await this.runMiddlewares(new Request(a,{...this.options,body:r,method:"POST"}));t!=null&&t.headers&&new Headers(t.headers).forEach((d,u)=>{n.headers.set(u,d)});try{const d=await fetch(n);return d.ok?{ok:!0,data:await d.json()}:{ok:!1,error:await this.safeToJson(d)??g(d.status)}}catch{return{ok:!1,error:{code:"HttpInternalServerError",message:"Something went wrong."}}}}async get(e,t){const a=new URL(this.url);a.pathname=e,t!=null&&t.searchParams&&t.searchParams.forEach((n,d)=>{a.searchParams.append(d,n)});const r=await this.runMiddlewares(new Request(a,{...this.options,method:"GET"}));t!=null&&t.headers&&new Headers(t.headers).forEach((n,d)=>{r.headers.set(d,n)});try{const n=await fetch(r);return n.ok?{ok:!0,data:await n.json()}:{ok:!1,error:await this.safeToJson(n)??g(n.status)}}catch{return{ok:!1,error:{code:"HttpInternalServerError",message:"Something went wrong."}}}}async delete(e,t){const a=new URL(this.url);a.pathname=e,t!=null&&t.searchParams&&t.searchParams.forEach((n,d)=>{a.searchParams.append(d,n)});const r=await this.runMiddlewares(new Request(a,{...this.options,method:"DELETE"}));t!=null&&t.headers&&new Headers(t.headers).forEach((n,d)=>{r.headers.set(d,n)});try{const n=await fetch(r);return n.ok?{ok:!0}:{ok:!1,error:g(n.status)}}catch{return{ok:!1,error:{code:"HttpInternalServerError",message:"Something went wrong."}}}}async runMiddlewares(e){let t=e.clone();for(const a of this.middlewares)t=await a(t);return t}async safeToJson(e){try{return await e.json()}catch{return null}}}class lt{constructor(e){c(this,"client");this.client=new ut(e.url,{middlewares:[t=>(t.headers.set("Platform-Code",e.platform),t.headers.set("Role","MEMBER"),t)]})}async createSession(e){const t=new Headers;switch(e.type){case"NAME_AND_PASSWORD":{const r=`${e.name}:${e.password}`,n=Buffer.from(r).toString("base64");t.set("Authorization",`Basic ${n}`);break}case"MOBILE_NUMBER":{const r=`${e.mobileNumber}:${e.verificationCode}`,n=Buffer.from(r).toString("base64");t.set("Authorization",`MobileNumberOTP ${n}`);break}case"MAYA":{t.set("Authorization",`Maya ${e.sessionId}`);break}}const a=await this.client.post("/sessions",{headers:t});return a.ok?a:a.error.code==="ACCOUNT_BLACKLISTED"?{ok:!1,error:{code:"AccountBlacklisted",message:"Account is blacklisted"}}:a.error.code==="HttpForbidden"||a.error.code==="HttpUnauthorized"?{ok:!1,error:{code:"AccountNotFound",message:"Invalid credentials."}}:a}async authenticate(e){if(e.type==="SECURITY_QUESTION"){const t=await this.client.post(`/session/${e.token}/authenticate`,{body:{secretAnswer:e.secretAnswer}});return t.ok?t:t.error.code==="HttpForbidden"||t.error.code==="HttpUnauthorized"?{ok:!1,error:{code:"InvalidTokenOrAnswer",message:"Invalid token or secret answer"}}:t}throw new Error("Invalid input 'type'")}async refreshSession(e){const t=await this.client.post("/session:refresh",{headers:{Authorization:`Bearer ${e}`}});return t.ok?t:t.error.code==="ACCOUNT_BLACKLISTED"?{ok:!1,error:{code:"AccountBlacklisted",message:"Account is blacklisted"}}:t.error.code==="HttpForbidden"||t.error.code==="HttpUnauthorized"?{ok:!1,error:{code:"InvalidToken",message:"Invalid token."}}:t}async destroySession(e){return await this.client.delete("/session",{headers:{Authorization:`Bearer ${e}`}})}async verifySession(e){return(await this.client.get("/session",{headers:{Authorization:`Bearer ${e}`}})).ok}}class pt{constructor(e){c(this,"client");this.client=e}async file(e){const t=await this.client.request(M,e);return t.ok?{ok:!0,data:t.data.node}:t}async uploadPrivateImageFile(e){const t=await this.client.upload(M,e);return t.ok?t.data.uploadPrivateImageFile?{ok:!1,error:t.data.uploadPrivateImageFile}:{ok:!0}:t}}class R{constructor(e){c(this,"client");this.client=e}async game(e){const t=await this.client.request(Se,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(Ee,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:t.data.createGameSession}:{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:{code:"UnknownError",message:"Something went wrong."}}:t}}class ht{constructor(e){c(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(at,e);return t.ok?{ok:t.ok,data:t.data.member.transactionRecords}:t}async withdrawalRecords(e){const t=await this.client.request(nt,e);return t.ok?{ok:t.ok,data:t.data.member.withdrawalRecords}:t}async depositRecords(e){const t=await this.client.request(Pe,e);return t.ok?{ok:t.ok,data:t.data.member.depositRecords}:t}async depositsCount(){const e=await this.client.request(Be);return e.ok?{ok:e.ok,data:e.data.member.depositsCount}:e}async member(){const e=await this.client.request(Oe);return e.ok?{ok:e.ok,data:e.data.member}:e}}class wt{constructor(e){c(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 ft extends R{async promos(){const e=await this.client.request(Me);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(Ne,e);return t.ok?{ok:t.ok,data:t.data.availablePromos}:t}async cashbackBonuses(){const e=await this.client.request(Ie);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:t.data.claimCashbackBonus}:{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(rt);return e.ok?{ok:e.ok,data:e.data.wallet}:e}async deposit(e){const t=await this.client.request(We,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:t.data.createGCashDeposit}:{ok:!0}:t}async createMayaDeposit(e){const t=await this.client.request(Ue,e);return t.ok?t.data.createMayaDeposit?{ok:!1,error:t.data.createMayaDeposit}:{ok:!0}:t}async createMayaAppDeposit(e){const t=await this.client.request(xe,e);return t.ok?t.data.createMayaAppDeposit?{ok:!1,error:t.data.createMayaAppDeposit}:{ok:!0}:t}async createGCashWithdrawal(e){const t=await this.client.request(st,e);return t.ok?t.data.createGCashWithdrawal?{ok:!1,error:t.data.createGCashWithdrawal}:{ok:!0}:t}async createMayaWithdrawal(e){const t=await this.client.request(ot,e);return t.ok?t.data.createMayaWithdrawal?{ok:!1,error:t.data.createMayaWithdrawal}:{ok:!0}:t}async createMayaAppWithdrawal(e){const t=await this.client.request(it,e);return t.ok?t.data.createMayaAppWithdrawal?{ok:!1,error:t.data.createMayaAppWithdrawal}:{ok:!0}:t}async createBankWithdrawal(e){const t=await this.client.request(dt,e);return t.ok?t.data.createBankWithdrawal?{ok:!1,error:t.data.createBankWithdrawal}:{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(Ze);return e.ok?{ok:e.ok,data:e.data.pointsWallet}:e}async pointsToCashConversion(e){const t=await this.client.request(et,e);return t.ok?t.data.pointsToCashConversion?{ok:!1,error:t.data.pointsToCashConversion}:{ok:!0}:t}async mayaSession(e){const t=await this.client.request(tt,e);return t.ok?{ok:t.ok,data:t.data.mayaSession}:t}}class gt{constructor(e){c(this,"client");this.client=e}async latestBetRecords(){const e=await this.client.request(ve);return e.ok?{ok:!0,data:e.data.latestBetRecords}:e}}class b{constructor(e,t){c(this,"url");c(this,"options");c(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 n=await this.runMiddlewares(new Request(this.url,{...this.options,body:a,headers:r,method:"POST"}));return await this.exec(n)}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 n=await this.runMiddlewares(new Request(this.url,{...this.options,body:a,headers:r,method:"POST"}));return await this.exec(n)}async exec(e){var t,a,r,n,d,u;try{const w=await fetch(e);if(!w.ok)return{ok:!1,error:g(w.status)};const k=await w.json(),T=k.data,p=(t=k.errors)==null?void 0:t.at(0);return p?((a=p.extensions)==null?void 0:a.code)==="FORBIDDEN"?{ok:!1,error:g(403,p.message)}:((r=p.extensions)==null?void 0:r.code)==="UNAUTHORIZED"?{ok:!1,error:g(401,p.message)}:((n=p.extensions)==null?void 0:n.code)==="BAD_USER_INPUT"||((d=p.extensions)==null?void 0:d.code)==="BAD_REQUEST"?{ok:!1,error:g(400,p.message)}:((u=p.extensions)==null?void 0:u.code)==="ACCESS_TOKEN_EXPIRED"?{ok:!1,error:{code:"HttpForbidden",message:p.message??"Access token expired."}}:{ok:!1,error:g(500,p.message)}:{ok:!0,data:T}}catch{return{ok:!1,error:g(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),n=new FormData;n.append("operations",JSON.stringify({query:e,variables:t})),Object.entries(r).forEach(([u,w])=>{n.append(u,JSON.stringify(w))});const d={};return Object.keys(a).forEach((u,w)=>{d[w.toString()]=`variables.${u}`}),n.append("map",JSON.stringify(d)),Object.values(a).forEach((u,w)=>{n.append(w.toString(),u)}),n}extractFiles(e){const t={},a={};return Object.entries(e).forEach(([r,n])=>{n instanceof File||n instanceof Blob?t[r]=n:a[r]=n}),{files:t,others:a}}}async function f(i){const e=new TextEncoder().encode(i),t=await crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(t)).map(n=>n.toString(16).padStart(2,"0")).join("")}class I{constructor(e){c(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(i){return new Date(i.getTime())}function S(i,e){const t=D(i);return t.setDate(t.getDate()+e),t}function A(i,e){const t=D(i);return t.setMinutes(t.getMinutes()+e),t}function G(i,e){return i.getTime()>e.getTime()}function yt(i){return new Promise(e=>{setTimeout(e,i)})}function E(i,e){const t=D(i);return t.setMinutes(t.getMinutes()-e),t}class bt{constructor(e){c(this,"logger");c(this,"storageKey","session");c(this,"authService");c(this,"_refreshing",!1);this.authService=new lt(e),this.logger=new I({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:{code:"UnknownError",message:"Server sign in is not supported."}};if(e.type==="MAYA"){const r=await this.authService.createSession(e);if(r.ok){const n=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...r.data,maya:!0,accessTokenExpiresAt:A(n,8).getTime(),refreshTokenExpiresAt:E(S(n,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 n=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...r.data,accessTokenExpiresAt:A(n,8).getTime(),refreshTokenExpiresAt:E(S(n,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:A(a,8).getTime(),refreshTokenExpiresAt:E(S(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:A(a,8).getTime(),refreshTokenExpiresAt:E(S(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 yt(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),n=new Date(t.refreshTokenExpiresAt);if(G(a,n))return this.logger.warn("Session expired. Logging out.."),window.localStorage.removeItem(this.storageKey),{ok:!1,error:{code:"SessionExpired",message:"Session expired."}};if(G(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.code==="InvalidToken"||d.error.code==="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:A(a,8).getTime(),refreshTokenExpiresAt:E(S(a,30),2).getTime()},window.localStorage.setItem(this.storageKey,JSON.stringify(t))}return{ok:!0,data:t}}catch{return{ok:!1,error:{code:"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,n;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.code)==="InvalidToken"||((r=e.error)==null?void 0:r.code)==="SessionExpired"||((n=e.error)==null?void 0:n.code)==="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 s(i,e){if(typeof i=="number"&&!Number.isNaN(i))return i;if(typeof i=="string"){const t=Number.parseFloat(i);if(!Number.isNaN(t))return t}return e}class St{constructor(e){c(this,"staticService");const t=(e==null?void 0:e.environment)==="development";this.staticService=new wt({url:t?"https://static.development.opexa.io/graphql":"https://static.opexa.io/graphql"})}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,n,d,u,w,k,T,p,P,$,U,x,W,B,O,q,F,L,V,H,Y,j,Q,K,z,J,X,Z,ee,te,ae,re,ne,se,oe,ie,de,ce,me,ue,le,pe,he,we,fe,ge,ye;return{paymentSettings:{minimumFirstDepositAmount:s(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:((n=e.bankDepositGatewaySettings)==null?void 0:n.mobileWebEnabled)??!1,minimumAmount:s((d=e.bankDepositGatewaySettings)==null?void 0:d.minimumAmount),maximumAmount:s((u=e.bankDepositGatewaySettings)==null?void 0:u.maximumAmount)},gcash:{androidEnabled:((w=e.gcashDepositGatewaySettings)==null?void 0:w.androidEnabled)??!1,iosEnabled:((k=e.gcashDepositGatewaySettings)==null?void 0:k.iosEnabled)??!1,webEnabled:((T=e.gcashDepositGatewaySettings)==null?void 0:T.webEnabled)??!1,mobileWebEnabled:((p=e.gcashDepositGatewaySettings)==null?void 0:p.mobileWebEnabled)??!1,minimumAmount:s((P=e.gcashDepositGatewaySettings)==null?void 0:P.minimumAmount),maximumAmount:s(($=e.gcashDepositGatewaySettings)==null?void 0:$.maximumAmount)},maya:{androidEnabled:((U=e.mayaDepositGatewaySettings)==null?void 0:U.androidEnabled)??!1,iosEnabled:((x=e.mayaDepositGatewaySettings)==null?void 0:x.iosEnabled)??!1,webEnabled:((W=e.mayaDepositGatewaySettings)==null?void 0:W.webEnabled)??!1,mobileWebEnabled:((B=e.mayaDepositGatewaySettings)==null?void 0:B.mobileWebEnabled)??!1,minimumAmount:s((O=e.mayaDepositGatewaySettings)==null?void 0:O.minimumAmount),maximumAmount:s((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:((H=e.mayaAppDepositGatewaySettings)==null?void 0:H.mobileWebEnabled)??!1,minimumAmount:s((Y=e.mayaAppDepositGatewaySettings)==null?void 0:Y.minimumAmount),maximumAmount:s((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:s((X=e.bankWithdrawalGatewaySettings)==null?void 0:X.minimumAmount),maximumAmount:s((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:s((ne=e.gcashWithdrawalGatewaySettings)==null?void 0:ne.minimumAmount),maximumAmount:s((se=e.gcashWithdrawalGatewaySettings)==null?void 0:se.maximumAmount,1e6)},maya:{androidEnabled:((oe=e.mayaWithdrawalGatewaySettings)==null?void 0:oe.androidEnabled)??!1,iosEnabled:((ie=e.mayaWithdrawalGatewaySettings)==null?void 0:ie.iosEnabled)??!1,webEnabled:((de=e.mayaWithdrawalGatewaySettings)==null?void 0:de.webEnabled)??!1,mobileWebEnabled:((ce=e.mayaWithdrawalGatewaySettings)==null?void 0:ce.mobileWebEnabled)??!1,minimumAmount:s((me=e.mayaWithdrawalGatewaySettings)==null?void 0:me.minimumAmount),maximumAmount:s((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:((he=e.mayaAppWithdrawalGatewaySettings)==null?void 0:he.webEnabled)??!1,mobileWebEnabled:((we=e.mayaAppWithdrawalGatewaySettings)==null?void 0:we.mobileWebEnabled)??!1,minimumAmount:s((fe=e.mayaAppWithdrawalGatewaySettings)==null?void 0:fe.minimumAmount),maximumAmount:s((ge=e.mayaAppWithdrawalGatewaySettings)==null?void 0:ge.maximumAmount,1e6)}}},pointsClubSettings:{multiplier:s((ye=e.pointsClubSettings)==null?void 0:ye.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:s(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:s(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:s(e.amount,0),netAmount:s(e.netAmount,0),fee:s(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:s(e.fee,0),amount:s(e.amount,0),netAmount:s(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:s(e.amount,0),fee:s(e.fee,0),netAmount:s(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:s(e.bet,0),payout:s(e.payout,0),jackpotContribution:s(e.jackpotContribution,0),jackpotPayout:s(e.jackpotPayout,0),winloss:s(e.winloss),validBet:s(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:s(e.bet,0),payout:s(e.payout,0),validBet:s(e.validBet,0),dateTimeSettled:new Date(e.dateTimeSettled),dateTimeCreated:new Date(e.dateTimeCreated)}}transactionRecord(e){return{...e,amount:s(e.amount,0),content:e.content??void 0,currentBalance:s(e.currentBalance,0),dateTimeCreated:new Date(e.dateTimeCreated)}}game(e){const t=this.staticService.gameThumbnails(e);return{...e,images:t}}gameSession(e){return{...e,game:this.game(e.game),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}promo(e){return{...e,banner:{...e.banner,dateTimeCreated:new Date(e.banner.dateTimeCreated)},maximumBonusAmount:s(e.maximumBonusAmount),minimumBonusAmount:s(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:s(e.deposit.fee,0),amount:s(e.deposit.amount,0),netAmount:s(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:s(e.balance,0),amount:s(e.amount,0),expiration:new Date(e.expiration),turnoverRequirement:s(e.turnoverRequirement,0),currentTurnoverRequirementContribution:s(e.currentTurnoverRequirementContribution,0),currentTurnoverRequirementContributionPercentage:s(e.currentTurnoverRequirementContributionPercentage,0),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}cashbackBonus(e){return{id:e.id,balance:s(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:s(e.points,0),account:e.account,dateTimeCreated:new Date(e.dateTimeCreated)}}}class At{constructor(e){c(this,"gameService");c(this,"fileService");c(this,"walletService");c(this,"reportService");c(this,"portalService");c(this,"accountService");c(this,"sessionManager");c(this,"transformer");c(this,"logger");const t=e.environment==="development";this.sessionManager=new bt({...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 b(t?"https://game.development.opexa.io/graphql":"https://game.opexa.io/graphql",a)),this.fileService=new pt(new b(t?"https://file.development.opexa.io/graphql":"https://file.opexa.io/graphql",a)),this.walletService=new ft(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 mt(new b(t?"https://account.development.opexa.io/graphql":"https://account.opexa.io/graphql",a)),this.portalService=new gt(new b(t?"https://portal.development.opexa.io/graphql":"https://portal.opexa.io/graphql",a)),this.transformer=new St(e),this.logger=new I({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 f(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 f(e.secretAnswer)});default:return{ok:!1,error:{code:"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 n=()=>setTimeout(async()=>{await this.sessionManager.verify()||await a(),r=n()},t);return r=n(),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??m.ObjectId.generate(h.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 f(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 f(t.password):void 0,transactionPassword:t.transactionPassword?await f(t.transactionPassword):void 0,...t.mobileNumber&&{mobileNumber:this.addAreaCode(t.mobileNumber)},secretAnswer:t.secretAnswer?await f(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??m.ObjectId.generate(h.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 f(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??m.ObjectId.generate(h.Withdrawal).toString();if(e.type==="BANK"){const a=await this.walletService.createBankWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await f(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 f(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 f(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 f(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??m.ObjectId.generate(h.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??m.ObjectId.generate(h.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??m.ObjectId.generate(h.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??m.ObjectId.generate(h.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:()=>m.ObjectId}),l.ObjectType=h,l.Sdk=At,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
934
|
+
`;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 ht{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 ft{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 E{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,f=(t=C.errors)==null?void 0:t.at(0);return f?((a=f.extensions)==null?void 0:a.code)==="FORBIDDEN"||((r=f.extensions)==null?void 0:r.code)==="ACCESS_TOKEN_EXPIRED"?{ok:!1,error:p(403,f.message)}:((s=f.extensions)==null?void 0:s.code)==="UNAUTHORIZED"?{ok:!1,error:p(401,f.message)}:((u=f.extensions)==null?void 0:u.code)==="BAD_USER_INPUT"||((b=f.extensions)==null?void 0:b.code)==="BAD_REQUEST"?{ok:!1,error:p(400,f.message)}:{ok:!1,error:p(500,f.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 ft({url:t?"https://static.development.opexa.io/graphql":"https://static.opexa.io/graphql"})}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,_,f,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,he,fe,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:((f=e.gcashDepositGatewaySettings)==null?void 0:f.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:((he=e.mayaAppWithdrawalGatewaySettings)==null?void 0:he.iosEnabled)??!1,webEnabled:((fe=e.mayaAppWithdrawalGatewaySettings)==null?void 0:fe.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,game:this.game(e.game),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 E(t?"https://game.development.opexa.io/graphql":"https://game.opexa.io/graphql",a)),this.fileService=new pt(new E(t?"https://file.development.opexa.io/graphql":"https://file.opexa.io/graphql",a)),this.walletService=new wt(new E(t?"https://wallet.development.opexa.io/graphql":"https://wallet.opexa.io/graphql",a)),this.reportService=new ht(new E(t?"https://report.development.opexa.io/graphql":"https://report.opexa.io/graphql",a)),this.accountService=new ut(new E(t?"https://account.development.opexa.io/graphql":"https://account.opexa.io/graphql",a)),this.portalService=new yt(new E(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(h.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(h.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(h.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(h.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(h.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(h.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(h.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=h,l.Sdk=At,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
1015
935
|
//# sourceMappingURL=index.js.map
|