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