@smartico/public-api 0.0.409 → 0.0.411

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.
Files changed (43) hide show
  1. package/README.md +1 -1
  2. package/dist/MiniGames/SAWDoAknowledgeRequest.d.ts +2 -0
  3. package/dist/MiniGames/SAWPrize.d.ts +18 -0
  4. package/dist/MiniGames/SAWPrizeUI.d.ts +1 -0
  5. package/dist/MiniGames/SAWTemplate.d.ts +24 -0
  6. package/dist/SmarticoAPI.d.ts +1 -1
  7. package/dist/SmarticoLib/index.d.ts +1 -1
  8. package/dist/WSAPI/WSAPIJackpots.d.ts +11 -2
  9. package/dist/WSAPI/WSAPIMiniGames.d.ts +92 -23
  10. package/dist/WSAPI/WSAPITypes.d.ts +45 -44
  11. package/dist/index.js +112 -31
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.modern.mjs +109 -28
  14. package/dist/index.modern.mjs.map +1 -1
  15. package/docs/api/classes/WSAPIJackpots.md +11 -2
  16. package/docs/api/classes/WSAPIMiniGames.md +92 -23
  17. package/docs/api/interfaces/SAWDoAknowledgeRequest.md +8 -0
  18. package/docs/api/interfaces/SAWPrize.md +36 -0
  19. package/docs/api/interfaces/SAWPrizeUI.md +2 -0
  20. package/docs/api/interfaces/SAWTemplate.md +48 -0
  21. package/docs/api/interfaces/TMiniGamePrize.md +51 -27
  22. package/docs/api/interfaces/TMiniGameTemplate.md +15 -16
  23. package/docs/capabilities/getJackpotEligibleGames.md +11 -2
  24. package/docs/capabilities/getMiniGames.md +63 -39
  25. package/docs/capabilities/miniGameWinAcknowledgeRequest.md +36 -7
  26. package/docs/capabilities/playMiniGame.md +27 -14
  27. package/docs/native/PROTOCOL.md +7 -0
  28. package/docs/ui/jackpots/UIGuide_getJackpotEligibleGames.md +8 -0
  29. package/docs/ui/minigames/UIGuide_getMiniGames.md +46 -0
  30. package/docs/ui/minigames/UIGuide_getMiniGamesHistory.md +1 -1
  31. package/docs/ui/minigames/UIGuide_miniGameWinAcknowledgeRequest.md +90 -0
  32. package/docs/ui/minigames/UIGuide_playMiniGame.md +38 -2
  33. package/package.json +1 -1
  34. package/src/MiniGames/SAWDoAknowledgeRequest.ts +2 -0
  35. package/src/MiniGames/SAWGetTemplatesResponse.ts +1 -0
  36. package/src/MiniGames/SAWPrize.ts +18 -0
  37. package/src/MiniGames/SAWPrizeUI.ts +2 -1
  38. package/src/MiniGames/SAWTemplate.ts +27 -4
  39. package/src/SmarticoAPI.ts +7 -1
  40. package/src/SmarticoLib/index.ts +1 -1
  41. package/src/WSAPI/WSAPIJackpots.ts +11 -2
  42. package/src/WSAPI/WSAPIMiniGames.ts +91 -24
  43. package/src/WSAPI/WSAPITypes.ts +47 -46
package/README.md CHANGED
@@ -73,7 +73,7 @@ The SDK surface is split across one class per feature area, joined by an interna
73
73
  | **Clans** | [`WSAPIClans`](docs/api/classes/WSAPIClans.md) | `getClans`, `getClanInfo`, `joinClan` | [`getClans`](docs/ui/clans/UIGuide_getClans.md) · [`getClanInfo`](docs/ui/clans/UIGuide_getClanInfo.md) · [`joinClan`](docs/ui/clans/UIGuide_joinClan.md) |
74
74
  | **Jackpots** | [`WSAPIJackpots`](docs/api/classes/WSAPIJackpots.md) | `jackpotGet`, `jackpotOptIn`, `jackpotOptOut`, `getJackpotWinners`, `getJackpotEligibleGames` | [`jackpotGet`](docs/ui/jackpots/UIGuide_jackpotGet.md) · [`jackpotOptIn`](docs/ui/jackpots/UIGuide_jackpotOptIn.md) · [`jackpotOptOut`](docs/ui/jackpots/UIGuide_jackpotOptOut.md) · [`getJackpotWinners`](docs/ui/jackpots/UIGuide_getJackpotWinners.md) · [`getJackpotEligibleGames`](docs/ui/jackpots/UIGuide_getJackpotEligibleGames.md) |
75
75
  | **Raffles / Draws** | [`WSAPIRaffles`](docs/api/classes/WSAPIRaffles.md) | `getRaffles`, `getRaffleDrawRun`, `getRaffleDrawRunsHistory`, `claimRafflePrize`, `requestRaffleOptin`, `getRaffleWonPrizes` | [`getRaffles`](docs/ui/raffles/UIGuide_getRaffles.md) · [`getRaffleDrawRun`](docs/ui/raffles/UIGuide_getRaffleDrawRun.md) · [`getRaffleDrawRunsHistory`](docs/ui/raffles/UIGuide_getRaffleDrawRunsHistory.md) · [`claimRafflePrize`](docs/ui/raffles/UIGuide_claimRafflePrize.md) · [`requestRaffleOptin`](docs/ui/raffles/UIGuide_requestRaffleOptin.md) · [`getRaffleWonPrizes`](docs/ui/raffles/UIGuide_getRaffleWonPrizes.md) |
