@smartico/public-api 0.0.408 → 0.0.410
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/GamePick/GamePickTypes.d.ts +6 -1
- package/dist/MiniGames/SAWDoAknowledgeRequest.d.ts +2 -0
- package/dist/MiniGames/SAWPrize.d.ts +9 -0
- package/dist/MiniGames/SAWTemplate.d.ts +1 -0
- package/dist/SmarticoAPI.d.ts +1 -1
- package/dist/SmarticoLib/index.d.ts +1 -1
- package/dist/Tournaments/GetClanTournamentPlayersResponse.d.ts +2 -16
- package/dist/WSAPI/WSAPIJackpots.d.ts +11 -2
- package/dist/WSAPI/WSAPIMiniGames.d.ts +86 -23
- package/dist/WSAPI/WSAPITypes.d.ts +16 -12
- package/dist/index.js +109 -31
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +106 -28
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/README.md +0 -2
- package/docs/api/classes/WSAPIJackpots.md +11 -2
- package/docs/api/classes/WSAPIMiniGames.md +86 -23
- package/docs/api/functions/clanTournamentPlayersTransform.md +2 -2
- package/docs/api/interfaces/GamePickEvent.md +6 -1
- package/docs/api/interfaces/SAWDoAknowledgeRequest.md +8 -0
- package/docs/api/interfaces/SAWPrize.md +18 -0
- package/docs/api/interfaces/SAWTemplate.md +2 -0
- package/docs/api/interfaces/TMiniGamePrize.md +25 -9
- package/docs/api/interfaces/TMiniGameTemplate.md +3 -3
- package/docs/capabilities/gamePickGetActiveRound.md +1 -1
- package/docs/capabilities/gamePickGetActiveRounds.md +1 -1
- package/docs/capabilities/gamePickGetHistory.md +1 -1
- package/docs/capabilities/gamePickGetRoundInfoForUser.md +1 -1
- package/docs/capabilities/gamePickSubmitSelection.md +1 -1
- package/docs/capabilities/gamePickSubmitSelectionQuiz.md +1 -1
- package/docs/capabilities/getJackpotEligibleGames.md +11 -2
- package/docs/capabilities/getMiniGames.md +35 -12
- package/docs/capabilities/miniGameWinAcknowledgeRequest.md +30 -7
- package/docs/capabilities/playMiniGame.md +27 -14
- package/docs/native/PROTOCOL.md +3 -0
- package/docs/ui/jackpots/UIGuide_getJackpotEligibleGames.md +8 -0
- package/docs/ui/minigames/UIGuide_getMiniGames.md +24 -0
- package/docs/ui/minigames/UIGuide_getMiniGamesHistory.md +1 -1
- package/docs/ui/minigames/UIGuide_playMiniGame.md +28 -1
- package/package.json +2 -2
- package/src/GamePick/GamePickTypes.ts +6 -1
- package/src/MiniGames/SAWDoAknowledgeRequest.ts +2 -0
- package/src/MiniGames/SAWGetTemplatesResponse.ts +2 -0
- package/src/MiniGames/SAWPrize.ts +9 -0
- package/src/MiniGames/SAWTemplate.ts +1 -0
- package/src/SmarticoAPI.ts +2 -1
- package/src/SmarticoLib/index.ts +1 -1
- package/src/Tournaments/GetClanTournamentPlayersResponse.ts +5 -18
- package/src/WSAPI/WSAPIJackpots.ts +11 -2
- package/src/WSAPI/WSAPIMiniGames.ts +85 -24
- package/src/WSAPI/WSAPITypes.ts +16 -12
- package/docs/api/interfaces/TClanTournamentPlayer.md +0 -55
- package/docs/api/interfaces/TClanTournamentPlayersResult.md +0 -13
|
@@ -229,7 +229,12 @@ export interface GamePickEvent {
|
|
|
229
229
|
resolution_score?: number;
|
|
230
230
|
/** Whether this event is still accepting predictions */
|
|
231
231
|
is_open_for_bets?: boolean;
|
|
232
|
-
/**
|
|
232
|
+
/** Per-outcome numbers keyed by the outcome value (`'1'` / `'x'` / `'2'`, `'yes'` / `'no'`, …).
|
|
233
|
+
* Dual-purpose by event type:
|
|
234
|
+
* - Sports / MatchX: decimal **betting odds** (e.g. `{ "1": 2.45, "x": 3.26, "2": 3.01 }`).
|
|
235
|
+
* - Quiz: when the round's `show_users_preference` is `true`, these are aggregated
|
|
236
|
+
* **user-preference percentages** — what other users predicted, summing to ~100
|
|
237
|
+
* (e.g. `{ "1": 33, "x": 25, "2": 42 }`). Render as the "what others predicted" bar. */
|
|
233
238
|
odds_details?: {
|
|
234
239
|
odd_value: {
|
|
235
240
|
[key: string]: number;
|
|
@@ -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
|
}
|
|
@@ -9,14 +9,23 @@ export interface SAWPrize {
|
|
|
9
9
|
place_from?: number;
|
|
10
10
|
place_to?: number;
|
|
11
11
|
sawUniqueWinId?: string;
|
|
12
|
+
/** Remaining stock. Present only when the template's `expose_game_stat_on_api` is enabled; always present for MatchX / Quiz games */
|
|
12
13
|
pool?: number;
|
|
14
|
+
/** Initial (configured) stock. Present regardless of `expose_game_stat_on_api` */
|
|
13
15
|
pool_initial?: number;
|
|
16
|
+
/** Times the prize has been won, across all players. Present only when `expose_game_stat_on_api` is enabled */
|
|
14
17
|
wins_count?: number;
|
|
18
|
+
/** 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
19
|
weekdays?: number[];
|
|
20
|
+
/** Prize availability window start (epoch ms), evaluated against `relative_period_timezone`. Present only when `expose_game_stat_on_api` is enabled */
|
|
16
21
|
active_from_ts?: number;
|
|
22
|
+
/** Prize availability window end (epoch ms), evaluated against `relative_period_timezone`. Present only when `expose_game_stat_on_api` is enabled */
|
|
17
23
|
active_till_ts?: number;
|
|
24
|
+
/** Timezone offset in minutes for `weekdays` / active-window evaluation (UTC minus local, as in JS `Date.getTimezoneOffset()`) */
|
|
18
25
|
relative_period_timezone?: number;
|
|
26
|
+
/** When true, the prize stays winnable at `pool` 0 (unlimited stock) */
|
|
19
27
|
is_surcharge?: boolean;
|
|
28
|
+
/** Always `false` in API responses — deleted prizes are excluded server-side */
|
|
20
29
|
is_deleted?: boolean;
|
|
21
30
|
prize_details_json?: {
|
|
22
31
|
[key: string]: any;
|
|
@@ -32,6 +32,7 @@ export interface SAWTemplate {
|
|
|
32
32
|
use_new_popups?: boolean;
|
|
33
33
|
lottie_animation_speed?: number;
|
|
34
34
|
};
|
|
35
|
+
/** 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
36
|
expose_game_stat_on_api?: boolean;
|
|
36
37
|
requires_prize_claim?: boolean;
|
|
37
38
|
relative_period_timezone?: number;
|
package/dist/SmarticoAPI.d.ts
CHANGED
|
@@ -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>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ProtocolResponse } from '../Base/ProtocolResponse';
|
|
2
|
+
import { TClanTournamentPlayers } from '../WSAPI/WSAPITypes';
|
|
2
3
|
export interface ClanTournamentPlayerRaw {
|
|
3
4
|
userId: number;
|
|
4
5
|
cleanExtUserId: string;
|
|
@@ -16,19 +17,4 @@ export interface GetClanTournamentPlayersResponse extends ProtocolResponse {
|
|
|
16
17
|
tournament_instance_id: number;
|
|
17
18
|
players: ClanTournamentPlayerRaw[];
|
|
18
19
|
}
|
|
19
|
-
export
|
|
20
|
-
user_id: number;
|
|
21
|
-
clean_ext_user_id: string;
|
|
22
|
-
public_username: string;
|
|
23
|
-
avatar_id: string;
|
|
24
|
-
avatar_real_id: number;
|
|
25
|
-
avatar_url?: string;
|
|
26
|
-
position: number;
|
|
27
|
-
scores: number;
|
|
28
|
-
is_me: boolean;
|
|
29
|
-
}
|
|
30
|
-
export interface TClanTournamentPlayersResult {
|
|
31
|
-
tournament_instance_id: number;
|
|
32
|
-
players: TClanTournamentPlayer[];
|
|
33
|
-
}
|
|
34
|
-
export declare const clanTournamentPlayersTransform: (response: GetClanTournamentPlayersResponse) => TClanTournamentPlayersResult;
|
|
20
|
+
export declare const clanTournamentPlayersTransform: (response: GetClanTournamentPlayersResponse) => TClanTournamentPlayers;
|
|
@@ -297,7 +297,7 @@ export declare class WSAPIJackpots extends WSAPIClans {
|
|
|
297
297
|
*
|
|
298
298
|
* @remarks
|
|
299
299
|
* **Preconditions**
|
|
300
|
-
* -
|
|
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**:
|
|
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`
|
|
263
|
-
* - For STANDARD prizes the value is credited
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
* explicit acknowledge
|
|
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)
|
|
301
|
-
*
|
|
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
|
|
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
|
|
371
|
-
* //
|
|
372
|
-
* //
|
|
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
|
|
388
|
-
*
|
|
389
|
-
* {@link
|
|
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,23 @@ 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. It only
|
|
457
|
+
* works on a spin that is not yet finalised, so it requires playing
|
|
458
|
+
* with `acknowledge: false` and calling promptly — once the automatic
|
|
459
|
+
* acknowledge or the server-side fallback (below) has finalised the
|
|
460
|
+
* spin, `lose: true` is a no-op and the prize stays credited.
|
|
461
|
+
* ("Explicit claim" prizes are exempt from the fallback, so for them
|
|
462
|
+
* there is no time pressure.)
|
|
463
|
+
*
|
|
412
464
|
* **Idempotency**: safe. Acknowledging a spin that is already
|
|
413
465
|
* finalised — by you, by the automatic acknowledge, or by the
|
|
414
466
|
* fallback — is a no-op with no double credit. Acknowledging a
|
|
@@ -423,11 +475,12 @@ export declare class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
423
475
|
* call here.
|
|
424
476
|
*
|
|
425
477
|
* **Side effects** (first successful call for an un-acknowledged spin)
|
|
426
|
-
* -
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
*
|
|
478
|
+
* - Default (win): the prize value is credited on this call — this is
|
|
479
|
+
* the finalisation step that credits standard and "explicit claim"
|
|
480
|
+
* prizes alike (see {@link playMiniGame} "Prize handling").
|
|
481
|
+
* - With `lose: true`: no credit; the prize returns to the prize pool
|
|
482
|
+
* and the "lose" engagement event fires.
|
|
483
|
+
* - Either way the spin's `is_claimed` flips to `true` on the next
|
|
431
484
|
* {@link getMiniGamesHistory} fetch.
|
|
432
485
|
*
|
|
433
486
|
* **Visitor mode**: not supported.
|
|
@@ -437,6 +490,10 @@ export declare class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
437
490
|
* (played with `acknowledge: false`), or the
|
|
438
491
|
* `client_request_id` of a
|
|
439
492
|
* {@link getMiniGamesHistory} row.
|
|
493
|
+
* @param options.lose Optional. When `true`, finalises the spin as
|
|
494
|
+
* lost — the prize is not credited and returns
|
|
495
|
+
* to the prize pool (see "Finalising as lost").
|
|
496
|
+
* Omit (or pass `false`) to deliver the win.
|
|
440
497
|
*
|
|
441
498
|
* @example
|
|
442
499
|
* ```ts
|
|
@@ -447,6 +504,10 @@ export declare class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
447
504
|
* await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
448
505
|
* }
|
|
449
506
|
*
|
|
507
|
+
* // Decline / forfeit — finalise the same spin as lost instead:
|
|
508
|
+
* // the prize is not credited and goes back to the prize pool.
|
|
509
|
+
* await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id, { lose: true });
|
|
510
|
+
*
|
|
450
511
|
* // Recovery — re-acknowledge any spins a batch acknowledge missed.
|
|
451
512
|
* const history = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
|
|
452
513
|
* for (const row of history.filter(h => !h.is_claimed)) {
|
|
@@ -455,7 +516,9 @@ export declare class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
455
516
|
* }
|
|
456
517
|
* ```
|
|
457
518
|
*/
|
|
458
|
-
miniGameWinAcknowledgeRequest(request_id: string
|
|
519
|
+
miniGameWinAcknowledgeRequest(request_id: string, { lose }?: {
|
|
520
|
+
lose?: boolean;
|
|
521
|
+
}): Promise<import("../MiniGames").SAWDoAknowledgeResponse>;
|
|
459
522
|
/**
|
|
460
523
|
* Plays a mini-game template `spin_count` times in one round-trip.
|
|
461
524
|
* Returns an array of per-spin results — each independent, each
|
|
@@ -50,25 +50,29 @@ export interface TMiniGamePrize {
|
|
|
50
50
|
acknowledge_dp_additional?: string;
|
|
51
51
|
/** The name of the action button in modal pop-up (additional) */
|
|
52
52
|
acknowledge_action_title_additional?: string;
|
|
53
|
+
/** Deep link that will trigger some action in modal pop-up (second button) */
|
|
54
|
+
second_btn?: string;
|
|
55
|
+
/** The name of the action button in modal pop-up (second button) */
|
|
56
|
+
second_btn_action_title?: string;
|
|
53
57
|
/** Message when the prize pool is empty for that specific prize */
|
|
54
58
|
out_of_stock_message?: string;
|
|
55
|
-
/**
|
|
59
|
+
/** 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 */
|
|
56
60
|
pool?: number;
|
|
57
|
-
/** Initial
|
|
61
|
+
/** Initial (configured) stock of the prize. Populated regardless of `expose_game_stat_on_api` */
|
|
58
62
|
pool_initial?: number;
|
|
59
|
-
/** Number of
|
|
63
|
+
/** Number of times the prize has been won, across all players. Populated only when the template's `expose_game_stat_on_api` is enabled */
|
|
60
64
|
wins_count?: number;
|
|
61
|
-
/**
|
|
65
|
+
/** 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 */
|
|
62
66
|
weekdays?: number[];
|
|
63
|
-
/**
|
|
67
|
+
/** 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 */
|
|
64
68
|
active_from_ts?: number;
|
|
65
|
-
/**
|
|
69
|
+
/** 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 */
|
|
66
70
|
active_till_ts?: number;
|
|
67
|
-
/**
|
|
71
|
+
/** 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) */
|
|
68
72
|
relative_period_timezone?: number;
|
|
69
|
-
/**
|
|
73
|
+
/** When true, the prize stays winnable even when its `pool` reaches 0 (effectively unlimited stock) */
|
|
70
74
|
is_surcharge?: boolean;
|
|
71
|
-
/**
|
|
75
|
+
/** Always `false` in API responses — deleted prizes are excluded server-side */
|
|
72
76
|
is_deleted?: boolean;
|
|
73
77
|
/** The custom data of the mini-game defined by operator in the BackOffice. Can be a JSON object, string or number */
|
|
74
78
|
custom_data?: any;
|
|
@@ -188,7 +192,7 @@ export interface TMiniGameTemplate {
|
|
|
188
192
|
custom_data: any;
|
|
189
193
|
/** List of prizes for mini-games */
|
|
190
194
|
prizes: TMiniGamePrize[];
|
|
191
|
-
/** When enabled, the
|
|
195
|
+
/** 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" */
|
|
192
196
|
expose_game_stat_on_api?: boolean;
|
|
193
197
|
/** Time zone to ensure each day aligns with your local midnight. */
|
|
194
198
|
relative_period_timezone?: number;
|
|
@@ -198,7 +202,7 @@ export interface TMiniGameTemplate {
|
|
|
198
202
|
activeTillDate?: number;
|
|
199
203
|
/** The amount of steps to complete the game and gather the prize */
|
|
200
204
|
steps_to_finish_game?: number;
|
|
201
|
-
/**
|
|
205
|
+
/** ID of the operator-defined custom section (widget menu grouping) the mini-game is assigned to */
|
|
202
206
|
custom_section_id?: number;
|
|
203
207
|
/** The UI definition of the mini-game */
|
|
204
208
|
saw_template_ui_definition: SAWTemplateUI;
|
|
@@ -210,7 +214,7 @@ export interface TMiniGameTemplate {
|
|
|
210
214
|
max_number_of_attempts?: number;
|
|
211
215
|
/** The period of time in milliseconds during which the user can do the maximum number of attempts */
|
|
212
216
|
max_spins_period_ms?: number;
|
|
213
|
-
/**
|
|
217
|
+
/** 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 */
|
|
214
218
|
expose_user_spin_id?: SAWExposeUserSpinIdName;
|
|
215
219
|
}
|
|
216
220
|
/**
|