@smartico/public-api 0.0.162 → 0.0.164

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.
@@ -264,6 +264,7 @@ var SAWAcknowledgeType;
264
264
  SAWAcknowledgeType[SAWAcknowledgeType["Silent"] = 1] = "Silent";
265
265
  SAWAcknowledgeType[SAWAcknowledgeType["QuickMessage"] = 2] = "QuickMessage";
266
266
  SAWAcknowledgeType[SAWAcknowledgeType["FullMessage"] = 3] = "FullMessage";
267
+ SAWAcknowledgeType[SAWAcknowledgeType["ExplicityAcknowledge"] = 4] = "ExplicityAcknowledge";
267
268
  })(SAWAcknowledgeType || (SAWAcknowledgeType = {}));
268
269
 
269
270
  var SAWAskForUsername;
@@ -1179,14 +1180,16 @@ class WSAPI {
1179
1180
  on(ClassId.SAW_SPINS_COUNT_PUSH, data => this.updateOnSpin(data));
1180
1181
  on(ClassId.SAW_SHOW_SPIN_PUSH, () => this.updateOnAddSpin());
1181
1182
  on(ClassId.SAW_DO_SPIN_RESPONSE, data => on(ClassId.SAW_AKNOWLEDGE_RESPONSE, () => this.updateOnPrizeWin(data)));
1182
- on(ClassId.MISSION_OPTIN_RESPONSE, () => this.updateMissionsOnOptIn());
1183
- on(ClassId.TOURNAMENT_REGISTER_RESPONSE, () => this.updateTournamentsOnRegistration());
1183
+ on(ClassId.MISSION_OPTIN_RESPONSE, () => this.updateMissions());
1184
+ on(ClassId.ACHIEVEMENT_CLAIM_PRIZE_RESPONSE, () => this.updateMissions());
1185
+ on(ClassId.RELOAD_ACHIEVEMENTS_EVENT, () => this.updateMissions());
1186
+ on(ClassId.TOURNAMENT_REGISTER_RESPONSE, () => this.updateTournaments());
1184
1187
  on(ClassId.CLIENT_ENGAGEMENT_EVENT_NEW, () => this.updateInboxMessages());
1185
1188
  on(ClassId.LOGOUT_RESPONSE, () => OCache.clearContext(ECacheContext.WSAPI));
1186
1189
  on(ClassId.IDENTIFY_RESPONSE, () => OCache.clearContext(ECacheContext.WSAPI));
1187
1190
  on(ClassId.JP_WIN_PUSH, data => this.jackpotClearCache());
1188
1191
  on(ClassId.JP_OPTOUT_RESPONSE, data => this.jackpotClearCache());
1189
- on(ClassId.JP_OPTIN_RESPONSE, data => this.jackpotClearCache());
1192
+ on(ClassId.CLAIM_BONUS_RESPONSE, () => this.updateBonuses());
1190
1193
  }
1191
1194
  }
1192
1195
  /** Returns information about current user
@@ -1296,17 +1299,22 @@ class WSAPI {
1296
1299
  *
1297
1300
  * **Visitor mode: not supported**
1298
1301
  */
1299
- async getBonuses() {
1302
+ async getBonuses({
1303
+ onUpdate
1304
+ } = {}) {
1305
+ if (onUpdate) {
1306
+ this.onUpdateCallback.set(onUpdateContextKey.Bonuses, onUpdate);
1307
+ }
1300
1308
  return OCache.use(onUpdateContextKey.Bonuses, ECacheContext.WSAPI, () => this.api.bonusesGetItemsT(null), CACHE_DATA_SEC);
1301
1309
  }
1302
1310
  /**
1303
- * Claim the bonus by bonus_id. Returns the err_code in case of success or error.
1304
- * Note that this method can be used only on integrations where originally failed bonus can be claimed again.
1305
- * For example, user won a bonus in the mini-game, but Operator rejected this bonus.
1306
- * This bonus will be available for the user to claim again.
1307
- *
1308
- * **Visitor mode: not supported**
1309
- */
1311
+ * Claim the bonus by bonus_id. Returns the err_code in case of success or error.
1312
+ * Note that this method can be used only on integrations where originally failed bonus can be claimed again.
1313
+ * For example, user won a bonus in the mini-game, but Operator rejected this bonus.
1314
+ * This bonus will be available for the user to claim again.
1315
+ *
1316
+ * **Visitor mode: not supported**
1317
+ */
1310
1318
  async claimBonus(bonus_id) {
1311
1319
  const r = await this.api.bonusClaimItem(null, bonus_id);
1312
1320
  const o = {
@@ -1728,21 +1736,19 @@ class WSAPI {
1728
1736
  }
1729
1737
  async updateOnPrizeWin(data) {
1730
1738
  if (data.errCode === SAWSpinErrorCode.SAW_OK) {
1731
- var _template$prizes$find;
1732
- const templates = await OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, () => this.api.sawGetTemplatesT(null), CACHE_DATA_SEC);
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
- }
1739
+ const updatedTemplates = await this.api.sawGetTemplatesT(null);
1740
+ this.updateEntity(onUpdateContextKey.Saw, updatedTemplates);
1739
1741
  }
1740
1742
  }
1741
- async updateMissionsOnOptIn() {
1743
+ async updateMissions() {
1742
1744
  const payload = await this.api.missionsGetItemsT(null);
1743
1745
  this.updateEntity(onUpdateContextKey.Missions, payload);
1744
1746
  }
1745
- async updateTournamentsOnRegistration() {
1747
+ async updateBonuses() {
1748
+ const payload = await this.api.bonusesGetItemsT(null);
1749
+ this.updateEntity(onUpdateContextKey.Bonuses, payload);
1750
+ }
1751
+ async updateTournaments() {
1746
1752
  const payload = await this.api.tournamentsGetLobbyT(null);
1747
1753
  this.updateEntity(onUpdateContextKey.TournamentList, payload);
1748
1754
  }