76
- | **MiniGames / SAW** | [`WSAPIMiniGames`](docs/api/classes/WSAPIMiniGames.md) | `getMiniGames`, `getMiniGamesHistory`, `playMiniGame`, `miniGameWinAcknowledgeRequest`, `playMiniGameBatch` | [`getMiniGames`](docs/ui/minigames/UIGuide_getMiniGames.md) · [`getMiniGamesHistory`](docs/ui/minigames/UIGuide_getMiniGamesHistory.md) · [`playMiniGame`](docs/ui/minigames/UIGuide_playMiniGame.md) · [`playMiniGameBatch`](docs/ui/minigames/UIGuide_playMiniGameBatch.md) |
76
+ | **MiniGames / SAW** | [`WSAPIMiniGames`](docs/api/classes/WSAPIMiniGames.md) | `getMiniGames`, `getMiniGamesHistory`, `playMiniGame`, `miniGameWinAcknowledgeRequest`, `playMiniGameBatch` | [`getMiniGames`](docs/ui/minigames/UIGuide_getMiniGames.md) · [`getMiniGamesHistory`](docs/ui/minigames/UIGuide_getMiniGamesHistory.md) · [`playMiniGame`](docs/ui/minigames/UIGuide_playMiniGame.md) · [`miniGameWinAcknowledgeRequest`](docs/ui/minigames/UIGuide_miniGameWinAcknowledgeRequest.md) · [`playMiniGameBatch`](docs/ui/minigames/UIGuide_playMiniGameBatch.md) |
77
77
  | **Avatars** | [`WSAPIAvatars`](docs/api/classes/WSAPIAvatars.md) | `getAvatarsList`, `getAvatarsCustomized`, `getAvatarPrompts`, `setAvatar`, `avatarsCustomize` | [`getAvatarsList`](docs/ui/avatars/UIGuide_getAvatarsList.md) · [`getAvatarsCustomized`](docs/ui/avatars/UIGuide_getAvatarsCustomized.md) · [`getAvatarPrompts`](docs/ui/avatars/UIGuide_getAvatarPrompts.md) · [`setAvatar`](docs/ui/avatars/UIGuide_setAvatar.md) · [`avatarsCustomize`](docs/ui/avatars/UIGuide_avatarsCustomize.md) |
78
78
  | **Game Pick (sports / quiz)** | [`WSAPIGamePick`](docs/api/classes/WSAPIGamePick.md) | `gamePickGet*`, `gamePickSubmit*` (9 methods) | [`gamePickGetActiveRounds`](docs/ui/gamepick/UIGuide_gamePickGetActiveRounds.md) · [`gamePickGetActiveRound`](docs/ui/gamepick/UIGuide_gamePickGetActiveRound.md) · [`gamePickGetHistory`](docs/ui/gamepick/UIGuide_gamePickGetHistory.md) · [`gamePickGetBoard`](docs/ui/gamepick/UIGuide_gamePickGetBoard.md) · [`gamePickSubmitSelection`](docs/ui/gamepick/UIGuide_gamePickSubmitSelection.md) · [`gamePickSubmitSelectionQuiz`](docs/ui/gamepick/UIGuide_gamePickSubmitSelectionQuiz.md) · [`gamePickGetUserInfo`](docs/ui/gamepick/UIGuide_gamePickGetUserInfo.md) · [`gamePickGetGameInfo`](docs/ui/gamepick/UIGuide_gamePickGetGameInfo.md) · [`gamePickGetRoundInfoForUser`](docs/ui/gamepick/UIGuide_gamePickGetRoundInfoForUser.md) |
79
79
  | **Leaderboard** | [`WSAPILeaderBoard`](docs/api/classes/WSAPILeaderBoard.md) | `getLeaderBoard`, `getLeaderBoards` | [`getLeaderBoard`](docs/ui/leaderboard/UIGuide_getLeaderBoard.md) |
@@ -1,4 +1,6 @@
1
1
  import { ProtocolMessage } from '.././Base/ProtocolMessage';
2
2
  export interface SAWDoAknowledgeRequest extends ProtocolMessage {
3
3
  request_id: string;
4
+ /** When true, finalises the spin as lost: the prize is not credited and is returned to the prize pool. */
5
+ lose?: boolean;
4
6
  }
@@ -2,24 +2,42 @@ import { AttemptPeriodType } from './AttemptPeriodType';
2
2
  import { SAWPrizeType } from './SAWPrizeType';
3
3
  import { SAWPrizeUI } from './SAWPrizeUI';
4
4
  export interface SAWPrize {
5
+ /** ID of the prize */
5
6
  saw_prize_id: number;
7
+ /** Visual definition of the prize (name, icon, win-modal buttons, per-game rendering hints) */
6
8
  saw_prize_ui_definition: SAWPrizeUI;
9
+ /** Numeric value for 'points' / 'spin' prize types (e.g. 100 for "100 points"); not relevant for other types */
7
10
  prize_value?: number;
11
+ /** The type of the prize — see {@link SAWPrizeType} */
8
12
  prize_type_id: SAWPrizeType;
13
+ /** Competition games (MatchX / Quiz): first finishing place this prize applies to */
9
14
  place_from?: number;
15
+ /** Competition games (MatchX / Quiz): last finishing place this prize applies to; equals `place_from` for a single-place prize */
10
16
  place_to?: number;
17
+ /** Client-side only — unique id of a win instance generated by the default Smartico UI to dedupe render effects; never sent by the server */
11
18
  sawUniqueWinId?: string;
19
+ /** Remaining stock. Present only when the template's `expose_game_stat_on_api` is enabled; always present for MatchX / Quiz games */
12
20
  pool?: number;
21
+ /** Initial (configured) stock. Present regardless of `expose_game_stat_on_api` */
13
22
  pool_initial?: number;
23
+ /** Times the prize has been won, across all players. Present only when `expose_game_stat_on_api` is enabled */
14
24
  wins_count?: number;
25
+ /** ISO weekday numbers (1 = Monday … 7 = Sunday) the prize can be won on; absent = any day. Present only when `expose_game_stat_on_api` is enabled */
15
26
  weekdays?: number[];
27
+ /** Prize availability window start (epoch ms), evaluated against `relative_period_timezone`. Present only when `expose_game_stat_on_api` is enabled */
16
28
  active_from_ts?: number;
29
+ /** Prize availability window end (epoch ms), evaluated against `relative_period_timezone`. Present only when `expose_game_stat_on_api` is enabled */
17
30
  active_till_ts?: number;
31
+ /** Timezone offset in minutes for `weekdays` / active-window evaluation (UTC minus local, as in JS `Date.getTimezoneOffset()`) */
18
32
  relative_period_timezone?: number;
33
+ /** When true, the prize stays winnable at `pool` 0 (unlimited stock) */
19
34
  is_surcharge?: boolean;
35
+ /** Always `false` in API responses — deleted prizes are excluded server-side */
20
36
  is_deleted?: boolean;
37
+ /** Type-specific prize details — e.g. `gems` / `_gems_diamonds_type` for gems-and-diamonds prizes, `tickets_count` for raffle-ticket prizes */
21
38
  prize_details_json?: {
22
39
  [key: string]: any;
23
40
  };
41
+ /** Period basis for the prize availability restriction — see {@link AttemptPeriodType} */
24
42
  max_give_period_type_id?: AttemptPeriodType;
25
43
  }
