@opexa/portal-sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1591 -0
- package/dist/graphql/account.service.d.ts +24 -0
- package/dist/graphql/announcement.d.ts +29 -0
- package/dist/graphql/auth.service.d.ts +16 -0
- package/dist/graphql/bet-record.d.ts +71 -0
- package/dist/graphql/bonus.d.ts +43 -0
- package/dist/graphql/cashback.d.ts +22 -0
- package/dist/graphql/deposit.d.ts +94 -0
- package/dist/graphql/file.d.ts +38 -0
- package/dist/graphql/file.service.d.ts +11 -0
- package/dist/graphql/game.d.ts +84 -0
- package/dist/graphql/game.service.d.ts +14 -0
- package/dist/graphql/index.d.ts +23 -0
- package/dist/graphql/member.d.ts +182 -0
- package/dist/graphql/platform.d.ts +38 -0
- package/dist/graphql/points.d.ts +22 -0
- package/dist/graphql/portal.service.d.ts +9 -0
- package/dist/graphql/promo.d.ts +35 -0
- package/dist/graphql/report.service.d.ts +18 -0
- package/dist/graphql/session.d.ts +25 -0
- package/dist/graphql/static.service.d.ts +12 -0
- package/dist/graphql/transaction.d.ts +26 -0
- package/dist/graphql/types.d.ts +93 -0
- package/dist/graphql/wallet.d.ts +14 -0
- package/dist/graphql/wallet.service.d.ts +30 -0
- package/dist/graphql/withdrawal.d.ts +106 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1007 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2916 -0
- package/dist/index.mjs.map +1 -0
- package/dist/logger.d.ts +15 -0
- package/dist/object-id.d.ts +1 -0
- package/dist/object-type.d.ts +9 -0
- package/dist/sdk.d.ts +228 -0
- package/dist/session-service.d.ts +25 -0
- package/dist/transformer.d.ts +52 -0
- package/dist/types.d.ts +839 -0
- package/dist/utils/add-days.d.ts +1 -0
- package/dist/utils/add-minutes.d.ts +1 -0
- package/dist/utils/clone-date.d.ts +1 -0
- package/dist/utils/gql.d.ts +1 -0
- package/dist/utils/graphql-client.d.ts +29 -0
- package/dist/utils/http-error.d.ts +6 -0
- package/dist/utils/is-after.d.ts +4 -0
- package/dist/utils/parse-decimal.d.ts +2 -0
- package/dist/utils/sha256.d.ts +1 -0
- package/dist/utils/sub-minutes.d.ts +1 -0
- package/dist/utils/types.d.ts +5 -0
- package/package.json +81 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1007 @@
|
|
|
1
|
+
(function(l,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("@opexa/object-id")):typeof define=="function"&&define.amd?define(["exports","@opexa/object-id"],m):(l=typeof globalThis<"u"?globalThis:l||self,m(l.sdk={},l.objectId))})(this,function(l,m){"use strict";var yt=Object.defineProperty;var bt=(l,m,h)=>m in l?yt(l,m,{enumerable:!0,configurable:!0,writable:!0,value:h}):l[m]=h;var d=(l,m,h)=>bt(l,typeof m!="symbol"?m+"":m,h);const h={Account:8,Deposit:9,Withdrawal:14,Verification:15,File:16,GameSession:204,MayaSession:230};function n(i,...e){let t="";for(const[a,o]of i.entries()){const c=e.at(a)??"";t=`${t}${o}${c}`}return t.trim()}const ge=n`
|
|
2
|
+
query Announcements($first: Int, $after: Cursor, $filter: AnnouncementFilterInput) {
|
|
3
|
+
announcements(first: $first, after: $after, filter: $filter) {
|
|
4
|
+
edges {
|
|
5
|
+
cursor
|
|
6
|
+
node {
|
|
7
|
+
... on Announcement {
|
|
8
|
+
id
|
|
9
|
+
type
|
|
10
|
+
title
|
|
11
|
+
status
|
|
12
|
+
message
|
|
13
|
+
activationStartDateTime
|
|
14
|
+
activationEndDateTime
|
|
15
|
+
dateTimeCreated
|
|
16
|
+
dateTimeLastUpdated
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
totalCount
|
|
21
|
+
pageInfo {
|
|
22
|
+
hasNextPage
|
|
23
|
+
endCursor
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
`,A=n`
|
|
28
|
+
fragment GameFragment on Game {
|
|
29
|
+
id
|
|
30
|
+
type
|
|
31
|
+
name
|
|
32
|
+
provider
|
|
33
|
+
}
|
|
34
|
+
`,ye=n`
|
|
35
|
+
${A}
|
|
36
|
+
|
|
37
|
+
query Game($id: ObjectId!) {
|
|
38
|
+
node(id: $id) {
|
|
39
|
+
... on Game {
|
|
40
|
+
...GameFragment
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`,be=n`
|
|
45
|
+
${A}
|
|
46
|
+
|
|
47
|
+
query Games($after: Cursor, $first: Int, $filter: GameFilterInput) {
|
|
48
|
+
games(after: $after, first: $first, filter: $filter) {
|
|
49
|
+
totalCount
|
|
50
|
+
edges {
|
|
51
|
+
cursor
|
|
52
|
+
node {
|
|
53
|
+
... on Game {
|
|
54
|
+
...GameFragment
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
pageInfo {
|
|
59
|
+
hasNextPage
|
|
60
|
+
endCursor
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
`,Ae=n`
|
|
65
|
+
${A}
|
|
66
|
+
|
|
67
|
+
query GamesByName($search: String!, $filter: GameFilterInput, $first: Int) {
|
|
68
|
+
gamesByName(search: $search, filter: $filter, first: $first) {
|
|
69
|
+
...GameFragment
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
`,Se=n`
|
|
73
|
+
${A}
|
|
74
|
+
|
|
75
|
+
query GameSession($id: ObjectId!) {
|
|
76
|
+
node(id: $id) {
|
|
77
|
+
... on GameSession {
|
|
78
|
+
id
|
|
79
|
+
game {
|
|
80
|
+
...GameFragment
|
|
81
|
+
}
|
|
82
|
+
status
|
|
83
|
+
launchUrl
|
|
84
|
+
dateTimeCreated
|
|
85
|
+
dateTimeLastUpdated
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
`,Ee=n`
|
|
90
|
+
mutation CreateGameSession($input: CreateGameSessionInput!) {
|
|
91
|
+
createGameSession(input: $input) {
|
|
92
|
+
... on GameDoesNotExistError {
|
|
93
|
+
code: __typename
|
|
94
|
+
message
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
`,Ce=n`
|
|
99
|
+
mutation EndGameSession($input: EndGameSessionInput!) {
|
|
100
|
+
endGameSession(input: $input)
|
|
101
|
+
}
|
|
102
|
+
`,ke=n`
|
|
103
|
+
${A}
|
|
104
|
+
|
|
105
|
+
query BetRecords($first: Int, $after: Cursor, $filter: BetRecordFilterInput) {
|
|
106
|
+
member {
|
|
107
|
+
betRecords(first: $first, after: $after, filter: $filter) {
|
|
108
|
+
totalCount
|
|
109
|
+
edges {
|
|
110
|
+
cursor
|
|
111
|
+
node {
|
|
112
|
+
... on BetRecord {
|
|
113
|
+
id
|
|
114
|
+
serialCode
|
|
115
|
+
game {
|
|
116
|
+
...GameFragment
|
|
117
|
+
}
|
|
118
|
+
bet
|
|
119
|
+
payout
|
|
120
|
+
winloss
|
|
121
|
+
jackpotPayout
|
|
122
|
+
jackpotContribution
|
|
123
|
+
status
|
|
124
|
+
dateTimeCreated
|
|
125
|
+
dateTimeSettled
|
|
126
|
+
dateTimeLastUpdated
|
|
127
|
+
metadata
|
|
128
|
+
vendorRoundId
|
|
129
|
+
betContent
|
|
130
|
+
contestName
|
|
131
|
+
externalCategory
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
pageInfo {
|
|
136
|
+
hasNextPage
|
|
137
|
+
endCursor
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
`,Te=n`
|
|
143
|
+
query LatestBetRecords {
|
|
144
|
+
latestBetRecords {
|
|
145
|
+
id
|
|
146
|
+
member {
|
|
147
|
+
id
|
|
148
|
+
name
|
|
149
|
+
}
|
|
150
|
+
game {
|
|
151
|
+
...GameFragment
|
|
152
|
+
}
|
|
153
|
+
bet
|
|
154
|
+
payout
|
|
155
|
+
validBet
|
|
156
|
+
dateTimeSettled
|
|
157
|
+
dateTimeCreated
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
${A}
|
|
162
|
+
`,S=n`
|
|
163
|
+
fragment FileFragment on File {
|
|
164
|
+
id
|
|
165
|
+
url
|
|
166
|
+
status
|
|
167
|
+
dateTimeCreated
|
|
168
|
+
}
|
|
169
|
+
`,k=n`
|
|
170
|
+
${S}
|
|
171
|
+
|
|
172
|
+
query File($id: ObjectId!) {
|
|
173
|
+
node(id: $id) {
|
|
174
|
+
... on File {
|
|
175
|
+
...FileFragment
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
`;n`
|
|
180
|
+
mutation UploadPrivateImageFile($input: UploadFileInput!) {
|
|
181
|
+
uploadPrivateImageFile(input: $input) {
|
|
182
|
+
... on FileFormatNotSupportedError {
|
|
183
|
+
code: __typename
|
|
184
|
+
message
|
|
185
|
+
}
|
|
186
|
+
... on FileNameTooLongError {
|
|
187
|
+
code: __typename
|
|
188
|
+
message
|
|
189
|
+
}
|
|
190
|
+
... on FileSizeTooBigError {
|
|
191
|
+
code: __typename
|
|
192
|
+
message
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
`;const T=n`
|
|
197
|
+
${S}
|
|
198
|
+
|
|
199
|
+
fragment CashbackFragment on Cashback {
|
|
200
|
+
id
|
|
201
|
+
name
|
|
202
|
+
banner {
|
|
203
|
+
...FileFragment
|
|
204
|
+
}
|
|
205
|
+
status
|
|
206
|
+
description
|
|
207
|
+
activationStartDateTime
|
|
208
|
+
activationEndDateTime
|
|
209
|
+
dateTimeCreated
|
|
210
|
+
dateTimeLastUpdated
|
|
211
|
+
}
|
|
212
|
+
`,_e=n`
|
|
213
|
+
${T}
|
|
214
|
+
|
|
215
|
+
query Cashbacks {
|
|
216
|
+
cashbacks {
|
|
217
|
+
...CashbackFragment
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
`,E=n`
|
|
221
|
+
${S}
|
|
222
|
+
|
|
223
|
+
fragment PromoFragment on Promo {
|
|
224
|
+
id
|
|
225
|
+
type
|
|
226
|
+
name
|
|
227
|
+
banner {
|
|
228
|
+
...FileFragment
|
|
229
|
+
}
|
|
230
|
+
status
|
|
231
|
+
description
|
|
232
|
+
maximumBonusAmount
|
|
233
|
+
minimumBonusAmount
|
|
234
|
+
activationStartDateTime
|
|
235
|
+
activationEndDateTime
|
|
236
|
+
dateTimeCreated
|
|
237
|
+
dateTimeLastUpdated
|
|
238
|
+
}
|
|
239
|
+
`,ve=n`
|
|
240
|
+
${E}
|
|
241
|
+
|
|
242
|
+
query Promos {
|
|
243
|
+
promos {
|
|
244
|
+
...PromoFragment
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
`,De=n`
|
|
248
|
+
${E}
|
|
249
|
+
|
|
250
|
+
query AvailablePromos($filter: PromoFilterInput) {
|
|
251
|
+
availablePromos(filter: $filter) {
|
|
252
|
+
...PromoFragment
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
`,Me=n`
|
|
256
|
+
${E}
|
|
257
|
+
|
|
258
|
+
query Bonus {
|
|
259
|
+
bonus {
|
|
260
|
+
id
|
|
261
|
+
promo {
|
|
262
|
+
...PromoFragment
|
|
263
|
+
}
|
|
264
|
+
deposit {
|
|
265
|
+
type
|
|
266
|
+
amount
|
|
267
|
+
netAmount
|
|
268
|
+
fee
|
|
269
|
+
status
|
|
270
|
+
reference
|
|
271
|
+
dateTimeCreated
|
|
272
|
+
dateTimeLastUpdated
|
|
273
|
+
}
|
|
274
|
+
amount
|
|
275
|
+
balance
|
|
276
|
+
turnoverRequirement
|
|
277
|
+
currentTurnoverRequirementContribution
|
|
278
|
+
currentTurnoverRequirementContributionPercentage
|
|
279
|
+
expiration
|
|
280
|
+
dateTimeCreated
|
|
281
|
+
dateTimeLastUpdated
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
`,Re=n`
|
|
285
|
+
${T}
|
|
286
|
+
|
|
287
|
+
query CashbackBonuses {
|
|
288
|
+
cashbackBonuses {
|
|
289
|
+
id
|
|
290
|
+
balance
|
|
291
|
+
cashback {
|
|
292
|
+
...CashbackFragment
|
|
293
|
+
}
|
|
294
|
+
dateTimeCreated
|
|
295
|
+
dateTimeLastUpdated
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
`,Ne=n`
|
|
299
|
+
mutation ClaimCashbackBonus($input: ClaimCashbackBonusInput!) {
|
|
300
|
+
claimCashbackBonus(input: $input) {
|
|
301
|
+
... on CashbackBonusDoesNotExistError {
|
|
302
|
+
code: __typename
|
|
303
|
+
message
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
`,Ie=n`
|
|
308
|
+
query DepositRecords($after: Cursor, $first: Int, $filter: DepositRecordFilterInput) {
|
|
309
|
+
member {
|
|
310
|
+
depositRecords(after: $after, first: $first, filter: $filter) {
|
|
311
|
+
edges {
|
|
312
|
+
cursor
|
|
313
|
+
node {
|
|
314
|
+
... on DepositRecord {
|
|
315
|
+
id
|
|
316
|
+
type
|
|
317
|
+
amount
|
|
318
|
+
netAmount
|
|
319
|
+
fee
|
|
320
|
+
status
|
|
321
|
+
reference
|
|
322
|
+
depositNumber
|
|
323
|
+
dateTimeCreated
|
|
324
|
+
dateTimeLastUpdated
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
totalCount
|
|
329
|
+
pageInfo {
|
|
330
|
+
hasNextPage
|
|
331
|
+
endCursor
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
`,Ge=n`
|
|
337
|
+
mutation CreateGCashDeposit($input: CreateGCashDepositInput!) {
|
|
338
|
+
createGCashDeposit(input: $input) {
|
|
339
|
+
... on DepositPromoMaximumAmountExceededError {
|
|
340
|
+
code: __typename
|
|
341
|
+
message
|
|
342
|
+
}
|
|
343
|
+
... on DepositPromoMinimumAmountNotMetError {
|
|
344
|
+
code: __typename
|
|
345
|
+
message
|
|
346
|
+
}
|
|
347
|
+
... on HasActiveBonusError {
|
|
348
|
+
code: __typename
|
|
349
|
+
message
|
|
350
|
+
}
|
|
351
|
+
... on MaximumDepositAmountExceededError {
|
|
352
|
+
code: __typename
|
|
353
|
+
message
|
|
354
|
+
}
|
|
355
|
+
... on MinimumDepositAmountNotMetError {
|
|
356
|
+
code: __typename
|
|
357
|
+
message
|
|
358
|
+
}
|
|
359
|
+
... on MinimumFirstDepositAmountNotMetError {
|
|
360
|
+
code: __typename
|
|
361
|
+
message
|
|
362
|
+
}
|
|
363
|
+
... on PromoNotEnabledError {
|
|
364
|
+
code: __typename
|
|
365
|
+
message
|
|
366
|
+
}
|
|
367
|
+
... on WalletDoesNotExistError {
|
|
368
|
+
code: __typename
|
|
369
|
+
message
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
`,Pe=n`
|
|
374
|
+
mutation CreateMayaDeposit($input: CreateMayaDepositInput!) {
|
|
375
|
+
createMayaDeposit(input: $input) {
|
|
376
|
+
... on DepositPromoMaximumAmountExceededError {
|
|
377
|
+
code: __typename
|
|
378
|
+
message
|
|
379
|
+
}
|
|
380
|
+
... on DepositPromoMinimumAmountNotMetError {
|
|
381
|
+
code: __typename
|
|
382
|
+
message
|
|
383
|
+
}
|
|
384
|
+
... on HasActiveBonusError {
|
|
385
|
+
code: __typename
|
|
386
|
+
message
|
|
387
|
+
}
|
|
388
|
+
... on MaximumDepositAmountExceededError {
|
|
389
|
+
code: __typename
|
|
390
|
+
message
|
|
391
|
+
}
|
|
392
|
+
... on MinimumDepositAmountNotMetError {
|
|
393
|
+
code: __typename
|
|
394
|
+
message
|
|
395
|
+
}
|
|
396
|
+
... on MinimumFirstDepositAmountNotMetError {
|
|
397
|
+
code: __typename
|
|
398
|
+
message
|
|
399
|
+
}
|
|
400
|
+
... on PromoNotEnabledError {
|
|
401
|
+
code: __typename
|
|
402
|
+
message
|
|
403
|
+
}
|
|
404
|
+
... on WalletDoesNotExistError {
|
|
405
|
+
code: __typename
|
|
406
|
+
message
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
`,$e=n`
|
|
411
|
+
mutation CreateMayaAppDeposit($input: CreateMayaAppDepositInput!) {
|
|
412
|
+
createMayaAppDeposit(input: $input) {
|
|
413
|
+
... on DepositPromoMaximumAmountExceededError {
|
|
414
|
+
code: __typename
|
|
415
|
+
message
|
|
416
|
+
}
|
|
417
|
+
... on DepositPromoMinimumAmountNotMetError {
|
|
418
|
+
code: __typename
|
|
419
|
+
message
|
|
420
|
+
}
|
|
421
|
+
... on HasActiveBonusError {
|
|
422
|
+
code: __typename
|
|
423
|
+
message
|
|
424
|
+
}
|
|
425
|
+
... on MaximumDepositAmountExceededError {
|
|
426
|
+
code: __typename
|
|
427
|
+
message
|
|
428
|
+
}
|
|
429
|
+
... on MinimumDepositAmountNotMetError {
|
|
430
|
+
code: __typename
|
|
431
|
+
message
|
|
432
|
+
}
|
|
433
|
+
... on MinimumFirstDepositAmountNotMetError {
|
|
434
|
+
code: __typename
|
|
435
|
+
message
|
|
436
|
+
}
|
|
437
|
+
... on PromoNotEnabledError {
|
|
438
|
+
code: __typename
|
|
439
|
+
message
|
|
440
|
+
}
|
|
441
|
+
... on WalletDoesNotExistError {
|
|
442
|
+
code: __typename
|
|
443
|
+
message
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
`,We=n`
|
|
448
|
+
query Deposit($id: ObjectId!) {
|
|
449
|
+
node(id: $id) {
|
|
450
|
+
... on GCashDeposit {
|
|
451
|
+
id
|
|
452
|
+
type
|
|
453
|
+
amount
|
|
454
|
+
netAmount
|
|
455
|
+
fee
|
|
456
|
+
status
|
|
457
|
+
reference
|
|
458
|
+
checkoutUrl
|
|
459
|
+
dateTimeCreated
|
|
460
|
+
dateTimeLastUpdated
|
|
461
|
+
}
|
|
462
|
+
... on MayaDeposit {
|
|
463
|
+
id
|
|
464
|
+
type
|
|
465
|
+
amount
|
|
466
|
+
netAmount
|
|
467
|
+
fee
|
|
468
|
+
status
|
|
469
|
+
reference
|
|
470
|
+
checkoutUrl
|
|
471
|
+
dateTimeCreated
|
|
472
|
+
dateTimeLastUpdated
|
|
473
|
+
}
|
|
474
|
+
... on MayaAppDeposit {
|
|
475
|
+
id
|
|
476
|
+
type
|
|
477
|
+
amount
|
|
478
|
+
netAmount
|
|
479
|
+
fee
|
|
480
|
+
status
|
|
481
|
+
reference
|
|
482
|
+
checkoutUrl
|
|
483
|
+
dateTimeCreated
|
|
484
|
+
dateTimeLastUpdated
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
`,Be=n`
|
|
489
|
+
query DepositsCount {
|
|
490
|
+
member {
|
|
491
|
+
depositsCount
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
`,Ue=n`
|
|
495
|
+
query Member {
|
|
496
|
+
member {
|
|
497
|
+
dateTimeLastActive
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
`,xe=n`
|
|
501
|
+
query MemberAccount {
|
|
502
|
+
memberAccount: self {
|
|
503
|
+
... on MemberAccount {
|
|
504
|
+
id
|
|
505
|
+
name
|
|
506
|
+
status
|
|
507
|
+
realName
|
|
508
|
+
emailAddress
|
|
509
|
+
mobileNumber
|
|
510
|
+
birthDay
|
|
511
|
+
verified
|
|
512
|
+
verificationStatus
|
|
513
|
+
nickName
|
|
514
|
+
validId
|
|
515
|
+
mobileNumberVerified
|
|
516
|
+
mobileNumberVerificationRequired
|
|
517
|
+
transactionPassword
|
|
518
|
+
dateTimeCreated
|
|
519
|
+
dateTimeLastUpdated
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
`,Oe=n`
|
|
524
|
+
${S}
|
|
525
|
+
|
|
526
|
+
query MemberVerification {
|
|
527
|
+
memberAccount: self {
|
|
528
|
+
... on MemberAccount {
|
|
529
|
+
verification {
|
|
530
|
+
id
|
|
531
|
+
status
|
|
532
|
+
address
|
|
533
|
+
sourceOfIncome
|
|
534
|
+
natureOfWork
|
|
535
|
+
nationality
|
|
536
|
+
placeOfBirth
|
|
537
|
+
idFrontImage {
|
|
538
|
+
...FileFragment
|
|
539
|
+
}
|
|
540
|
+
selfieImage {
|
|
541
|
+
...FileFragment
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
`,qe=n`
|
|
548
|
+
mutation RegisterMemberAccount(
|
|
549
|
+
$input: RegisterMemberAccountInput!
|
|
550
|
+
$referralCode: String
|
|
551
|
+
$verificationCode: String
|
|
552
|
+
$reCAPTCHAResponse: String
|
|
553
|
+
) {
|
|
554
|
+
registerMemberAccount(
|
|
555
|
+
input: $input
|
|
556
|
+
referralCode: $referralCode
|
|
557
|
+
verificationCode: $verificationCode
|
|
558
|
+
reCAPTCHAResponse: $reCAPTCHAResponse
|
|
559
|
+
) {
|
|
560
|
+
... on AccountNameNotAvailableError {
|
|
561
|
+
code: __typename
|
|
562
|
+
message
|
|
563
|
+
}
|
|
564
|
+
... on InvalidPlatformError {
|
|
565
|
+
code: __typename
|
|
566
|
+
message
|
|
567
|
+
}
|
|
568
|
+
... on InvalidPlatformError {
|
|
569
|
+
code: __typename
|
|
570
|
+
message
|
|
571
|
+
}
|
|
572
|
+
... on InvalidReCAPTCHAResponseError {
|
|
573
|
+
code: __typename
|
|
574
|
+
message
|
|
575
|
+
}
|
|
576
|
+
... on InvalidSMSVerificationCodeError {
|
|
577
|
+
code: __typename
|
|
578
|
+
message
|
|
579
|
+
}
|
|
580
|
+
... on MinimumAgeRequirementError {
|
|
581
|
+
code: __typename
|
|
582
|
+
message
|
|
583
|
+
}
|
|
584
|
+
... on MobileNumberNotAvailableError {
|
|
585
|
+
code: __typename
|
|
586
|
+
message
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
`,Fe=n`
|
|
591
|
+
mutation UpdateMemberAccount($input: UpdateMemberAccountInput!) {
|
|
592
|
+
updateMemberAccount(input: $input) {
|
|
593
|
+
... on AccountNameNotAvailableError {
|
|
594
|
+
code: __typename
|
|
595
|
+
message
|
|
596
|
+
}
|
|
597
|
+
... on EmailAddressNotAvailableError {
|
|
598
|
+
code: __typename
|
|
599
|
+
message
|
|
600
|
+
}
|
|
601
|
+
... on InvalidTransactionPasswordError {
|
|
602
|
+
code: __typename
|
|
603
|
+
message
|
|
604
|
+
}
|
|
605
|
+
... on MobileNumberNotAvailableError {
|
|
606
|
+
code: __typename
|
|
607
|
+
message
|
|
608
|
+
}
|
|
609
|
+
... on NickNameNotAvailableError {
|
|
610
|
+
code: __typename
|
|
611
|
+
message
|
|
612
|
+
}
|
|
613
|
+
... on RealNameAlreadySetError {
|
|
614
|
+
code: __typename
|
|
615
|
+
message
|
|
616
|
+
}
|
|
617
|
+
... on ValidIdAlreadySetError {
|
|
618
|
+
code: __typename
|
|
619
|
+
message
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
`,Le=n`
|
|
624
|
+
mutation ResetPassword($input: ResetPasswordInput!, $verificationCode: String) {
|
|
625
|
+
resetPassword(input: $input, verificationCode: $verificationCode) {
|
|
626
|
+
... on AccountNotFoundError {
|
|
627
|
+
code: __typename
|
|
628
|
+
message
|
|
629
|
+
}
|
|
630
|
+
... on InvalidVerificationCodeError {
|
|
631
|
+
code: __typename
|
|
632
|
+
message
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
`,Ve=n`
|
|
637
|
+
mutation DeleteMemberAccount($input: DeleteMemberAccountInput!) {
|
|
638
|
+
deleteMemberAccount(input: $input)
|
|
639
|
+
}
|
|
640
|
+
`,He=n`
|
|
641
|
+
mutation SendVerificationCode($input: SendVerificationCodeInput!) {
|
|
642
|
+
sendVerificationCode(input: $input) {
|
|
643
|
+
... on InvalidPlatformError {
|
|
644
|
+
code: __typename
|
|
645
|
+
message
|
|
646
|
+
}
|
|
647
|
+
... on NotReadyToSendVerficationCodeError {
|
|
648
|
+
code: __typename
|
|
649
|
+
message
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
`,je=n`
|
|
654
|
+
mutation VerifyMobileNumber($input: VerifyMobileNumberInput!) {
|
|
655
|
+
verifyMobileNumber(input: $input) {
|
|
656
|
+
... on InvalidSMSVerificationCodeError {
|
|
657
|
+
code: __typename
|
|
658
|
+
message
|
|
659
|
+
}
|
|
660
|
+
... on MobileNumberAlreadyVerifiedError {
|
|
661
|
+
code: __typename
|
|
662
|
+
message
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
`,Ye=n`
|
|
667
|
+
mutation CreateMemberVerification($input: CreateMemberVerificationInput!) {
|
|
668
|
+
createMemberVerification(input: $input) {
|
|
669
|
+
... on FileDoesNotExistError {
|
|
670
|
+
code: __typename
|
|
671
|
+
message
|
|
672
|
+
}
|
|
673
|
+
... on FileNotReadyError {
|
|
674
|
+
code: __typename
|
|
675
|
+
message
|
|
676
|
+
}
|
|
677
|
+
... on MemberVerificationAlreadyExistsError {
|
|
678
|
+
code: __typename
|
|
679
|
+
message
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
`,Qe=n`
|
|
684
|
+
mutation UpdateMemberVerification($input: UpdateMemberVerificationInput!) {
|
|
685
|
+
updateMemberVerification(input: $input) {
|
|
686
|
+
... on FileDoesNotExistError {
|
|
687
|
+
code: __typename
|
|
688
|
+
message
|
|
689
|
+
}
|
|
690
|
+
... on FileNotReadyError {
|
|
691
|
+
code: __typename
|
|
692
|
+
message
|
|
693
|
+
}
|
|
694
|
+
... on MemberVerificationAlreadyApprovedError {
|
|
695
|
+
code: __typename
|
|
696
|
+
message
|
|
697
|
+
}
|
|
698
|
+
... on MemberVerificationDoesNotExistError {
|
|
699
|
+
code: __typename
|
|
700
|
+
message
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
`,Ke=n`
|
|
705
|
+
query ProfileCompletion {
|
|
706
|
+
profileCompletion {
|
|
707
|
+
completionPercentage
|
|
708
|
+
personalInformation
|
|
709
|
+
accountVerification
|
|
710
|
+
mobileNumberVerification
|
|
711
|
+
transactionPassword
|
|
712
|
+
accountPassword
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
`,ze=n`
|
|
716
|
+
fragment DepositGatewaySettingsCoreData on DepositGatewaySettings {
|
|
717
|
+
minimumAmount
|
|
718
|
+
maximumAmount
|
|
719
|
+
fixedFee
|
|
720
|
+
percentageFee
|
|
721
|
+
webEnabled
|
|
722
|
+
mobileWebEnabled
|
|
723
|
+
androidEnabled
|
|
724
|
+
iosEnabled
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
fragment WithdrawalGatewaySettingsCoreData on WithdrawalGatewaySettings {
|
|
728
|
+
minimumAmount
|
|
729
|
+
maximumAmount
|
|
730
|
+
fixedFee
|
|
731
|
+
percentageFee
|
|
732
|
+
webEnabled
|
|
733
|
+
mobileWebEnabled
|
|
734
|
+
androidEnabled
|
|
735
|
+
iosEnabled
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
query Platform {
|
|
739
|
+
minimumFirstDepositAmount
|
|
740
|
+
restrictWithdrawalsToVerifiedMembers
|
|
741
|
+
bankDepositGatewaySettings: depositGatewaySettings(gateway: BANK) {
|
|
742
|
+
...DepositGatewaySettingsCoreData
|
|
743
|
+
}
|
|
744
|
+
gcashDepositGatewaySettings: depositGatewaySettings(gateway: GCASH) {
|
|
745
|
+
...DepositGatewaySettingsCoreData
|
|
746
|
+
}
|
|
747
|
+
mayaDepositGatewaySettings: depositGatewaySettings(gateway: MAYA) {
|
|
748
|
+
...DepositGatewaySettingsCoreData
|
|
749
|
+
}
|
|
750
|
+
mayaAppDepositGatewaySettings: depositGatewaySettings(gateway: MAYA_APP) {
|
|
751
|
+
...DepositGatewaySettingsCoreData
|
|
752
|
+
}
|
|
753
|
+
bankWithdrawalGatewaySettings: withdrawalGatewaySettings(gateway: BANK) {
|
|
754
|
+
...WithdrawalGatewaySettingsCoreData
|
|
755
|
+
}
|
|
756
|
+
gcashWithdrawalGatewaySettings: withdrawalGatewaySettings(gateway: GCASH) {
|
|
757
|
+
...WithdrawalGatewaySettingsCoreData
|
|
758
|
+
}
|
|
759
|
+
mayaWithdrawalGatewaySettings: withdrawalGatewaySettings(gateway: MAYA) {
|
|
760
|
+
...WithdrawalGatewaySettingsCoreData
|
|
761
|
+
}
|
|
762
|
+
mayaAppWithdrawalGatewaySettings: withdrawalGatewaySettings(gateway: MAYA_APP) {
|
|
763
|
+
...WithdrawalGatewaySettingsCoreData
|
|
764
|
+
}
|
|
765
|
+
pointsClubSettings {
|
|
766
|
+
multiplier
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
`,Je=n`
|
|
770
|
+
query PointsWallet {
|
|
771
|
+
pointsWallet {
|
|
772
|
+
id
|
|
773
|
+
points
|
|
774
|
+
account
|
|
775
|
+
dateTimeCreated
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
`,Ze=n`
|
|
779
|
+
mutation PointsToCashConversion($input: PointsToCashConversionInput!) {
|
|
780
|
+
pointsToCashConversion(input: $input) {
|
|
781
|
+
... on InsufficientPointsError {
|
|
782
|
+
message
|
|
783
|
+
__typename
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
`,Xe=n`
|
|
788
|
+
query TransactionRecords($first: Int, $after: Cursor, $filter: TransactionRecordFilter) {
|
|
789
|
+
member {
|
|
790
|
+
transactionRecords(first: $first, after: $after, filter: $filter) {
|
|
791
|
+
edges {
|
|
792
|
+
cursor
|
|
793
|
+
node {
|
|
794
|
+
... on TransactionRecord {
|
|
795
|
+
id
|
|
796
|
+
type
|
|
797
|
+
amount
|
|
798
|
+
content
|
|
799
|
+
currentBalance
|
|
800
|
+
referenceNumber
|
|
801
|
+
dateTimeCreated
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
totalCount
|
|
806
|
+
pageInfo {
|
|
807
|
+
hasNextPage
|
|
808
|
+
endCursor
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
`,et=n`
|
|
814
|
+
query Wallet {
|
|
815
|
+
wallet {
|
|
816
|
+
id
|
|
817
|
+
balance
|
|
818
|
+
currency
|
|
819
|
+
dateTimeCreated
|
|
820
|
+
dateTimeLastUpdated
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
`,tt=n`
|
|
824
|
+
query WithdrawalRecords($first: Int, $after: Cursor, $filter: WithdrawalRecordFilterInput) {
|
|
825
|
+
member {
|
|
826
|
+
withdrawalRecords(first: $first, after: $after, filter: $filter) {
|
|
827
|
+
edges {
|
|
828
|
+
cursor
|
|
829
|
+
node {
|
|
830
|
+
... on BankWithdrawalRecord {
|
|
831
|
+
id
|
|
832
|
+
type
|
|
833
|
+
bank
|
|
834
|
+
fee
|
|
835
|
+
netAmount
|
|
836
|
+
reference
|
|
837
|
+
amount
|
|
838
|
+
status
|
|
839
|
+
withdrawalNumber
|
|
840
|
+
dateTimeCreated
|
|
841
|
+
dateTimeLastUpdated
|
|
842
|
+
}
|
|
843
|
+
... on GCashWithdrawalRecord {
|
|
844
|
+
id
|
|
845
|
+
type
|
|
846
|
+
fee
|
|
847
|
+
netAmount
|
|
848
|
+
reference
|
|
849
|
+
amount
|
|
850
|
+
status
|
|
851
|
+
withdrawalNumber
|
|
852
|
+
recipientMobileNumber
|
|
853
|
+
dateTimeCreated
|
|
854
|
+
dateTimeLastUpdated
|
|
855
|
+
}
|
|
856
|
+
... on ManualWithdrawalRecord {
|
|
857
|
+
id
|
|
858
|
+
type
|
|
859
|
+
fee
|
|
860
|
+
netAmount
|
|
861
|
+
reference
|
|
862
|
+
amount
|
|
863
|
+
status
|
|
864
|
+
withdrawalNumber
|
|
865
|
+
dateTimeCreated
|
|
866
|
+
dateTimeLastUpdated
|
|
867
|
+
}
|
|
868
|
+
... on MayaAppWithdrawalRecord {
|
|
869
|
+
id
|
|
870
|
+
type
|
|
871
|
+
fee
|
|
872
|
+
netAmount
|
|
873
|
+
reference
|
|
874
|
+
amount
|
|
875
|
+
status
|
|
876
|
+
withdrawalNumber
|
|
877
|
+
dateTimeCreated
|
|
878
|
+
dateTimeLastUpdated
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
totalCount
|
|
883
|
+
pageInfo {
|
|
884
|
+
hasNextPage
|
|
885
|
+
endCursor
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
`,at=n`
|
|
891
|
+
mutation CreateGCashWithdrawal($input: CreateGCashWithdrawalInput!) {
|
|
892
|
+
createGCashWithdrawal(input: $input) {
|
|
893
|
+
... on AccountNotVerifiedError {
|
|
894
|
+
code: __typename
|
|
895
|
+
message
|
|
896
|
+
}
|
|
897
|
+
... on InvalidTransactionPasswordError {
|
|
898
|
+
code: __typename
|
|
899
|
+
message
|
|
900
|
+
}
|
|
901
|
+
... on InvalidWithdrawalAmountError {
|
|
902
|
+
code: __typename
|
|
903
|
+
message
|
|
904
|
+
}
|
|
905
|
+
... on MobileNumberNotVerifiedError {
|
|
906
|
+
code: __typename
|
|
907
|
+
message
|
|
908
|
+
}
|
|
909
|
+
... on NotEnoughBalanceError {
|
|
910
|
+
code: __typename
|
|
911
|
+
message
|
|
912
|
+
}
|
|
913
|
+
... on WithdrawalDailyLimitExceededError {
|
|
914
|
+
code: __typename
|
|
915
|
+
message
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
`,rt=n`
|
|
920
|
+
mutation CreateMayaWithdrawal($input: CreateMayaWithdrawalInput!) {
|
|
921
|
+
createMayaWithdrawal(input: $input) {
|
|
922
|
+
... on AccountNotVerifiedError {
|
|
923
|
+
code: __typename
|
|
924
|
+
message
|
|
925
|
+
}
|
|
926
|
+
... on InvalidTransactionPasswordError {
|
|
927
|
+
code: __typename
|
|
928
|
+
message
|
|
929
|
+
}
|
|
930
|
+
... on InvalidWithdrawalAmountError {
|
|
931
|
+
code: __typename
|
|
932
|
+
message
|
|
933
|
+
}
|
|
934
|
+
... on MobileNumberNotVerifiedError {
|
|
935
|
+
code: __typename
|
|
936
|
+
message
|
|
937
|
+
}
|
|
938
|
+
... on NotEnoughBalanceError {
|
|
939
|
+
code: __typename
|
|
940
|
+
message
|
|
941
|
+
}
|
|
942
|
+
... on WithdrawalDailyLimitExceededError {
|
|
943
|
+
code: __typename
|
|
944
|
+
message
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
`,nt=n`
|
|
949
|
+
mutation CreateMayaAppWithdrawal($input: CreateMayaAppWithdrawalInput!) {
|
|
950
|
+
createMayaAppWithdrawal(input: $input) {
|
|
951
|
+
... on AccountNotVerifiedError {
|
|
952
|
+
code: __typename
|
|
953
|
+
message
|
|
954
|
+
}
|
|
955
|
+
... on InvalidTransactionPasswordError {
|
|
956
|
+
code: __typename
|
|
957
|
+
message
|
|
958
|
+
}
|
|
959
|
+
... on InvalidWithdrawalAmountError {
|
|
960
|
+
code: __typename
|
|
961
|
+
message
|
|
962
|
+
}
|
|
963
|
+
... on NotEnoughBalanceError {
|
|
964
|
+
code: __typename
|
|
965
|
+
message
|
|
966
|
+
}
|
|
967
|
+
... on WithdrawalDailyLimitExceededError {
|
|
968
|
+
code: __typename
|
|
969
|
+
message
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
`,ot=n`
|
|
974
|
+
mutation CreateBankWithdrawal($input: CreateBankWithdrawalInput!) {
|
|
975
|
+
createBankWithdrawal(input: $input) {
|
|
976
|
+
... on MobileNumberNotVerifiedError {
|
|
977
|
+
code: __typename
|
|
978
|
+
message
|
|
979
|
+
}
|
|
980
|
+
... on AccountNotVerifiedError {
|
|
981
|
+
code: __typename
|
|
982
|
+
message
|
|
983
|
+
}
|
|
984
|
+
... on InvalidWithdrawalAmountError {
|
|
985
|
+
code: __typename
|
|
986
|
+
message
|
|
987
|
+
}
|
|
988
|
+
... on WithdrawalDailyLimitExceededError {
|
|
989
|
+
code: __typename
|
|
990
|
+
message
|
|
991
|
+
}
|
|
992
|
+
... on InvalidTransactionPasswordError {
|
|
993
|
+
code: __typename
|
|
994
|
+
message
|
|
995
|
+
}
|
|
996
|
+
... on NotEnoughBalanceError {
|
|
997
|
+
code: __typename
|
|
998
|
+
message
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
`,it=n`
|
|
1003
|
+
query RemainingDailyWithdrawalsCount {
|
|
1004
|
+
remainingDailyWithdrawalsCount
|
|
1005
|
+
}
|
|
1006
|
+
`;class st{constructor(e){d(this,"client");this.client=e}async memberAccount(){const e=await this.client.request(xe);return e.ok?{ok:!0,data:e.data.memberAccount}:e}async registerMemberAccount(e){const t=await this.client.request(qe,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(Fe,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(Ve,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(Le,e);return t.ok?t.data.resetPassword?{ok:!1,error:t.data.resetPassword}:{ok:!0}:t}async profileCompletion(){const e=await this.client.request(Ke);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(He,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(je,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(Ye,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(Qe,e);return t.ok?t.data.updateMemberVerification?{ok:!1,error:t.data.updateMemberVerification}:{ok:!0}:t}async memberVerification(){const e=await this.client.request(Oe);return e.ok?{ok:!0,data:e.data.memberAccount.verification}:e}async announcements(e){const t=await this.client.request(ge,e);return t.ok?{ok:!0,data:t.data.announcements}:t}}function p(i,e){const t=dt[i];return{code:t.code,message:e??t.message}}const dt={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"},503:{code:"HttpServiceUnavailable",message:"Service Unavailable"}};async function g(i){const e=new TextEncoder().encode(i),t=await crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(t)).map(c=>c.toString(16).padStart(2,"0")).join("")}class ct{constructor(e){d(this,"url");d(this,"platform");this.url=e.url,this.platform=e.platform}async createSession(e){const t=new Headers;if(t.set("Content-Type","application/json"),t.set("Platform-Code",this.platform),t.set("Role","MEMBER"),"name"in e){const a=`${e.name}:${await g(e.password)}`,o=Buffer.from(a).toString("base64");t.set("Authorization",`Basic ${o}`)}if("mobileNumber"in e){const a=`${e.mobileNumber}:${e.verificationCode}`,o=Buffer.from(a).toString("base64");t.set("Authorization",`Basic ${o}`)}try{const a=await fetch(`${this.url}/sessions`,{method:"POST",headers:t}),o=await a.json();return a.status===401||a.status===403?o.code==="ACCOUNT_BLACKLISTED"?{ok:!1,error:{code:"AccountBlacklisted",message:"Account is blacklisted"}}:{ok:!1,error:{code:"AccountNotFound",message:"Account not found."}}:a.ok?{ok:!0,data:o}:{ok:!1,error:p(a.status)}}catch{return{ok:!1,error:p(500)}}}async refreshSession(e){try{const t=await fetch(`${this.url}/session:refresh`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`,"Platform-Code":this.platform,Role:"MEMBER"}}),a=await t.json();return t.status===401||t.status===403?a.code==="ACCOUNT_BLACKLISTED"?{ok:!1,error:{code:"AccountBlacklisted",message:"Account is blacklisted"}}:{ok:!1,error:{code:"InvalidToken",message:"Invalid token."}}:t.ok?{ok:!0,data:a}:{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",Authorization:`Bearer ${e}`,"Platform-Code":this.platform,Role:"MEMBER"}});return t.ok?{ok:!0}:{ok:!1,error:p(t.status)}}catch{return{ok:!1,error:{code:"UnknownError",message:"Something went wrong."}}}}async verifySession(e){try{const t=await fetch(`${this.url}/session`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`,"Platform-Code":this.platform,Role:"MEMBER"}});if(t.status===403||t.status===401)return!1}catch{}return!0}}class mt{constructor(e){d(this,"client");this.client=e}async file(e){const t=await this.client.request(k,e);return t.ok?{ok:!0,data:t.data.node}:t}async uploadPrivateImageFile(e){const t=await this.client.upload(k,e);return t.ok?t.data.uploadPrivateImageFile?{ok:!1,error:t.data.uploadPrivateImageFile}:{ok:!0}:t}}class _{constructor(e){d(this,"client");this.client=e}async game(e){const t=await this.client.request(ye,e);return t.ok?{ok:!0,data:t.data.node}:t}async games(e){const t=await this.client.request(be,e);return t.ok?{ok:!0,data:t.data.games}:t}async gamesByName(e){const t=await this.client.request(Ae,e);return t.ok?{ok:!0,data:t.data.gamesByName}:t}async gameSession(e){const t=await this.client.request(Se,e);return t.ok?{ok:!0,data:t.data.node}:t}async createGameSession(e){const t=await this.client.request(Ee,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(Ce,e);return t.ok?t.data.endGameSession?{ok:!0}:{ok:!1,error:{code:"UnknownError",message:"Something went wrong."}}:t}}class ut{constructor(e){d(this,"client");this.client=e}async betRecords(e){const t=await this.client.request(ke,e);return t.ok?{ok:t.ok,data:t.data.member.betRecords}:t}async transactionRecords(e){const t=await this.client.request(Xe,e);return t.ok?{ok:t.ok,data:t.data.member.transactionRecords}:t}async withdrawalRecords(e){const t=await this.client.request(tt,e);return t.ok?{ok:t.ok,data:t.data.member.withdrawalRecords}:t}async depositRecords(e){const t=await this.client.request(Ie,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(Ue);return e.ok?{ok:e.ok,data:e.data.member}:e}}class lt{constructor(e){d(this,"url");this.url=e.url}gameThumbnail(e){return`${this.url}/images/${e.provider.toLowerCase()}/thumbnail-${e.id}.webp`}}class pt extends _{async promos(){const e=await this.client.request(ve);return e.ok?{ok:e.ok,data:e.data.promos}:e}async cashbacks(){const e=await this.client.request(_e);return e.ok?{ok:e.ok,data:e.data.cashbacks}:e}async availablePromos(e){const t=await this.client.request(De,e);return t.ok?{ok:t.ok,data:t.data.availablePromos}:t}async cashbackBonuses(){const e=await this.client.request(Re);return e.ok?{ok:e.ok,data:e.data.cashbackBonuses}:e}async claimCashbackBonus(e){const t=await this.client.request(Ne,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(Me);return e.ok?{ok:e.ok,data:e.data.bonus}:e}async wallet(){const e=await this.client.request(et);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(Ge,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(Pe,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($e,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(at,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(rt,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(nt,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(ot,e);return t.ok?t.data.createBankWithdrawal?{ok:!1,error:t.data.createBankWithdrawal}:{ok:!0}:t}async remainingDailyWithdrawalsCount(){const e=await this.client.request(it);return e.ok?{ok:e.ok,data:e.data.remainingDailyWithdrawalsCount}:e}async pointsWallet(){const e=await this.client.request(Je);return e.ok?{ok:e.ok,data:e.data.pointsWallet}:e}async pointsToCashConversion(e){const t=await this.client.request(Ze,e);return t.ok?t.data.pointsToCashConversion?{ok:!1,error:t.data.pointsToCashConversion}:{ok:!0}:t}}class ft{constructor(e){d(this,"client");this.client=e}async latestBetRecords(){const e=await this.client.request(Te);return e.ok?{ok:!0,data:e.data.latestBetRecords}:e}}class v{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 C(i){return new Date(i.getTime())}function D(i,e){const t=C(i);return t.setDate(t.getDate()+e),t}function M(i,e){const t=C(i);return t.setMinutes(t.getMinutes()+e),t}function R(i,e){return i.getTime()>e.getTime()}function N(i,e){const t=C(i);return t.setMinutes(t.getMinutes()-e),t}class ht{constructor(e){d(this,"logger");d(this,"storageKey","session");d(this,"authService");this.logger=new v,this.authService=new ct(e)}async create(e){const t=await this.authService.createSession(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:M(a,8).getTime(),refreshTokenExpiresAt:N(D(a,30),2).getTime()})),{ok:!0}}else return t}async session(){if(this.isServer)return this.logger.warn("'localStorage' is not available on the server."),null;const e=window.localStorage.getItem(this.storageKey);if(!e)return null;try{let t=JSON.parse(e),a=new Date;const o=new Date(t.accessTokenExpiresAt),c=new Date(t.refreshTokenExpiresAt);if(R(a,c))return this.logger.warn("Session expired. Logging out.."),window.localStorage.removeItem(this.storageKey),null;if(R(a,o)){const u=await this.authService.refreshSession(t.refreshToken);if(this.logger.info("Refreshing session..."),!u.ok)return this.logger.error(`Failed to refresh session: ${u.error.message}`),u.error.code==="InvalidToken"||u.error.code==="AccountBlacklisted"?(window.localStorage.removeItem(this.storageKey),null):(this.logger.warn("Old session returned."),t);this.logger.success("Session refreshed!"),a=new Date,t={...t,...u.data,accessTokenExpiresAt:M(a,8).getTime(),refreshTokenExpiresAt:N(D(a,30),2).getTime()},window.localStorage.setItem(this.storageKey,JSON.stringify(t))}return t}catch{return null}}async destroy(){if(this.isServer){this.logger.warn("'localStorage' is not available on the server.");return}const e=await this.session();e&&await this.authService.destroySession(e.accessToken),window.localStorage.removeItem(this.storageKey)}get isServer(){return typeof window>"u"}}function r(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 wt{constructor(e){d(this,"staticService");const t=(e==null?void 0:e.environment)==="development";this.staticService=new lt({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,o,c,u,f,w,s,b,I,G,P,$,W,B,U,x,O,q,F,L,V,H,j,Y,Q,K,z,J,Z,X,ee,te,ae,re,ne,oe,ie,se,de,ce,me,ue,le,pe,fe,he,we;return{paymentSettings:{minimumFirstDepositAmount:r(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:((o=e.bankDepositGatewaySettings)==null?void 0:o.webEnabled)??!1,mobileWebEnabled:((c=e.bankDepositGatewaySettings)==null?void 0:c.mobileWebEnabled)??!1,minimumAmount:r((u=e.bankDepositGatewaySettings)==null?void 0:u.minimumAmount),maximumAmount:r((f=e.bankDepositGatewaySettings)==null?void 0:f.maximumAmount)},gcash:{androidEnabled:((w=e.gcashDepositGatewaySettings)==null?void 0:w.androidEnabled)??!1,iosEnabled:((s=e.gcashDepositGatewaySettings)==null?void 0:s.iosEnabled)??!1,webEnabled:((b=e.gcashDepositGatewaySettings)==null?void 0:b.webEnabled)??!1,mobileWebEnabled:((I=e.gcashDepositGatewaySettings)==null?void 0:I.mobileWebEnabled)??!1,minimumAmount:r((G=e.gcashDepositGatewaySettings)==null?void 0:G.minimumAmount),maximumAmount:r((P=e.gcashDepositGatewaySettings)==null?void 0:P.maximumAmount)},maya:{androidEnabled:(($=e.mayaDepositGatewaySettings)==null?void 0:$.androidEnabled)??!1,iosEnabled:((W=e.mayaDepositGatewaySettings)==null?void 0:W.iosEnabled)??!1,webEnabled:((B=e.mayaDepositGatewaySettings)==null?void 0:B.webEnabled)??!1,mobileWebEnabled:((U=e.mayaDepositGatewaySettings)==null?void 0:U.mobileWebEnabled)??!1,minimumAmount:r((x=e.mayaDepositGatewaySettings)==null?void 0:x.minimumAmount),maximumAmount:r((O=e.mayaDepositGatewaySettings)==null?void 0:O.maximumAmount)},mayaApp:{androidEnabled:((q=e.mayaAppDepositGatewaySettings)==null?void 0:q.androidEnabled)??!1,iosEnabled:((F=e.mayaAppDepositGatewaySettings)==null?void 0:F.iosEnabled)??!1,webEnabled:((L=e.mayaAppDepositGatewaySettings)==null?void 0:L.webEnabled)??!1,mobileWebEnabled:((V=e.mayaAppDepositGatewaySettings)==null?void 0:V.mobileWebEnabled)??!1,minimumAmount:r((H=e.mayaAppDepositGatewaySettings)==null?void 0:H.minimumAmount),maximumAmount:r((j=e.mayaAppDepositGatewaySettings)==null?void 0:j.maximumAmount)}},withdrawalGateway:{bank:{androidEnabled:((Y=e.bankWithdrawalGatewaySettings)==null?void 0:Y.androidEnabled)??!1,iosEnabled:((Q=e.bankWithdrawalGatewaySettings)==null?void 0:Q.iosEnabled)??!1,webEnabled:((K=e.bankWithdrawalGatewaySettings)==null?void 0:K.webEnabled)??!1,mobileWebEnabled:((z=e.bankWithdrawalGatewaySettings)==null?void 0:z.mobileWebEnabled)??!1,minimumAmount:r((J=e.bankWithdrawalGatewaySettings)==null?void 0:J.minimumAmount),maximumAmount:r((Z=e.bankWithdrawalGatewaySettings)==null?void 0:Z.maximumAmount)},gcash:{androidEnabled:((X=e.gcashWithdrawalGatewaySettings)==null?void 0:X.androidEnabled)??!1,iosEnabled:((ee=e.gcashWithdrawalGatewaySettings)==null?void 0:ee.iosEnabled)??!1,webEnabled:((te=e.gcashWithdrawalGatewaySettings)==null?void 0:te.webEnabled)??!1,mobileWebEnabled:((ae=e.gcashWithdrawalGatewaySettings)==null?void 0:ae.mobileWebEnabled)??!1,minimumAmount:r((re=e.gcashWithdrawalGatewaySettings)==null?void 0:re.minimumAmount),maximumAmount:r((ne=e.gcashWithdrawalGatewaySettings)==null?void 0:ne.maximumAmount,1e6)},maya:{androidEnabled:((oe=e.mayaWithdrawalGatewaySettings)==null?void 0:oe.androidEnabled)??!1,iosEnabled:((ie=e.mayaWithdrawalGatewaySettings)==null?void 0:ie.iosEnabled)??!1,webEnabled:((se=e.mayaWithdrawalGatewaySettings)==null?void 0:se.webEnabled)??!1,mobileWebEnabled:((de=e.mayaWithdrawalGatewaySettings)==null?void 0:de.mobileWebEnabled)??!1,minimumAmount:r((ce=e.mayaWithdrawalGatewaySettings)==null?void 0:ce.minimumAmount),maximumAmount:r((me=e.mayaWithdrawalGatewaySettings)==null?void 0:me.maximumAmount)},mayaApp:{androidEnabled:((ue=e.mayaAppWithdrawalGatewaySettings)==null?void 0:ue.androidEnabled)??!1,iosEnabled:((le=e.mayaAppWithdrawalGatewaySettings)==null?void 0:le.iosEnabled)??!1,webEnabled:((pe=e.mayaAppWithdrawalGatewaySettings)==null?void 0:pe.webEnabled)??!1,mobileWebEnabled:((fe=e.mayaAppWithdrawalGatewaySettings)==null?void 0:fe.mobileWebEnabled)??!1,minimumAmount:r((he=e.mayaAppWithdrawalGatewaySettings)==null?void 0:he.minimumAmount),maximumAmount:r((we=e.mayaAppWithdrawalGatewaySettings)==null?void 0:we.maximumAmount,1e6)}}},pointsClubSettings:{multiplier:r(e.pointsClubSettings.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,dateTimeLastActive:e.dateTimeLastActive?new Date(e.dateTimeLastActive):void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}wallet(e){return{...e,balance:r(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:r(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:r(e.amount,0),netAmount:r(e.netAmount,0),fee:r(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:r(e.fee,0),amount:r(e.amount,0),netAmount:r(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:r(e.amount,0),fee:r(e.fee,0),netAmount:r(e.netAmount,0),reference:e.reference??void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}betRecord(e){var t,a;return{...e,bet:r(e.bet,0),payout:r(e.payout,0),jackpotContribution:r(e.jackpotContribution,0),jackpotPayout:r(e.jackpotPayout,0),winloss:r(e.winloss),validBet:r(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,validBet:r((a=e.metadata)==null?void 0:a.validBet)}}}latestBetRecord(e){return{...e,game:this.game(e.game),bet:r(e.bet,0),payout:r(e.payout,0),validBet:r(e.validBet,0),dateTimeSettled:new Date(e.dateTimeSettled),dateTimeCreated:new Date(e.dateTimeCreated)}}transactionRecord(e){return{...e,amount:r(e.amount,0),content:e.content??void 0,currentBalance:r(e.currentBalance,0),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}game(e){return{...e,image:this.staticService.gameThumbnail(e)}}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:r(e.maximumBonusAmount),minimumBonusAmount:r(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:r(e.deposit.fee,0),amount:r(e.deposit.amount,0),netAmount:r(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:r(e.balance,0),amount:r(e.amount,0),expiration:new Date(e.expiration),turnoverRequirement:r(e.turnoverRequirement,0),currentTurnoverRequirementContribution:r(e.currentTurnoverRequirementContribution,0),currentTurnoverRequirementContributionPercentage:r(e.currentTurnoverRequirementContributionPercentage,0),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}cashbackBonus(e){return{id:e.id,balance:r(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:r(e.points,0),account:e.account,dateTimeCreated:new Date(e.dateTimeCreated)}}}class y{constructor(e,t){d(this,"url");d(this,"options");d(this,"middlewares");var o;const a=new Headers((o=t==null?void 0:t.fetchOptions)==null?void 0:o.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){var b;const a=JSON.stringify({query:e,variables:t}),o=new Headers(this.options.headers);o.set("Content-Type","application/json"),o.set("Accept","application/json");const c=await this.runMiddlewares(new Request(this.url,{...this.options,body:a,headers:o,method:"POST"})),u=await fetch(c);if(!u.ok)return{ok:!1,error:p(u.status)};const f=await u.json(),w=f.data,s=(b=f.errors)==null?void 0:b.at(0);return(s==null?void 0:s.extensions.code)==="FORBIDDEN"?{ok:!1,error:p(403,s.message)}:(s==null?void 0:s.extensions.code)==="UNAUTHORIZED"?{ok:!1,error:p(401,s.message)}:(s==null?void 0:s.extensions.code)==="BAD_USER_INPUT"?{ok:!1,error:p(400,s.message)}:(s==null?void 0:s.extensions.code)==="INTERNAL_SERVER_ERROR"?{ok:!1,error:p(500,s.message)}:{ok:!0,data:w}}async upload(e,t){var b;const a=y.createUploadBody(e,t),o=new Headers(this.options.headers);o.set("Accept","application/json"),o.delete("Content-Type");const c=await this.runMiddlewares(new Request(this.url,{...this.options,body:a,headers:o,method:"POST"})),u=await fetch(c);if(!u.ok)return{ok:!1,error:p(u.status)};const f=await u.json(),w=f.data,s=(b=f.errors)==null?void 0:b.at(0);return(s==null?void 0:s.extensions.code)==="FORBIDDEN"?{ok:!1,error:p(403)}:(s==null?void 0:s.extensions.code)==="UNAUTHORIZED"?{ok:!1,error:p(401)}:(s==null?void 0:s.extensions.code)==="BAD_USER_INPUT"?{ok:!1,error:p(400)}:(s==null?void 0:s.extensions.code)==="INTERNAL_SERVER_ERROR"?{ok:!1,error:p(500,s.message)}:{ok:!0,data:w}}async runMiddlewares(e){let t=e.clone();for(const a of this.middlewares)t=await a(t);return t}static createUploadBody(e,t){const{files:a,others:o}=y.extractFiles(t),c=new FormData;c.append("operations",JSON.stringify({query:e,variables:t})),Object.entries(o).forEach(([f,w])=>{c.append(f,JSON.stringify(w))});const u={};return Object.keys(a).forEach((f,w)=>{u[w.toString()]=`variables.${f}`}),c.append("map",JSON.stringify(u)),Object.values(a).forEach((f,w)=>{c.append(w.toString(),f)}),c}static extractFiles(e){const t={},a={};return Object.entries(e).forEach(([o,c])=>{c instanceof File||c instanceof Blob?t[o]=c:a[o]=c}),{files:t,others:a}}}class gt{constructor(e){d(this,"gameService");d(this,"fileService");d(this,"walletService");d(this,"reportService");d(this,"portalService");d(this,"accountService");d(this,"sessionService");d(this,"transformer");d(this,"logger");const t=e.environment==="development";this.sessionService=new ht({url:t?"https://auth.development.opexa.io":"https://auth.opexa.io",platform:e.platform});const a={middlewares:[this.authMiddleware],fetchOptions:{headers:{Role:"MEMBER","Platform-Code":e.platform}}};this.gameService=new _(new y(t?"https://game.development.opexa.io/graphql":"https://game.opexa.io/graphql",a)),this.fileService=new mt(new y(t?"https://file.development.opexa.io/graphql":"https://file.opexa.io/graphql",a)),this.walletService=new pt(new y(t?"https://wallet.development.opexa.io/graphql":"https://wallet.opexa.io/graphql",a)),this.reportService=new ut(new y(t?"https://report.development.opexa.io/graphql":"https://report.opexa.io/graphql",a)),this.accountService=new st(new y(t?"https://account.development.opexa.io/graphql":"https://account.opexa.io/graphql",a)),this.portalService=new ft(new y(t?"https://portal.development.opexa.io/graphql":"https://portal.opexa.io/graphql",a)),this.transformer=new wt(e),this.logger=new v({enabled:e.log??!1})}get authMiddleware(){return async e=>{this.logger.info("Checking for session");const t=await this.sessionService.session();return t?(e.headers.append("Authorization",`Bearer ${t.accessToken}`),this.logger.info("Session found"),this.logger.success("Added 'Authorization' header")):this.logger.info("No session found"),e}}async signIn(e){const t=await this.sessionService.create(e);return t.ok?{ok:!0}:t}async signOut(){await this.sessionService.destroy()}async session(){const e=await this.sessionService.session();return{ok:!0,data:e?{id:e.session.id,dateTimeCreated:new Date(e.session.dateTimeCreated)}:null}}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 g(e.password),mobileNumber:this.addAreaCode(e.mobileNumber),domain:e.domain},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 g(t.password):void 0,transactionPassword:t.transactionPassword?await g(t.transactionPassword):void 0,...t.mobileNumber&&{mobileNumber:this.addAreaCode(t.mobileNumber)}}}})}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 g(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:o})=>({...this.transformer.transform.announcement(o),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 g(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 g(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 g(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 g(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:o})=>({...this.transformer.transform.withdrawalRecord(o),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:o})=>({...this.transformer.transform.depositRecord(o),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:o})=>({...this.transformer.transform.betRecord(o),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:o})=>({...this.transformer.transform.transactionRecord(o),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:o})=>({...this.transformer.transform.game(o),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:o})=>({...this.transformer.transform.game(o),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=gt,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
1007
|
+
//# sourceMappingURL=index.js.map
|