@smartico/public-api 0.0.432 → 0.0.433

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.
@@ -5,6 +5,8 @@ export interface GetJackpotWinnersResponse extends ProtocolResponse {
5
5
  winners: JackpotWinnerHistory[];
6
6
  /** Whether there are more winners to fetch */
7
7
  has_more: boolean;
8
+ /** Win statistics of the jackpot template */
9
+ win_stats?: JackpotWinStats;
8
10
  }
9
11
  export interface JackpotWinnerHistory {
10
12
  /** Id of the jackpot pot */
@@ -14,7 +16,33 @@ export interface JackpotWinnerHistory {
14
16
  /** Info about jackpot winner */
15
17
  winner: JackPotWinner;
16
18
  }
19
+ export interface JackpotWinStats {
20
+ /** Total number of issued wins of the jackpot template. Wins waiting for manual approval are not counted */
21
+ total_wins: number;
22
+ /** The biggest win of the jackpot template, `null` when there are no wins yet */
23
+ highest_win: JackpotWin | null;
24
+ /** The most recent win of the jackpot template, `null` when there are no wins yet */
25
+ last_win: JackpotWin | null;
26
+ }
27
+ export interface JackpotWin {
28
+ /** Won amount in the Jackpot currency */
29
+ winning_amount: number;
30
+ /** Date of winning in milliseconds */
31
+ win_date_ts: number;
32
+ /** Name of the winner, masked by default. `null` when the jackpot template doesn't expose winners over API */
33
+ public_username: string | null;
34
+ }
35
+ export interface TGetJackpotWinStatsResponse {
36
+ /** The list of jackpot winners */
37
+ winners: JackpotWinnerHistory[];
38
+ /** Win statistics of the jackpot template */
39
+ win_stats: JackpotWinStats;
40
+ }
17
41
  /**
18
42
  * @ignore
19
43
  */
20
44
  export declare const GetJackpotWinnersResponseTransform: (items: JackpotWinnerHistory[]) => JackpotWinnerHistory[];
45
+ /**
46
+ * @ignore
47
+ */
48
+ export declare const GetJackpotWinStatsResponseTransform: (response: GetJackpotWinnersResponse) => TGetJackpotWinStatsResponse;
@@ -29,7 +29,7 @@ import { GetAvatarsCustomizedResponse } from './Avatars/GetAvatarsCustomizedResp
29
29
  import { GetAvatarPromptsResponse } from './Avatars/GetAvatarPromptsResponse';
30
30
  import { SetAvatarResponse } from './Avatars';
31
31
  import { AvatarCustomizeResponse } from './Avatars/AvatarCustomizeResponse';
32
- import { GetJackpotWinnersResponse, JackpotWinnerHistory } from './Jackpots/GetJackpotWinnersResponse';
32
+ import { GetJackpotWinnersResponse, JackpotWinnerHistory, TGetJackpotWinStatsResponse } from './Jackpots/GetJackpotWinnersResponse';
33
33
  import { GetJackpotEligibleGamesResponse, TGetJackpotEligibleGamesResponse } from './Jackpots/GetJackpotEligibleGamesResponse';
34
34
  import { GamePickGameInfo, GamePickRound, GamePickRoundBoard, GamePickUserInfo, GamesApiResponse } from './GamePick';
35
35
  interface Tracker {
@@ -113,6 +113,7 @@ declare class SmarticoAPI {
113
113
  }): Promise<JackpotsOptoutResponse>;
114
114
  getJackpotWinners(user_ext_id: string, limit: number, offset: number, jp_template_id: number): Promise<GetJackpotWinnersResponse>;
115
115
  getJackpotWinnersT(user_ext_id: string, limit: number, offset: number, jp_template_id: number): Promise<JackpotWinnerHistory[]>;
116
+ getJackpotWinStatsT(user_ext_id: string, limit: number, offset: number, jp_template_id: number): Promise<TGetJackpotWinStatsResponse>;
116
117
  getJackpotEligibleGames(user_ext_id: string, { jp_template_id }: {
117
118
  jp_template_id: number;
118
119
  }): Promise<GetJackpotEligibleGamesResponse>;
@@ -1,5 +1,6 @@
1
1
  import { JackpotDetails, JackpotWinnerHistory, JackpotsOptinResponse, JackpotsOptoutResponse } from '../Jackpots';
2
2
  import { TGetJackpotEligibleGamesResponse } from '../Jackpots/GetJackpotEligibleGamesResponse';
3
+ import { TGetJackpotWinStatsResponse } from '../Jackpots/GetJackpotWinnersResponse';
3
4
  import { WSAPIClans } from './WSAPIClans';
4
5
  /** @group Jackpots */
5
6
  export declare class WSAPIJackpots extends WSAPIClans {
@@ -288,6 +289,81 @@ export declare class WSAPIJackpots extends WSAPIClans {
288
289
  /** Jackpot template ID (required). */
289
290
  jp_template_id?: number;
290
291
  }): Promise<JackpotWinnerHistory[]>;
292
+ /**
293
+ * Returns past winners of a specific jackpot template, paginated, together
294
+ * with the win statistics of that template: total number of wins, the
295
+ * biggest win and the most recent win. Use it for a jackpot info modal /
296
+ * tooltip that shows "Total wins", "Highest win" and "Latest win" next to
297
+ * the winners list.
298
+ *
299
+ * @remarks
300
+ * **Preconditions**
301
+ * - User must be authenticated. Visitor mode not supported.
302
+ * - `jp_template_id` is mandatory.
303
+ * - The consumer SHOULD check
304
+ * `JackpotDetails.expose_winners_over_api` before calling, since
305
+ * the server does not enforce it.
306
+ *
307
+ * **Statistics**
308
+ * - `win_stats` describes the whole jackpot template and does not depend
309
+ * on `limit` / `offset`. Pass `limit: 1` when only the statistics are needed.
310
+ * - Only issued wins are counted — a pot that exploded but still waits for
311
+ * manual approval is not included.
312
+ * - `highest_win` / `last_win` are `null` while the jackpot has no wins,
313
+ * `total_wins` is `0` in that case.
314
+ * - `public_username` of `highest_win` / `last_win` is masked by the same
315
+ * label setting as the winners list, and is `null` when the template
316
+ * doesn't expose winners over API.
317
+ * - The server refreshes the statistics once per minute.
318
+ *
319
+ * **Currency caveat**
320
+ * All amounts (`win_stats.*.winning_amount`,
321
+ * `winners[].winner.winning_amount_jp_currency`) are in the jackpot's
322
+ * NATIVE currency, NOT the user's wallet currency.
323
+ *
324
+ * **Refresh**
325
+ * - The SDK caches each page separately (per `jp_template_id` +
326
+ * `limit` + `offset`) for 30 seconds.
327
+ * - Caches clear on jackpot-win push events and on opt-in / opt-out.
328
+ *
329
+ * **Error handling**
330
+ * Non-zero `errCode` on control-group users or generic server errors. The
331
+ * SDK does NOT enumerate distinct codes — branch on `errCode === 0` and
332
+ * surface `errMsg` on failure.
333
+ *
334
+ * **Visitor mode**: not supported.
335
+ *
336
+ * @returns {@link TGetJackpotWinStatsResponse} —
337
+ * `{ winners: JackpotWinnerHistory[], win_stats: JackpotWinStats }`.
338
+ *
339
+ * @example
340
+ * ```ts
341
+ * const [jp] = await window._smartico.api.jackpotGet({ jp_template_id: 42 });
342
+ *
343
+ * if (!jp || !jp.expose_winners_over_api) {
344
+ * console.log('[smartico] winners hidden by operator config — hide the stats');
345
+ * return;
346
+ * }
347
+ *
348
+ * const { winners, win_stats } = await window._smartico.api.getJackpotWinStats({
349
+ * jp_template_id: 42,
350
+ * limit: 10,
351
+ * offset: 0,
352
+ * });
353
+ * console.log('[smartico] total wins', win_stats.total_wins);
354
+ * console.log('[smartico] highest win', win_stats.highest_win?.winning_amount, jp.jp_currency);
355
+ * console.log('[smartico] latest win', win_stats.last_win?.public_username, win_stats.last_win?.win_date_ts);
356
+ * console.log('[smartico] render', winners.length, 'recent winner rows');
357
+ * ```
358
+ */
359
+ getJackpotWinStats({ limit, offset, jp_template_id, }: {
360
+ /** Page size of the winners list (default 20). */
361
+ limit?: number;
362
+ /** Pagination offset of the winners list (default 0). */
363
+ offset?: number;
364
+ /** Jackpot template ID (required). */
365
+ jp_template_id?: number;
366
+ }): Promise<TGetJackpotWinStatsResponse>;
291
367
  /**
292
368
  * Returns the casino games eligible to contribute to a specific jackpot —
293
369
  * the catalog the user must play to grow the pot. Use to power an