@@ -7,6 +7,7 @@ export interface SAWPrizeUI {
7
7
  name_original?: string;
8
8
  hide_prize_popup: boolean;
9
9
  aknowledge_message?: string;
10
+ /** Message shown instead of `aknowledge_message` when the spin is finalised as lost (`lose: true` acknowledge — games with a client-decided outcome, e.g. Voyager) */
10
11
  aknowledge_message_lose?: string;
11
12
  sectors?: number[];
12
13
  acknowledge_type?: SAWAcknowledgeType;
@@ -3,37 +3,61 @@ import { SAWGameType } from './SAWGameType';
3
3
  import { SAWPrize } from './SAWPrize';
4
4
  import { SAWTemplateUI } from './SAWTemplateUI';
5
5
  export interface SAWTemplate {
6
+ /** ID of the mini-game template */
6
7
  saw_template_id: number;
8
+ /** The type of the game — see {@link SAWGameType} */
7
9
  saw_game_type_id: SAWGameType;
10
+ /** Full UI definition of the mini-game (name, description, skin, colors, per-game visual settings) */
8
11
  saw_template_ui_definition: SAWTemplateUI;
12
+ /** How the user is charged per attempt — see {@link SAWBuyInType} */
9
13
  saw_buyin_type_id: SAWBuyInType;
14
+ /** Cost per attempt in the buy-in currency (points, gems or diamonds per `saw_buyin_type_id`) */
10
15
  buyin_cost_points?: number;
16
+ /** Operator hint: show the game only while the user can actually play it (has attempts / sufficient balance) */
11
17
  visibile_when_can_spin: boolean;
18
+ /** Number of spin attempts the user currently has (initial value; later changes arrive as spin-count pushes) */
12
19
  spin_count?: number;
20
+ /** Prizes configured for this game — see {@link SAWPrize} */
13
21
  prizes: SAWPrize[];
22
+ /** Operator visibility flag for the template */
14
23
  is_visible: boolean;
24
+ /** Time from which the template becomes available (epoch ms); absent when not restricted */
15
25
  activeFromDate?: number;
26
+ /** Time until which the template stays available (epoch ms); absent when not restricted */
16
27
  activeTillDate?: number;
28
+ /** Amount added to the jackpot on every play (abstract contribution — nothing is deducted from the player) */
17
29
  jackpot_add_on_attempt: number;
30
+ /** Current jackpot accumulator value */
18
31
  jackpot_current: number;
32
+ /** Seed value of the jackpot — the accumulator starts at (and resets to) this amount after a jackpot win */
19
33
  jackpot_guaranteed: number;
34
+ /** Maximum number of unspent spin attempts a user can accumulate */
20
35
  maxActiveSpinsAllowed: number;
36
+ /** Maximum number of attempts a user can make during `maxSpinsPediodMs` */
21
37
  maxSpinsCount: number;
38
+ /** Length of the attempt-limit period in ms (note the field-name spelling) */
22
39
  maxSpinsPediodMs: number;
40
+ /** Epoch-ms time when the next attempt becomes available; populated only when the operator enabled the "show time to the next available spin" setting and max attempts per period is 1 */
23
41
  next_available_spin_ts?: number;
24
42
  /** Soonest-expiring spin's expiration time for this user (epoch ms); `null`/absent when no expirable spins. */
25
43
  earliest_expiration_dt?: number | null;
26
44
  /** Latest-expiring spin's expiration time for this user (epoch ms); `null`/absent when no expirable spins. */
27
45
  latest_expiration_dt?: number | null;
46
+ /** Key of the visual skin the operator selected for the game */
28
47
  saw_skin_key: string;
48
+ /** Skin assets of the game: `skin_folder` is the base URL for the skin's images, `skin_css` custom CSS overrides, plus optional popup/animation tweaks */
29
49
  saw_skin_ui_definition: {
30
50
  skin_folder: string;
31
51
  skin_css: string;
32
52
  use_new_popups?: boolean;
33
53
  lottie_animation_speed?: number;
34
54
  };
55
+ /** Operator template setting. When enabled, the per-prize stock statistics (`pool`, `wins_count`, `weekdays`, `active_from_ts` / `active_till_ts`) are populated on `prizes`; when disabled (default) the server strips them from the response (`pool` is kept for MatchX / Quiz games). */
35
56
  expose_game_stat_on_api?: boolean;
57
+ /** Prize Drop only: when true, the pushed prize requires an explicit claim by the user before it is credited */
36
58
  requires_prize_claim?: boolean;
59
+ /** Timezone offset in minutes used to evaluate the template's period-based rules (UTC minus local, as in JS `Date.getTimezoneOffset()`) */
37
60
  relative_period_timezone?: number;
61
+ /** Operator setting: show a prize-history entry point (icon / button) on this game's view */
38
62
  show_prize_history?: boolean;
39
63
  }
@@ -120,7 +120,7 @@ declare class SmarticoAPI {
120
120
  }): Promise<TGetJackpotEligibleGamesResponse>;
