@smartico/public-api 0.0.277 → 0.0.279

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.
@@ -1895,6 +1895,7 @@ class WSAPI {
1895
1895
  on(ClassId.ACHIEVEMENT_CLAIM_PRIZE_RESPONSE, () => this.updateMissions());
1896
1896
  on(ClassId.RELOAD_ACHIEVEMENTS_EVENT, () => this.updateMissions());
1897
1897
  on(ClassId.TOURNAMENT_REGISTER_RESPONSE, () => this.updateTournaments());
1898
+ on(ClassId.BUY_SHOP_ITEM_RESPONSE, () => this.updateStorePurchasedItems());
1898
1899
  on(ClassId.CLIENT_ENGAGEMENT_EVENT_NEW, () => this.updateInboxMessages());
1899
1900
  on(ClassId.LOGOUT_RESPONSE, () => OCache.clearContext(ECacheContext.WSAPI));
1900
1901
  on(ClassId.IDENTIFY_RESPONSE, () => OCache.clearContext(ECacheContext.WSAPI));
@@ -2134,6 +2135,9 @@ class WSAPI {
2134
2135
  * Returns purchased items based on the provided parameters. "Limit" and "offset" indicate the range of items to be fetched.
2135
2136
  * The maximum number of items per request is limited to 20.
2136
2137
  * You can leave this params empty and by default it will return list of purchased items ranging from 0 to 20.
2138
+ * The returned store items are cached for 30 seconds. But you can pass the onUpdate callback as a parameter.
2139
+ * Note that each time you call getStorePurchasedItems with a new onUpdate callback, the old one will be overwritten by the new one.
2140
+ * The onUpdate callback will be called on purchase of the store item and the last 20 items will be passed to it.
2137
2141
  *
2138
2142
  * **Example**:
2139
2143
  * ```
@@ -2555,6 +2559,10 @@ class WSAPI {
2555
2559
  const payload = await this.api.tournamentsGetLobbyT(null);
2556
2560
  this.updateEntity(onUpdateContextKey.TournamentList, payload);
2557
2561
  }
2562
+ async updateStorePurchasedItems() {
2563
+ const payload = await this.api.storeGetPurchasedItemsT(null, 20, 0);
2564
+ this.updateEntity(onUpdateContextKey.StoreHistory, payload);
2565
+ }
2558
2566
  async updateInboxMessages() {
2559
2567
  const payload = await this.api.getInboxMessagesT(null);
2560
2568
  this.updateEntity(onUpdateContextKey.InboxMessages, payload);
@@ -3507,7 +3515,7 @@ class SmarticoAPI {
3507
3515
  include_users: true
3508
3516
  });
3509
3517
  const response = await this.send(message, ClassId.GET_LEADERS_BOARD_RESPONSE, force_language);
3510
- const boardKey = Object.keys(response.map).find(k => period_type_id === undefined || k === (period_type_id == null ? void 0 : period_type_id.toString()));
3518
+ const boardKey = Object.keys(response.map || {}).find(k => period_type_id === undefined || k === (period_type_id == null ? void 0 : period_type_id.toString()));
3511
3519
  if (boardKey === undefined) {
3512
3520
  return undefined;
3513
3521
  }