@smartico/public-api 0.0.55 → 0.0.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MiniGames/SAWBuyInType.d.ts +9 -5
- package/dist/MiniGames/SAWGameType.d.ts +10 -6
- package/dist/MiniGames/SAWGetTemplatesResponse.d.ts +2 -0
- package/dist/MiniGames/SAWPrizeType.d.ts +12 -0
- package/dist/SmarticoAPI.d.ts +5 -2
- package/dist/Store/StoreCategory.d.ts +2 -0
- package/dist/Tournaments/TournamentRegistrationStatus.d.ts +11 -2
- package/dist/WSAPI/WSAPI.d.ts +6 -2
- package/dist/WSAPI/WSAPITypes.d.ts +57 -0
- package/dist/index.js +218 -80
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +139 -21
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +10 -6
- package/docs/classes/WSAPI.md +24 -0
- package/docs/enums/MiniGamePrizeTypeName.md +43 -0
- package/docs/enums/SAWBuyInTypeName.md +25 -0
- package/docs/enums/SAWGameTypeName.md +31 -0
- package/docs/enums/TournamentRegistrationStatusName.md +49 -0
- package/docs/interfaces/TMiniGamePrize.md +51 -0
- package/docs/interfaces/TMiniGameTemplate.md +109 -0
- package/docs/interfaces/TStoreCategory.md +21 -0
- package/docs/interfaces/TTournament.md +1 -1
- package/docs/interfaces/TTournamentDetailed.md +1 -1
- package/package.json +1 -1
- package/src/MiniGames/SAWBuyInType.ts +15 -4
- package/src/MiniGames/SAWGameType.ts +18 -5
- package/src/MiniGames/SAWGetTemplatesResponse.ts +47 -0
- package/src/MiniGames/SAWPrizeType.ts +23 -0
- package/src/SmarticoAPI.ts +18 -6
- package/src/Store/StoreCategory.ts +12 -0
- package/src/Tournaments/Tournament.ts +2 -2
- package/src/Tournaments/TournamentRegistrationStatus.ts +19 -10
- package/src/WSAPI/WSAPI.ts +12 -2
- package/src/WSAPI/WSAPITypes.ts +75 -1
- package/tsconfig.json +4 -1
|
@@ -10,18 +10,27 @@ export enum TournamentRegistrationStatus {
|
|
|
10
10
|
QUALIFIED_PENDING_REGISTRATION = 6
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export enum TournamentRegistrationStatusName {
|
|
14
|
+
NOT_REGISTERED = 'NOT_REGISTERED',
|
|
15
|
+
REGISTERED = 'REGISTERED',
|
|
16
|
+
FINISHED = 'FINISHED',
|
|
17
|
+
PENDING = 'PENDING',
|
|
18
|
+
CANCELLED = 'CANCELLED',
|
|
19
|
+
REGISTERED_PENDING_QUALIFICATION = 'REGISTERED_PENDING_QUALIFICATION',
|
|
20
|
+
QUALIFIED_PENDING_REGISTRATION = 'QUALIFIED_PENDING_REGISTRATION',
|
|
21
|
+
UNKNOWN = "UNKNOWN"
|
|
22
|
+
}
|
|
14
23
|
|
|
15
24
|
/** @hidden */
|
|
16
|
-
export const
|
|
25
|
+
export const TournamentRegistrationStatusNamed = (type: TournamentRegistrationStatus): TournamentRegistrationStatusName => {
|
|
17
26
|
return ({
|
|
18
|
-
[TournamentRegistrationStatus.CANCELLED]:
|
|
19
|
-
[TournamentRegistrationStatus.FINISHED]:
|
|
20
|
-
[TournamentRegistrationStatus.NOT_REGISTERED]:
|
|
21
|
-
[TournamentRegistrationStatus.PENDING]:
|
|
22
|
-
[TournamentRegistrationStatus.QUALIFIED_PENDING_REGISTRATION]:
|
|
23
|
-
[TournamentRegistrationStatus.REGISTERED]:
|
|
24
|
-
[TournamentRegistrationStatus.REGISTERED_PENDING_QUALIFICATION]:
|
|
25
|
-
}[type] ||
|
|
27
|
+
[TournamentRegistrationStatus.CANCELLED]: TournamentRegistrationStatusName.CANCELLED,
|
|
28
|
+
[TournamentRegistrationStatus.FINISHED]: TournamentRegistrationStatusName.FINISHED,
|
|
29
|
+
[TournamentRegistrationStatus.NOT_REGISTERED]: TournamentRegistrationStatusName.NOT_REGISTERED,
|
|
30
|
+
[TournamentRegistrationStatus.PENDING]: TournamentRegistrationStatusName.PENDING,
|
|
31
|
+
[TournamentRegistrationStatus.QUALIFIED_PENDING_REGISTRATION]: TournamentRegistrationStatusName.QUALIFIED_PENDING_REGISTRATION,
|
|
32
|
+
[TournamentRegistrationStatus.REGISTERED]: TournamentRegistrationStatusName.REGISTERED,
|
|
33
|
+
[TournamentRegistrationStatus.REGISTERED_PENDING_QUALIFICATION]: TournamentRegistrationStatusName.REGISTERED_PENDING_QUALIFICATION
|
|
34
|
+
}[type] || TournamentRegistrationStatusName.UNKNOWN) as TournamentRegistrationStatusName;
|
|
26
35
|
}
|
|
27
36
|
|
package/src/WSAPI/WSAPI.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CoreUtils } from "../Core";
|
|
2
2
|
import { SmarticoAPI } from "../SmarticoAPI";
|
|
3
3
|
|
|
4
|
-
import { TLevel, TMissionOrBadge, TStoreItem, TTournament, TTournamentDetailed, TUserProfile } from "./WSAPITypes";
|
|
4
|
+
import { TLevel, TMiniGameTemplate, TMissionOrBadge, TStoreItem, TTournament, TTournamentDetailed, TUserProfile } from "./WSAPITypes";
|
|
5
5
|
|
|
6
6
|
/** @group General API */
|
|
7
7
|
export class WSAPI {
|
|
@@ -11,7 +11,7 @@ export class WSAPI {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/** Returns information about current user */
|
|
14
|
-
public
|
|
14
|
+
public getUserProfile(): TUserProfile {
|
|
15
15
|
if (this.api.tracker) {
|
|
16
16
|
const o: TUserProfile = Object.assign({}, this.api.tracker.userPublicProps);
|
|
17
17
|
o.avatar_url = CoreUtils.avatarUrl(this.api.tracker.userPublicProps.avatar_id, this.api.avatarDomain);
|
|
@@ -41,6 +41,16 @@ export class WSAPI {
|
|
|
41
41
|
return this.api.storeGetItemsT(null);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
/** Returns store categories */
|
|
45
|
+
public async getStoreCategories(): Promise<TStoreItem[]> {
|
|
46
|
+
return this.api.storeGetItemsT(null);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Returns the list of mini-games available for user */
|
|
50
|
+
public async getMiniGames(): Promise<TMiniGameTemplate[]> {
|
|
51
|
+
return this.api.sawGetTemplatesT(null);
|
|
52
|
+
}
|
|
53
|
+
|
|
44
54
|
/** Returns all the active instances of tournaments */
|
|
45
55
|
public async getTournamentsList(): Promise<TTournament[]> {
|
|
46
56
|
return this.api.tournamentsGetLobbyT(null);
|
package/src/WSAPI/WSAPITypes.ts
CHANGED
|
@@ -1,7 +1,73 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MiniGamePrizeTypeName, SAWBuyInTypeName, SAWGameTypeName, SAWPrizeType, SAWPrizeUI } from "../MiniGames";
|
|
2
|
+
import { TournamentRegistrationStatusName, TournamentRegistrationTypeName } from "../Tournaments";
|
|
2
3
|
|
|
3
4
|
type TRibbon = 'sale' | 'hot' | 'new' | 'vip' | string
|
|
4
5
|
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* TMiniGamePrize interface describes the information of prize in the array of prizes in the TMiniGameTemplate
|
|
9
|
+
*/
|
|
10
|
+
export interface TMiniGamePrize {
|
|
11
|
+
/** ID of the prize */
|
|
12
|
+
id: number;
|
|
13
|
+
/** The visual name of the prize */
|
|
14
|
+
name: string;
|
|
15
|
+
/** The type of the prize, no-prize, points, bonus, manual, spin, jackpot */
|
|
16
|
+
prize_type: MiniGamePrizeTypeName;
|
|
17
|
+
/** Numeric value of the prize in case it's pints or spin type */
|
|
18
|
+
prize_value?: number;
|
|
19
|
+
/** Custom font size for the prize */
|
|
20
|
+
font_size?: number;
|
|
21
|
+
/** The URL of the icon of the prize */
|
|
22
|
+
icon?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* TMiniGameTemplate interface describes the information of mini-games available for the user
|
|
29
|
+
*/
|
|
30
|
+
export interface TMiniGameTemplate {
|
|
31
|
+
/** ID of the mini-game template */
|
|
32
|
+
id: number;
|
|
33
|
+
/** Name of the mini-game template, translated to the user language */
|
|
34
|
+
name: string;
|
|
35
|
+
/** Description of the mini-game template, translated to the user language */
|
|
36
|
+
description: string;
|
|
37
|
+
/** URL of the icon of the mini-game template */
|
|
38
|
+
thumbnail: string;
|
|
39
|
+
|
|
40
|
+
/** The type of the game, e.g. Spin the Wheel, Gift Box, Scratch card, MatchX etc */
|
|
41
|
+
saw_game_type: SAWGameTypeName;
|
|
42
|
+
/** How the user is charged for each game attempt e.g. Free, Points or Spin attempts */
|
|
43
|
+
saw_buyin_type: SAWBuyInTypeName;
|
|
44
|
+
|
|
45
|
+
// in case of charging type 'Points', what is the points amount will be deducted from user balance
|
|
46
|
+
buyin_cost_points: number;
|
|
47
|
+
// in case of charging type 'Spin attempts', shows the current number of spin attempts that user has
|
|
48
|
+
spin_count?: number;
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
/** The message that should be shown to the user when he cannot play the game, server rejected attempt with error code SAWSpinErrorCode.SAW_FAILED_MAX_SPINS_REACHED */
|
|
52
|
+
over_limit_message: string;
|
|
53
|
+
/** The message that should be shown to the user when he cannot play the game because he doesn't have spin attempts or points. */
|
|
54
|
+
no_attempts_message: string;
|
|
55
|
+
|
|
56
|
+
/** Current jackpont amount, if jackpot is enabled. */
|
|
57
|
+
jackpot_current: number;
|
|
58
|
+
/** The amount that will be added to the jackpot every time when somebody plays the game. Note that the contribution amount is abstract, means that no money or points are deducted from the user balance. */
|
|
59
|
+
jackpot_add_on_attempt: number;
|
|
60
|
+
/** The symbol of jackpot that is giving the sense to the 'amount' E.g. the symbol could be EUR and connected to the amount it can indicate that amount is monetary, e.g. '100 EUR'. Or the symbol can be 'Free spins' and connected to the amount it can indicate that amount is number of free spins, e.g. '100 Free spins'.
|
|
61
|
+
*/
|
|
62
|
+
jackpot_symbol: string;
|
|
63
|
+
|
|
64
|
+
prizes: TMiniGamePrize[];
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
5
71
|
/**
|
|
6
72
|
* TUser interface describes the information of the user
|
|
7
73
|
* The user object is returned by _smartico.api.getUserProfile() method.
|
|
@@ -178,6 +244,14 @@ export interface TTournamentDetailed extends TTournament {
|
|
|
178
244
|
|
|
179
245
|
};
|
|
180
246
|
|
|
247
|
+
/**
|
|
248
|
+
* TStoreCategory interface describes the store category item. Each store item can be assigned to 1 or more categories
|
|
249
|
+
*/
|
|
250
|
+
export interface TStoreCategory {
|
|
251
|
+
id: number;
|
|
252
|
+
name: string;
|
|
253
|
+
order: number
|
|
254
|
+
}
|
|
181
255
|
|
|
182
256
|
/**
|
|
183
257
|
* TStoreItem interface describes the information of the store item defined in the system
|
package/tsconfig.json
CHANGED
|
@@ -18,7 +18,10 @@
|
|
|
18
18
|
"entryPoints": [
|
|
19
19
|
"src/WSAPI/WSAPI.ts", "src/WSAPI/WSAPITypes.ts",
|
|
20
20
|
"src/Tournaments/TournamentRegistrationStatus.ts",
|
|
21
|
-
"src/Tournaments/TournamentRegistrationType.ts"
|
|
21
|
+
"src/Tournaments/TournamentRegistrationType.ts",
|
|
22
|
+
"src/MiniGames/SAWBuyInType.ts",
|
|
23
|
+
"src/MiniGames/SAWGameType.ts",
|
|
24
|
+
"src/MiniGames/SAWPrizeType.ts",
|
|
22
25
|
],
|
|
23
26
|
"out": "docs",
|
|
24
27
|
"plugin": ["typedoc-plugin-markdown", "typedoc-plugin-merge-modules"],
|