@smartico/public-api 0.0.72 → 0.0.74
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/SmarticoAPI.d.ts +2 -1
- package/dist/WSAPI/WSAPI.d.ts +15 -2
- package/dist/WSAPI/WSAPITypes.d.ts +9 -0
- package/dist/index.js +119 -71
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +32 -1
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +1 -0
- package/docs/classes/WSAPI.md +29 -20
- package/docs/interfaces/TMissionOptInResult.md +19 -0
- package/package.json +1 -1
- package/src/SmarticoAPI.ts +11 -1
- package/src/WSAPI/WSAPI.ts +32 -4
- package/src/WSAPI/WSAPITypes.ts +10 -0
package/dist/SmarticoAPI.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { GetTranslationsResponse, ResponseIdentify, TranslationArea } from './Co
|
|
|
6
6
|
import { GetLabelInfoResponse } from './Core/GetLabelInfoResponse';
|
|
7
7
|
import { GetInboxMessagesResponse } from './Inbox';
|
|
8
8
|
import { GetCategoriesStoreResponse, GetStoreItemsResponse } from './Store';
|
|
9
|
-
import { GetAchievementMapResponse } from './Missions';
|
|
9
|
+
import { AchievementOptinResponse, GetAchievementMapResponse } from './Missions';
|
|
10
10
|
import { GetTournamentInfoResponse, GetTournamentsResponse } from './Tournaments';
|
|
11
11
|
import { LeaderBoardDetails, LeaderBoardPeriodType } from "./Leaderboard";
|
|
12
12
|
import { GetLevelMapResponse } from "./Level";
|
|
@@ -56,6 +56,7 @@ declare class SmarticoAPI {
|
|
|
56
56
|
sawGetTemplatesT(user_ext_id: string): Promise<TMiniGameTemplate[]>;
|
|
57
57
|
doAcknowledgeRequest(user_ext_id: string, request_id: string): Promise<SAWDoAknowledgeResponse>;
|
|
58
58
|
sawSpinRequest(user_ext_id: string, saw_template_id: number, round_id?: number): Promise<SAWDoSpinResponse>;
|
|
59
|
+
missionOptIn(user_ext_id: string, mission_id: number): Promise<AchievementOptinResponse>;
|
|
59
60
|
inboxGetMessages(user_ext_id: string, limit?: number, offset?: number): Promise<GetInboxMessagesResponse>;
|
|
60
61
|
storeGetItems(user_ext_id: string): Promise<GetStoreItemsResponse>;
|
|
61
62
|
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, TMiniGamePlayResult, TMiniGameTemplate, TMissionOrBadge, TStoreItem, TTournament, TTournamentDetailed, TUserProfile } from "./WSAPITypes";
|
|
2
|
+
import { TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionOptInResult, TMissionOrBadge, TStoreItem, TTournament, TTournamentDetailed, TUserProfile } from "./WSAPITypes";
|
|
3
3
|
/** @group General API */
|
|
4
4
|
export declare class WSAPI {
|
|
5
5
|
private api;
|
|
@@ -13,6 +13,9 @@ export declare class WSAPI {
|
|
|
13
13
|
/** Returns all the missions available the current user.
|
|
14
14
|
* The returned missions is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getMissions with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
15
15
|
* The onUpdate callback will be called on mission OptIn and the updated missions will be passed to it. */
|
|
16
|
+
/**
|
|
17
|
+
* @param params
|
|
18
|
+
*/
|
|
16
19
|
getMissions({ onUpdate }?: {
|
|
17
20
|
onUpdate?: (data: TMissionOrBadge[]) => void;
|
|
18
21
|
}): Promise<TMissionOrBadge[]>;
|
|
@@ -24,21 +27,31 @@ export declare class WSAPI {
|
|
|
24
27
|
getStoreCategories(): Promise<TStoreItem[]>;
|
|
25
28
|
/** Returns the list of mini-games available for user
|
|
26
29
|
* The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getMiniGames with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
27
|
-
* The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or wined prize is spin/jackpot and if max count of the available user spin equal one. Updated templates will be passed to onUpdate callback. */
|
|
30
|
+
* The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or wined prize is spin/jackpot and if max count of the available user spin equal one, also if the spins were issued to the user manually in the BO. Updated templates will be passed to onUpdate callback. */
|
|
31
|
+
/**
|
|
32
|
+
/**
|
|
33
|
+
* @param params
|
|
34
|
+
*/
|
|
28
35
|
getMiniGames({ onUpdate }?: {
|
|
29
36
|
onUpdate?: (data: TMiniGameTemplate[]) => void;
|
|
30
37
|
}): Promise<TMiniGameTemplate[]>;
|
|
31
38
|
/** Plays the specified by template_id mini-game on behalf of user and returns prize_id or err_code */
|
|
32
39
|
playMiniGame(template_id: number): Promise<TMiniGamePlayResult>;
|
|
40
|
+
/** Requests an opt-in for the specified mission_id. Returns the err_code. */
|
|
41
|
+
requestMissionOptIn(mission_id: number): Promise<TMissionOptInResult>;
|
|
33
42
|
/** Returns all the active instances of tournaments
|
|
34
43
|
* The returned list is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getTournamentsList with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
35
44
|
* The onUpdate callback will be called when the user has registered in a tournament. Updated list will be passed to onUpdate callback.*/
|
|
45
|
+
/**
|
|
46
|
+
* @param params
|
|
47
|
+
*/
|
|
36
48
|
getTournamentsList({ onUpdate }?: {
|
|
37
49
|
onUpdate?: (data: TTournament[]) => void;
|
|
38
50
|
}): Promise<TTournament[]>;
|
|
39
51
|
/** Returns details information of specific tournament instance, the response will includ tournamnet info and the leaderboard of players */
|
|
40
52
|
getTournamentInstanceInfo(tournamentInstanceId: number): Promise<TTournamentDetailed>;
|
|
41
53
|
private updateOnSpin;
|
|
54
|
+
private updateOnAddSpin;
|
|
42
55
|
private updateOnPrizeWin;
|
|
43
56
|
private updateMissionsOnOptIn;
|
|
44
57
|
private updateTournamentsOnRegistration;
|
|
@@ -330,4 +330,13 @@ export interface TMissionOrBadgeTask {
|
|
|
330
330
|
/** The progress of the task in percents */
|
|
331
331
|
progress: number;
|
|
332
332
|
}
|
|
333
|
+
/**
|
|
334
|
+
* TMissionOptInResult describes the response of call to _smartico.api.requestMissionOptIn(mission_id) method
|
|
335
|
+
*/
|
|
336
|
+
export interface TMissionOptInResult {
|
|
337
|
+
/** Error code that represents outcome of the opt-in request. Successful opt-in in case err_code is 0 */
|
|
338
|
+
err_code: number;
|
|
339
|
+
/** Optional error message */
|
|
340
|
+
err_message: string;
|
|
341
|
+
}
|
|
333
342
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -837,6 +837,9 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
837
837
|
on(exports.ClassId.SAW_SPINS_COUNT_PUSH, function (data) {
|
|
838
838
|
return _this.updateOnSpin(data);
|
|
839
839
|
});
|
|
840
|
+
on(exports.ClassId.SAW_SHOW_SPIN_PUSH, function () {
|
|
841
|
+
return _this.updateOnAddSpin();
|
|
842
|
+
});
|
|
840
843
|
on(exports.ClassId.SAW_DO_SPIN_RESPONSE, function (data) {
|
|
841
844
|
return on(exports.ClassId.SAW_AKNOWLEDGE_RESPONSE, function () {
|
|
842
845
|
return _this.updateOnPrizeWin(data);
|
|
@@ -872,6 +875,9 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
872
875
|
/** Returns all the missions available the current user.
|
|
873
876
|
* The returned missions is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getMissions with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
874
877
|
* The onUpdate callback will be called on mission OptIn and the updated missions will be passed to it. */
|
|
878
|
+
/**
|
|
879
|
+
* @param params
|
|
880
|
+
*/
|
|
875
881
|
;
|
|
876
882
|
_proto.getMissions = function getMissions(_temp) {
|
|
877
883
|
var _ref = _temp === void 0 ? {} : _temp,
|
|
@@ -914,7 +920,11 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
914
920
|
}
|
|
915
921
|
/** Returns the list of mini-games available for user
|
|
916
922
|
* The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getMiniGames with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
917
|
-
* The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or wined prize is spin/jackpot and if max count of the available user spin equal one. Updated templates will be passed to onUpdate callback. */
|
|
923
|
+
* The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or wined prize is spin/jackpot and if max count of the available user spin equal one, also if the spins were issued to the user manually in the BO. Updated templates will be passed to onUpdate callback. */
|
|
924
|
+
/**
|
|
925
|
+
/**
|
|
926
|
+
* @param params
|
|
927
|
+
*/
|
|
918
928
|
;
|
|
919
929
|
_proto.getMiniGames = function getMiniGames(_temp2) {
|
|
920
930
|
var _ref2 = _temp2 === void 0 ? {} : _temp2,
|
|
@@ -946,21 +956,38 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
946
956
|
} catch (e) {
|
|
947
957
|
return Promise.reject(e);
|
|
948
958
|
}
|
|
959
|
+
} /** Requests an opt-in for the specified mission_id. Returns the err_code. */;
|
|
960
|
+
_proto.requestMissionOptIn = function requestMissionOptIn(mission_id) {
|
|
961
|
+
try {
|
|
962
|
+
var _this9 = this;
|
|
963
|
+
return Promise.resolve(_this9.api.missionOptIn(null, mission_id)).then(function (r) {
|
|
964
|
+
var o = {
|
|
965
|
+
err_code: r.errCode,
|
|
966
|
+
err_message: r.errMsg
|
|
967
|
+
};
|
|
968
|
+
return o;
|
|
969
|
+
});
|
|
970
|
+
} catch (e) {
|
|
971
|
+
return Promise.reject(e);
|
|
972
|
+
}
|
|
949
973
|
}
|
|
950
974
|
/** Returns all the active instances of tournaments
|
|
951
975
|
* The returned list is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getTournamentsList with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
952
976
|
* The onUpdate callback will be called when the user has registered in a tournament. Updated list will be passed to onUpdate callback.*/
|
|
977
|
+
/**
|
|
978
|
+
* @param params
|
|
979
|
+
*/
|
|
953
980
|
;
|
|
954
981
|
_proto.getTournamentsList = function getTournamentsList(_temp3) {
|
|
955
982
|
var _ref3 = _temp3 === void 0 ? {} : _temp3,
|
|
956
983
|
onUpdate = _ref3.onUpdate;
|
|
957
984
|
try {
|
|
958
|
-
var
|
|
985
|
+
var _this10 = this;
|
|
959
986
|
if (onUpdate) {
|
|
960
|
-
|
|
987
|
+
_this10.onUpdateCallback.set(onUpdateContextKey.TournamentList, onUpdate);
|
|
961
988
|
}
|
|
962
989
|
return Promise.resolve(OCache.use(onUpdateContextKey.TournamentList, ECacheContext.WSAPI, function () {
|
|
963
|
-
return
|
|
990
|
+
return _this10.api.tournamentsGetLobbyT(null);
|
|
964
991
|
}, CACHE_DATA_SEC));
|
|
965
992
|
} catch (e) {
|
|
966
993
|
return Promise.reject(e);
|
|
@@ -968,23 +995,33 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
968
995
|
} /** Returns details information of specific tournament instance, the response will includ tournamnet info and the leaderboard of players */;
|
|
969
996
|
_proto.getTournamentInstanceInfo = function getTournamentInstanceInfo(tournamentInstanceId) {
|
|
970
997
|
try {
|
|
971
|
-
var
|
|
972
|
-
return Promise.resolve(
|
|
998
|
+
var _this11 = this;
|
|
999
|
+
return Promise.resolve(_this11.api.tournamentsGetInfoT(null, tournamentInstanceId));
|
|
973
1000
|
} catch (e) {
|
|
974
1001
|
return Promise.reject(e);
|
|
975
1002
|
}
|
|
976
1003
|
};
|
|
977
1004
|
_proto.updateOnSpin = function updateOnSpin(data) {
|
|
978
1005
|
try {
|
|
979
|
-
var
|
|
1006
|
+
var _this12 = this;
|
|
980
1007
|
return Promise.resolve(OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, function () {
|
|
981
|
-
return
|
|
1008
|
+
return _this12.api.sawGetTemplatesT(null);
|
|
982
1009
|
}, CACHE_DATA_SEC)).then(function (templates) {
|
|
983
1010
|
var index = templates.findIndex(function (t) {
|
|
984
1011
|
return t.id === data.saw_template_id;
|
|
985
1012
|
});
|
|
986
1013
|
templates[index].spin_count = data.spin_count;
|
|
987
|
-
|
|
1014
|
+
_this12.updateEntity(onUpdateContextKey.Saw, templates);
|
|
1015
|
+
});
|
|
1016
|
+
} catch (e) {
|
|
1017
|
+
return Promise.reject(e);
|
|
1018
|
+
}
|
|
1019
|
+
};
|
|
1020
|
+
_proto.updateOnAddSpin = function updateOnAddSpin() {
|
|
1021
|
+
try {
|
|
1022
|
+
var _this13 = this;
|
|
1023
|
+
return Promise.resolve(_this13.api.sawGetTemplatesT(null)).then(function (payload) {
|
|
1024
|
+
_this13.updateEntity(onUpdateContextKey.Saw, payload);
|
|
988
1025
|
});
|
|
989
1026
|
} catch (e) {
|
|
990
1027
|
return Promise.reject(e);
|
|
@@ -992,11 +1029,11 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
992
1029
|
};
|
|
993
1030
|
_proto.updateOnPrizeWin = function updateOnPrizeWin(data) {
|
|
994
1031
|
try {
|
|
995
|
-
var
|
|
1032
|
+
var _this14 = this;
|
|
996
1033
|
var _temp5 = function () {
|
|
997
1034
|
if (data.errCode === exports.SAWSpinErrorCode.SAW_OK) {
|
|
998
1035
|
return Promise.resolve(OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, function () {
|
|
999
|
-
return
|
|
1036
|
+
return _this14.api.sawGetTemplatesT(null);
|
|
1000
1037
|
}, CACHE_DATA_SEC)).then(function (templates) {
|
|
1001
1038
|
var _template$prizes$find;
|
|
1002
1039
|
var template = templates.find(function (t) {
|
|
@@ -1009,8 +1046,8 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1009
1046
|
})) == null ? void 0 : _template$prizes$find.prize_type;
|
|
1010
1047
|
var _temp4 = function () {
|
|
1011
1048
|
if (template.jackpot_add_on_attempt || template.spin_count === 1 || prizeType === exports.MiniGamePrizeTypeName.JACKPOT || prizeType === exports.MiniGamePrizeTypeName.SPIN) {
|
|
1012
|
-
return Promise.resolve(
|
|
1013
|
-
|
|
1049
|
+
return Promise.resolve(_this14.api.sawGetTemplatesT(null)).then(function (updatedTemplates) {
|
|
1050
|
+
_this14.updateEntity(onUpdateContextKey.Saw, updatedTemplates);
|
|
1014
1051
|
});
|
|
1015
1052
|
}
|
|
1016
1053
|
}();
|
|
@@ -1025,9 +1062,9 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1025
1062
|
};
|
|
1026
1063
|
_proto.updateMissionsOnOptIn = function updateMissionsOnOptIn() {
|
|
1027
1064
|
try {
|
|
1028
|
-
var
|
|
1029
|
-
return Promise.resolve(
|
|
1030
|
-
|
|
1065
|
+
var _this15 = this;
|
|
1066
|
+
return Promise.resolve(_this15.api.missionsGetItemsT(null)).then(function (payload) {
|
|
1067
|
+
_this15.updateEntity(onUpdateContextKey.Missions, payload);
|
|
1031
1068
|
});
|
|
1032
1069
|
} catch (e) {
|
|
1033
1070
|
return Promise.reject(e);
|
|
@@ -1035,9 +1072,9 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1035
1072
|
};
|
|
1036
1073
|
_proto.updateTournamentsOnRegistration = function updateTournamentsOnRegistration() {
|
|
1037
1074
|
try {
|
|
1038
|
-
var
|
|
1039
|
-
return Promise.resolve(
|
|
1040
|
-
|
|
1075
|
+
var _this16 = this;
|
|
1076
|
+
return Promise.resolve(_this16.api.tournamentsGetLobbyT(null)).then(function (payload) {
|
|
1077
|
+
_this16.updateEntity(onUpdateContextKey.TournamentList, payload);
|
|
1041
1078
|
});
|
|
1042
1079
|
} catch (e) {
|
|
1043
1080
|
return Promise.reject(e);
|
|
@@ -1045,9 +1082,9 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1045
1082
|
};
|
|
1046
1083
|
_proto.updateEntity = function updateEntity(contextKey, payload) {
|
|
1047
1084
|
try {
|
|
1048
|
-
var
|
|
1085
|
+
var _this17 = this;
|
|
1049
1086
|
OCache.set(contextKey, payload, ECacheContext.WSAPI);
|
|
1050
|
-
var onUpdate =
|
|
1087
|
+
var onUpdate = _this17.onUpdateCallback.get(contextKey);
|
|
1051
1088
|
if (onUpdate) {
|
|
1052
1089
|
onUpdate(payload);
|
|
1053
1090
|
}
|
|
@@ -1405,6 +1442,17 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
1405
1442
|
return Promise.reject(e);
|
|
1406
1443
|
}
|
|
1407
1444
|
};
|
|
1445
|
+
_proto.missionOptIn = function missionOptIn(user_ext_id, mission_id) {
|
|
1446
|
+
try {
|
|
1447
|
+
var _this11 = this;
|
|
1448
|
+
var message = _this11.buildMessage(user_ext_id, exports.ClassId.MISSION_OPTIN_REQUEST, {
|
|
1449
|
+
achievementId: mission_id
|
|
1450
|
+
});
|
|
1451
|
+
return Promise.resolve(_this11.send(message, exports.ClassId.MISSION_OPTIN_RESPONSE));
|
|
1452
|
+
} catch (e) {
|
|
1453
|
+
return Promise.reject(e);
|
|
1454
|
+
}
|
|
1455
|
+
};
|
|
1408
1456
|
_proto.inboxGetMessages = function inboxGetMessages(user_ext_id, limit, offset) {
|
|
1409
1457
|
if (limit === void 0) {
|
|
1410
1458
|
limit = 10;
|
|
@@ -1413,30 +1461,30 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
1413
1461
|
offset = 0;
|
|
1414
1462
|
}
|
|
1415
1463
|
try {
|
|
1416
|
-
var
|
|
1417
|
-
var message =
|
|
1464
|
+
var _this12 = this;
|
|
1465
|
+
var message = _this12.buildMessage(user_ext_id, exports.ClassId.GET_INBOX_MESSAGES_REQUEST, {
|
|
1418
1466
|
limit: limit,
|
|
1419
1467
|
offset: offset
|
|
1420
1468
|
});
|
|
1421
|
-
return Promise.resolve(
|
|
1469
|
+
return Promise.resolve(_this12.send(message, exports.ClassId.GET_INBOX_MESSAGES_RESPONSE));
|
|
1422
1470
|
} catch (e) {
|
|
1423
1471
|
return Promise.reject(e);
|
|
1424
1472
|
}
|
|
1425
1473
|
};
|
|
1426
1474
|
_proto.storeGetItems = function storeGetItems(user_ext_id) {
|
|
1427
1475
|
try {
|
|
1428
|
-
var
|
|
1429
|
-
var message =
|
|
1430
|
-
return Promise.resolve(
|
|
1476
|
+
var _this13 = this;
|
|
1477
|
+
var message = _this13.buildMessage(user_ext_id, exports.ClassId.GET_SHOP_ITEMS_REQUEST);
|
|
1478
|
+
return Promise.resolve(_this13.send(message, exports.ClassId.GET_SHOP_ITEMS_RESPONSE));
|
|
1431
1479
|
} catch (e) {
|
|
1432
1480
|
return Promise.reject(e);
|
|
1433
1481
|
}
|
|
1434
1482
|
};
|
|
1435
1483
|
_proto.storeGetItemsT = function storeGetItemsT(user_ext_id) {
|
|
1436
1484
|
try {
|
|
1437
|
-
var
|
|
1438
|
-
return Promise.resolve(
|
|
1439
|
-
return StoreItemTransform(
|
|
1485
|
+
var _this14 = this;
|
|
1486
|
+
return Promise.resolve(_this14.storeGetItems(user_ext_id)).then(function (_this14$storeGetItems) {
|
|
1487
|
+
return StoreItemTransform(_this14$storeGetItems.items);
|
|
1440
1488
|
});
|
|
1441
1489
|
} catch (e) {
|
|
1442
1490
|
return Promise.reject(e);
|
|
@@ -1444,18 +1492,18 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
1444
1492
|
};
|
|
1445
1493
|
_proto.storeGetCategories = function storeGetCategories(user_ext_id) {
|
|
1446
1494
|
try {
|
|
1447
|
-
var
|
|
1448
|
-
var message =
|
|
1449
|
-
return Promise.resolve(
|
|
1495
|
+
var _this15 = this;
|
|
1496
|
+
var message = _this15.buildMessage(user_ext_id, exports.ClassId.GET_SHOP_CATEGORIES_REQUEST);
|
|
1497
|
+
return Promise.resolve(_this15.send(message, exports.ClassId.GET_SHOP_CATEGORIES_RESPONSE));
|
|
1450
1498
|
} catch (e) {
|
|
1451
1499
|
return Promise.reject(e);
|
|
1452
1500
|
}
|
|
1453
1501
|
};
|
|
1454
1502
|
_proto.storeGetCategoriesT = function storeGetCategoriesT(user_ext_id) {
|
|
1455
1503
|
try {
|
|
1456
|
-
var
|
|
1457
|
-
return Promise.resolve(
|
|
1458
|
-
return StoreCategoryTransform(
|
|
1504
|
+
var _this16 = this;
|
|
1505
|
+
return Promise.resolve(_this16.storeGetCategories(user_ext_id)).then(function (_this16$storeGetCateg) {
|
|
1506
|
+
return StoreCategoryTransform(_this16$storeGetCateg.categories);
|
|
1459
1507
|
});
|
|
1460
1508
|
} catch (e) {
|
|
1461
1509
|
return Promise.reject(e);
|
|
@@ -1463,9 +1511,9 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
1463
1511
|
};
|
|
1464
1512
|
_proto.missionsGetItems = function missionsGetItems(user_ext_id) {
|
|
1465
1513
|
try {
|
|
1466
|
-
var
|
|
1467
|
-
var message =
|
|
1468
|
-
return Promise.resolve(
|
|
1514
|
+
var _this17 = this;
|
|
1515
|
+
var message = _this17.buildMessage(user_ext_id, exports.ClassId.GET_ACHIEVEMENT_MAP_REQUEST);
|
|
1516
|
+
return Promise.resolve(_this17.send(message, exports.ClassId.GET_ACHIEVEMENT_MAP_RESPONSE)).then(function (response) {
|
|
1469
1517
|
if (response.achievements) {
|
|
1470
1518
|
response.achievements = response.achievements.filter(function (a) {
|
|
1471
1519
|
return a.ach_type_id === exports.AchievementType.Mission;
|
|
@@ -1479,9 +1527,9 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
1479
1527
|
};
|
|
1480
1528
|
_proto.missionsGetItemsT = function missionsGetItemsT(user_ext_id) {
|
|
1481
1529
|
try {
|
|
1482
|
-
var
|
|
1483
|
-
return Promise.resolve(
|
|
1484
|
-
return UserAchievementTransform(
|
|
1530
|
+
var _this18 = this;
|
|
1531
|
+
return Promise.resolve(_this18.missionsGetItems(user_ext_id)).then(function (_this18$missionsGetIt) {
|
|
1532
|
+
return UserAchievementTransform(_this18$missionsGetIt.achievements);
|
|
1485
1533
|
});
|
|
1486
1534
|
} catch (e) {
|
|
1487
1535
|
return Promise.reject(e);
|
|
@@ -1489,9 +1537,9 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
1489
1537
|
};
|
|
1490
1538
|
_proto.badgetsGetItems = function badgetsGetItems(user_ext_id) {
|
|
1491
1539
|
try {
|
|
1492
|
-
var
|
|
1493
|
-
var message =
|
|
1494
|
-
return Promise.resolve(
|
|
1540
|
+
var _this19 = this;
|
|
1541
|
+
var message = _this19.buildMessage(user_ext_id, exports.ClassId.GET_ACHIEVEMENT_MAP_REQUEST);
|
|
1542
|
+
return Promise.resolve(_this19.send(message, exports.ClassId.GET_ACHIEVEMENT_MAP_RESPONSE)).then(function (response) {
|
|
1495
1543
|
if (response.achievements) {
|
|
1496
1544
|
response.achievements = response.achievements.filter(function (a) {
|
|
1497
1545
|
return a.ach_type_id === exports.AchievementType.Badge;
|
|
@@ -1505,9 +1553,9 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
1505
1553
|
};
|
|
1506
1554
|
_proto.badgetsGetItemsT = function badgetsGetItemsT(user_ext_id) {
|
|
1507
1555
|
try {
|
|
1508
|
-
var
|
|
1509
|
-
return Promise.resolve(
|
|
1510
|
-
return UserAchievementTransform(
|
|
1556
|
+
var _this20 = this;
|
|
1557
|
+
return Promise.resolve(_this20.badgetsGetItems(user_ext_id)).then(function (_this20$badgetsGetIte) {
|
|
1558
|
+
return UserAchievementTransform(_this20$badgetsGetIte.achievements);
|
|
1511
1559
|
});
|
|
1512
1560
|
} catch (e) {
|
|
1513
1561
|
return Promise.reject(e);
|
|
@@ -1515,18 +1563,18 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
1515
1563
|
};
|
|
1516
1564
|
_proto.tournamentsGetLobby = function tournamentsGetLobby(user_ext_id) {
|
|
1517
1565
|
try {
|
|
1518
|
-
var
|
|
1519
|
-
var message =
|
|
1520
|
-
return Promise.resolve(
|
|
1566
|
+
var _this21 = this;
|
|
1567
|
+
var message = _this21.buildMessage(user_ext_id, exports.ClassId.GET_TOURNAMENT_LOBBY_REQUEST);
|
|
1568
|
+
return Promise.resolve(_this21.send(message, exports.ClassId.GET_TOURNAMENT_LOBBY_RESPONSE));
|
|
1521
1569
|
} catch (e) {
|
|
1522
1570
|
return Promise.reject(e);
|
|
1523
1571
|
}
|
|
1524
1572
|
};
|
|
1525
1573
|
_proto.tournamentsGetLobbyT = function tournamentsGetLobbyT(user_ext_id) {
|
|
1526
1574
|
try {
|
|
1527
|
-
var
|
|
1528
|
-
return Promise.resolve(
|
|
1529
|
-
return TournamentItemsTransform(
|
|
1575
|
+
var _this22 = this;
|
|
1576
|
+
return Promise.resolve(_this22.tournamentsGetLobby(user_ext_id)).then(function (_this22$tournamentsGe) {
|
|
1577
|
+
return TournamentItemsTransform(_this22$tournamentsGe.tournaments);
|
|
1530
1578
|
});
|
|
1531
1579
|
} catch (e) {
|
|
1532
1580
|
return Promise.reject(e);
|
|
@@ -1534,18 +1582,18 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
1534
1582
|
};
|
|
1535
1583
|
_proto.tournamentsGetInfo = function tournamentsGetInfo(user_ext_id, tournamentInstanceId) {
|
|
1536
1584
|
try {
|
|
1537
|
-
var
|
|
1538
|
-
var message =
|
|
1585
|
+
var _this23 = this;
|
|
1586
|
+
var message = _this23.buildMessage(user_ext_id, exports.ClassId.GET_TOURNAMENT_INFO_REQUEST, {
|
|
1539
1587
|
tournamentInstanceId: tournamentInstanceId
|
|
1540
1588
|
});
|
|
1541
|
-
return Promise.resolve(
|
|
1589
|
+
return Promise.resolve(_this23.send(message, exports.ClassId.GET_TOURNAMENT_INFO_RESPONSE)).then(function (response) {
|
|
1542
1590
|
var _response$userPositio, _response$tournamentI;
|
|
1543
1591
|
if ((_response$userPositio = response.userPosition) != null && _response$userPositio.avatar_id) {
|
|
1544
|
-
response.userPosition.avatar_url = CoreUtils.avatarUrl(response.userPosition.avatar_id,
|
|
1592
|
+
response.userPosition.avatar_url = CoreUtils.avatarUrl(response.userPosition.avatar_id, _this23.avatarDomain);
|
|
1545
1593
|
}
|
|
1546
1594
|
if ((_response$tournamentI = response.tournamentInfo.players) != null && _response$tournamentI.length) {
|
|
1547
1595
|
response.tournamentInfo.players.forEach(function (p) {
|
|
1548
|
-
p.avatar_url = CoreUtils.avatarUrl(p.avatar_id,
|
|
1596
|
+
p.avatar_url = CoreUtils.avatarUrl(p.avatar_id, _this23.avatarDomain);
|
|
1549
1597
|
});
|
|
1550
1598
|
}
|
|
1551
1599
|
return response;
|
|
@@ -1556,8 +1604,8 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
1556
1604
|
};
|
|
1557
1605
|
_proto.tournamentsGetInfoT = function tournamentsGetInfoT(user_ext_id, tournamentInstanceId) {
|
|
1558
1606
|
try {
|
|
1559
|
-
var
|
|
1560
|
-
return Promise.resolve(
|
|
1607
|
+
var _this24 = this;
|
|
1608
|
+
return Promise.resolve(_this24.tournamentsGetInfo(user_ext_id, tournamentInstanceId)).then(tournamentInfoItemTransform);
|
|
1561
1609
|
} catch (e) {
|
|
1562
1610
|
return Promise.reject(e);
|
|
1563
1611
|
}
|
|
@@ -1567,13 +1615,13 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
1567
1615
|
prevPeriod = false;
|
|
1568
1616
|
}
|
|
1569
1617
|
try {
|
|
1570
|
-
var
|
|
1571
|
-
var message =
|
|
1618
|
+
var _this25 = this;
|
|
1619
|
+
var message = _this25.buildMessage(user_ext_id, exports.ClassId.GET_LEADERS_BOARD_REQUEST, {
|
|
1572
1620
|
period_type_id: period_type_id,
|
|
1573
1621
|
snapshot_offset: prevPeriod ? 1 : 0,
|
|
1574
1622
|
include_users: true
|
|
1575
1623
|
});
|
|
1576
|
-
return Promise.resolve(
|
|
1624
|
+
return Promise.resolve(_this25.send(message, exports.ClassId.GET_LEADERS_BOARD_RESPONSE)).then(function (response) {
|
|
1577
1625
|
var _response$map$boardKe, _response$map$boardKe2, _response$map$boardKe3, _response$map$boardKe4;
|
|
1578
1626
|
var boardKey = Object.keys(response.map).find(function (k) {
|
|
1579
1627
|
return period_type_id === undefined || k === (period_type_id == null ? void 0 : period_type_id.toString());
|
|
@@ -1582,11 +1630,11 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
1582
1630
|
return undefined;
|
|
1583
1631
|
}
|
|
1584
1632
|
if ((_response$map$boardKe = response.map[boardKey]) != null && (_response$map$boardKe2 = _response$map$boardKe.userPosition) != null && _response$map$boardKe2.avatar_id) {
|
|
1585
|
-
response.map[boardKey].userPosition.avatar_url = CoreUtils.avatarUrl(response.map[boardKey].userPosition.avatar_id,
|
|
1633
|
+
response.map[boardKey].userPosition.avatar_url = CoreUtils.avatarUrl(response.map[boardKey].userPosition.avatar_id, _this25.avatarDomain);
|
|
1586
1634
|
}
|
|
1587
1635
|
if ((_response$map$boardKe3 = response.map[boardKey]) != null && (_response$map$boardKe4 = _response$map$boardKe3.positions) != null && _response$map$boardKe4.length) {
|
|
1588
1636
|
response.map[boardKey].positions.forEach(function (p) {
|
|
1589
|
-
p.avatar_url = CoreUtils.avatarUrl(p.avatar_id,
|
|
1637
|
+
p.avatar_url = CoreUtils.avatarUrl(p.avatar_id, _this25.avatarDomain);
|
|
1590
1638
|
});
|
|
1591
1639
|
}
|
|
1592
1640
|
return response.map[boardKey];
|
|
@@ -1597,17 +1645,17 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
1597
1645
|
};
|
|
1598
1646
|
_proto.levelsGet = function levelsGet(user_ext_id) {
|
|
1599
1647
|
try {
|
|
1600
|
-
var
|
|
1601
|
-
var message =
|
|
1602
|
-
return Promise.resolve(
|
|
1648
|
+
var _this26 = this;
|
|
1649
|
+
var message = _this26.buildMessage(user_ext_id, exports.ClassId.GET_LEVEL_MAP_REQUEST);
|
|
1650
|
+
return Promise.resolve(_this26.send(message, exports.ClassId.GET_LEVEL_MAP_RESPONSE));
|
|
1603
1651
|
} catch (e) {
|
|
1604
1652
|
return Promise.reject(e);
|
|
1605
1653
|
}
|
|
1606
1654
|
};
|
|
1607
1655
|
_proto.levelsGetT = function levelsGetT(user_ext_id) {
|
|
1608
1656
|
try {
|
|
1609
|
-
var
|
|
1610
|
-
return Promise.resolve(
|
|
1657
|
+
var _this27 = this;
|
|
1658
|
+
return Promise.resolve(_this27.levelsGet(user_ext_id)).then(GetLevelMapResponseTransform);
|
|
1611
1659
|
} catch (e) {
|
|
1612
1660
|
return Promise.reject(e);
|
|
1613
1661
|
}
|