121
121
  sawGetTemplates(user_ext_id: string, force_language?: string, is_visitor_mode?: boolean): Promise<SAWGetTemplatesResponse>;
122
122
  sawGetTemplatesT(user_ext_id: string): Promise<TMiniGameTemplate[]>;
123
- doAcknowledgeRequest(user_ext_id: string, request_id: string): Promise<SAWDoAknowledgeResponse>;
123
+ doAcknowledgeRequest(user_ext_id: string, request_id: string, lose?: boolean): Promise<SAWDoAknowledgeResponse>;
124
124
  sawSpinRequest(user_ext_id: string, saw_template_id: number, round_id?: number): Promise<SAWDoSpinResponse>;
125
125
  doAcknowledgeBatchRequest(user_ext_id: string, request_ids: string[]): Promise<SAWDoAcknowledgeBatchResponse>;
126
126
  sawSpinBatchRequest(user_ext_id: string, saw_template_id: number, spins_count: number): Promise<SAWDoSpinBatchResponse>;
@@ -2021,7 +2021,7 @@ declare class SmarticoAPI {
2021
2021
  coreCheckSegments(user_ext_id: string, segment_id: number[]): Promise<TSegmentCheckResult[]>;
2022
2022
  sawGetTemplates(user_ext_id: string, lang?: string, is_visitor_mode?: boolean): Promise<SAWGetTemplatesResponse>;
2023
2023
  sawGetTemplatesT(user_ext_id: string): Promise<TMiniGameTemplate[]>;
2024
- doAcknowledgeRequest(user_ext_id: string, request_id: string): Promise<SAWDoAknowledgeResponse>;
2024
+ doAcknowledgeRequest(user_ext_id: string, request_id: string, lose?: boolean): Promise<SAWDoAknowledgeResponse>;
2025
2025
  sawSpinRequest(user_ext_id: string, saw_template_id: number, round_id?: number): Promise<SAWDoSpinResponse>;
2026
2026
  missionOptIn(user_ext_id: string, mission_id: number): Promise<AchievementOptinResponse>;
2027
2027
  missionClaimPrize(user_ext_id: string, mission_id: number, ach_completed_id: number): Promise<AchClaimPrizeResponse>;
@@ -297,7 +297,7 @@ export declare class WSAPIJackpots extends WSAPIClans {
297
297
  *
298
298
  * @remarks
299
299
  * **Preconditions**
300
- * - User must be authenticated. Visitor mode not supported.
300
+ * - No authentication required — works in both identified and visitor mode.
301
301
  * - `jp_template_id` is mandatory.
302
302
  *
303
303
  * **`onUpdate` caveat**
@@ -315,7 +315,12 @@ export declare class WSAPIJackpots extends WSAPIClans {
315
315
  * Non-zero `errCode` on control-group users or generic server errors.
316
316
  * Branch on `errCode === 0` and surface `errMsg` on failure.
317
317
  *
318
- * **Visitor mode**: not supported.
318
+ * **Visitor mode**: supported via
319
+ * `_smartico.vapi(lang).getJackpotEligibleGames(...)`. The eligible-games
320
+ * list is template-level (which games contribute to the pot) and carries no
321
+ * per-user fields, so a visitor session receives the same list an identified
322
+ * user would. The `lang` passed to `_smartico.vapi(lang)` drives the
323
+ * translation of game names.
319
324
  *
320
325
  * **UI guidance**: see [UI Guide — `getJackpotEligibleGames`](../../docs/ui/jackpots/UIGuide_getJackpotEligibleGames.md).
321
326
  *
@@ -333,6 +338,10 @@ export declare class WSAPIJackpots extends WSAPIClans {
333
338
  *
334
339
  * const r = await window._smartico.api.getJackpotEligibleGames({ jp_template_id: 42 });
335
340
  * console.log('[smartico] render', r.eligible_games.length, 'eligible game tiles');
341
+ *
342
+ * // Visitor mode — same shape, language driven by the vapi(lang) argument
343
+ * const visitor = await window._smartico.vapi('EN').getJackpotEligibleGames({ jp_template_id: 42 });
344
+ * console.log('[smartico] visitor eligible games:', visitor.eligible_games.length);
336
345
  * ```
337
346
  */
338
347
  getJackpotEligibleGames({ jp_template_id, onUpdate }: {
@@ -53,6 +53,27 @@ export declare class WSAPIMiniGames extends WSAPIRaffles {
53
53
  * games server (not this SDK); the SAW spin is fired
54
54
  * server-internally to deduct the buy-in.
55
55
  *
56
+ * **Per-prize statistics (`expose_game_stat_on_api`)**
57
+ * Each template's `prizes` array always carries the definition
58
+ * fields — name, icon, `prize_type`, `prize_value`, acknowledge
59
+ * configuration. The stock-statistics fields are gated by an
60
+ * operator template setting, surfaced as
61
+ * `expose_game_stat_on_api`:
62
+ * - Populated when enabled: `pool` (remaining stock),
63
+ * `wins_count` (total wins across all players), `weekdays`
64
+ * (ISO 1–7 days the prize can be won), `active_from_ts` /
65
+ * `active_till_ts` (prize availability window).
66
+ * - Omitted when disabled (the default) — this keeps the live
67
+ * prize economy (stock levels, win rates, schedules) hidden
68
+ * from players.
69
+ * - Exception: `pool` is always populated for `MatchX` / `Quiz`
70
+ * templates, whose game flow needs the remaining stock.
71
+ * - `pool_initial` is populated regardless of the setting.
72
+ * When enabled, the values are also kept current — the server
73
+ * refreshes the prize rows on each fetch and drops its template
74
+ * caches after every play, so `pool` / `wins_count` are safe to
75
+ * drive an "X prizes left" scarcity UI.
76
+ *
56
77
  * **Cache TTL**: the SDK caches the response for 30 seconds. Cache
57
78
  * is fully cleared on login / logout.
58
79
  *
@@ -259,14 +280,19 @@ export declare class WSAPIMiniGames extends WSAPIRaffles {
259
280
  * it later by calling {@link miniGameWinAcknowledgeRequest} with the
260
281
  * `request_id` returned on this result.
261
282
  *
262
- * What `acknowledge: false` does and does NOT defer:
263
- * - For STANDARD prizes the value is credited at spin time
264
- * regardless, so opting out does NOT delay the balance change —
265
- * it only defers the "delivered" bookkeeping and the `is_claimed`
266
- * flag flipping in {@link getMiniGamesHistory}.
267
- * - For operator-configured "explicit claim" prizes the credit IS
268
- * deferred until the spin is acknowledged, so those require an
269
- * explicit acknowledge to finalise.
283
+ * What `acknowledge: false` defers:
284
+ * - For STANDARD prizes the value is credited when the spin is
285
+ * finalised — by your later acknowledge or, failing that, by the
286
+ * server-side fallback below — so opting out delays the balance
287
+ * change by at most that fallback window. The `is_claimed` flag in
288
+ * {@link getMiniGamesHistory} flips on the same finalisation.
289
+ * - For operator-configured "explicit claim" prizes the credit is
290
+ * deferred until your explicit acknowledge — the fallback does not
291
+ * cover them.
292
+ *
293
+ * While the spin is un-finalised it can also be finalised as LOST —
294
+ * prize discarded back to the pool — via
295
+ * {@link miniGameWinAcknowledgeRequest} with `{ lose: true }`.
270
296
  *
271
297
  * A server-side fallback auto-acknowledges ordinary un-acknowledged
272
298
  * spins after a short delay (about 1–3 minutes), so an ordinary
@@ -297,8 +323,10 @@ export declare class WSAPIMiniGames extends WSAPIRaffles {
297
323
  * time the call resolves. Balance updates flow via the
298
324
  * user-properties channel (observe via {@link getUserProfile}).
299
325
  * - Prize value credited per the prize's type (see "Prize handling"
300
- * above). Standard prizes are credited at spin time; "explicit
301
- * claim" prizes are credited when the spin is acknowledged.
326
+ * above) when the spin is finalised — with the default
327
+ * auto-acknowledge that happens before the call resolves;
328
+ * "explicit claim" prizes are credited only by an explicit
329
+ * acknowledge.
302
330
  * - The play is recorded server-side for analytics / reporting.
303
331
  *
304
332
  * **UI guidance**: see [UI Guide — `playMiniGame`](../../docs/ui/minigames/UIGuide_playMiniGame.md).
@@ -363,18 +391,24 @@ export declare class WSAPIMiniGames extends WSAPIRaffles {
363
391
  *
364
392
  * @example
365
393
  * Manual finalisation (`acknowledge: false`) — e.g. an explicit
366
- * "Claim" CTA, or finalising on your own schedule:
394
+ * "Claim" CTA, a decline/forfeit flow, or finalising on your own
395
+ * schedule:
367
396
  * ```ts
368
397
  * const r = await window._smartico.api.playMiniGame(game.id, { acknowledge: false });
369
398
  * if (r.err_code === 0) {
370
- * // Spin resolved but not yet acknowledged. For standard prizes the
371
- * // balance already changed server-side; "explicit claim" prizes
372
- * // are credited only by the acknowledge below.
399
+ * // Spin resolved but not yet finalised — the prize is not credited
400
+ * // yet. Your acknowledge below credits it (for standard prizes the
401
+ * // server-side fallback would eventually do the same).
373
402
  * console.log('[smartico] prize won — show the result / Claim CTA, then finalise');
374
403
  *
375
404
  * // On the user's Claim click, finalise with the request_id from the result.
376
405
  * await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
377
406
  * console.log('[smartico] win finalised — refresh getUserProfile / getMiniGames to reflect it');
407
+ *
408
+ * // Or, if the game flow ends in the player declining / losing the
409
+ * // drawn prize, finalise the spin as lost instead — the prize is
410
+ * // not credited and returns to the prize pool:
411
+ * // await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id, { lose: true });
378
412
  * }
379
413
  * ```
380
414
  */
@@ -384,9 +418,10 @@ export declare class WSAPIMiniGames extends WSAPIRaffles {
384
418
  }): Promise<TMiniGamePlayResult>;
385
419
  /**
386
420
  * Manually acknowledges a mini-game spin — marks the win delivered
387
- * server-side. Most consumers do NOT need this: {@link playMiniGame}
388
- * acknowledges by default (`acknowledge: true`) and
389
- * {@link playMiniGameBatch} acknowledges automatically. Call this
421
+ * server-side, or (with `lose: true`) finalises it as lost and
422
+ * returns the prize to the pool. Most consumers do NOT need this:
423
+ * {@link playMiniGame} acknowledges by default (`acknowledge: true`)
424
+ * and {@link playMiniGameBatch} acknowledges automatically. Call this
390
425
  * directly only when you took ownership of the acknowledge step or
391
426
  * need to recover a lost one.
392
427
  *
@@ -409,6 +444,27 @@ export declare class WSAPIMiniGames extends WSAPIRaffles {
409
444
  * `client_request_id` on a {@link getMiniGamesHistory} row are the
410
445
  * same correlation id — this method accepts either.
411
446
  *
447
+ * **Finalising as lost (`lose: true`)**
448
+ * Pass `{ lose: true }` to finalise the spin as LOST instead of won:
449
+ * the prize is NOT credited and is returned to the game's prize pool
450
+ * (available again for other players), and the spin fires the
451
+ * mini-game "lose" engagement event instead of the win one. On the
452
+ * next {@link getMiniGamesHistory} fetch the row shows `is_claimed:
453
+ * true` with no prize attached. Use this for game mechanics where the
454
+ * player can decline or forfeit the drawn prize — e.g. a
455
+ * gamble/discard step, or a client-driven game where the user's final
456
+ * action decides whether the pre-drawn prize is actually won (the
457
+ * default Smartico UI does this for the Voyager game: failing the
458
+ * star-collection run finalises the spin as lost). When configured,
459
+ * the prize's `aknowledge_message_lose` is the operator's result copy
460
+ * for this case — show it instead of `aknowledge_message`. It only
461
+ * works on a spin that is not yet finalised, so it requires playing
462
+ * with `acknowledge: false` and calling promptly — once the automatic
463
+ * acknowledge or the server-side fallback (below) has finalised the
464
+ * spin, `lose: true` is a no-op and the prize stays credited.
465
+ * ("Explicit claim" prizes are exempt from the fallback, so for them
466
+ * there is no time pressure.)
467
+ *
412
468
  * **Idempotency**: safe. Acknowledging a spin that is already
413
469
  * finalised — by you, by the automatic acknowledge, or by the
414
470
  * fallback — is a no-op with no double credit. Acknowledging a
@@ -423,13 +479,16 @@ export declare class WSAPIMiniGames extends WSAPIRaffles {
423
479
  * call here.
424
480
  *
425
481
  * **Side effects** (first successful call for an un-acknowledged spin)
426
- * - For "explicit claim" prizes, the prize value is credited on this
427
- * call. For standard prizes the value was already credited at spin
428
- * time (see {@link playMiniGame} "Prize handling"); this call only
429
- * marks the win delivered.
430
- * - The spin's `is_claimed` flips to `true` on the next
482
+ * - Default (win): the prize value is credited on this call — this is
483
+ * the finalisation step that credits standard and "explicit claim"
484
+ * prizes alike (see {@link playMiniGame} "Prize handling").
485
+ * - With `lose: true`: no credit; the prize returns to the prize pool
486
+ * and the "lose" engagement event fires.
487
+ * - Either way the spin's `is_claimed` flips to `true` on the next
431
488
  * {@link getMiniGamesHistory} fetch.
432
489
  *
490
+ * **UI guidance**: see [UI Guide — `miniGameWinAcknowledgeRequest`](../../docs/ui/minigames/UIGuide_miniGameWinAcknowledgeRequest.md).
491
+ *
433
492
  * **Visitor mode**: not supported.
434
493
  *
435
494
  * @param request_id Correlation id of the spin to finalise: the
@@ -437,6 +496,10 @@ export declare class WSAPIMiniGames extends WSAPIRaffles {
437
496
  * (played with `acknowledge: false`), or the
438
497
  * `client_request_id` of a
439
498
  * {@link getMiniGamesHistory} row.
499
+ * @param options.lose Optional. When `true`, finalises the spin as
500
+ * lost — the prize is not credited and returns
501
+ * to the prize pool (see "Finalising as lost").
502
+ * Omit (or pass `false`) to deliver the win.
440
503
  *
441
504
  * @example
442
505
  * ```ts
@@ -447,6 +510,10 @@ export declare class WSAPIMiniGames extends WSAPIRaffles {
447
510
  * await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
448
511
  * }
449
512
  *
513
+ * // Decline / forfeit — finalise the same spin as lost instead:
514
+ * // the prize is not credited and goes back to the prize pool.
515
+ * await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id, { lose: true });
516
+ *
450
517
  * // Recovery — re-acknowledge any spins a batch acknowledge missed.
451
518
  * const history = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
452
519
  * for (const row of history.filter(h => !h.is_claimed)) {
@@ -455,7 +522,9 @@ export declare class WSAPIMiniGames extends WSAPIRaffles {
455
522
  * }
456
523
  * ```
457
524
  */
458
- miniGameWinAcknowledgeRequest(request_id: string): Promise<import("../MiniGames").SAWDoAknowledgeResponse>;
525
+ miniGameWinAcknowledgeRequest(request_id: string, { lose }?: {
526
+ lose?: boolean;
527
+ }): Promise<import("../MiniGames").SAWDoAknowledgeResponse>;
459
528
  /**
460
529
  * Plays a mini-game template `spin_count` times in one round-trip.
461
530
  * Returns an array of per-spin results — each independent, each
@@ -20,71 +20,73 @@ type TRibbon = 'sale' | 'hot' | 'new' | 'vip' | string;
20
20
  export interface TMiniGamePrize {
21
21
  /** ID of the prize */
22
22
  id: number;
23
- /** The visual name of the prize */
23
+ /** Display name of the prize, pre-translated; any jackpot placeholder in it arrives resolved to the live jackpot value */
24
24
  name: string;
25
- /** The type of the prize, no-prize, points, bonus, manual, spin, jackpot */
25
+ /** The type of the prize — see {@link MiniGamePrizeTypeName} ('no-prize', 'points', 'gems-and-diamonds', 'spin', 'bonus', 'jackpot', 'raffle-ticket', 'mission', 'change-level', 'manual') */
26
26
  prize_type: MiniGamePrizeTypeName;
27
27
  /** Numeric value of the prize in case it's 'points' or 'spin' type. For other types of prizes this value is not relevant.
28
28
  * For example for prize '100 points' the prize_value will be 100. For '100 free spins' the prize_value will be 100.
29
29
  */
30
30
  prize_value?: number;
31
- /** Custom font size for the prize (desktop) */
31
+ /** Custom font size in px for rendering the prize name on the game surface (e.g. a wheel sector), desktop */
32
32
  font_size?: number;
33
- /** Custom font size for the prize (mobile) */
33
+ /** Custom font size in px for the prize name, mobile; falls back to `font_size` when absent */
34
34
  font_size_mobile?: number;
35
35
  /** The URL of the icon of the prize, aspect ratio 1:1 */
36
36
  icon?: string;
37
- /** for scratch card defines position of prize in the list */
37
+ /** For Scratch Card games — relative order of the prize in the scratch grid (lower first). May be absent for other game types */
38
38
  position: number;
39
- /** List of sectors for the prize */
39
+ /** For Spin-a-Wheel games — wheel sector indices this prize occupies. Absent for non-wheel games */
40
40
  sectors: number[];
41
- /** Type of acknowledge message for users */
41
+ /** Which win modal the prize uses — see {@link SAWAcknowledgeTypeName} (Silent / QuickMessage / FullMessage / ExplicitAcknowledge) */
42
42
  acknowledge_type: SAWAcknowledgeTypeName;
43
43
  /** Message that will be shown to user in modal pop-up */
44
44
  aknowledge_message: string;
45
- /** Deep link that will trigger some action in modal pop-up */
45
+ /** Message shown instead of `aknowledge_message` when the spin is finalised as lost (`lose: true` acknowledge flows — games with a client-decided outcome, e.g. Voyager). Absent unless configured */
46
+ aknowledge_message_lose?: string;
47
+ /** Deep link executed when the user taps the main action button in the win modal (run it via `_smartico.dp()`) */
46
48
  acknowledge_dp: string;
47
- /** The name of the action button in modal pop-up */
49
+ /** Label of the main action button in the win modal */
48
50
  acknowledge_action_title: string;
49
- /** Deep link that will trigger some action in modal pop-up (additional) */
51
+ /** Deep link of the additional action button in the win modal */
50
52
  acknowledge_dp_additional?: string;
51
- /** The name of the action button in modal pop-up (additional) */
53
+ /** Label of the additional action button in the win modal */
52
54
  acknowledge_action_title_additional?: string;
53
- /** Deep link that will trigger some action in modal pop-up (second button) */
55
+ /** Deep link of the secondary button in the win modal */
54
56
  second_btn?: string;
55
- /** The name of the action button in modal pop-up (second button) */
57
+ /** Label of the secondary button in the win modal */
56
58
  second_btn_action_title?: string;
57
59
  /** Message when the prize pool is empty for that specific prize */
58
60
  out_of_stock_message?: string;
59
- /** Number of items in stock */
61
+ /** Remaining stock of the prize — decrements on each win, refunded if the spin is finalised as lost. Populated only when the template's `expose_game_stat_on_api` is enabled; always populated for MatchX / Quiz games */
60
62
  pool?: number;
61
- /** Initial number of items in stock */
63
+ /** Initial (configured) stock of the prize. Populated regardless of `expose_game_stat_on_api` */
62
64
  pool_initial?: number;
63
- /** Number of wins in game */
65
+ /** Number of times the prize has been won, across all players. Populated only when the template's `expose_game_stat_on_api` is enabled */
64
66
  wins_count?: number;
65
- /** Number of days of week, when the prize can be available */
67
+ /** ISO weekday numbers (1 = Monday … 7 = Sunday) on which the prize can be won; absent = any day. Populated only when the template's `expose_game_stat_on_api` is enabled */
66
68
  weekdays?: number[];
67
- /** Holds time from which prize will become available, for the prizes that are targeted to be available from specific time (UNIX timestamp) */
69
+ /** Time from which the prize can be won (epoch ms), evaluated against `relative_period_timezone`. Populated only when the template's `expose_game_stat_on_api` is enabled */
68
70
  active_from_ts?: number;
69
- /** Holds time till which prize will become available, for the prizes that are targeted to be available from specific time (UNIX timestamp) */
71
+ /** Time until which the prize can be won (epoch ms), evaluated against `relative_period_timezone`. Populated only when the template's `expose_game_stat_on_api` is enabled */
70
72
  active_till_ts?: number;
71
- /** Time zone to ensure each day aligns with your local midnight. */
73
+ /** Timezone offset in minutes used to evaluate `weekdays` and the active window (UTC minus local, as in JS `Date.getTimezoneOffset()` — e.g. `-180` for UTC+3) */
72
74
  relative_period_timezone?: number;
73
- /** Flag indicating that the prize is surcharged (available all the time, despite pool numbers) */
75
+ /** When true, the prize stays winnable even when its `pool` reaches 0 (effectively unlimited stock) */
74
76
  is_surcharge?: boolean;
75
- /** Flag indicating the state of the prize */
77
+ /** Always `false` in API responses — deleted prizes are excluded server-side */
76
78
  is_deleted?: boolean;
77
- /** The custom data of the mini-game defined by operator in the BackOffice. Can be a JSON object, string or number */
79
+ /** The custom data of the prize defined by the operator. Can be a JSON object, string or number */
78
80
  custom_data?: any;
79
- /** Prize modifiers that will multiply by 2x, 5x or 10x the current total. This will not affect the final Prize Amount that will be awarded. */
81
+ /** Step-modifier tiles for step games (Treasure Hunt / Voyager) — see {@link PrizeModifiers} (2x / 5x / 10x, /2 / /5 / /10, 0, reset) applied to the running total revealed during the game. Presentation only — the awarded amount is still `prize_value` */
80
82
  prize_modifiers?: PrizeModifiers[];
81
- /** When enabled, you can split prize value by decimal values */
83
+ /** Step games (Treasure Hunt / Voyager): when true, the per-step revealed amounts of the prize value may be fractional; when false the split uses whole numbers */
82
84
  allow_split_decimal?: boolean;
83
- /** When enabled, you can hide prize from prize history */
85
+ /** Operator hint to hide this prize when rendering prize-history UIs. Informational only — API responses are not filtered by it */
84
86
  hide_prize_from_history?: boolean;
85
- /** Requirements to claim the prize (lootbox specific)*/
87
+ /** Operator text describing what the user must do to be eligible for this prize (lootbox games); shown when the prize is not yet available to the user */
86
88
  requirements_to_get_prize?: string;
87
- /** The period type for the prize to be given: Time from last attempt, Calendar days UTC, Calendar days user time zone, Lifetime */
89
+ /** Period basis for the prize availability restriction — see {@link AttemptPeriodType}. `CalendarDaysUserTimeZone` evaluates `weekdays` / the active window in the user's timezone; the other types use `relative_period_timezone` */
88
90
  max_give_period_type_id?: AttemptPeriodType;
89
91
  }
90
92
  /**
@@ -158,10 +160,9 @@ export interface TMiniGameTemplate {
158
160
  /** in case of charging type 'Spin attempts', shows the current number of spin attempts that user has */
159
161
  spin_count?: number;
160
162
  /**
161
- * if the game is limit to the number of spins that user can do during period of time,
162
- * this property shows the epoch time in UTC when the next attempt will be available.
163
- * Note that you need to enable 'Show time to the next available spin' setting on mini-game template in the backoffice
164
- * Important: this field will not be populated if “Max number of attempts a user can do” is set to value different from 1
163
+ * If the game limits the number of attempts per period of time, the epoch-ms time (UTC) when the next attempt becomes available.
164
+ * Populated only when the operator enabled the "show time to the next available spin" template setting, and only when the
165
+ * template's maximum attempts per period is 1.
165
166
  * */
166
167
  next_available_spin_ts: number;
167
168
  /** Soonest-expiring spin's expiration time for the current user, as an epoch-ms timestamp.
@@ -177,7 +178,7 @@ export interface TMiniGameTemplate {
177
178
  over_limit_message: string;
178
179
  /** The message that should be shown to the user when he cannot play the game because he doesn't have spin attempts or points. */
179
180
  no_attempts_message: string;
180
- /** Current jackpont amount, if jackpot is enabled. */
181
+ /** Current jackpot amount, if jackpot is enabled. */
181
182
  jackpot_current: number;
182
183
  /** The amount that will be added to the jackpot every time when somebody plays the game. Note that the contribution amount is abstract, means that no money or points are deducted from the user balance. */
183
184
  jackpot_add_on_attempt: number;
@@ -190,31 +191,31 @@ export interface TMiniGameTemplate {
190
191
  promo_text: string;
191
192
  /** The custom data of the mini-game defined by operator in the BackOffice. Can be a JSON object, string or number */
192
193
  custom_data: any;
193
- /** List of prizes for mini-games */
194
+ /** Prizes configured for this game — see {@link TMiniGamePrize} */
194
195
  prizes: TMiniGamePrize[];
195
- /** When enabled, the number of items in the pool and number of won items will be exposed in the Retention API and in the UI Widgets */
196
+ /** Operator template setting. When enabled, the per-prize stock statistics (`pool`, `wins_count`, `weekdays`, `active_from_ts` / `active_till_ts`) are populated on `prizes` and kept current after every play; when disabled (default) those fields are omitted. See `getMiniGames` "Per-prize statistics" */
196
197
  expose_game_stat_on_api?: boolean;
197
- /** Time zone to ensure each day aligns with your local midnight. */
198
+ /** Timezone offset in minutes used to evaluate the template's period-based rules (UTC minus local, as in JS `Date.getTimezoneOffset()` — e.g. `-180` for UTC+3) */
198
199
  relative_period_timezone?: number;
199
- /** Holds time from which template will become available, for the template that are targeted to be available from specific time (UNIX timestamp) */
200
+ /** Time from which the template becomes available (epoch ms); absent when not restricted */
200
201
  activeFromDate?: number;
201
- /** Holds time till which template will become available, for the templates that are targeted to be available from specific time (UNIX timestamp) */
202
+ /** Time until which the template stays available (epoch ms); absent when not restricted */
202
203
  activeTillDate?: number;
203
- /** The amount of steps to complete the game and gather the prize */
204
+ /** Number of steps to complete the game and collect the prize (step games — Voyager / Treasure Hunt) */
204
205
  steps_to_finish_game?: number;
205
- /** Hold the id of the custom section */
206
+ /** ID of the operator-defined custom section (widget menu grouping) the mini-game is assigned to */
206
207
  custom_section_id?: number;
207
- /** The UI definition of the mini-game */
208
+ /** Full raw UI definition of the mini-game (skin, colors, per-game visual settings) — see {@link SAWTemplateUI}. The commonly needed values are already lifted onto this template object */
208
209
  saw_template_ui_definition: SAWTemplateUI;
209
- /** The layout of the game */
210
+ /** Grid layout of the game. Populated only for Lootbox game types (LootboxWeekdays / LootboxCalendarDays) */
210
211
  game_layout?: SAWGameLayoutName;
211
- /** When enabled the prize history icon is visible on a certain template */
212
+ /** Operator setting: show a prize-history entry point (icon / button) on this game's view */
212
213
  show_prize_history?: boolean;
213
214
  /** The maximum number of attempts that user can do during period of time */
214
215
  max_number_of_attempts?: number;
215
216
  /** The period of time in milliseconds during which the user can do the maximum number of attempts */
216
217
  max_spins_period_ms?: number;
217
- /** The ID of the user spin id to expose on the game */
218
+ /** Which identifier to show next to a win result for transparency/audit — 'userId' (the player's external user id) or 'spinId' (the spin's transaction id). Absent when the operator disabled it */
218
219
  expose_user_spin_id?: SAWExposeUserSpinIdName;
219
220
  }
220
221
  /**