@smartico/public-api 0.0.171 → 0.0.173
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/UserProfile/UserProfile.d.ts +1 -1
- package/dist/WSAPI/WSAPI.d.ts +11 -3
- package/dist/index.js +33 -16
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +17 -2
- package/dist/index.modern.mjs.map +1 -1
- package/docs/classes/WSAPI.md +10 -2
- package/package.json +1 -1
- package/src/UserProfile/UserProfile.ts +1 -1
- package/src/WSAPI/WSAPI.ts +21 -6
package/dist/WSAPI/WSAPI.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { SmarticoAPI } from '../SmarticoAPI';
|
|
|
2
2
|
import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TSegmentCheckResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUICustomSection, TUserProfile, UserLevelExtraCountersT, TBonus, TClaimBonusResult, TMiniGamePlayBatchResult } from './WSAPITypes';
|
|
3
3
|
import { LeaderBoardPeriodType } from '../Leaderboard';
|
|
4
4
|
import { JackpotDetails, JackpotsOptinResponse, JackpotsOptoutResponse } from '../Jackpots';
|
|
5
|
-
import { GetAchievementMapResponse } from '
|
|
5
|
+
import { GetAchievementMapResponse } from '../Missions';
|
|
6
6
|
/** @group General API */
|
|
7
7
|
export declare class WSAPI {
|
|
8
8
|
private api;
|
|
@@ -252,6 +252,8 @@ export declare class WSAPI {
|
|
|
252
252
|
}): Promise<TMiniGameTemplate[]>;
|
|
253
253
|
/**
|
|
254
254
|
* Plays the specified by template_id mini-game on behalf of user and returns prize_id or err_code
|
|
255
|
+
* After playMiniGame is called, you can call getMiniGames to get the list of mini-games.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 playMiniGame with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
256
|
+
* 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.
|
|
255
257
|
*
|
|
256
258
|
* **Example**:
|
|
257
259
|
* ```
|
|
@@ -262,9 +264,13 @@ export declare class WSAPI {
|
|
|
262
264
|
*
|
|
263
265
|
* **Visitor mode: not supported**
|
|
264
266
|
*/
|
|
265
|
-
playMiniGame(template_id: number
|
|
267
|
+
playMiniGame(template_id: number, { onUpdate }?: {
|
|
268
|
+
onUpdate?: (data: TMissionOrBadge[]) => void;
|
|
269
|
+
}): Promise<TMiniGamePlayResult>;
|
|
266
270
|
/**
|
|
267
271
|
* Plays the specified by template_id mini-game on behalf of user spin_count times and returns array of the prizes
|
|
272
|
+
* After playMiniGameBatch is called, you can call getMiniGames to get the list of mini-games. 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 playMiniGameBatch with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
273
|
+
* 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.
|
|
268
274
|
*
|
|
269
275
|
* **Example**:
|
|
270
276
|
* ```
|
|
@@ -274,7 +280,9 @@ export declare class WSAPI {
|
|
|
274
280
|
* ```
|
|
275
281
|
* **Visitor mode: not supported**
|
|
276
282
|
*/
|
|
277
|
-
playMiniGameBatch(template_id: number, spin_count: number
|
|
283
|
+
playMiniGameBatch(template_id: number, spin_count: number, { onUpdate }?: {
|
|
284
|
+
onUpdate?: (data: TMissionOrBadge[]) => void;
|
|
285
|
+
}): Promise<TMiniGamePlayBatchResult[]>;
|
|
278
286
|
/**
|
|
279
287
|
* Requests an opt-in for the specified mission_id. Returns the err_code.
|
|
280
288
|
*
|
package/dist/index.js
CHANGED
|
@@ -1251,6 +1251,9 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1251
1251
|
on(exports.ClassId.CLAIM_BONUS_RESPONSE, function () {
|
|
1252
1252
|
return _this.updateBonuses();
|
|
1253
1253
|
});
|
|
1254
|
+
on(exports.ClassId.SAW_DO_SPIN_BATCH_RESPONSE, function () {
|
|
1255
|
+
return _this.updateOnAddSpin();
|
|
1256
|
+
});
|
|
1254
1257
|
}
|
|
1255
1258
|
}
|
|
1256
1259
|
/** Returns information about current user
|
|
@@ -1678,6 +1681,8 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1678
1681
|
}
|
|
1679
1682
|
/**
|
|
1680
1683
|
* Plays the specified by template_id mini-game on behalf of user and returns prize_id or err_code
|
|
1684
|
+
* After playMiniGame is called, you can call getMiniGames to get the list of mini-games.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 playMiniGame with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
1685
|
+
* 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.
|
|
1681
1686
|
*
|
|
1682
1687
|
* **Example**:
|
|
1683
1688
|
* ```
|
|
@@ -1689,9 +1694,14 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1689
1694
|
* **Visitor mode: not supported**
|
|
1690
1695
|
*/
|
|
1691
1696
|
;
|
|
1692
|
-
_proto.playMiniGame = function playMiniGame(template_id) {
|
|
1697
|
+
_proto.playMiniGame = function playMiniGame(template_id, _temp5) {
|
|
1698
|
+
var _ref5 = _temp5 === void 0 ? {} : _temp5,
|
|
1699
|
+
onUpdate = _ref5.onUpdate;
|
|
1693
1700
|
try {
|
|
1694
1701
|
var _this17 = this;
|
|
1702
|
+
if (onUpdate) {
|
|
1703
|
+
_this17.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
|
|
1704
|
+
}
|
|
1695
1705
|
return Promise.resolve(_this17.api.sawSpinRequest(null, template_id)).then(function (r) {
|
|
1696
1706
|
_this17.api.doAcknowledgeRequest(null, r.request_id);
|
|
1697
1707
|
var o = {
|
|
@@ -1707,6 +1717,8 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1707
1717
|
}
|
|
1708
1718
|
/**
|
|
1709
1719
|
* Plays the specified by template_id mini-game on behalf of user spin_count times and returns array of the prizes
|
|
1720
|
+
* After playMiniGameBatch is called, you can call getMiniGames to get the list of mini-games. 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 playMiniGameBatch with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
1721
|
+
* 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.
|
|
1710
1722
|
*
|
|
1711
1723
|
* **Example**:
|
|
1712
1724
|
* ```
|
|
@@ -1717,9 +1729,14 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1717
1729
|
* **Visitor mode: not supported**
|
|
1718
1730
|
*/
|
|
1719
1731
|
;
|
|
1720
|
-
_proto.playMiniGameBatch = function playMiniGameBatch(template_id, spin_count) {
|
|
1732
|
+
_proto.playMiniGameBatch = function playMiniGameBatch(template_id, spin_count, _temp6) {
|
|
1733
|
+
var _ref6 = _temp6 === void 0 ? {} : _temp6,
|
|
1734
|
+
onUpdate = _ref6.onUpdate;
|
|
1721
1735
|
try {
|
|
1722
1736
|
var _this18 = this;
|
|
1737
|
+
if (onUpdate) {
|
|
1738
|
+
_this18.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
|
|
1739
|
+
}
|
|
1723
1740
|
return Promise.resolve(_this18.api.sawSpinBatchRequest(null, template_id, spin_count)).then(function (response) {
|
|
1724
1741
|
var request_ids = response.results.map(function (result) {
|
|
1725
1742
|
return result.request_id;
|
|
@@ -1799,9 +1816,9 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1799
1816
|
* ```
|
|
1800
1817
|
* */
|
|
1801
1818
|
;
|
|
1802
|
-
_proto.getTournamentsList = function getTournamentsList(
|
|
1803
|
-
var
|
|
1804
|
-
onUpdate =
|
|
1819
|
+
_proto.getTournamentsList = function getTournamentsList(_temp7) {
|
|
1820
|
+
var _ref7 = _temp7 === void 0 ? {} : _temp7,
|
|
1821
|
+
onUpdate = _ref7.onUpdate;
|
|
1805
1822
|
try {
|
|
1806
1823
|
var _this21 = this;
|
|
1807
1824
|
if (onUpdate) {
|
|
@@ -1910,12 +1927,12 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1910
1927
|
* @param params
|
|
1911
1928
|
*/
|
|
1912
1929
|
;
|
|
1913
|
-
_proto.getInboxMessages = function getInboxMessages(
|
|
1914
|
-
var
|
|
1915
|
-
from =
|
|
1916
|
-
to =
|
|
1917
|
-
onlyFavorite =
|
|
1918
|
-
onUpdate =
|
|
1930
|
+
_proto.getInboxMessages = function getInboxMessages(_temp8) {
|
|
1931
|
+
var _ref8 = _temp8 === void 0 ? {} : _temp8,
|
|
1932
|
+
from = _ref8.from,
|
|
1933
|
+
to = _ref8.to,
|
|
1934
|
+
onlyFavorite = _ref8.onlyFavorite,
|
|
1935
|
+
onUpdate = _ref8.onUpdate;
|
|
1919
1936
|
try {
|
|
1920
1937
|
var _this25 = this;
|
|
1921
1938
|
if (onUpdate) {
|
|
@@ -2080,14 +2097,14 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
2080
2097
|
_proto.updateOnPrizeWin = function updateOnPrizeWin(data) {
|
|
2081
2098
|
try {
|
|
2082
2099
|
var _this35 = this;
|
|
2083
|
-
var
|
|
2100
|
+
var _temp9 = function () {
|
|
2084
2101
|
if (data.errCode === exports.SAWSpinErrorCode.SAW_OK) {
|
|
2085
2102
|
return Promise.resolve(_this35.api.sawGetTemplatesT(null)).then(function (updatedTemplates) {
|
|
2086
2103
|
_this35.updateEntity(onUpdateContextKey.Saw, updatedTemplates);
|
|
2087
2104
|
});
|
|
2088
2105
|
}
|
|
2089
2106
|
}();
|
|
2090
|
-
return Promise.resolve(
|
|
2107
|
+
return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
|
|
2091
2108
|
} catch (e) {
|
|
2092
2109
|
return Promise.reject(e);
|
|
2093
2110
|
}
|
|
@@ -2197,7 +2214,7 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
2197
2214
|
return Promise.reject(e);
|
|
2198
2215
|
}
|
|
2199
2216
|
}, JACKPOT_TEMPLATE_CACHE_SEC)).then(function (_OCache$use) {
|
|
2200
|
-
function
|
|
2217
|
+
function _temp11() {
|
|
2201
2218
|
return jackpots.map(function (jp) {
|
|
2202
2219
|
var _jp = _extends({}, jp, {
|
|
2203
2220
|
pot: pots.find(function (p) {
|
|
@@ -2208,7 +2225,7 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
2208
2225
|
});
|
|
2209
2226
|
}
|
|
2210
2227
|
jackpots = _OCache$use;
|
|
2211
|
-
var
|
|
2228
|
+
var _temp10 = function () {
|
|
2212
2229
|
if (jackpots.length > 0) {
|
|
2213
2230
|
return Promise.resolve(OCache.use(onUpdateContextKey.Pots, exports.ECacheContext.WSAPI, function () {
|
|
2214
2231
|
try {
|
|
@@ -2228,7 +2245,7 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
2228
2245
|
});
|
|
2229
2246
|
}
|
|
2230
2247
|
}();
|
|
2231
|
-
return
|
|
2248
|
+
return _temp10 && _temp10.then ? _temp10.then(_temp11) : _temp11(_temp10);
|
|
2232
2249
|
});
|
|
2233
2250
|
} catch (e) {
|
|
2234
2251
|
return Promise.reject(e);
|