@smartico/public-api 0.0.383 → 0.0.385
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/index.js +25 -16
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +25 -16
- package/dist/index.modern.mjs.map +1 -1
- package/package.json +1 -1
- package/src/Inbox/InboxMessage.ts +3 -0
- package/src/Tournaments/Tournament.ts +1 -1
- package/src/WSAPI/WSAPIBase.ts +1 -1
- package/src/WSAPI/WSAPIBonuses.ts +1 -1
- package/src/WSAPI/WSAPIClans.ts +1 -1
- package/src/WSAPI/WSAPIInbox.ts +2 -2
- package/src/WSAPI/WSAPIJackpots.ts +4 -1
- package/src/WSAPI/WSAPIMiniGames.ts +6 -3
- package/src/WSAPI/WSAPIMissions.ts +1 -1
- package/src/WSAPI/WSAPIRaffles.ts +1 -1
- package/src/WSAPI/WSAPIStore.ts +2 -2
- package/src/WSAPI/WSAPITournaments.ts +1 -1
- package/src/WSAPI/WSAPIUser.ts +1 -1
package/package.json
CHANGED
|
@@ -76,7 +76,7 @@ export interface Tournament {
|
|
|
76
76
|
|
|
77
77
|
export const TournamentItemsTransform = (items: Tournament[]): TTournament[] => {
|
|
78
78
|
return items
|
|
79
|
-
.filter((r) => r.tournamentId >= 1)
|
|
79
|
+
.filter((r) => r != null && r.tournamentId >= 1)
|
|
80
80
|
.map((r) => {
|
|
81
81
|
const x: TTournament = {
|
|
82
82
|
instance_id: r.tournamentInstanceId,
|
package/src/WSAPI/WSAPIBase.ts
CHANGED
|
@@ -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
|
|
package/src/WSAPI/WSAPIClans.ts
CHANGED
|
@@ -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
|
|
package/src/WSAPI/WSAPIInbox.ts
CHANGED
|
@@ -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(
|
|
@@ -121,6 +121,9 @@ export class WSAPIJackpots extends WSAPIClans {
|
|
|
121
121
|
ECacheContext.WSAPI,
|
|
122
122
|
async () => {
|
|
123
123
|
const _jackpots = await this.api.jackpotGet(this.userExtId, filter);
|
|
124
|
+
if (!_jackpots?.items) {
|
|
125
|
+
return [];
|
|
126
|
+
}
|
|
124
127
|
const _pots = _jackpots.items.map((jp) => jp.pot);
|
|
125
128
|
|
|
126
129
|
_jackpots.items.forEach((jp) => {
|
|
@@ -434,7 +437,7 @@ export class WSAPIJackpots extends WSAPIClans {
|
|
|
434
437
|
/** Optional callback; not auto-invoked today. */
|
|
435
438
|
onUpdate?: () => void,
|
|
436
439
|
}): Promise<TGetJackpotEligibleGamesResponse> {
|
|
437
|
-
if (onUpdate) {
|
|
440
|
+
if (typeof onUpdate === 'function') {
|
|
438
441
|
this.onUpdateCallback.set(onUpdateContextKey.JackpotEligibleGames, onUpdate);
|
|
439
442
|
}
|
|
440
443
|
|
|
@@ -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
|
|
|
@@ -586,6 +586,9 @@ export class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
586
586
|
CACHE_DATA_SEC,
|
|
587
587
|
);
|
|
588
588
|
const index = templates.findIndex((t) => t.id === data.saw_template_id);
|
|
589
|
+
if (index === -1) {
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
589
592
|
templates[index].spin_count = data.spin_count;
|
|
590
593
|
this.updateEntity(onUpdateContextKey.Saw, templates);
|
|
591
594
|
}
|
|
@@ -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
|
|
package/src/WSAPI/WSAPIStore.ts
CHANGED
|
@@ -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
|
|
package/src/WSAPI/WSAPIUser.ts
CHANGED
|
@@ -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
|
|