@smartico/public-api 0.0.141 → 0.0.143
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/README.md +14 -1
- package/dist/CustomSections/AchCustomSection.d.ts +27 -0
- package/dist/CustomSections/GetCustomSectionsRequest.d.ts +3 -0
- package/dist/CustomSections/GetCustomSectionsResponse.d.ts +7 -0
- package/dist/CustomSections/UICustomSection.d.ts +15 -0
- package/dist/CustomSections/index.d.ts +4 -0
- package/dist/Missions/AchievementPublicMeta.d.ts +1 -0
- package/dist/Missions/UserAchievement.d.ts +1 -0
- package/dist/OCache.d.ts +1 -0
- package/dist/SmarticoAPI.d.ts +17 -14
- package/dist/WSAPI/WSAPI.d.ts +270 -48
- package/dist/WSAPI/WSAPITypes.d.ts +25 -0
- package/dist/index.js +559 -214
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +382 -95
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +1 -0
- package/docs/classes/WSAPI.md +234 -27
- package/docs/enums/AchCustomLayoutTheme.md +27 -0
- package/docs/enums/AchCustomSectionType.md +43 -0
- package/docs/enums/AchMissionsTabsOptions.md +21 -0
- package/docs/enums/AchOverviewMissionsFilter.md +33 -0
- package/docs/interfaces/TUICustomSection.md +85 -0
- package/package.json +1 -1
- package/src/CustomSections/AchCustomSection.ts +30 -0
- package/src/CustomSections/GetCustomSectionsRequest.ts +5 -0
- package/src/CustomSections/GetCustomSectionsResponse.ts +7 -0
- package/src/CustomSections/UICustomSection.ts +34 -0
- package/src/CustomSections/index.ts +4 -0
- package/src/Level/GetLevelMapResponse.ts +1 -1
- package/src/Missions/AchievementPublicMeta.ts +1 -0
- package/src/Missions/UserAchievement.ts +3 -1
- package/src/OCache.ts +5 -0
- package/src/SmarticoAPI.ts +42 -34
- package/src/WSAPI/WSAPI.ts +296 -64
- package/src/WSAPI/WSAPITypes.ts +27 -0
package/src/WSAPI/WSAPI.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { CoreUtils } from "../Core";
|
|
|
3
3
|
import { MiniGamePrizeTypeName, SAWDoSpinResponse, SAWSpinErrorCode, SAWSpinsCountPush } from "../MiniGames";
|
|
4
4
|
import { ECacheContext, OCache } from "../OCache";
|
|
5
5
|
import { SmarticoAPI } from "../SmarticoAPI";
|
|
6
|
-
import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TSegmentCheckResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUserProfile, UserLevelExtraCountersT } from "./WSAPITypes";
|
|
6
|
+
import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TSegmentCheckResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUICustomSection, TUserProfile, UserLevelExtraCountersT } from "./WSAPITypes";
|
|
7
7
|
import { LeaderBoardPeriodType } from "../Leaderboard";
|
|
8
8
|
import { JackpotDetails, JackpotPot, JackpotWinPush, JackpotsOptinResponse, JackpotsOptoutRequest, JackpotsOptoutResponse } from "../Jackpots";
|
|
9
9
|
|
|
@@ -30,6 +30,7 @@ enum onUpdateContextKey {
|
|
|
30
30
|
StoreHistory = 'storeHistory',
|
|
31
31
|
Jackpots = 'jackpots',
|
|
32
32
|
Pots = 'Pots',
|
|
33
|
+
CustomSections = 'customSections'
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
|
|
@@ -41,27 +42,33 @@ export class WSAPI {
|
|
|
41
42
|
|
|
42
43
|
/** @private */
|
|
43
44
|
constructor(private api: SmarticoAPI) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
|
|
46
|
+
OCache.clearAll();
|
|
47
|
+
if (this.api.tracker) {
|
|
48
|
+
const on = this.api.tracker.on;
|
|
49
|
+
on(ClassId.SAW_SPINS_COUNT_PUSH, (data: SAWSpinsCountPush) => this.updateOnSpin(data));
|
|
50
|
+
on(ClassId.SAW_SHOW_SPIN_PUSH, () => this.updateOnAddSpin());
|
|
51
|
+
on(ClassId.SAW_DO_SPIN_RESPONSE, (data: SAWDoSpinResponse) => on(ClassId.SAW_AKNOWLEDGE_RESPONSE, () => this.updateOnPrizeWin(data)));
|
|
52
|
+
on(ClassId.MISSION_OPTIN_RESPONSE, () => this.updateMissionsOnOptIn());
|
|
53
|
+
on(ClassId.TOURNAMENT_REGISTER_RESPONSE, () => this.updateTournamentsOnRegistration());
|
|
54
|
+
on(ClassId.CLIENT_ENGAGEMENT_EVENT_NEW, () => this.updateInboxMessages());
|
|
55
|
+
on(ClassId.LOGOUT_RESPONSE, () => OCache.clearContext(ECacheContext.WSAPI));
|
|
56
|
+
on(ClassId.IDENTIFY_RESPONSE, () => OCache.clearContext(ECacheContext.WSAPI));
|
|
57
|
+
on(ClassId.JP_WIN_PUSH, (data: JackpotWinPush) => this.jackpotClearCache());
|
|
58
|
+
on(ClassId.JP_OPTOUT_RESPONSE, (data: JackpotsOptoutRequest) => this.jackpotClearCache());
|
|
59
|
+
on(ClassId.JP_OPTIN_RESPONSE, (data: JackpotsOptinResponse) => this.jackpotClearCache());
|
|
60
|
+
}
|
|
56
61
|
}
|
|
57
62
|
|
|
58
63
|
/** Returns information about current user
|
|
59
|
-
*
|
|
64
|
+
*
|
|
65
|
+
* **Example**:
|
|
60
66
|
* ```
|
|
61
67
|
* _smartico.api.getUserProfile().then((result) => {
|
|
62
68
|
* console.log(result);
|
|
63
69
|
* });
|
|
64
70
|
* ```
|
|
71
|
+
* **Visitor mode: not supported**
|
|
65
72
|
* */
|
|
66
73
|
public getUserProfile(): TUserProfile {
|
|
67
74
|
if (this.api.tracker) {
|
|
@@ -74,12 +81,14 @@ export class WSAPI {
|
|
|
74
81
|
}
|
|
75
82
|
|
|
76
83
|
/** Check if user belongs to specific segments
|
|
77
|
-
* Example
|
|
84
|
+
* **Example**:
|
|
78
85
|
* ```
|
|
79
86
|
* _smartico.api.checkSegmentMatch(1).then((result) => {
|
|
80
87
|
* console.log(result);
|
|
81
88
|
* });
|
|
82
89
|
* ```
|
|
90
|
+
*
|
|
91
|
+
* **Visitor mode: not supported**
|
|
83
92
|
*/
|
|
84
93
|
public async checkSegmentMatch(segment_id: number): Promise<boolean> {
|
|
85
94
|
const r = await this.api.coreCheckSegments(null, [segment_id]);
|
|
@@ -91,22 +100,30 @@ export class WSAPI {
|
|
|
91
100
|
}
|
|
92
101
|
|
|
93
102
|
/** Check if user belongs to specific list of segments
|
|
94
|
-
* Example
|
|
103
|
+
* **Example**:
|
|
95
104
|
* ```
|
|
96
105
|
* _smartico.api.checkSegmentListMatch([1, 2, 3]).then((result) => {
|
|
97
106
|
* console.log(result);
|
|
98
107
|
* });
|
|
99
108
|
* ```
|
|
109
|
+
* **Visitor mode: not supported**
|
|
100
110
|
*/
|
|
101
111
|
public async checkSegmentListMatch(segment_ids: number[]): Promise<TSegmentCheckResult[]> {
|
|
102
112
|
return await this.api.coreCheckSegments(null, Array.isArray(segment_ids) ? segment_ids : [segment_ids]);
|
|
103
113
|
}
|
|
104
114
|
|
|
105
115
|
/** Returns all the levels available the current user
|
|
106
|
-
* Example
|
|
116
|
+
* **Example**:
|
|
107
117
|
* ```
|
|
108
118
|
* _smartico.api.getLevels().then((result) => {
|
|
109
|
-
*
|
|
119
|
+
* console.log(result);
|
|
120
|
+
* });
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* **Example in the Visitor mode**:
|
|
124
|
+
* ```
|
|
125
|
+
* _smartico.vapi('EN').getLevels().then((result) => {
|
|
126
|
+
* console.log(result);
|
|
110
127
|
* });
|
|
111
128
|
* ```
|
|
112
129
|
*/
|
|
@@ -118,14 +135,20 @@ export class WSAPI {
|
|
|
118
135
|
* The returned missions are cached for 30 seconds. But you can pass the onUpdate callback as a parameter.
|
|
119
136
|
* Note that each time you call getMissions with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
120
137
|
* The onUpdate callback will be called on mission OptIn and the updated missions will be passed to it.
|
|
121
|
-
*
|
|
138
|
+
*
|
|
139
|
+
* **Example**:
|
|
122
140
|
* ```
|
|
123
141
|
* _smartico.api.getMissions().then((result) => {
|
|
124
|
-
*
|
|
142
|
+
* console.log(result);
|
|
143
|
+
* });
|
|
144
|
+
* ```
|
|
145
|
+
*
|
|
146
|
+
* **Example in the Visitor mode**:
|
|
147
|
+
* ```
|
|
148
|
+
* _smartico.vapi('EN').getMissions().then((result) => {
|
|
149
|
+
* console.log(result);
|
|
125
150
|
* });
|
|
126
151
|
* ```
|
|
127
|
-
/**
|
|
128
|
-
* @param params
|
|
129
152
|
*/
|
|
130
153
|
public async getMissions({ onUpdate }: { onUpdate?: (data: TMissionOrBadge[]) => void } = {}): Promise<TMissionOrBadge[]> {
|
|
131
154
|
if (onUpdate) {
|
|
@@ -135,7 +158,11 @@ export class WSAPI {
|
|
|
135
158
|
return OCache.use(onUpdateContextKey.Missions, ECacheContext.WSAPI, () => this.api.missionsGetItemsT(null), CACHE_DATA_SEC);
|
|
136
159
|
}
|
|
137
160
|
|
|
138
|
-
/**
|
|
161
|
+
/**
|
|
162
|
+
* Returns all the badges available the current user
|
|
163
|
+
*
|
|
164
|
+
* **Visitor mode: not supported**
|
|
165
|
+
*/
|
|
139
166
|
public async getBadges(): Promise<TMissionOrBadge[]> {
|
|
140
167
|
return OCache.use(onUpdateContextKey.Badges, ECacheContext.WSAPI, () => this.api.badgetsGetItemsT(null), CACHE_DATA_SEC);
|
|
141
168
|
}
|
|
@@ -144,23 +171,37 @@ export class WSAPI {
|
|
|
144
171
|
* Returns the extra counters for the current user level.
|
|
145
172
|
* These are counters that are configured for each Smartico client separatly by request.
|
|
146
173
|
* For example 1st counter could be total wagering amount, 2nd counter could be total deposit amount, etc.
|
|
147
|
-
*
|
|
174
|
+
*
|
|
175
|
+
* **Example**:
|
|
148
176
|
* ```
|
|
149
177
|
* _smartico.api.getUserLevelExtraCounters().then((result) => {
|
|
150
178
|
* console.log(result);
|
|
151
179
|
* });
|
|
152
180
|
* ```
|
|
181
|
+
*
|
|
182
|
+
* **Visitor mode: not supported**
|
|
153
183
|
*/
|
|
154
184
|
public async getUserLevelExtraCounters(): Promise<UserLevelExtraCountersT> {
|
|
155
185
|
return OCache.use(onUpdateContextKey.LevelExtraCounters, ECacheContext.WSAPI, () => this.api.getUserGamificationInfoT(null), CACHE_DATA_SEC);
|
|
156
186
|
}
|
|
157
187
|
|
|
158
|
-
/**
|
|
159
|
-
*
|
|
188
|
+
/**
|
|
189
|
+
*
|
|
190
|
+
* Returns all the store items available the current user
|
|
191
|
+
*
|
|
192
|
+
* **Example**:
|
|
160
193
|
* ```
|
|
161
194
|
* _smartico.api.getStoreItems().then((result) => {
|
|
162
195
|
* console.log(result);
|
|
163
196
|
* });
|
|
197
|
+
* ```
|
|
198
|
+
*
|
|
199
|
+
* **Example in the Visitor mode**:
|
|
200
|
+
* ```
|
|
201
|
+
* _smartico.vapi('EN').getStoreItems().then((result) => {
|
|
202
|
+
* console.log(result);
|
|
203
|
+
* });
|
|
204
|
+
* ```
|
|
164
205
|
*/
|
|
165
206
|
|
|
166
207
|
public async getStoreItems(): Promise<TStoreItem[]> {
|
|
@@ -168,11 +209,14 @@ export class WSAPI {
|
|
|
168
209
|
}
|
|
169
210
|
|
|
170
211
|
/** Buy the specific shop item by item_id. Returns the err_code in case of success or error.
|
|
171
|
-
* Example
|
|
212
|
+
* **Example**:
|
|
172
213
|
* ```
|
|
173
214
|
* _smartico.api.buyStoreItem(1).then((result) => {
|
|
174
215
|
* console.log(result);
|
|
175
216
|
* });
|
|
217
|
+
* ```
|
|
218
|
+
*
|
|
219
|
+
* **Visitor mode: not supported**
|
|
176
220
|
*/
|
|
177
221
|
public async buyStoreItem(item_id: number): Promise<TBuyStoreItemResult> {
|
|
178
222
|
const r = await this.api.buyStoreItem(null, item_id);
|
|
@@ -185,20 +229,41 @@ export class WSAPI {
|
|
|
185
229
|
return o;
|
|
186
230
|
}
|
|
187
231
|
|
|
188
|
-
/**
|
|
232
|
+
/**
|
|
233
|
+
*
|
|
234
|
+
* Returns store categories
|
|
235
|
+
*
|
|
236
|
+
* **Example**:
|
|
237
|
+
* ```
|
|
238
|
+
* _smartico.api.getStoreCategories().then((result) => {
|
|
239
|
+
* console.log(result);
|
|
240
|
+
* });
|
|
241
|
+
* ```
|
|
242
|
+
*
|
|
243
|
+
* **Example in the Visitor mode**:
|
|
244
|
+
* ```
|
|
245
|
+
* _smartico.vapi('EN').getStoreCategories().then((result) => {
|
|
246
|
+
* console.log(result);
|
|
247
|
+
* });
|
|
248
|
+
* ```
|
|
249
|
+
*/
|
|
189
250
|
public async getStoreCategories(): Promise<TStoreCategory[]> {
|
|
190
251
|
return OCache.use(onUpdateContextKey.StoreCategories, ECacheContext.WSAPI, () => this.api.storeGetCategoriesT(null), CACHE_DATA_SEC);
|
|
191
252
|
}
|
|
192
253
|
|
|
193
|
-
/**
|
|
254
|
+
/**
|
|
255
|
+
* Returns purchased items based on the provided parameters. "Limit" and "offset" indicate the range of items to be fetched.
|
|
194
256
|
* The maximum number of items per request is limited to 20.
|
|
195
257
|
* You can leave this params empty and by default it will return list of purchased items ranging from 0 to 20.
|
|
196
|
-
*
|
|
258
|
+
*
|
|
259
|
+
* **Example**:
|
|
197
260
|
* ```
|
|
198
261
|
* _smartico.api.getStorePurchasedItems().then((result) => {
|
|
199
262
|
* console.log(result);
|
|
200
263
|
* });
|
|
201
264
|
* ```
|
|
265
|
+
*
|
|
266
|
+
* **Visitor mode: not supported**
|
|
202
267
|
*/
|
|
203
268
|
|
|
204
269
|
public async getStorePurchasedItems({ limit, offset, onUpdate } : { limit?: number, offset?: number, onUpdate?: (data: TStoreItem[]) => void} = {}): Promise<TStoreItem[]> {
|
|
@@ -208,17 +273,69 @@ export class WSAPI {
|
|
|
208
273
|
return OCache.use(onUpdateContextKey.StoreHistory, ECacheContext.WSAPI, () => this.api.storeGetPurchasedItemsT(null, limit, offset), CACHE_DATA_SEC);
|
|
209
274
|
}
|
|
210
275
|
|
|
211
|
-
/**
|
|
276
|
+
/**
|
|
277
|
+
* Returns missions & badges categories
|
|
278
|
+
*
|
|
279
|
+
* **Example**:
|
|
280
|
+
* ```
|
|
281
|
+
* _smartico.api.getAchCategories().then((result) => {
|
|
282
|
+
* console.log(result);
|
|
283
|
+
* });
|
|
284
|
+
* ```
|
|
285
|
+
*
|
|
286
|
+
* **Example in the Visitor mode**:
|
|
287
|
+
* ```
|
|
288
|
+
* _smartico.vapi('EN').getAchCategories().then((result) => {
|
|
289
|
+
* console.log(result);
|
|
290
|
+
* });
|
|
291
|
+
* ```
|
|
292
|
+
*
|
|
293
|
+
* */
|
|
212
294
|
public async getAchCategories(): Promise<TAchCategory[]> {
|
|
213
295
|
return OCache.use(onUpdateContextKey.AchCategories, ECacheContext.WSAPI, () => this.api.achGetCategoriesT(null), CACHE_DATA_SEC);
|
|
214
296
|
}
|
|
215
297
|
|
|
216
|
-
|
|
298
|
+
/**
|
|
299
|
+
* Returns list of custom sections
|
|
300
|
+
*
|
|
301
|
+
* **Example**:
|
|
302
|
+
* ```
|
|
303
|
+
* _smartico.api.getCustomSections().then((result) => {
|
|
304
|
+
* console.log(result);
|
|
305
|
+
* });
|
|
306
|
+
* ```
|
|
307
|
+
*
|
|
308
|
+
* **Example in the Visitor mode**:
|
|
309
|
+
* ```
|
|
310
|
+
* _smartico.vapi('EN').getCustomSections().then((result) => {
|
|
311
|
+
* console.log(result);
|
|
312
|
+
* });
|
|
313
|
+
* ```
|
|
314
|
+
*
|
|
315
|
+
* */
|
|
316
|
+
public async getCustomSections(): Promise<TUICustomSection[]> {
|
|
317
|
+
return OCache.use(onUpdateContextKey.CustomSections, ECacheContext.WSAPI, () => this.api.getCustomSectionsT(null), CACHE_DATA_SEC);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Returns the list of mini-games available for user
|
|
217
322
|
* The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getMiniGames with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
218
|
-
* The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or wined prize is spin/jackpot and if max count of the available user spin equal one, also if the spins were issued to the user manually in the BO. Updated templates will be passed to onUpdate callback.
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
*
|
|
323
|
+
* The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or wined prize is spin/jackpot and if max count of the available user spin equal one, also if the spins were issued to the user manually in the BO. Updated templates will be passed to onUpdate callback.
|
|
324
|
+
*
|
|
325
|
+
* **Example**:
|
|
326
|
+
* ```
|
|
327
|
+
* _smartico.api.getMiniGames().then((result) => {
|
|
328
|
+
* console.log(result);
|
|
329
|
+
* });
|
|
330
|
+
* ```
|
|
331
|
+
*
|
|
332
|
+
* **Example in the Visitor mode**:
|
|
333
|
+
* ```
|
|
334
|
+
* _smartico.vapi('EN').getMiniGames().then((result) => {
|
|
335
|
+
* console.log(result);
|
|
336
|
+
* });
|
|
337
|
+
* ```
|
|
338
|
+
*
|
|
222
339
|
*/
|
|
223
340
|
public async getMiniGames({ onUpdate }: { onUpdate?: (data: TMiniGameTemplate[]) => void } = {}): Promise<TMiniGameTemplate[]> {
|
|
224
341
|
if (onUpdate) {
|
|
@@ -228,7 +345,11 @@ export class WSAPI {
|
|
|
228
345
|
return OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, () => this.api.sawGetTemplatesT(null), CACHE_DATA_SEC);
|
|
229
346
|
}
|
|
230
347
|
|
|
231
|
-
/**
|
|
348
|
+
/**
|
|
349
|
+
* Plays the specified by template_id mini-game on behalf of user and returns prize_id or err_code
|
|
350
|
+
*
|
|
351
|
+
* **Visitor mode: not supported**
|
|
352
|
+
*/
|
|
232
353
|
public async playMiniGame(template_id: number): Promise<TMiniGamePlayResult> {
|
|
233
354
|
const r = await this.api.sawSpinRequest(null, template_id);
|
|
234
355
|
this.api.doAcknowledgeRequest(null, r.request_id)
|
|
@@ -242,7 +363,11 @@ export class WSAPI {
|
|
|
242
363
|
return o;
|
|
243
364
|
}
|
|
244
365
|
|
|
245
|
-
/**
|
|
366
|
+
/**
|
|
367
|
+
* Requests an opt-in for the specified mission_id. Returns the err_code.
|
|
368
|
+
*
|
|
369
|
+
* **Visitor mode: not supported**
|
|
370
|
+
*/
|
|
246
371
|
public async requestMissionOptIn(mission_id: number): Promise<TMissionOptInResult>{
|
|
247
372
|
const r = await this.api.missionOptIn(null, mission_id);
|
|
248
373
|
|
|
@@ -254,7 +379,11 @@ export class WSAPI {
|
|
|
254
379
|
return o;
|
|
255
380
|
}
|
|
256
381
|
|
|
257
|
-
/**
|
|
382
|
+
/**
|
|
383
|
+
* Request for claim reward for the specified mission id. Returns the err_code.
|
|
384
|
+
*
|
|
385
|
+
* **Visitor mode: not supported**
|
|
386
|
+
*/
|
|
258
387
|
public async requestMissionClaimReward(mission_id: number, ach_completed_id: number): Promise<TMissionClaimRewardResult> {
|
|
259
388
|
const r = await this.api.missionClaimPrize(null, mission_id, ach_completed_id);
|
|
260
389
|
|
|
@@ -268,10 +397,22 @@ export class WSAPI {
|
|
|
268
397
|
|
|
269
398
|
/** Returns all the active instances of tournaments
|
|
270
399
|
* The returned list is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getTournamentsList with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
271
|
-
* The onUpdate callback will be called when the user has registered in a tournament. Updated list will be passed to onUpdate callback
|
|
272
|
-
|
|
273
|
-
*
|
|
274
|
-
|
|
400
|
+
* The onUpdate callback will be called when the user has registered in a tournament. Updated list will be passed to onUpdate callback.
|
|
401
|
+
*
|
|
402
|
+
* **Example**:
|
|
403
|
+
* ```
|
|
404
|
+
* _smartico.api.getTournamentsList().then((result) => {
|
|
405
|
+
* console.log(result);
|
|
406
|
+
* });
|
|
407
|
+
* ```
|
|
408
|
+
*
|
|
409
|
+
* **Example in the Visitor mode**:
|
|
410
|
+
* ```
|
|
411
|
+
* _smartico.vapi('EN').getTournamentsList().then((result) => {
|
|
412
|
+
* console.log(result);
|
|
413
|
+
* });
|
|
414
|
+
* ```
|
|
415
|
+
* */
|
|
275
416
|
public async getTournamentsList({ onUpdate }: { onUpdate?: (data: TTournament[]) => void } = {}): Promise<TTournament[]> {
|
|
276
417
|
if (onUpdate) {
|
|
277
418
|
this.onUpdateCallback.set(onUpdateContextKey.TournamentList, onUpdate);
|
|
@@ -280,12 +421,40 @@ export class WSAPI {
|
|
|
280
421
|
return OCache.use(onUpdateContextKey.TournamentList, ECacheContext.WSAPI, () => this.api.tournamentsGetLobbyT(null), CACHE_DATA_SEC);
|
|
281
422
|
}
|
|
282
423
|
|
|
283
|
-
/**
|
|
424
|
+
/**
|
|
425
|
+
* Returns details information of specific tournament instance, the response will include tournament info and the leaderboard of players
|
|
426
|
+
*
|
|
427
|
+
* **Example**:
|
|
428
|
+
* ```
|
|
429
|
+
* _smartico.api.getTournamentsList().then((result) => {
|
|
430
|
+
* if (result.length > 0) {
|
|
431
|
+
* _smartico.api.getTournamentInstanceInfo(result[0].instance_id).then((result) => {
|
|
432
|
+
* console.log(result);
|
|
433
|
+
* });
|
|
434
|
+
* }
|
|
435
|
+
* });
|
|
436
|
+
* ```
|
|
437
|
+
*
|
|
438
|
+
* **Example in the Visitor mode**:
|
|
439
|
+
* ```
|
|
440
|
+
* _smartico.vapi('EN').getTournamentsList().then((result) => {
|
|
441
|
+
* if (result.length > 0) {
|
|
442
|
+
* _smartico.vapi('EN').getTournamentInstanceInfo(result[0].instance_id).then((result) => {
|
|
443
|
+
* console.log(result);
|
|
444
|
+
* });
|
|
445
|
+
* }
|
|
446
|
+
* });
|
|
447
|
+
* ```
|
|
448
|
+
*/
|
|
284
449
|
public async getTournamentInstanceInfo(tournamentInstanceId: number): Promise<TTournamentDetailed> {
|
|
285
450
|
return this.api.tournamentsGetInfoT(null, tournamentInstanceId);
|
|
286
451
|
}
|
|
287
452
|
|
|
288
|
-
/**
|
|
453
|
+
/**
|
|
454
|
+
* Requests registration for the specified tournament instance. Returns the err_code.
|
|
455
|
+
*
|
|
456
|
+
* **Visitor mode: not supported**
|
|
457
|
+
*/
|
|
289
458
|
public async registerInTournament(tournamentInstanceId: number): Promise<TTournamentRegistrationResult>{
|
|
290
459
|
const r = await this.api.registerInTournament(null, tournamentInstanceId);
|
|
291
460
|
|
|
@@ -297,8 +466,23 @@ export class WSAPI {
|
|
|
297
466
|
return o;
|
|
298
467
|
}
|
|
299
468
|
|
|
300
|
-
/**
|
|
301
|
-
|
|
469
|
+
/**
|
|
470
|
+
* Returns the leaderboard for the current type (default is Daily). If getPreviousPeriod is passed as true, a leaderboard for the previous period for the current type will be returned.
|
|
471
|
+
* For example, if the type is Weekly and getPreviousPeriod is true, a leaderboard for the previous week will be returned.
|
|
472
|
+
*
|
|
473
|
+
* **Example**:
|
|
474
|
+
* ```
|
|
475
|
+
* _smartico.api.getLeaderBoard(1).then((result) => {
|
|
476
|
+
* console.log(result);
|
|
477
|
+
* });
|
|
478
|
+
* ```
|
|
479
|
+
*
|
|
480
|
+
* **Example in the Visitor mode**:
|
|
481
|
+
* ```
|
|
482
|
+
* _smartico.vapi('EN').getLeaderBoard(1).then((result) => {
|
|
483
|
+
* console.log(result);
|
|
484
|
+
* });
|
|
485
|
+
* ```
|
|
302
486
|
*/
|
|
303
487
|
public async getLeaderBoard(periodType: LeaderBoardPeriodType, getPreviousPeriod?: boolean): Promise<LeaderBoardDetailsT> {
|
|
304
488
|
return OCache.use(onUpdateContextKey.LeaderBoards, ECacheContext.WSAPI, () => this.api.leaderboardsGetT(null, periodType, getPreviousPeriod), CACHE_DATA_SEC);
|
|
@@ -310,8 +494,10 @@ export class WSAPI {
|
|
|
310
494
|
* This functions return list of messages without the body of the message.
|
|
311
495
|
* To get the body of the message you need to call getInboxMessageBody function and pass the message guid contained in each message of this request.
|
|
312
496
|
* All other action like mark as read, favorite, delete, etc. can be done using this message GUID.
|
|
313
|
-
* The "onUpdate" callback will be triggered when the user receives a new message. It will provide an updated list of messages, ranging from 0 to 20, to the onUpdate callback function.
|
|
314
|
-
|
|
497
|
+
* The "onUpdate" callback will be triggered when the user receives a new message. It will provide an updated list of messages, ranging from 0 to 20, to the onUpdate callback function.
|
|
498
|
+
*
|
|
499
|
+
* **Visitor mode: not supported**
|
|
500
|
+
*
|
|
315
501
|
* @param params
|
|
316
502
|
*/
|
|
317
503
|
public async getInboxMessages({ from, to, onlyFavorite, onUpdate }: { from?: number, to?: number, onlyFavorite?: boolean, onUpdate?: (data: TInboxMessage[]) => void } = {}): Promise<TInboxMessage[]> {
|
|
@@ -322,12 +508,20 @@ export class WSAPI {
|
|
|
322
508
|
return await this.api.getInboxMessagesT(null, from, to, onlyFavorite);
|
|
323
509
|
}
|
|
324
510
|
|
|
325
|
-
/**
|
|
511
|
+
/**
|
|
512
|
+
* Returns the message body of the specified message guid.
|
|
513
|
+
*
|
|
514
|
+
* **Visitor mode: not supported**
|
|
515
|
+
*/
|
|
326
516
|
public async getInboxMessageBody(messageGuid: string): Promise<TInboxMessageBody> {
|
|
327
517
|
return await this.api.getInboxMessageBodyT(messageGuid);
|
|
328
518
|
}
|
|
329
519
|
|
|
330
|
-
/**
|
|
520
|
+
/**
|
|
521
|
+
* Requests to mark inbox message with specified guid as read
|
|
522
|
+
*
|
|
523
|
+
* **Visitor mode: not supported**
|
|
524
|
+
*/
|
|
331
525
|
public async markInboxMessageAsRead(messageGuid: string): Promise<InboxMarkMessageAction> {
|
|
332
526
|
const r = await this.api.markInboxMessageRead(null, messageGuid);
|
|
333
527
|
|
|
@@ -337,7 +531,11 @@ export class WSAPI {
|
|
|
337
531
|
}
|
|
338
532
|
}
|
|
339
533
|
|
|
340
|
-
/**
|
|
534
|
+
/**
|
|
535
|
+
* Requests to mark all inbox messages as rea
|
|
536
|
+
*
|
|
537
|
+
* **Visitor mode: not supported**
|
|
538
|
+
*/
|
|
341
539
|
public async markAllInboxMessagesAsRead(): Promise<InboxMarkMessageAction> {
|
|
342
540
|
const r = await this.api.markAllInboxMessageRead(null);
|
|
343
541
|
|
|
@@ -347,7 +545,11 @@ export class WSAPI {
|
|
|
347
545
|
}
|
|
348
546
|
}
|
|
349
547
|
|
|
350
|
-
/**
|
|
548
|
+
/**
|
|
549
|
+
* Requests to mark inbox message with specified guid as favorite. Pass mark true to add message to favorite and false to remove.
|
|
550
|
+
*
|
|
551
|
+
* **Visitor mode: not supported**
|
|
552
|
+
*/
|
|
351
553
|
public async markUnmarkInboxMessageAsFavorite(messageGuid: string, mark: boolean): Promise<InboxMarkMessageAction> {
|
|
352
554
|
const r = await this.api.markUnmarkInboxMessageAsFavorite(null, messageGuid, mark);
|
|
353
555
|
|
|
@@ -357,7 +559,12 @@ export class WSAPI {
|
|
|
357
559
|
}
|
|
358
560
|
}
|
|
359
561
|
|
|
360
|
-
/**
|
|
562
|
+
/**
|
|
563
|
+
* Requests to delete inbox message
|
|
564
|
+
*
|
|
565
|
+
* **Visitor mode: not supported**
|
|
566
|
+
*/
|
|
567
|
+
|
|
361
568
|
public async deleteInboxMessage(messageGuid: string): Promise<InboxMarkMessageAction> {
|
|
362
569
|
const r = await this.api.deleteInboxMessage(null, messageGuid);
|
|
363
570
|
|
|
@@ -367,7 +574,12 @@ export class WSAPI {
|
|
|
367
574
|
}
|
|
368
575
|
}
|
|
369
576
|
|
|
370
|
-
/**
|
|
577
|
+
/**
|
|
578
|
+
* Requests to delete all inbox messages
|
|
579
|
+
*
|
|
580
|
+
* **Visitor mode: not supported**
|
|
581
|
+
*/
|
|
582
|
+
|
|
371
583
|
public async deleteAllInboxMessages(): Promise<InboxMarkMessageAction> {
|
|
372
584
|
const r = await this.api.deleteAllInboxMessages(null);
|
|
373
585
|
|
|
@@ -377,7 +589,9 @@ export class WSAPI {
|
|
|
377
589
|
}
|
|
378
590
|
}
|
|
379
591
|
|
|
380
|
-
/**
|
|
592
|
+
/**
|
|
593
|
+
* Requests translations for the given language. Returns the object including translation key/translation value pairs. All possible translation keys defined in the back office.
|
|
594
|
+
*/
|
|
381
595
|
public async getTranslations(lang_code: string): Promise<TGetTranslations> {
|
|
382
596
|
const r = await this.api.getTranslationsT(null, lang_code, []);
|
|
383
597
|
|
|
@@ -449,12 +663,20 @@ export class WSAPI {
|
|
|
449
663
|
* If filter is not provided, all active jackpots will be returned.
|
|
450
664
|
* Filter can be used to get jackpots related to specific game or specific jackpot template.
|
|
451
665
|
* You can call this method every second in order to get up to date information about current value of the jackpot(s) and present them to the end-users
|
|
452
|
-
*
|
|
666
|
+
*
|
|
667
|
+
* **Example**:
|
|
453
668
|
* ```
|
|
454
669
|
* _smartico.api.jackpotGet({ related_game_id: 'wooko-slot' }).then((result) => {
|
|
455
670
|
* console.log(result);
|
|
456
671
|
* });
|
|
457
672
|
* ```
|
|
673
|
+
*
|
|
674
|
+
* **Example in the Visitor mode**:
|
|
675
|
+
* ```
|
|
676
|
+
* _smartico.vapi('EN').jackpotGet({ related_game_id: 'wooko-slot' }).then((result) => {
|
|
677
|
+
* console.log(result);
|
|
678
|
+
* });
|
|
679
|
+
* ```
|
|
458
680
|
*/
|
|
459
681
|
public async jackpotGet(filter?: { related_game_id?: string, jp_template_id?: number }): Promise<JackpotDetails[]> {
|
|
460
682
|
|
|
@@ -471,10 +693,10 @@ export class WSAPI {
|
|
|
471
693
|
jackpots = await OCache.use<JackpotDetails[]>(onUpdateContextKey.Jackpots, ECacheContext.WSAPI, async () => {
|
|
472
694
|
|
|
473
695
|
const _jackpots = await this.api.jackpotGet(null, filter);
|
|
474
|
-
const _pots = _jackpots.map( jp => jp.pot);
|
|
696
|
+
const _pots = _jackpots.items.map( jp => jp.pot);
|
|
475
697
|
|
|
476
698
|
OCache.set(onUpdateContextKey.Pots, _pots, ECacheContext.WSAPI, JACKPOT_POT_CACHE_SEC);
|
|
477
|
-
return _jackpots;
|
|
699
|
+
return _jackpots.items;
|
|
478
700
|
|
|
479
701
|
}, JACKPOT_TEMPLATE_CACHE_SEC);
|
|
480
702
|
|
|
@@ -483,7 +705,7 @@ export class WSAPI {
|
|
|
483
705
|
pots = await OCache.use<JackpotPot[]>(onUpdateContextKey.Pots, ECacheContext.WSAPI, async () => {
|
|
484
706
|
|
|
485
707
|
const jp_template_ids = jackpots.map(jp => jp.jp_template_id);
|
|
486
|
-
return this.api.potGet(null, { jp_template_ids })
|
|
708
|
+
return (await this.api.potGet(null, { jp_template_ids })).items;
|
|
487
709
|
|
|
488
710
|
}, JACKPOT_POT_CACHE_SEC);
|
|
489
711
|
}
|
|
@@ -498,14 +720,19 @@ export class WSAPI {
|
|
|
498
720
|
|
|
499
721
|
}
|
|
500
722
|
|
|
501
|
-
/**
|
|
723
|
+
/**
|
|
724
|
+
* Opt-in currently logged in user to the jackpot with the specified jp_template_id.
|
|
502
725
|
* You may call jackpotGet method after doing optin to see that user is opted in to the jackpot.
|
|
503
|
-
*
|
|
726
|
+
*
|
|
727
|
+
* **Example**:
|
|
504
728
|
* ```
|
|
505
729
|
* _smartico.api.jackpotOptIn({ jp_template_id: 123 }).then((result) => {
|
|
506
730
|
* console.log('Opted in to the jackpot');
|
|
507
731
|
* });
|
|
508
732
|
* ```
|
|
733
|
+
*
|
|
734
|
+
* **Visitor mode: not supported**
|
|
735
|
+
*
|
|
509
736
|
*/
|
|
510
737
|
public async jackpotOptIn(filter: { jp_template_id: number }): Promise<JackpotsOptinResponse> {
|
|
511
738
|
|
|
@@ -518,14 +745,19 @@ export class WSAPI {
|
|
|
518
745
|
return result;
|
|
519
746
|
}
|
|
520
747
|
|
|
521
|
-
/**
|
|
748
|
+
/**
|
|
749
|
+
* Opt-out currently logged in user from the jackpot with the specified jp_template_id.
|
|
522
750
|
* You may call jackpotGet method after doing optout to see that user is not opted in to the jackpot.
|
|
523
|
-
*
|
|
751
|
+
*
|
|
752
|
+
* **Example**:
|
|
524
753
|
* ```
|
|
525
754
|
* _smartico.api.jackpotOptOut({ jp_template_id: 123 }).then((result) => {
|
|
526
755
|
* console.log('Opted out from the jackpot');
|
|
527
756
|
* });
|
|
528
757
|
* ```
|
|
758
|
+
*
|
|
759
|
+
* **Visitor mode: not supported**
|
|
760
|
+
*
|
|
529
761
|
*/
|
|
530
762
|
public async jackpotOptOut(filter: { jp_template_id: number }): Promise<JackpotsOptoutResponse> {
|
|
531
763
|
|