@smartico/public-api 0.0.57 → 0.0.59
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/SAWPrizeUI.d.ts +1 -0
- package/dist/MiniGames/SAWSpinErrorCode.d.ts +6 -0
- package/dist/SmarticoAPI.d.ts +1 -1
- package/dist/WSAPI/WSAPI.d.ts +3 -1
- package/dist/WSAPI/WSAPITypes.d.ts +22 -11
- package/dist/index.js +29 -5
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +20 -1
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +2 -0
- package/docs/classes/WSAPI.md +20 -2
- package/docs/enums/SAWSpinErrorCode.md +49 -0
- package/docs/interfaces/TLevel.md +1 -1
- package/docs/interfaces/TMiniGamePlayResult.md +27 -0
- package/docs/interfaces/TMiniGamePrize.md +1 -1
- package/docs/interfaces/TMiniGameTemplate.md +1 -1
- package/docs/interfaces/TMissionOrBadge.md +1 -1
- package/docs/interfaces/TMissionOrBadgeTask.md +1 -1
- package/docs/interfaces/TStoreCategory.md +1 -1
- package/docs/interfaces/TStoreItem.md +1 -1
- package/docs/interfaces/TTournament.md +1 -1
- package/docs/interfaces/TTournamentDetailed.md +1 -1
- package/docs/interfaces/TUserProfile.md +1 -1
- package/package.json +1 -1
- package/src/MiniGames/SAWPrizeUI.ts +1 -0
- package/src/MiniGames/SAWSpinErrorCode.ts +10 -2
- package/src/SmarticoAPI.ts +1 -1
- package/src/WSAPI/WSAPI.ts +16 -2
- package/src/WSAPI/WSAPITypes.ts +23 -11
- package/tsconfig.json +1 -0
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
export declare enum SAWSpinErrorCode {
|
|
2
|
+
/** No error */
|
|
2
3
|
SAW_OK = 0,
|
|
4
|
+
/** User doesn't have 'spin attempts' to play. In case buy in type for the game is 'spins' based */
|
|
3
5
|
SAW_NO_SPINS = 40001,
|
|
6
|
+
/** The are no prizes left to play the game */
|
|
4
7
|
SAW_PRIZE_POOL_EMPTY = 40002,
|
|
8
|
+
/** User doesn't have enough points to play. In case buy in type for the game is 'points' based */
|
|
5
9
|
SAW_NOT_ENOUGH_POINTS = 40003,
|
|
10
|
+
/** User reached max number of game attempts defined in the BackOffice */
|
|
6
11
|
SAW_FAILED_MAX_SPINS_REACHED = 40004,
|
|
12
|
+
/** Special code for the 'visitor' mode */
|
|
7
13
|
SAW_VISITOR_STOP_SPIN_REQUEST = -40001
|
|
8
14
|
}
|
package/dist/SmarticoAPI.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ declare class SmarticoAPI {
|
|
|
53
53
|
}>;
|
|
54
54
|
sawGetTemplates(user_ext_id: string, lang?: string, is_visitor_mode?: boolean): Promise<SAWGetTemplatesResponse>;
|
|
55
55
|
sawGetTemplatesT(user_ext_id: string): Promise<TMiniGameTemplate[]>;
|
|
56
|
-
sawSpinRequest(user_ext_id: string, saw_template_id: number, round_id
|
|
56
|
+
sawSpinRequest(user_ext_id: string, saw_template_id: number, round_id?: number): Promise<SAWDoSpinResponse>;
|
|
57
57
|
inboxGetMessages(user_ext_id: string, limit?: number, offset?: number): Promise<GetInboxMessagesResponse>;
|
|
58
58
|
storeGetItems(user_ext_id: string): Promise<GetStoreItemsResponse>;
|
|
59
59
|
storeGetItemsT(user_ext_id: string): Promise<TStoreItem[]>;
|
package/dist/WSAPI/WSAPI.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SmarticoAPI } from "../SmarticoAPI";
|
|
2
|
-
import { TLevel, TMiniGameTemplate, TMissionOrBadge, TStoreItem, TTournament, TTournamentDetailed, TUserProfile } from "./WSAPITypes";
|
|
2
|
+
import { TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionOrBadge, TStoreItem, TTournament, TTournamentDetailed, TUserProfile } from "./WSAPITypes";
|
|
3
3
|
/** @group General API */
|
|
4
4
|
export declare class WSAPI {
|
|
5
5
|
private api;
|
|
@@ -19,6 +19,8 @@ export declare class WSAPI {
|
|
|
19
19
|
getStoreCategories(): Promise<TStoreItem[]>;
|
|
20
20
|
/** Returns the list of mini-games available for user */
|
|
21
21
|
getMiniGames(): Promise<TMiniGameTemplate[]>;
|
|
22
|
+
/** Plays the specified by template_id mini-game on behalf of user and returns prize_id or err_code */
|
|
23
|
+
playMiniGame(template_id: number): Promise<TMiniGamePlayResult>;
|
|
22
24
|
/** Returns all the active instances of tournaments */
|
|
23
25
|
getTournamentsList(): Promise<TTournament[]>;
|
|
24
26
|
/** Returns details information of specific tournament instance, the response will includ tournamnet info and the leaderboard of players */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { MiniGamePrizeTypeName, SAWBuyInTypeName, SAWGameTypeName } from "../MiniGames";
|
|
1
|
+
import { MiniGamePrizeTypeName, SAWBuyInTypeName, SAWGameTypeName, SAWSpinErrorCode } from "../MiniGames";
|
|
2
2
|
import { TournamentRegistrationStatusName, TournamentRegistrationTypeName } from "../Tournaments";
|
|
3
3
|
type TRibbon = 'sale' | 'hot' | 'new' | 'vip' | string;
|
|
4
4
|
/**
|
|
5
|
-
* TMiniGamePrize
|
|
5
|
+
* TMiniGamePrize describes the information of prize in the array of prizes in the TMiniGameTemplate
|
|
6
6
|
*/
|
|
7
7
|
export interface TMiniGamePrize {
|
|
8
8
|
/** ID of the prize */
|
|
@@ -19,7 +19,18 @@ export interface TMiniGamePrize {
|
|
|
19
19
|
icon?: string;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* TMiniGamePlayResult describes the response of call to _smartico.api.playMiniGame(template_id) method
|
|
23
|
+
*/
|
|
24
|
+
export interface TMiniGamePlayResult {
|
|
25
|
+
/** Error code that represents outcome of the game play attempt. Game succeed to be played in case err_code is 0 */
|
|
26
|
+
err_code: SAWSpinErrorCode;
|
|
27
|
+
/** Optional error message */
|
|
28
|
+
err_message: string;
|
|
29
|
+
/** The prize_id that user won, details of the prize can be found in the mini-game definition */
|
|
30
|
+
prize_id: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* TMiniGameTemplate describes the information of mini-games available for the user
|
|
23
34
|
*/
|
|
24
35
|
export interface TMiniGameTemplate {
|
|
25
36
|
/** ID of the mini-game template */
|
|
@@ -50,7 +61,7 @@ export interface TMiniGameTemplate {
|
|
|
50
61
|
prizes: TMiniGamePrize[];
|
|
51
62
|
}
|
|
52
63
|
/**
|
|
53
|
-
* TUser
|
|
64
|
+
* TUser describes the information of the user
|
|
54
65
|
* The user object is returned by _smartico.api.getUserProfile() method.
|
|
55
66
|
* If you want to track the changes of the user profile, you can subscribe to the callback in the following way
|
|
56
67
|
* _smartico.on('props_change', () => console.log(_smartico.api.getUserProfile()) );
|
|
@@ -81,7 +92,7 @@ export interface TUserProfile {
|
|
|
81
92
|
core_inbox_unread_count?: number;
|
|
82
93
|
}
|
|
83
94
|
/**
|
|
84
|
-
* TLevel
|
|
95
|
+
* TLevel describes the information of each level defined in the system
|
|
85
96
|
* There is no order of the levels, but it can be calculated using required_points property
|
|
86
97
|
* The current level of user can be taken from the user object using ach_level_current_id property
|
|
87
98
|
* The progress to the next level can be calculated using ach_points_ever and required_points properties of next level
|
|
@@ -115,7 +126,7 @@ export interface TLevel {
|
|
|
115
126
|
required_level_counter_2: number;
|
|
116
127
|
}
|
|
117
128
|
/**
|
|
118
|
-
* TTournament
|
|
129
|
+
* TTournament describes the general information of the tournament item
|
|
119
130
|
*/
|
|
120
131
|
export interface TTournament {
|
|
121
132
|
/** ID of tournament instance. Generated every time when tournament based on specific template is scheduled for run */
|
|
@@ -177,7 +188,7 @@ export interface TTournament {
|
|
|
177
188
|
is_upcoming: boolean;
|
|
178
189
|
}
|
|
179
190
|
/**
|
|
180
|
-
* TTournamentDetailed
|
|
191
|
+
* TTournamentDetailed describes the information of the tournament item and includes list of participants, their scores and position in the tournament leaderboard
|
|
181
192
|
*/
|
|
182
193
|
export interface TTournamentDetailed extends TTournament {
|
|
183
194
|
/** The list of the tournament participants */
|
|
@@ -206,7 +217,7 @@ export interface TTournamentDetailed extends TTournament {
|
|
|
206
217
|
};
|
|
207
218
|
}
|
|
208
219
|
/**
|
|
209
|
-
* TStoreCategory
|
|
220
|
+
* TStoreCategory describes the store category item. Each store item can be assigned to 1 or more categories
|
|
210
221
|
*/
|
|
211
222
|
export interface TStoreCategory {
|
|
212
223
|
id: number;
|
|
@@ -214,7 +225,7 @@ export interface TStoreCategory {
|
|
|
214
225
|
order: number;
|
|
215
226
|
}
|
|
216
227
|
/**
|
|
217
|
-
* TStoreItem
|
|
228
|
+
* TStoreItem describes the information of the store item defined in the system
|
|
218
229
|
*/
|
|
219
230
|
export interface TStoreItem {
|
|
220
231
|
/** ID of the store item */
|
|
@@ -249,7 +260,7 @@ export interface TStoreItem {
|
|
|
249
260
|
category_ids: number[];
|
|
250
261
|
}
|
|
251
262
|
/**
|
|
252
|
-
* TMissionOrBadge
|
|
263
|
+
* TMissionOrBadge describes the information of mission or badge defined in the system
|
|
253
264
|
*/
|
|
254
265
|
export interface TMissionOrBadge {
|
|
255
266
|
/** ID of the mission or badge */
|
|
@@ -303,7 +314,7 @@ export interface TMissionOrBadge {
|
|
|
303
314
|
tasks: TMissionOrBadgeTask[];
|
|
304
315
|
}
|
|
305
316
|
/**
|
|
306
|
-
* TMissionOrBadgeTask
|
|
317
|
+
* TMissionOrBadgeTask describes the information of tasks that belings to mission or badge. See also TMissionOrBadge
|
|
307
318
|
*/
|
|
308
319
|
export interface TMissionOrBadgeTask {
|
|
309
320
|
/** ID of the task */
|
package/dist/index.js
CHANGED
|
@@ -304,14 +304,23 @@ var SAWTemplatesTransform = function SAWTemplatesTransform(items) {
|
|
|
304
304
|
});
|
|
305
305
|
};
|
|
306
306
|
|
|
307
|
+
/*
|
|
308
|
+
* Possible error codes for the mini-games attempts
|
|
309
|
+
*/
|
|
307
310
|
exports.SAWSpinErrorCode = void 0;
|
|
308
311
|
(function (SAWSpinErrorCode) {
|
|
312
|
+
/** No error */
|
|
309
313
|
SAWSpinErrorCode[SAWSpinErrorCode["SAW_OK"] = 0] = "SAW_OK";
|
|
314
|
+
/** User doesn't have 'spin attempts' to play. In case buy in type for the game is 'spins' based */
|
|
310
315
|
SAWSpinErrorCode[SAWSpinErrorCode["SAW_NO_SPINS"] = 40001] = "SAW_NO_SPINS";
|
|
316
|
+
/** The are no prizes left to play the game */
|
|
311
317
|
SAWSpinErrorCode[SAWSpinErrorCode["SAW_PRIZE_POOL_EMPTY"] = 40002] = "SAW_PRIZE_POOL_EMPTY";
|
|
318
|
+
/** User doesn't have enough points to play. In case buy in type for the game is 'points' based */
|
|
312
319
|
SAWSpinErrorCode[SAWSpinErrorCode["SAW_NOT_ENOUGH_POINTS"] = 40003] = "SAW_NOT_ENOUGH_POINTS";
|
|
320
|
+
/** User reached max number of game attempts defined in the BackOffice */
|
|
313
321
|
SAWSpinErrorCode[SAWSpinErrorCode["SAW_FAILED_MAX_SPINS_REACHED"] = 40004] = "SAW_FAILED_MAX_SPINS_REACHED";
|
|
314
|
-
|
|
322
|
+
/** Special code for the 'visitor' mode */
|
|
323
|
+
SAWSpinErrorCode[SAWSpinErrorCode["SAW_VISITOR_STOP_SPIN_REQUEST"] = -40001] = "SAW_VISITOR_STOP_SPIN_REQUEST";
|
|
315
324
|
})(exports.SAWSpinErrorCode || (exports.SAWSpinErrorCode = {}));
|
|
316
325
|
|
|
317
326
|
var _SAWWinSoundFiles;
|
|
@@ -865,19 +874,34 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
865
874
|
} catch (e) {
|
|
866
875
|
return Promise.reject(e);
|
|
867
876
|
}
|
|
877
|
+
} /** Plays the specified by template_id mini-game on behalf of user and returns prize_id or err_code */;
|
|
878
|
+
_proto.playMiniGame = function playMiniGame(template_id) {
|
|
879
|
+
try {
|
|
880
|
+
var _this7 = this;
|
|
881
|
+
return Promise.resolve(_this7.api.sawSpinRequest(null, template_id)).then(function (r) {
|
|
882
|
+
var o = {
|
|
883
|
+
err_code: r.errCode,
|
|
884
|
+
err_message: r.errMsg,
|
|
885
|
+
prize_id: r.saw_prize_id
|
|
886
|
+
};
|
|
887
|
+
return o;
|
|
888
|
+
});
|
|
889
|
+
} catch (e) {
|
|
890
|
+
return Promise.reject(e);
|
|
891
|
+
}
|
|
868
892
|
} /** Returns all the active instances of tournaments */;
|
|
869
893
|
_proto.getTournamentsList = function getTournamentsList() {
|
|
870
894
|
try {
|
|
871
|
-
var
|
|
872
|
-
return Promise.resolve(
|
|
895
|
+
var _this8 = this;
|
|
896
|
+
return Promise.resolve(_this8.api.tournamentsGetLobbyT(null));
|
|
873
897
|
} catch (e) {
|
|
874
898
|
return Promise.reject(e);
|
|
875
899
|
}
|
|
876
900
|
} /** Returns details information of specific tournament instance, the response will includ tournamnet info and the leaderboard of players */;
|
|
877
901
|
_proto.getTournamentInstanceInfo = function getTournamentInstanceInfo(tournamentInstanceId) {
|
|
878
902
|
try {
|
|
879
|
-
var
|
|
880
|
-
return Promise.resolve(
|
|
903
|
+
var _this9 = this;
|
|
904
|
+
return Promise.resolve(_this9.api.tournamentsGetInfoT(null, tournamentInstanceId));
|
|
881
905
|
} catch (e) {
|
|
882
906
|
return Promise.reject(e);
|
|
883
907
|
}
|