@smartico/public-api 0.0.346 → 0.0.348
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 +114 -1
- package/dist/Base/ClassId.d.ts +4 -0
- package/dist/SmarticoAPI.d.ts +4 -1
- package/dist/WSAPI/WSAPI.d.ts +6 -3
- package/dist/index.js +48 -24
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +19 -5
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/classes/WSAPI.md +6 -3
- package/package.json +1 -1
- package/src/Base/ClassId.ts +5 -0
- package/src/SmarticoAPI.ts +16 -2
- package/src/WSAPI/WSAPI.ts +6 -8
|
@@ -123,7 +123,7 @@ ___
|
|
|
123
123
|
|
|
124
124
|
▸ **getMissions**(`«destructured»?`): `Promise`\<[`TMissionOrBadge`](../interfaces/TMissionOrBadge.md)[]\>
|
|
125
125
|
|
|
126
|
-
Returns all the missions
|
|
126
|
+
Returns all the missions configured for the current user (server-side scoped, not filtered by Widget visibility).
|
|
127
127
|
The returned missions are cached for 30 seconds. But you can pass the onUpdate callback as a parameter.
|
|
128
128
|
Note that each time you call getMissions with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
129
129
|
The onUpdate callback will be called on mission OptIn and the updated missions will be passed to it.
|
|
@@ -418,7 +418,7 @@ ___
|
|
|
418
418
|
|
|
419
419
|
▸ **getMiniGames**(`«destructured»?`): `Promise`\<[`TMiniGameTemplate`](../interfaces/TMiniGameTemplate.md)[]\>
|
|
420
420
|
|
|
421
|
-
Returns the list of mini-games
|
|
421
|
+
Returns the list of mini-games configured for the current user (not filtered by spin availability or Widget visibility).
|
|
422
422
|
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.
|
|
423
423
|
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.
|
|
424
424
|
|
|
@@ -1261,7 +1261,8 @@ ___
|
|
|
1261
1261
|
|
|
1262
1262
|
▸ **getRaffleDrawRun**(`props`): `Promise`\<[`TRaffleDraw`](../interfaces/TRaffleDraw.md)\>
|
|
1263
1263
|
|
|
1264
|
-
Returns draw run for provided raffle_id and run_id
|
|
1264
|
+
Returns draw run for provided raffle_id and run_id.
|
|
1265
|
+
You can pass winners_from and winners_to parameters to get a specific range of winners. Default is 0-20.
|
|
1265
1266
|
|
|
1266
1267
|
**Example**:
|
|
1267
1268
|
|
|
@@ -1286,6 +1287,8 @@ _smartico.vapi('EN').getRaffleDrawRun({ raffle_id: 156, run_id: 145 }).then((res
|
|
|
1286
1287
|
| `props` | `Object` |
|
|
1287
1288
|
| `props.raffle_id` | `number` |
|
|
1288
1289
|
| `props.run_id` | `number` |
|
|
1290
|
+
| `props.winners_from?` | `number` |
|
|
1291
|
+
| `props.winners_to?` | `number` |
|
|
1289
1292
|
|
|
1290
1293
|
#### Returns
|
|
1291
1294
|
|
package/package.json
CHANGED
package/src/Base/ClassId.ts
CHANGED
|
@@ -173,6 +173,11 @@ export enum ClassId {
|
|
|
173
173
|
RAF_CLAIM_PRIZE_REQUEST = 906,
|
|
174
174
|
*/
|
|
175
175
|
|
|
176
|
+
BNR_GET_BANNER_PLACEMENTS_REQUEST = 950,
|
|
177
|
+
BNR_GET_BANNER_PLACEMENTS_RESPONSE = 951,
|
|
178
|
+
BNR_GET_BANNER_CONTENT_REQUEST = 952,
|
|
179
|
+
BNR_GET_BANNER_CONTENT_RESPONSE = 953,
|
|
180
|
+
|
|
176
181
|
/*
|
|
177
182
|
!Important, if adding new messages that are 'acting' on behalf of the client,
|
|
178
183
|
you need to include them in the CLASS_ID_IGNORE_FOR_SIMULATION
|
package/src/SmarticoAPI.ts
CHANGED
|
@@ -99,6 +99,7 @@ import {
|
|
|
99
99
|
TRaffle,
|
|
100
100
|
TLevelCurrent,
|
|
101
101
|
TActivityLog,
|
|
102
|
+
TRaffleDraw,
|
|
102
103
|
} from './WSAPI/WSAPITypes';
|
|
103
104
|
import { getLeaderBoardTransform } from './Leaderboard/LeaderBoards';
|
|
104
105
|
import { GetAchievementsUserInfoResponse } from './Core/GetAchievementsUserInfoResponse';
|
|
@@ -127,7 +128,7 @@ import { GetRafflesResponse, raffleTransform } from './Raffle/GetRafflesResponse
|
|
|
127
128
|
import { GetRafflesRequest } from './Raffle/GetRafflesRequest';
|
|
128
129
|
import { GetActivityLogRequest, GetActivityLogResponse, ActivityLogTransform } from './ActivityLog';
|
|
129
130
|
import { InboxCategories } from './Inbox/InboxCategories';
|
|
130
|
-
import { GetDrawRunRequest, GetDrawRunResponse, GetRaffleDrawRunsHistoryRequest, GetRaffleDrawRunsHistoryResponse, RaffleClaimPrizeRequest, RaffleClaimPrizeResponse, RaffleOptinRequest, RaffleOptinResponse } from './Raffle';
|
|
131
|
+
import { GetDrawRunRequest, GetDrawRunResponse, GetRaffleDrawRunsHistoryRequest, GetRaffleDrawRunsHistoryResponse, RaffleClaimPrizeRequest, RaffleClaimPrizeResponse, RaffleOptinRequest, RaffleOptinResponse, drawRunTransform } from './Raffle';
|
|
131
132
|
import { GetJackpotWinnersResponse, GetJackpotWinnersResponseTransform, JackpotWinnerHistory } from './Jackpots/GetJackpotWinnersResponse';
|
|
132
133
|
import { GetJackpotWinnersRequest } from './Jackpots/GetJackpotWinnersRequest';
|
|
133
134
|
import { GetJackpotEligibleGamesRequest } from './Jackpots/GetJackpotEligibleGamesRequest';
|
|
@@ -1292,7 +1293,7 @@ class SmarticoAPI {
|
|
|
1292
1293
|
return await this.send<GetRafflesResponse>(message, ClassId.RAF_GET_RAFFLES_RESPONSE);
|
|
1293
1294
|
}
|
|
1294
1295
|
|
|
1295
|
-
public async getRaffleDrawRun(user_ext_id: string, payload: { raffle_id: number; run_id: number }): Promise<GetDrawRunResponse> {
|
|
1296
|
+
public async getRaffleDrawRun(user_ext_id: string, payload: { raffle_id: number; run_id: number; winners_limit?: number; winners_offset?: number }): Promise<GetDrawRunResponse> {
|
|
1296
1297
|
const message = this.buildMessage<GetDrawRunRequest, GetDrawRunResponse>(
|
|
1297
1298
|
user_ext_id,
|
|
1298
1299
|
ClassId.RAF_GET_DRAW_RUN_REQUEST,
|
|
@@ -1302,6 +1303,19 @@ class SmarticoAPI {
|
|
|
1302
1303
|
return await this.send<GetDrawRunResponse>(message, ClassId.RAF_GET_DRAW_RUN_RESPONSE);
|
|
1303
1304
|
}
|
|
1304
1305
|
|
|
1306
|
+
public async getRaffleDrawRunT(
|
|
1307
|
+
user_ext_id: string,
|
|
1308
|
+
raffle_id: number,
|
|
1309
|
+
run_id: number,
|
|
1310
|
+
winners_from: number = 0,
|
|
1311
|
+
winners_to: number = 20,
|
|
1312
|
+
): Promise<TRaffleDraw> {
|
|
1313
|
+
const winners_limit = winners_to - winners_from > 50 ? 50 : winners_to - winners_from;
|
|
1314
|
+
const winners_offset = winners_from;
|
|
1315
|
+
|
|
1316
|
+
return drawRunTransform(await this.getRaffleDrawRun(user_ext_id, { raffle_id, run_id, winners_limit, winners_offset }),);
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1305
1319
|
public async getRaffleDrawRunsHistory(
|
|
1306
1320
|
user_ext_id: string,
|
|
1307
1321
|
props: { raffle_id: number; draw_id?: number },
|
package/src/WSAPI/WSAPI.ts
CHANGED
|
@@ -54,7 +54,6 @@ import { GetRelatedAchTourResponse } from '../Missions/GetRelatedAchTourResponse
|
|
|
54
54
|
import { InboxCategories } from '../Inbox/InboxCategories';
|
|
55
55
|
import {
|
|
56
56
|
drawRunHistoryTransform,
|
|
57
|
-
drawRunTransform,
|
|
58
57
|
raffleClaimPrizeResponseTransform,
|
|
59
58
|
RaffleOptinRequest,
|
|
60
59
|
RaffleOptinResponse,
|
|
@@ -251,7 +250,7 @@ export class WSAPI {
|
|
|
251
250
|
return OCache.use(onUpdateContextKey.CurrentLevel, ECacheContext.WSAPI, () => this.api.getLevelCurrent(null), CACHE_DATA_SEC);
|
|
252
251
|
}
|
|
253
252
|
|
|
254
|
-
/** Returns all the missions
|
|
253
|
+
/** Returns all the missions configured for the current user (server-side scoped, not filtered by Widget visibility).
|
|
255
254
|
* The returned missions are cached for 30 seconds. But you can pass the onUpdate callback as a parameter.
|
|
256
255
|
* Note that each time you call getMissions with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
257
256
|
* The onUpdate callback will be called on mission OptIn and the updated missions will be passed to it.
|
|
@@ -524,7 +523,7 @@ export class WSAPI {
|
|
|
524
523
|
}
|
|
525
524
|
|
|
526
525
|
/**
|
|
527
|
-
* Returns the list of mini-games
|
|
526
|
+
* Returns the list of mini-games configured for the current user (not filtered by spin availability or Widget visibility).
|
|
528
527
|
* 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.
|
|
529
528
|
* 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.
|
|
530
529
|
*
|
|
@@ -1379,7 +1378,8 @@ export class WSAPI {
|
|
|
1379
1378
|
}
|
|
1380
1379
|
|
|
1381
1380
|
/**
|
|
1382
|
-
* Returns draw run for provided raffle_id and run_id
|
|
1381
|
+
* Returns draw run for provided raffle_id and run_id.
|
|
1382
|
+
* You can pass winners_from and winners_to parameters to get a specific range of winners. Default is 0-20.
|
|
1383
1383
|
*
|
|
1384
1384
|
*
|
|
1385
1385
|
* **Example**:
|
|
@@ -1401,14 +1401,12 @@ export class WSAPI {
|
|
|
1401
1401
|
*
|
|
1402
1402
|
*/
|
|
1403
1403
|
|
|
1404
|
-
public async getRaffleDrawRun(props: { raffle_id: number; run_id: number }): Promise<TRaffleDraw> {
|
|
1405
|
-
const res = await this.api.getRaffleDrawRun(null, props);
|
|
1406
|
-
|
|
1404
|
+
public async getRaffleDrawRun(props: { raffle_id: number; run_id: number; winners_from?: number; winners_to?: number }): Promise<TRaffleDraw> {
|
|
1407
1405
|
if (!props.raffle_id || !props.run_id) {
|
|
1408
1406
|
throw new Error('both raffle_id and run_id are required');
|
|
1409
1407
|
}
|
|
1410
1408
|
|
|
1411
|
-
return
|
|
1409
|
+
return await this.api.getRaffleDrawRunT(null, props.raffle_id, props.run_id, props.winners_from, props.winners_to);
|
|
1412
1410
|
}
|
|
1413
1411
|
|
|
1414
1412
|
/**
|