@smartico/public-api 0.0.72 → 0.0.73
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/WSAPI/WSAPI.d.ts +12 -1
- package/dist/index.js +39 -13
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +17 -1
- package/dist/index.modern.mjs.map +1 -1
- package/docs/classes/WSAPI.md +11 -20
- package/package.json +1 -1
- package/src/WSAPI/WSAPI.ts +19 -2
package/dist/WSAPI/WSAPI.d.ts
CHANGED
|
@@ -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,7 +27,11 @@ 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[]>;
|
|
@@ -33,12 +40,16 @@ export declare class WSAPI {
|
|
|
33
40
|
/** Returns all the active instances of tournaments
|
|
34
41
|
* 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
42
|
* The onUpdate callback will be called when the user has registered in a tournament. Updated list will be passed to onUpdate callback.*/
|
|
43
|
+
/**
|
|
44
|
+
* @param params
|
|
45
|
+
*/
|
|
36
46
|
getTournamentsList({ onUpdate }?: {
|
|
37
47
|
onUpdate?: (data: TTournament[]) => void;
|
|
38
48
|
}): Promise<TTournament[]>;
|
|
39
49
|
/** Returns details information of specific tournament instance, the response will includ tournamnet info and the leaderboard of players */
|
|
40
50
|
getTournamentInstanceInfo(tournamentInstanceId: number): Promise<TTournamentDetailed>;
|
|
41
51
|
private updateOnSpin;
|
|
52
|
+
private updateOnAddSpin;
|
|
42
53
|
private updateOnPrizeWin;
|
|
43
54
|
private updateMissionsOnOptIn;
|
|
44
55
|
private updateTournamentsOnRegistration;
|
package/dist/index.js
CHANGED
|
@@ -837,6 +837,12 @@ 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_SPINS_COUNT_PUSH, function (data) {
|
|
841
|
+
return _this.updateOnSpin(data);
|
|
842
|
+
});
|
|
843
|
+
on(exports.ClassId.SAW_SHOW_SPIN_PUSH, function () {
|
|
844
|
+
return _this.updateOnAddSpin();
|
|
845
|
+
});
|
|
840
846
|
on(exports.ClassId.SAW_DO_SPIN_RESPONSE, function (data) {
|
|
841
847
|
return on(exports.ClassId.SAW_AKNOWLEDGE_RESPONSE, function () {
|
|
842
848
|
return _this.updateOnPrizeWin(data);
|
|
@@ -872,6 +878,9 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
872
878
|
/** Returns all the missions available the current user.
|
|
873
879
|
* 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
880
|
* The onUpdate callback will be called on mission OptIn and the updated missions will be passed to it. */
|
|
881
|
+
/**
|
|
882
|
+
* @param params
|
|
883
|
+
*/
|
|
875
884
|
;
|
|
876
885
|
_proto.getMissions = function getMissions(_temp) {
|
|
877
886
|
var _ref = _temp === void 0 ? {} : _temp,
|
|
@@ -914,7 +923,11 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
914
923
|
}
|
|
915
924
|
/** Returns the list of mini-games available for user
|
|
916
925
|
* 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. */
|
|
926
|
+
* 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. */
|
|
927
|
+
/**
|
|
928
|
+
/**
|
|
929
|
+
* @param params
|
|
930
|
+
*/
|
|
918
931
|
;
|
|
919
932
|
_proto.getMiniGames = function getMiniGames(_temp2) {
|
|
920
933
|
var _ref2 = _temp2 === void 0 ? {} : _temp2,
|
|
@@ -950,6 +963,9 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
950
963
|
/** Returns all the active instances of tournaments
|
|
951
964
|
* 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
965
|
* The onUpdate callback will be called when the user has registered in a tournament. Updated list will be passed to onUpdate callback.*/
|
|
966
|
+
/**
|
|
967
|
+
* @param params
|
|
968
|
+
*/
|
|
953
969
|
;
|
|
954
970
|
_proto.getTournamentsList = function getTournamentsList(_temp3) {
|
|
955
971
|
var _ref3 = _temp3 === void 0 ? {} : _temp3,
|
|
@@ -990,13 +1006,23 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
990
1006
|
return Promise.reject(e);
|
|
991
1007
|
}
|
|
992
1008
|
};
|
|
993
|
-
_proto.
|
|
1009
|
+
_proto.updateOnAddSpin = function updateOnAddSpin() {
|
|
994
1010
|
try {
|
|
995
1011
|
var _this12 = this;
|
|
1012
|
+
return Promise.resolve(_this12.api.sawGetTemplatesT(null)).then(function (payload) {
|
|
1013
|
+
_this12.updateEntity(onUpdateContextKey.Saw, payload);
|
|
1014
|
+
});
|
|
1015
|
+
} catch (e) {
|
|
1016
|
+
return Promise.reject(e);
|
|
1017
|
+
}
|
|
1018
|
+
};
|
|
1019
|
+
_proto.updateOnPrizeWin = function updateOnPrizeWin(data) {
|
|
1020
|
+
try {
|
|
1021
|
+
var _this13 = this;
|
|
996
1022
|
var _temp5 = function () {
|
|
997
1023
|
if (data.errCode === exports.SAWSpinErrorCode.SAW_OK) {
|
|
998
1024
|
return Promise.resolve(OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, function () {
|
|
999
|
-
return
|
|
1025
|
+
return _this13.api.sawGetTemplatesT(null);
|
|
1000
1026
|
}, CACHE_DATA_SEC)).then(function (templates) {
|
|
1001
1027
|
var _template$prizes$find;
|
|
1002
1028
|
var template = templates.find(function (t) {
|
|
@@ -1009,8 +1035,8 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1009
1035
|
})) == null ? void 0 : _template$prizes$find.prize_type;
|
|
1010
1036
|
var _temp4 = function () {
|
|
1011
1037
|
if (template.jackpot_add_on_attempt || template.spin_count === 1 || prizeType === exports.MiniGamePrizeTypeName.JACKPOT || prizeType === exports.MiniGamePrizeTypeName.SPIN) {
|
|
1012
|
-
return Promise.resolve(
|
|
1013
|
-
|
|
1038
|
+
return Promise.resolve(_this13.api.sawGetTemplatesT(null)).then(function (updatedTemplates) {
|
|
1039
|
+
_this13.updateEntity(onUpdateContextKey.Saw, updatedTemplates);
|
|
1014
1040
|
});
|
|
1015
1041
|
}
|
|
1016
1042
|
}();
|
|
@@ -1025,9 +1051,9 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1025
1051
|
};
|
|
1026
1052
|
_proto.updateMissionsOnOptIn = function updateMissionsOnOptIn() {
|
|
1027
1053
|
try {
|
|
1028
|
-
var
|
|
1029
|
-
return Promise.resolve(
|
|
1030
|
-
|
|
1054
|
+
var _this14 = this;
|
|
1055
|
+
return Promise.resolve(_this14.api.missionsGetItemsT(null)).then(function (payload) {
|
|
1056
|
+
_this14.updateEntity(onUpdateContextKey.Missions, payload);
|
|
1031
1057
|
});
|
|
1032
1058
|
} catch (e) {
|
|
1033
1059
|
return Promise.reject(e);
|
|
@@ -1035,9 +1061,9 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1035
1061
|
};
|
|
1036
1062
|
_proto.updateTournamentsOnRegistration = function updateTournamentsOnRegistration() {
|
|
1037
1063
|
try {
|
|
1038
|
-
var
|
|
1039
|
-
return Promise.resolve(
|
|
1040
|
-
|
|
1064
|
+
var _this15 = this;
|
|
1065
|
+
return Promise.resolve(_this15.api.tournamentsGetLobbyT(null)).then(function (payload) {
|
|
1066
|
+
_this15.updateEntity(onUpdateContextKey.TournamentList, payload);
|
|
1041
1067
|
});
|
|
1042
1068
|
} catch (e) {
|
|
1043
1069
|
return Promise.reject(e);
|
|
@@ -1045,9 +1071,9 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1045
1071
|
};
|
|
1046
1072
|
_proto.updateEntity = function updateEntity(contextKey, payload) {
|
|
1047
1073
|
try {
|
|
1048
|
-
var
|
|
1074
|
+
var _this16 = this;
|
|
1049
1075
|
OCache.set(contextKey, payload, ECacheContext.WSAPI);
|
|
1050
|
-
var onUpdate =
|
|
1076
|
+
var onUpdate = _this16.onUpdateCallback.get(contextKey);
|
|
1051
1077
|
if (onUpdate) {
|
|
1052
1078
|
onUpdate(payload);
|
|
1053
1079
|
}
|