@smartico/public-api 0.0.162 → 0.0.163
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 +13 -10
- package/dist/index.js +73 -70
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +26 -21
- package/dist/index.modern.mjs.map +1 -1
- package/docs/classes/WSAPI.md +4 -1
- package/package.json +1 -1
- package/src/WSAPI/WSAPI.ts +20 -29
package/dist/index.modern.mjs
CHANGED
|
@@ -1179,14 +1179,16 @@ class WSAPI {
|
|
|
1179
1179
|
on(ClassId.SAW_SPINS_COUNT_PUSH, data => this.updateOnSpin(data));
|
|
1180
1180
|
on(ClassId.SAW_SHOW_SPIN_PUSH, () => this.updateOnAddSpin());
|
|
1181
1181
|
on(ClassId.SAW_DO_SPIN_RESPONSE, data => on(ClassId.SAW_AKNOWLEDGE_RESPONSE, () => this.updateOnPrizeWin(data)));
|
|
1182
|
-
on(ClassId.MISSION_OPTIN_RESPONSE, () => this.
|
|
1183
|
-
on(ClassId.
|
|
1182
|
+
on(ClassId.MISSION_OPTIN_RESPONSE, () => this.updateMissions());
|
|
1183
|
+
on(ClassId.ACHIEVEMENT_CLAIM_PRIZE_RESPONSE, () => this.updateMissions());
|
|
1184
|
+
on(ClassId.RELOAD_ACHIEVEMENTS_EVENT, () => this.updateMissions());
|
|
1185
|
+
on(ClassId.TOURNAMENT_REGISTER_RESPONSE, () => this.updateTournaments());
|
|
1184
1186
|
on(ClassId.CLIENT_ENGAGEMENT_EVENT_NEW, () => this.updateInboxMessages());
|
|
1185
1187
|
on(ClassId.LOGOUT_RESPONSE, () => OCache.clearContext(ECacheContext.WSAPI));
|
|
1186
1188
|
on(ClassId.IDENTIFY_RESPONSE, () => OCache.clearContext(ECacheContext.WSAPI));
|
|
1187
1189
|
on(ClassId.JP_WIN_PUSH, data => this.jackpotClearCache());
|
|
1188
1190
|
on(ClassId.JP_OPTOUT_RESPONSE, data => this.jackpotClearCache());
|
|
1189
|
-
on(ClassId.
|
|
1191
|
+
on(ClassId.CLAIM_BONUS_RESPONSE, () => this.updateBonuses());
|
|
1190
1192
|
}
|
|
1191
1193
|
}
|
|
1192
1194
|
/** Returns information about current user
|
|
@@ -1296,17 +1298,22 @@ class WSAPI {
|
|
|
1296
1298
|
*
|
|
1297
1299
|
* **Visitor mode: not supported**
|
|
1298
1300
|
*/
|
|
1299
|
-
async getBonuses(
|
|
1301
|
+
async getBonuses({
|
|
1302
|
+
onUpdate
|
|
1303
|
+
} = {}) {
|
|
1304
|
+
if (onUpdate) {
|
|
1305
|
+
this.onUpdateCallback.set(onUpdateContextKey.Bonuses, onUpdate);
|
|
1306
|
+
}
|
|
1300
1307
|
return OCache.use(onUpdateContextKey.Bonuses, ECacheContext.WSAPI, () => this.api.bonusesGetItemsT(null), CACHE_DATA_SEC);
|
|
1301
1308
|
}
|
|
1302
1309
|
/**
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
+
* Claim the bonus by bonus_id. Returns the err_code in case of success or error.
|
|
1311
|
+
* Note that this method can be used only on integrations where originally failed bonus can be claimed again.
|
|
1312
|
+
* For example, user won a bonus in the mini-game, but Operator rejected this bonus.
|
|
1313
|
+
* This bonus will be available for the user to claim again.
|
|
1314
|
+
*
|
|
1315
|
+
* **Visitor mode: not supported**
|
|
1316
|
+
*/
|
|
1310
1317
|
async claimBonus(bonus_id) {
|
|
1311
1318
|
const r = await this.api.bonusClaimItem(null, bonus_id);
|
|
1312
1319
|
const o = {
|
|
@@ -1728,21 +1735,19 @@ class WSAPI {
|
|
|
1728
1735
|
}
|
|
1729
1736
|
async updateOnPrizeWin(data) {
|
|
1730
1737
|
if (data.errCode === SAWSpinErrorCode.SAW_OK) {
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
const template = templates.find(t => t.prizes.find(p => p.id === data.saw_prize_id));
|
|
1734
|
-
const prizeType = (_template$prizes$find = template.prizes.find(p => p.id === data.saw_prize_id)) == null ? void 0 : _template$prizes$find.prize_type;
|
|
1735
|
-
if (template.jackpot_add_on_attempt || template.spin_count === 1 || prizeType === MiniGamePrizeTypeName.JACKPOT || prizeType === MiniGamePrizeTypeName.SPIN) {
|
|
1736
|
-
const updatedTemplates = await this.api.sawGetTemplatesT(null);
|
|
1737
|
-
this.updateEntity(onUpdateContextKey.Saw, updatedTemplates);
|
|
1738
|
-
}
|
|
1738
|
+
const updatedTemplates = await this.api.sawGetTemplatesT(null);
|
|
1739
|
+
this.updateEntity(onUpdateContextKey.Saw, updatedTemplates);
|
|
1739
1740
|
}
|
|
1740
1741
|
}
|
|
1741
|
-
async
|
|
1742
|
+
async updateMissions() {
|
|
1742
1743
|
const payload = await this.api.missionsGetItemsT(null);
|
|
1743
1744
|
this.updateEntity(onUpdateContextKey.Missions, payload);
|
|
1744
1745
|
}
|
|
1745
|
-
async
|
|
1746
|
+
async updateBonuses() {
|
|
1747
|
+
const payload = await this.api.bonusesGetItemsT(null);
|
|
1748
|
+
this.updateEntity(onUpdateContextKey.Bonuses, payload);
|
|
1749
|
+
}
|
|
1750
|
+
async updateTournaments() {
|
|
1746
1751
|
const payload = await this.api.tournamentsGetLobbyT(null);
|
|
1747
1752
|
this.updateEntity(onUpdateContextKey.TournamentList, payload);
|
|
1748
1753
|
}
|