@smartico/public-api 0.0.383 → 0.0.384

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartico/public-api",
3
- "version": "0.0.383",
3
+ "version": "0.0.384",
4
4
  "description": "Smartico public API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -86,7 +86,7 @@ export abstract class WSAPIBase {
86
86
  OCache.set(contextKey, payload, ECacheContext.WSAPI);
87
87
 
88
88
  const onUpdate = this.onUpdateCallback.get(contextKey);
89
- if (onUpdate) {
89
+ if (typeof onUpdate === 'function') {
90
90
  onUpdate(payload);
91
91
  }
92
92
  }
@@ -133,7 +133,7 @@ export class WSAPIBonuses extends WSAPIMissions {
133
133
  * ```
134
134
  */
135
135
  public async getBonuses({ onUpdate }: { onUpdate?: (data: TBonus[]) => void } = {}): Promise<TBonus[]> {
136
- if (onUpdate) {
136
+ if (typeof onUpdate === 'function') {
137
137
  this.onUpdateCallback.set(onUpdateContextKey.Bonuses, onUpdate);
138
138
  }
139
139
 
@@ -134,7 +134,7 @@ export class WSAPIClans extends WSAPITournaments {
134
134
  * ```
135
135
  */
136
136
  public async getClans({ onUpdate }: { onUpdate?: (data: TClans) => void } = {}): Promise<TClans> {
137
- if (onUpdate) {
137
+ if (typeof onUpdate === 'function') {
138
138
  this.onUpdateCallback.set(onUpdateContextKey.Clans, onUpdate);
139
139
  }
140
140
 
@@ -265,7 +265,7 @@ export class WSAPIInbox extends WSAPILeaderBoard {
265
265
  read_status?: InboxReadStatus;
266
266
  onUpdate?: (data: TInboxMessage[]) => void;
267
267
  } = {}): Promise<TInboxMessage[]> {
268
- if (onUpdate) {
268
+ if (typeof onUpdate === 'function') {
269
269
  this.onUpdateCallback.set(onUpdateContextKey.InboxMessages, onUpdate);
270
270
  }
271
271
  return await this.api.getInboxMessagesT(this.userExtId, from, to, onlyFavorite, categoryId, read_status);
@@ -321,7 +321,7 @@ export class WSAPIInbox extends WSAPILeaderBoard {
321
321
  * ```
322
322
  */
323
323
  public async getInboxUnreadCount({ onUpdate }: { onUpdate?: (unread_count: number) => void } = {}): Promise<number> {
324
- if (onUpdate) {
324
+ if (typeof onUpdate === 'function') {
325
325
  this.onUpdateCallback.set(onUpdateContextKey.InboxUnreadCount, onUpdate);
326
326
  }
327
327
  return OCache.use(
@@ -434,7 +434,7 @@ export class WSAPIJackpots extends WSAPIClans {
434
434
  /** Optional callback; not auto-invoked today. */
435
435
  onUpdate?: () => void,
436
436
  }): Promise<TGetJackpotEligibleGamesResponse> {
437
- if (onUpdate) {
437
+ if (typeof onUpdate === 'function') {
438
438
  this.onUpdateCallback.set(onUpdateContextKey.JackpotEligibleGames, onUpdate);
439
439
  }
440
440
 
@@ -111,7 +111,7 @@ export class WSAPIMiniGames extends WSAPIRaffles {
111
111
  public async getMiniGames({ onUpdate }: { onUpdate?: (data: TMiniGameTemplate[]) => void } = {}): Promise<
112
112
  TMiniGameTemplate[]
113
113
  > {
114
- if (onUpdate) {
114
+ if (typeof onUpdate === 'function') {
115
115
  this.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
116
116
  }
117
117
 
@@ -369,7 +369,7 @@ export class WSAPIMiniGames extends WSAPIRaffles {
369
369
  template_id: number,
370
370
  { onUpdate }: { onUpdate?: (data: TMiniGameTemplate[]) => void } = {},
371
371
  ): Promise<TMiniGamePlayResult> {
372
- if (onUpdate) {
372
+ if (typeof onUpdate === 'function') {
373
373
  this.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
374
374
  }
375
375
 
@@ -558,7 +558,7 @@ export class WSAPIMiniGames extends WSAPIRaffles {
558
558
  spin_count: number,
559
559
  { onUpdate }: { onUpdate?: (data: TMiniGameTemplate[]) => void } = {},
560
560
  ): Promise<TMiniGamePlayBatchResult[]> {
561
- if (onUpdate) {
561
+ if (typeof onUpdate === 'function') {
562
562
  this.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
563
563
  }
564
564
 
@@ -138,7 +138,7 @@ export class WSAPIMissions extends WSAPIGeneral {
138
138
  * ```
139
139
  */
140
140
  public async getMissions({ onUpdate }: { onUpdate?: (data: TMissionOrBadge[]) => void } = {}): Promise<TMissionOrBadge[]> {
141
- if (onUpdate) {
141
+ if (typeof onUpdate === 'function') {
142
142
  this.onUpdateCallback.set(onUpdateContextKey.Missions, onUpdate);
143
143
  }
144
144
 
@@ -133,7 +133,7 @@ export class WSAPIRaffles extends WSAPIJackpots {
133
133
  * ```
134
134
  */
135
135
  public async getRaffles({ onUpdate }: { onUpdate?: (data: TRaffle[]) => void } = {}): Promise<TRaffle[]> {
136
- if (onUpdate) {
136
+ if (typeof onUpdate === 'function') {
137
137
  this.onUpdateCallback.set(onUpdateContextKey.Raffles, onUpdate);
138
138
  }
139
139
 
@@ -194,7 +194,7 @@ export class WSAPIStore extends WSAPIBonuses {
194
194
  * ```
195
195
  */
196
196
  public async getStoreItems({ onUpdate }: { onUpdate?: (data: TStoreItem[]) => void } = {}): Promise<TStoreItem[]> {
197
- if (onUpdate) {
197
+ if (typeof onUpdate === 'function') {
198
198
  this.onUpdateCallback.set(onUpdateContextKey.StoreItems, onUpdate);
199
199
  }
200
200
  return OCache.use(
@@ -696,7 +696,7 @@ export class WSAPIStore extends WSAPIBonuses {
696
696
  const requestOffset = offset === undefined ? 0 : offset;
697
697
  const cacheKey = this.storeHistoryCacheKey(requestLimit, requestOffset);
698
698
 
699
- if (onUpdate) {
699
+ if (typeof onUpdate === 'function') {
700
700
  this.onUpdateCallback.set(onUpdateContextKey.StoreHistory, onUpdate);
701
701
  this.storeHistoryOnUpdateParams = { limit: requestLimit, offset: requestOffset };
702
702
  }
@@ -138,7 +138,7 @@ export class WSAPITournaments extends WSAPIStore {
138
138
  * ```
139
139
  */
140
140
  public async getTournamentsList({ onUpdate }: { onUpdate?: (data: TTournament[]) => void } = {}): Promise<TTournament[]> {
141
- if (onUpdate) {
141
+ if (typeof onUpdate === 'function') {
142
142
  this.onUpdateCallback.set(onUpdateContextKey.TournamentList, onUpdate);
143
143
  }
144
144
 
@@ -584,7 +584,7 @@ export class WSAPIUser extends WSAPIBase {
584
584
  onUpdate?: (data: TActivityLog[]) => void;
585
585
  }): Promise<TActivityLog[]> {
586
586
 
587
- if (onUpdate) {
587
+ if (typeof onUpdate === 'function') {
588
588
  this.onUpdateCallback.set(onUpdateContextKey.ActivityLog, onUpdate);
589
589
  }
590
590