@opexa/portal-sdk 0.0.6 → 0.0.8
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 -1591
- package/dist/index.d.ts +0 -3
- package/dist/index.js +66 -59
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +759 -574
- package/dist/index.mjs.map +1 -1
- package/dist/sdk/index.d.ts +4 -0
- package/dist/{sdk.d.ts → sdk/sdk.d.ts} +38 -2
- package/dist/{session-manager.d.ts → sdk/session-manager.d.ts} +6 -2
- package/dist/{transformer.d.ts → sdk/transformer.d.ts} +1 -1
- package/dist/{types.d.ts → sdk/types.d.ts} +120 -94
- package/dist/services/account.service.d.ts +3 -2
- package/dist/services/auth.service.d.ts +8 -6
- package/dist/services/bet-record.d.ts +1 -7
- package/dist/services/bonus.d.ts +3 -2
- package/dist/services/cashback.d.ts +2 -4
- package/dist/services/deposit.d.ts +8 -17
- package/dist/services/file.d.ts +20 -10
- package/dist/services/file.service.d.ts +1 -1
- package/dist/services/game.d.ts +26 -12
- package/dist/services/game.service.d.ts +3 -2
- package/dist/services/member.d.ts +15 -9
- package/dist/services/platform.d.ts +1 -1
- package/dist/services/points.d.ts +3 -2
- package/dist/services/portal.service.d.ts +1 -1
- package/dist/services/promo.d.ts +2 -4
- package/dist/services/report.service.d.ts +2 -1
- package/dist/services/session.d.ts +64 -9
- package/dist/services/types.d.ts +9 -32
- package/dist/services/wallet.service.d.ts +3 -1
- package/dist/services/withdrawal.d.ts +6 -5
- package/dist/utils/graphql-client.d.ts +4 -11
- package/dist/utils/rest-client.d.ts +34 -0
- package/dist/utils/status-code-to-error.d.ts +3 -0
- package/dist/utils/types.d.ts +25 -3
- package/package.json +78 -78
- package/dist/utils/http-error.d.ts +0 -26
- /package/dist/{logger.d.ts → sdk/logger.d.ts} +0 -0
- /package/dist/{object-id.d.ts → sdk/object-id.d.ts} +0 -0
- /package/dist/{object-type.d.ts → sdk/object-type.d.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountReturn, AnnouncementsInput, AnnouncementsReturn, AvailablePromosReturn, BetRecordsInput, BetRecordsReturn, BonusReturn, CashbackBonusReturn, CashbacksReturn, ClaimCashbackBonusReturn, CreateAccountInput, CreateAccountReturn, CreateDepositInput, CreateDepositReturn, CreateGameSessionInput, CreateGameSessionReturn, CreateWithdrawalInput, CreateWithdrawalReturn, DeleteAccountReturn, DepositRecordsInput, DepositRecordsReturn, DepositReturn, DepositsCountReturn, EndGameSessionReturn, FileReturn, GameSessionReturn, GamesByNameInput, GamesByNameInput__Next, GamesByNameReturn, GamesInput, GamesInput__Next, GamesReturn, LatestBetRecordsReturn, PlatformReturn, PointsToCashConversionReturn, PointsWalletReturn, ProfileCompletionReturn, PromosReturn, RemainingDailyWithdrawalsCountReturn, ResetPasswordInput, ResetPasswordReturn, SendVerificationCodeReturn, SessionReturn,
|
|
1
|
+
import { AccountReturn, AnnouncementsInput, AnnouncementsReturn, AuthenticateInput, AuthenticateReturn, AvailablePromosReturn, BetRecordsInput, BetRecordsReturn, BonusReturn, CashbackBonusReturn, CashbacksReturn, ClaimCashbackBonusReturn, CreateAccountInput, CreateAccountReturn, CreateDepositInput, CreateDepositReturn, CreateGameSessionInput, CreateGameSessionReturn, CreateWithdrawalInput, CreateWithdrawalReturn, DeleteAccountReturn, DepositRecordsInput, DepositRecordsReturn, DepositReturn, DepositsCountReturn, EndGameSessionReturn, FileReturn, GameSessionReturn, GamesByNameInput, GamesByNameInput__Next, GamesByNameReturn, GamesInput, GamesInput__Next, GamesReturn, LatestBetRecordsReturn, MayaSignInInput, MayaSignInReturn, MobileNumberSignInInput, MobileNumberSignInReturn, NameAndPasswordSignInInput, NameAndPasswordSignInReturn, PlatformReturn, PointsToCashConversionReturn, PointsWalletReturn, ProfileCompletionReturn, PromosReturn, RemainingDailyWithdrawalsCountReturn, ResetPasswordInput, ResetPasswordReturn, SendVerificationCodeReturn, SessionReturn, SubmitVerificationDetailsInput, SubmitVerificationDetailsReturn, TransactionRecordsInput, TransactionRecordsReturn, UpdateAccountInput, UpdateAccountReturn, UpdateVerificationDetailsInput, UpdateVerificationDetailsReturn, UploadImageFileInput, UploadImageFileReturn, VerificationDetailsReturn, VerifyMobileNumberReturn, WalletReturn, WatchSessionInput, WithdrawalRecordsInput, WithdrawalRecordsReturn } from './types';
|
|
2
2
|
|
|
3
3
|
export interface SdkConfig {
|
|
4
4
|
platform: string;
|
|
@@ -25,7 +25,43 @@ export declare class Sdk {
|
|
|
25
25
|
private logger;
|
|
26
26
|
constructor(config: SdkConfig);
|
|
27
27
|
private get authMiddleware();
|
|
28
|
-
signIn(input:
|
|
28
|
+
signIn(input: NameAndPasswordSignInInput): Promise<NameAndPasswordSignInReturn>;
|
|
29
|
+
signIn(input: MobileNumberSignInInput): Promise<MobileNumberSignInReturn>;
|
|
30
|
+
signIn(input: MayaSignInInput): Promise<MayaSignInReturn>;
|
|
31
|
+
/**
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const signInResult = await signIn({
|
|
35
|
+
* type: 'NAME_AND_PASSWORD',
|
|
36
|
+
* name: data.name,
|
|
37
|
+
* password: data.password,
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* if (!signInResult.ok) {
|
|
41
|
+
* return window.alert(signInResult.error.message);
|
|
42
|
+
* }
|
|
43
|
+
*
|
|
44
|
+
* if (!signInResult.data) {
|
|
45
|
+
* // Signed in. No more steps needed
|
|
46
|
+
* return;
|
|
47
|
+
* }
|
|
48
|
+
*
|
|
49
|
+
* const secretAnswer = window.prompt(SECRET_QUESTIONS_MAP[signInResult.secretQuestion]);
|
|
50
|
+
*
|
|
51
|
+
* const authResult = await sdk.authenticate({
|
|
52
|
+
* type: 'SECURITY_QUESTION',
|
|
53
|
+
* token: signInResult.token,
|
|
54
|
+
* secretAnswer: secretAnswer,
|
|
55
|
+
* });
|
|
56
|
+
*
|
|
57
|
+
* if (!authResult.ok) {
|
|
58
|
+
* window.alert(res.error.message);
|
|
59
|
+
* } else {
|
|
60
|
+
* // Signed in
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
authenticate(input: AuthenticateInput): Promise<AuthenticateReturn>;
|
|
29
65
|
signOut(): Promise<void>;
|
|
30
66
|
/**
|
|
31
67
|
* @description Watches the session if it is still valid whenever signed in.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AuthServiceConfig, CreateSessionError, CreateSessionInput,
|
|
1
|
+
import { AuthenticateError, AuthenticateInput, Authenticator, AuthServiceConfig, CreateSessionError, CreateSessionInput, RefreshSessionError, Session } from '../services';
|
|
2
|
+
import { OperationResult } from '../utils/types';
|
|
2
3
|
|
|
3
4
|
interface Data {
|
|
4
5
|
session: Session;
|
|
@@ -18,7 +19,10 @@ export declare class SessionManager {
|
|
|
18
19
|
constructor(config: SessionManagerConfig);
|
|
19
20
|
get refreshing(): boolean;
|
|
20
21
|
set refreshing(value: boolean);
|
|
21
|
-
create(input: CreateSessionInput): Promise<OperationResult<CreateSessionError
|
|
22
|
+
create(input: CreateSessionInput): Promise<OperationResult<CreateSessionError, {
|
|
23
|
+
authenticator: Authenticator;
|
|
24
|
+
} | null>>;
|
|
25
|
+
createFromAuthenticator(input: AuthenticateInput): Promise<OperationResult<AuthenticateError>>;
|
|
22
26
|
get(): Promise<OperationResult<RefreshSessionError, Data | null>>;
|
|
23
27
|
destroy(): Promise<void>;
|
|
24
28
|
verify(): Promise<boolean>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type * as Internal from '
|
|
1
|
+
import { OperationResult } from '../utils/types';
|
|
2
|
+
import type * as Internal from '../services';
|
|
3
3
|
type WithCursor<T> = T & {
|
|
4
4
|
cursor: string;
|
|
5
5
|
};
|
|
@@ -12,28 +12,40 @@ type PaginatedQueryResult<K extends string, T> = Record<K, Array<WithCursor<T>>>
|
|
|
12
12
|
hasNextPage: true;
|
|
13
13
|
nextCursor: string;
|
|
14
14
|
});
|
|
15
|
-
export
|
|
16
|
-
interface SignIn__NameAndPassword {
|
|
17
|
-
name: string;
|
|
18
|
-
password: string;
|
|
19
|
-
mobileNumber?: never;
|
|
20
|
-
verificationCode?: never;
|
|
15
|
+
export interface SecurityQuestionAuthenticator extends Internal.Authenticator__SecurityQuestion {
|
|
21
16
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
mobileNumber: string;
|
|
26
|
-
verificationCode: string;
|
|
17
|
+
export type Authenticator = SecurityQuestionAuthenticator;
|
|
18
|
+
export type SecretQuestion = Internal.SecretQuestion;
|
|
19
|
+
export interface NameAndPasswordSignInInput extends Internal.CreateSessionInput__NameAndPassword {
|
|
27
20
|
}
|
|
28
|
-
export
|
|
21
|
+
export interface MobileNumberSignInInput extends Internal.CreateSessionInput__MobileNumber {
|
|
22
|
+
}
|
|
23
|
+
export interface MayaSignInInput extends Internal.CreateSessionInput__Maya {
|
|
24
|
+
}
|
|
25
|
+
export type MayaSignInReturn = OperationResult<SignInError>;
|
|
26
|
+
export type MobileNumberSignInReturn = OperationResult<SignInError>;
|
|
27
|
+
export type NameAndPasswordSignInReturn = OperationResult<SignInError, {
|
|
28
|
+
/** Two Factor Authentication is enabled */
|
|
29
|
+
'2FAEnabled': true;
|
|
30
|
+
authenticator: Authenticator;
|
|
31
|
+
} | {
|
|
32
|
+
'2FAEnabled': false;
|
|
33
|
+
authenticator?: never;
|
|
34
|
+
}>;
|
|
35
|
+
export type SignInInput = NameAndPasswordSignInInput | MobileNumberSignInInput | MayaSignInInput;
|
|
29
36
|
export type SignInError = Internal.CreateSessionError;
|
|
30
|
-
export type SignInReturn =
|
|
37
|
+
export type SignInReturn = NameAndPasswordSignInReturn | MobileNumberSignInReturn | MayaSignInReturn;
|
|
38
|
+
export interface SecurityQuestionAuthenticateInput extends Internal.AuthenticateInput__SecurityQuestion {
|
|
39
|
+
}
|
|
40
|
+
export type AuthenticateInput = SecurityQuestionAuthenticateInput;
|
|
41
|
+
export type AuthenticateError = Internal.AuthenticateError;
|
|
42
|
+
export type AuthenticateReturn = OperationResult<AuthenticateError>;
|
|
31
43
|
export interface Session {
|
|
32
44
|
id: string;
|
|
33
45
|
dateTimeCreated: Date;
|
|
34
46
|
}
|
|
35
47
|
export type SessionError = Internal.RefreshSessionError;
|
|
36
|
-
export type SessionReturn =
|
|
48
|
+
export type SessionReturn = OperationResult<SessionError, Session | null>;
|
|
37
49
|
export interface WatchSessionInput {
|
|
38
50
|
/**
|
|
39
51
|
* @default 30000
|
|
@@ -41,26 +53,20 @@ export interface WatchSessionInput {
|
|
|
41
53
|
interval?: number;
|
|
42
54
|
onInvalid: () => void | Promise<void>;
|
|
43
55
|
}
|
|
44
|
-
export
|
|
56
|
+
export type File = {
|
|
45
57
|
id: string;
|
|
58
|
+
dateTimeCreated: Date;
|
|
59
|
+
} & ({
|
|
46
60
|
url?: never;
|
|
47
61
|
status: 'UPLOADING' | 'FAILED';
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
export interface File__Ready {
|
|
51
|
-
id: string;
|
|
52
|
-
url: string;
|
|
53
|
-
status: 'READY';
|
|
54
|
-
dateTimeCreated: Date;
|
|
55
|
-
}
|
|
56
|
-
export interface File__Deleted {
|
|
57
|
-
id: string;
|
|
62
|
+
} | {
|
|
58
63
|
url?: string;
|
|
59
64
|
status: 'DELETED';
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
} | {
|
|
66
|
+
url: string;
|
|
67
|
+
status: 'READY';
|
|
68
|
+
});
|
|
69
|
+
export type FileReturn = OperationResult<never, File | null>;
|
|
64
70
|
export interface UploadImageFileInput {
|
|
65
71
|
/**
|
|
66
72
|
* @example
|
|
@@ -81,7 +87,7 @@ export interface UploadImageFileInput {
|
|
|
81
87
|
file: globalThis.File;
|
|
82
88
|
}
|
|
83
89
|
export type UploadImageFileError = Internal.UploadPrivateImageFileError;
|
|
84
|
-
export type UploadImageFileReturn =
|
|
90
|
+
export type UploadImageFileReturn = OperationResult<UploadImageFileError, {
|
|
85
91
|
id: string;
|
|
86
92
|
}>;
|
|
87
93
|
export type AccountStatus = Internal.MemberAccountStatus;
|
|
@@ -105,7 +111,7 @@ export interface Account {
|
|
|
105
111
|
dateTimeCreated: Date;
|
|
106
112
|
dateTimeLastUpdated: Date;
|
|
107
113
|
}
|
|
108
|
-
export type AccountReturn =
|
|
114
|
+
export type AccountReturn = OperationResult<never, Account>;
|
|
109
115
|
export type VerificationDetailsStatus = Internal.MemberVerificationStatus;
|
|
110
116
|
export interface VerificationDetails {
|
|
111
117
|
id: string;
|
|
@@ -118,7 +124,7 @@ export interface VerificationDetails {
|
|
|
118
124
|
idFrontImage: File;
|
|
119
125
|
selfieImage: File;
|
|
120
126
|
}
|
|
121
|
-
export type VerificationDetailsReturn =
|
|
127
|
+
export type VerificationDetailsReturn = OperationResult<never, VerificationDetails | null>;
|
|
122
128
|
export interface ProfileCompletion {
|
|
123
129
|
completionPercentage: number;
|
|
124
130
|
personalInformation: boolean;
|
|
@@ -127,7 +133,7 @@ export interface ProfileCompletion {
|
|
|
127
133
|
transactionPassword: boolean;
|
|
128
134
|
accountPassword: boolean;
|
|
129
135
|
}
|
|
130
|
-
export type ProfileCompletionReturn =
|
|
136
|
+
export type ProfileCompletionReturn = OperationResult<never, ProfileCompletion>;
|
|
131
137
|
export interface CreateAccountInput {
|
|
132
138
|
/**
|
|
133
139
|
* @example
|
|
@@ -182,9 +188,10 @@ export interface CreateAccountInput {
|
|
|
182
188
|
*/
|
|
183
189
|
verificationCode?: string;
|
|
184
190
|
reCAPTCHAResponse?: string;
|
|
191
|
+
btag?: string;
|
|
185
192
|
}
|
|
186
193
|
export type CreateAccountError = Internal.RegisterMemberAccountError;
|
|
187
|
-
export type CreateAccountReturn =
|
|
194
|
+
export type CreateAccountReturn = OperationResult<CreateAccountError, {
|
|
188
195
|
id: string;
|
|
189
196
|
}>;
|
|
190
197
|
export interface UpdateAccountInput {
|
|
@@ -244,10 +251,12 @@ export interface UpdateAccountInput {
|
|
|
244
251
|
* - _pattern_: `/^[a-z0-9]{8,30}$/`
|
|
245
252
|
*/
|
|
246
253
|
transactionPassword?: string;
|
|
254
|
+
secretQuestion?: SecretQuestion;
|
|
255
|
+
secretAnswer?: string;
|
|
247
256
|
}
|
|
248
257
|
export type UpdateAccountError = Internal.UpdateMemberAccountError;
|
|
249
|
-
export type UpdateAccountReturn =
|
|
250
|
-
export type DeleteAccountReturn =
|
|
258
|
+
export type UpdateAccountReturn = OperationResult<UpdateAccountError>;
|
|
259
|
+
export type DeleteAccountReturn = OperationResult;
|
|
251
260
|
export interface ResetPasswordInput {
|
|
252
261
|
/**
|
|
253
262
|
* @validation
|
|
@@ -277,7 +286,7 @@ export interface ResetPasswordInput {
|
|
|
277
286
|
verificationCode: string;
|
|
278
287
|
}
|
|
279
288
|
export type ResetPasswordError = Internal.ResetPasswordError;
|
|
280
|
-
export type ResetPasswordReturn =
|
|
289
|
+
export type ResetPasswordReturn = OperationResult<ResetPasswordError>;
|
|
281
290
|
export interface SubmitVerificationDetailsInput {
|
|
282
291
|
/**
|
|
283
292
|
* @example
|
|
@@ -340,17 +349,17 @@ export interface SubmitVerificationDetailsInput {
|
|
|
340
349
|
placeOfBirth: string;
|
|
341
350
|
}
|
|
342
351
|
export type SubmitVerificationError = Internal.CreateMemberVerificationError;
|
|
343
|
-
export type SubmitVerificationDetailsReturn =
|
|
352
|
+
export type SubmitVerificationDetailsReturn = OperationResult<SubmitVerificationError, {
|
|
344
353
|
id: string;
|
|
345
354
|
}>;
|
|
346
355
|
export interface UpdateVerificationDetailsInput extends Partial<Omit<SubmitVerificationDetailsInput, 'id'>> {
|
|
347
356
|
}
|
|
348
357
|
export type UpdateVerificationError = Internal.UpdateMemberVerificationError;
|
|
349
|
-
export type UpdateVerificationDetailsReturn =
|
|
358
|
+
export type UpdateVerificationDetailsReturn = OperationResult<UpdateVerificationError>;
|
|
350
359
|
export type SendVerificationCodeError = Internal.SendVerificationCodeError;
|
|
351
|
-
export type SendVerificationCodeReturn =
|
|
360
|
+
export type SendVerificationCodeReturn = OperationResult<SendVerificationCodeError>;
|
|
352
361
|
export type VerifyMobileNumberError = Internal.VerifyMobileNumberError;
|
|
353
|
-
export type VerifyMobileNumberReturn =
|
|
362
|
+
export type VerifyMobileNumberReturn = OperationResult<VerifyMobileNumberError>;
|
|
354
363
|
export type Currency = Internal.Currency;
|
|
355
364
|
export interface Wallet {
|
|
356
365
|
id: string;
|
|
@@ -359,16 +368,16 @@ export interface Wallet {
|
|
|
359
368
|
dateTimeCreated: Date;
|
|
360
369
|
dateTimeLastUpdated: Date;
|
|
361
370
|
}
|
|
362
|
-
export type WalletReturn =
|
|
371
|
+
export type WalletReturn = OperationResult<never, Wallet | null>;
|
|
363
372
|
export interface PointsWallet {
|
|
364
373
|
id: string;
|
|
365
374
|
points: number;
|
|
366
375
|
account: string;
|
|
367
376
|
dateTimeCreated: Date;
|
|
368
377
|
}
|
|
369
|
-
export type PointsWalletReturn =
|
|
378
|
+
export type PointsWalletReturn = OperationResult<never, PointsWallet | null>;
|
|
370
379
|
export type PointsToCashConversionError = Internal.PointsToCashConversionError;
|
|
371
|
-
export type PointsToCashConversionReturn =
|
|
380
|
+
export type PointsToCashConversionReturn = OperationResult<PointsToCashConversionError>;
|
|
372
381
|
export type GameType = Internal.GameType;
|
|
373
382
|
export type GameProvider = Internal.GameProvider;
|
|
374
383
|
export type GameProvider__Next = Internal.GameProvider__Next;
|
|
@@ -400,7 +409,7 @@ export interface GamesInput__Next {
|
|
|
400
409
|
provider?: Internal.EnumFilterField<GameProvider__Next>;
|
|
401
410
|
};
|
|
402
411
|
}
|
|
403
|
-
export type GamesReturn =
|
|
412
|
+
export type GamesReturn = OperationResult<never, PaginatedQueryResult<'games', Game>>;
|
|
404
413
|
export interface GamesByNameInput {
|
|
405
414
|
search: string;
|
|
406
415
|
filter?: GamesInput['filter'];
|
|
@@ -409,22 +418,20 @@ export interface GamesByNameInput__Next {
|
|
|
409
418
|
search: string;
|
|
410
419
|
filter: GamesInput__Next['filter'];
|
|
411
420
|
}
|
|
412
|
-
export type GamesByNameReturn =
|
|
421
|
+
export type GamesByNameReturn = OperationResult<never, Game[]>;
|
|
413
422
|
export type GameSession = {
|
|
414
423
|
id: string;
|
|
415
424
|
game: Game;
|
|
416
|
-
status: Extract<GameSessionStatus, 'READY'>;
|
|
417
|
-
launchUrl: string;
|
|
418
425
|
dateTimeCreated: Date;
|
|
419
426
|
dateTimeLastUpdated: Date;
|
|
427
|
+
} & ({
|
|
428
|
+
status: 'READY' | 'ENDED';
|
|
429
|
+
launchUrl: string;
|
|
420
430
|
} | {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
dateTimeLastUpdated: Date;
|
|
426
|
-
};
|
|
427
|
-
export type GameSessionReturn = Internal.OperationResult<never, GameSession | null>;
|
|
431
|
+
status: 'PENDING' | 'STARTING' | 'CANCELLED';
|
|
432
|
+
launchUrl?: never;
|
|
433
|
+
});
|
|
434
|
+
export type GameSessionReturn = OperationResult<never, GameSession | null>;
|
|
428
435
|
export interface CreateGameSessionInput {
|
|
429
436
|
/**
|
|
430
437
|
* @example
|
|
@@ -441,10 +448,10 @@ export interface CreateGameSessionInput {
|
|
|
441
448
|
game: string;
|
|
442
449
|
}
|
|
443
450
|
export type CreateGameSessionError = Internal.CreateGameSessionError;
|
|
444
|
-
export type CreateGameSessionReturn =
|
|
451
|
+
export type CreateGameSessionReturn = OperationResult<CreateGameSessionError, {
|
|
445
452
|
id: string;
|
|
446
453
|
}>;
|
|
447
|
-
export type EndGameSessionReturn =
|
|
454
|
+
export type EndGameSessionReturn = OperationResult;
|
|
448
455
|
export type AnnouncementStatus = Internal.AnnouncementStatus;
|
|
449
456
|
export type AnnouncementType = Internal.AnnouncementType;
|
|
450
457
|
export interface Announcement {
|
|
@@ -460,7 +467,7 @@ export interface Announcement {
|
|
|
460
467
|
}
|
|
461
468
|
export interface AnnouncementsInput extends Omit<Internal.AnnouncementsQueryVariables, 'filter'> {
|
|
462
469
|
}
|
|
463
|
-
export type AnnouncementsReturn =
|
|
470
|
+
export type AnnouncementsReturn = OperationResult<never, PaginatedQueryResult<'announcements', Announcement>>;
|
|
464
471
|
export type BetRecordStatus = Internal.BetRecordStatus;
|
|
465
472
|
export interface BetRecord {
|
|
466
473
|
id: string;
|
|
@@ -482,12 +489,11 @@ export interface BetRecord {
|
|
|
482
489
|
externalCategory?: string;
|
|
483
490
|
metadata: {
|
|
484
491
|
odds?: string;
|
|
485
|
-
validBet?: number;
|
|
486
492
|
};
|
|
487
493
|
}
|
|
488
494
|
export interface BetRecordsInput extends Internal.BetRecordsQueryVariables {
|
|
489
495
|
}
|
|
490
|
-
export type BetRecordsReturn =
|
|
496
|
+
export type BetRecordsReturn = OperationResult<never, PaginatedQueryResult<'betRecords', BetRecord>>;
|
|
491
497
|
export interface LatestBetRecord {
|
|
492
498
|
id: string;
|
|
493
499
|
member: {
|
|
@@ -501,7 +507,7 @@ export interface LatestBetRecord {
|
|
|
501
507
|
dateTimeSettled: Date;
|
|
502
508
|
dateTimeCreated: Date;
|
|
503
509
|
}
|
|
504
|
-
export type LatestBetRecordsReturn =
|
|
510
|
+
export type LatestBetRecordsReturn = OperationResult<never, LatestBetRecord[]>;
|
|
505
511
|
export type TransactionRecordType = Internal.TransactionRecordType;
|
|
506
512
|
export interface TransactionRecord {
|
|
507
513
|
id: string;
|
|
@@ -514,7 +520,7 @@ export interface TransactionRecord {
|
|
|
514
520
|
}
|
|
515
521
|
export interface TransactionRecordsInput extends Internal.TransactionRecordsQueryVariables {
|
|
516
522
|
}
|
|
517
|
-
export type TransactionRecordsReturn =
|
|
523
|
+
export type TransactionRecordsReturn = OperationResult<never, PaginatedQueryResult<'transactionRecords', TransactionRecord>>;
|
|
518
524
|
export type DepositRecordType = Internal.DepositRecordType;
|
|
519
525
|
export type DepositRecordStatus = Internal.DepositRecordStatus;
|
|
520
526
|
export interface DepositRecord {
|
|
@@ -531,23 +537,40 @@ export interface DepositRecord {
|
|
|
531
537
|
}
|
|
532
538
|
export interface DepositRecordsInput extends Internal.DepositRecordsQueryVariables {
|
|
533
539
|
}
|
|
534
|
-
export type DepositRecordsReturn =
|
|
535
|
-
export type DepositsCountReturn =
|
|
536
|
-
type
|
|
537
|
-
type
|
|
540
|
+
export type DepositRecordsReturn = OperationResult<never, PaginatedQueryResult<'depositRecords', DepositRecord>>;
|
|
541
|
+
export type DepositsCountReturn = OperationResult<never, number>;
|
|
542
|
+
type DepositCommonProps = Omit<DepositRecord, 'type' | 'status' | 'depositNumber'>;
|
|
543
|
+
export type GCashDeposit = DepositCommonProps & {
|
|
544
|
+
type: 'GCASH';
|
|
545
|
+
} & ({
|
|
546
|
+
status: 'PENDING';
|
|
547
|
+
checkoutUrl?: never;
|
|
548
|
+
} | {
|
|
538
549
|
status: 'REJECTED' | 'CANCELLED';
|
|
539
550
|
checkoutUrl?: string;
|
|
540
|
-
}
|
|
541
|
-
|
|
551
|
+
} | {
|
|
552
|
+
status: 'ACCEPTED' | 'APPROVED' | 'CONFIRMED';
|
|
553
|
+
checkoutUrl: string;
|
|
554
|
+
});
|
|
555
|
+
export type MayaDeposit = DepositCommonProps & {
|
|
556
|
+
type: 'MAYA';
|
|
557
|
+
} & ({
|
|
542
558
|
status: 'PENDING';
|
|
543
559
|
checkoutUrl?: never;
|
|
544
|
-
}
|
|
545
|
-
|
|
560
|
+
} | {
|
|
561
|
+
status: 'REJECTED' | 'CANCELLED';
|
|
562
|
+
checkoutUrl?: string;
|
|
563
|
+
} | {
|
|
546
564
|
status: 'ACCEPTED' | 'APPROVED' | 'CONFIRMED';
|
|
547
565
|
checkoutUrl: string;
|
|
548
|
-
};
|
|
549
|
-
export
|
|
550
|
-
|
|
566
|
+
});
|
|
567
|
+
export interface MayaAppDeposit extends DepositCommonProps {
|
|
568
|
+
type: 'MAYA_APP';
|
|
569
|
+
status: DepositRecordStatus;
|
|
570
|
+
}
|
|
571
|
+
export type DepositType = Internal.DepositType;
|
|
572
|
+
export type Deposit = MayaDeposit | GCashDeposit | MayaAppDeposit;
|
|
573
|
+
export type DepositReturn = OperationResult<never, Deposit | null>;
|
|
551
574
|
export interface CreateMayaDepositInput {
|
|
552
575
|
/**
|
|
553
576
|
* @example
|
|
@@ -601,11 +624,11 @@ export interface CreateMayaAppDepositInput {
|
|
|
601
624
|
}
|
|
602
625
|
export type CreateDepositInput = CreateMayaDepositInput | CreateGCashDepositInput | CreateMayaAppDepositInput;
|
|
603
626
|
export type CreateDepositError = Internal.CreateDepositError;
|
|
604
|
-
export type CreateDepositReturn =
|
|
627
|
+
export type CreateDepositReturn = OperationResult<CreateDepositError, {
|
|
605
628
|
id: string;
|
|
606
629
|
}>;
|
|
607
630
|
export type WithdrawalRecordStatus = Internal.WithdrawalRecordStatus;
|
|
608
|
-
interface
|
|
631
|
+
interface WithdrawalRecordCommonProps {
|
|
609
632
|
id: string;
|
|
610
633
|
fee: number;
|
|
611
634
|
amount: number;
|
|
@@ -617,7 +640,7 @@ interface WithdrawalRecord__Common {
|
|
|
617
640
|
dateTimeCreated: Date;
|
|
618
641
|
dateTimeLastUpdated: Date;
|
|
619
642
|
}
|
|
620
|
-
export interface ManualWithdrawalRecord extends
|
|
643
|
+
export interface ManualWithdrawalRecord extends WithdrawalRecordCommonProps {
|
|
621
644
|
type: 'MANUAL';
|
|
622
645
|
}
|
|
623
646
|
/**
|
|
@@ -627,23 +650,23 @@ export interface ManualWithdrawalRecord extends WithdrawalRecord__Common {
|
|
|
627
650
|
* - `MKRUPHM1` - BANK OF MAKATI
|
|
628
651
|
*/
|
|
629
652
|
export type Bank = Internal.Bank;
|
|
630
|
-
export interface BankWithdrawalRecord extends
|
|
653
|
+
export interface BankWithdrawalRecord extends WithdrawalRecordCommonProps {
|
|
631
654
|
type: 'BANK';
|
|
632
655
|
bank: Bank;
|
|
633
656
|
}
|
|
634
|
-
export interface GCashWithdrawalRecord extends
|
|
657
|
+
export interface GCashWithdrawalRecord extends WithdrawalRecordCommonProps {
|
|
635
658
|
type: 'GCASH';
|
|
636
659
|
recipientMobileNumber: string;
|
|
637
660
|
}
|
|
638
|
-
export interface MayaWithdrawalRecord extends
|
|
661
|
+
export interface MayaWithdrawalRecord extends WithdrawalRecordCommonProps {
|
|
639
662
|
type: 'MAYA';
|
|
640
663
|
recipientMobileNumber: string;
|
|
641
664
|
}
|
|
642
665
|
export type WithdrawalRecord = ManualWithdrawalRecord | BankWithdrawalRecord | GCashWithdrawalRecord | MayaWithdrawalRecord;
|
|
643
666
|
export interface WithdrawalRecordsInput extends Internal.WithdrawalRecordsQueryVariables {
|
|
644
667
|
}
|
|
645
|
-
export type WithdrawalRecordsReturn =
|
|
646
|
-
export type RemainingDailyWithdrawalsCountReturn =
|
|
668
|
+
export type WithdrawalRecordsReturn = OperationResult<never, PaginatedQueryResult<'withdrawalRecords', WithdrawalRecord>>;
|
|
669
|
+
export type RemainingDailyWithdrawalsCountReturn = OperationResult<never, number>;
|
|
647
670
|
export interface CreateBankWithdrawalInput {
|
|
648
671
|
/**
|
|
649
672
|
* @example
|
|
@@ -750,7 +773,7 @@ export interface CreateMayaAppWithdrawalInput {
|
|
|
750
773
|
}
|
|
751
774
|
export type CreateWithdrawalInput = CreateBankWithdrawalInput | CreateGCashWithdrawalInput | CreateMayaWithdrawalInput | CreateMayaAppWithdrawalInput;
|
|
752
775
|
export type CreateWithdrawalError = Internal.CreateWithdrawalError;
|
|
753
|
-
export type CreateWithdrawalReturn =
|
|
776
|
+
export type CreateWithdrawalReturn = OperationResult<CreateWithdrawalError, {
|
|
754
777
|
id: string;
|
|
755
778
|
}>;
|
|
756
779
|
export interface GatewaySettings {
|
|
@@ -786,14 +809,16 @@ export interface Platform {
|
|
|
786
809
|
paymentSettings: PaymentSettings;
|
|
787
810
|
pointsClubSettings: PointsClubSettings;
|
|
788
811
|
}
|
|
789
|
-
export type PlatformReturn =
|
|
812
|
+
export type PlatformReturn = OperationResult<never, Platform>;
|
|
790
813
|
export type PromoType = Internal.PromoType;
|
|
791
814
|
export type PromoStatus = Internal.PromoStatus;
|
|
792
815
|
export interface Promo {
|
|
793
816
|
id: string;
|
|
794
817
|
type: PromoType;
|
|
795
818
|
name: string;
|
|
796
|
-
banner:
|
|
819
|
+
banner: Extract<File, {
|
|
820
|
+
status: 'READY';
|
|
821
|
+
}>;
|
|
797
822
|
status: PromoStatus;
|
|
798
823
|
description: string;
|
|
799
824
|
minimumBonusAmount?: number;
|
|
@@ -803,13 +828,15 @@ export interface Promo {
|
|
|
803
828
|
dateTimeCreated: Date;
|
|
804
829
|
dateTimeLastUpdated: Date;
|
|
805
830
|
}
|
|
806
|
-
export type PromosReturn =
|
|
807
|
-
export type AvailablePromosReturn =
|
|
831
|
+
export type PromosReturn = OperationResult<never, Promo[]>;
|
|
832
|
+
export type AvailablePromosReturn = OperationResult<never, Promo[]>;
|
|
808
833
|
export type CashbackStatus = Internal.CashbackStatus;
|
|
809
834
|
export interface Cashback {
|
|
810
835
|
id: string;
|
|
811
836
|
name: string;
|
|
812
|
-
banner:
|
|
837
|
+
banner: Extract<File, {
|
|
838
|
+
status: 'READY';
|
|
839
|
+
}>;
|
|
813
840
|
status: CashbackStatus;
|
|
814
841
|
description: string;
|
|
815
842
|
activationStartDateTime: Date;
|
|
@@ -817,7 +844,7 @@ export interface Cashback {
|
|
|
817
844
|
dateTimeCreated: Date;
|
|
818
845
|
dateTimeLastUpdated: Date;
|
|
819
846
|
}
|
|
820
|
-
export type CashbacksReturn =
|
|
847
|
+
export type CashbacksReturn = OperationResult<never, Cashback[]>;
|
|
821
848
|
export interface Bonus {
|
|
822
849
|
id: string;
|
|
823
850
|
promo: Promo;
|
|
@@ -831,7 +858,7 @@ export interface Bonus {
|
|
|
831
858
|
dateTimeCreated: Date;
|
|
832
859
|
dateTimeLastUpdated: Date;
|
|
833
860
|
}
|
|
834
|
-
export type BonusReturn =
|
|
861
|
+
export type BonusReturn = OperationResult<never, Bonus | null>;
|
|
835
862
|
export interface CashbackBonus {
|
|
836
863
|
id: string;
|
|
837
864
|
balance: number;
|
|
@@ -839,8 +866,7 @@ export interface CashbackBonus {
|
|
|
839
866
|
dateTimeCreated: Date;
|
|
840
867
|
dateTimeLastUpdated: Date;
|
|
841
868
|
}
|
|
842
|
-
export type CashbackBonusReturn =
|
|
869
|
+
export type CashbackBonusReturn = OperationResult<never, CashbackBonus[]>;
|
|
843
870
|
export type ClaimCashbackBonusError = Internal.ClaimCashbackBonusError;
|
|
844
|
-
export type ClaimCashbackBonusReturn =
|
|
845
|
-
export type Error = HttpError | UnknownError | SignInError | UploadImageFileError | CreateAccountError | UpdateAccountError | ResetPasswordError | SubmitVerificationError | UpdateVerificationError | SendVerificationCodeError | VerifyMobileNumberError | PointsToCashConversionError | CreateGameSessionError | CreateDepositError | CreateWithdrawalError | ClaimCashbackBonusError;
|
|
871
|
+
export type ClaimCashbackBonusReturn = OperationResult<ClaimCashbackBonusError>;
|
|
846
872
|
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { GraphQLClient } from '../utils/graphql-client';
|
|
2
|
+
import { OperationResult } from '../utils/types';
|
|
2
3
|
import { Announcement, AnnouncementsQueryVariables } from './announcement';
|
|
3
4
|
import { CreateMemberVerificationError, CreateMemberVerificationMutationVariables, DeleteMemberAccountMutationVariables, MemberAccount, MemberVerification, ProfileCompletion, RegisterMemberAccountError, RegisterMemberAccountMutationVariables, ResetPasswordError, ResetPasswordMutationVariables, SendVerificationCodeError, SendVerificationCodeMutationVariables, UpdateMemberAccountError, UpdateMemberAccountMutationVariables, UpdateMemberVerificationError, UpdateMemberVerificationMutationVariables, VerifyMobileNumberError, VerifyMobileNumberMutationVariables } from './member';
|
|
4
5
|
import { Platform } from './platform';
|
|
5
|
-
import {
|
|
6
|
+
import { PaginatedQueryResult } from './types';
|
|
6
7
|
|
|
7
8
|
export declare class AccountService {
|
|
8
9
|
private client;
|
|
@@ -11,7 +12,7 @@ export declare class AccountService {
|
|
|
11
12
|
memberAccount(): Promise<OperationResult<never, MemberAccount>>;
|
|
12
13
|
registerMemberAccount(variables: RegisterMemberAccountMutationVariables): Promise<OperationResult<RegisterMemberAccountError>>;
|
|
13
14
|
updateMemberAccount(variables: UpdateMemberAccountMutationVariables): Promise<OperationResult<UpdateMemberAccountError>>;
|
|
14
|
-
deleteMemberAccount(variables: DeleteMemberAccountMutationVariables): Promise<OperationResult
|
|
15
|
+
deleteMemberAccount(variables: DeleteMemberAccountMutationVariables): Promise<OperationResult>;
|
|
15
16
|
resetPassword(variables: ResetPasswordMutationVariables): Promise<OperationResult<ResetPasswordError>>;
|
|
16
17
|
profileCompletion(): Promise<OperationResult<never, ProfileCompletion>>;
|
|
17
18
|
platform(): Promise<OperationResult<never, Platform>>;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { OperationResult } from '../utils/types';
|
|
2
|
+
import { AuthenticateError, AuthenticateInput, AuthenticateMutation, CreateSessionError, CreateSessionInput__Maya, CreateSessionInput__MobileNumber, CreateSessionInput__NameAndPassword, CreateSessionMutation__Maya, CreateSessionMutation__MobileNumber, CreateSessionMutation__NameAndPassword, RefreshSessionError, RefreshSessionMutation } from './session';
|
|
3
3
|
|
|
4
4
|
export interface AuthServiceConfig {
|
|
5
5
|
url: string;
|
|
6
6
|
platform: string;
|
|
7
7
|
}
|
|
8
8
|
export declare class AuthService {
|
|
9
|
-
private
|
|
10
|
-
private platform;
|
|
9
|
+
private client;
|
|
11
10
|
constructor(config: AuthServiceConfig);
|
|
12
|
-
createSession(input:
|
|
11
|
+
createSession(input: CreateSessionInput__Maya): Promise<OperationResult<CreateSessionError, CreateSessionMutation__Maya>>;
|
|
12
|
+
createSession(input: CreateSessionInput__MobileNumber): Promise<OperationResult<CreateSessionError, CreateSessionMutation__MobileNumber>>;
|
|
13
|
+
createSession(input: CreateSessionInput__NameAndPassword): Promise<OperationResult<CreateSessionError, CreateSessionMutation__NameAndPassword>>;
|
|
14
|
+
authenticate(input: AuthenticateInput): Promise<OperationResult<AuthenticateError, AuthenticateMutation>>;
|
|
13
15
|
refreshSession(refreshToken: string): Promise<OperationResult<RefreshSessionError, RefreshSessionMutation>>;
|
|
14
|
-
destroySession(accessToken: string): Promise<OperationResult
|
|
16
|
+
destroySession(accessToken: string): Promise<OperationResult>;
|
|
15
17
|
verifySession(accessToken: string): Promise<boolean>;
|
|
16
18
|
}
|
|
@@ -4,9 +4,6 @@ import { DateFilterField, DateString, Decimal, EnumFilterField, ObjectIdFilterFi
|
|
|
4
4
|
export type BetRecordStatus = 'STARTED' | 'SETTLED' | 'CANCELLED';
|
|
5
5
|
export interface BetRecordMetadata {
|
|
6
6
|
odds?: string | null;
|
|
7
|
-
validBet?: Decimal | null;
|
|
8
|
-
betContent?: string | null;
|
|
9
|
-
contestName?: string | null;
|
|
10
7
|
}
|
|
11
8
|
export interface BetRecord {
|
|
12
9
|
id: string;
|
|
@@ -26,10 +23,7 @@ export interface BetRecord {
|
|
|
26
23
|
betContent?: string | null;
|
|
27
24
|
contestName?: string | null;
|
|
28
25
|
externalCategory?: string | null;
|
|
29
|
-
metadata?:
|
|
30
|
-
odds?: string | null;
|
|
31
|
-
validBet?: Decimal | null;
|
|
32
|
-
} | null;
|
|
26
|
+
metadata?: BetRecordMetadata | null;
|
|
33
27
|
}
|
|
34
28
|
export interface BetRecordsQuery {
|
|
35
29
|
member: PaginatedQuery<'betRecords', BetRecord>;
|
package/dist/services/bonus.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { DepositRecord } from '..';
|
|
2
|
+
import { OperationError } from '../utils/types';
|
|
2
3
|
import { Cashback } from './cashback';
|
|
3
4
|
import { Promo } from './promo';
|
|
4
|
-
import { DateString, Decimal
|
|
5
|
+
import { DateString, Decimal } from './types';
|
|
5
6
|
|
|
6
7
|
export interface Bonus {
|
|
7
8
|
id: string;
|
|
@@ -31,7 +32,7 @@ export interface CashbackBonusesQuery {
|
|
|
31
32
|
cashbackBonuses: CashbackBonus[];
|
|
32
33
|
}
|
|
33
34
|
export declare const CASHBACK_BONUSES_QUERY: string;
|
|
34
|
-
export type ClaimCashbackBonusError =
|
|
35
|
+
export type ClaimCashbackBonusError = OperationError<'CashbackBonusDoesNotExistError'>;
|
|
35
36
|
export interface ClaimCashbackBonusMutation {
|
|
36
37
|
claimCashbackBonus?: null | ClaimCashbackBonusError;
|
|
37
38
|
}
|