@smartico/public-api 0.0.409 → 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/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/WSAPI/WSAPIJackpots.d.ts +11 -2
- package/dist/WSAPI/WSAPIMiniGames.d.ts +86 -23
- package/dist/WSAPI/WSAPITypes.d.ts +12 -12
- package/dist/index.js +104 -31
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +101 -28
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/classes/WSAPIJackpots.md +11 -2
- package/docs/api/classes/WSAPIMiniGames.md +86 -23
- 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/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 +1 -1
- package/src/MiniGames/SAWDoAknowledgeRequest.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/WSAPI/WSAPIJackpots.ts +11 -2
- package/src/WSAPI/WSAPIMiniGames.ts +85 -24
- package/src/WSAPI/WSAPITypes.ts +12 -12
|
@@ -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>;
|
|
@@ -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
|
|
@@ -56,23 +56,23 @@ export interface TMiniGamePrize {
|
|
|
56
56
|
second_btn_action_title?: string;
|
|
57
57
|
/** Message when the prize pool is empty for that specific prize */
|
|
58
58
|
out_of_stock_message?: string;
|
|
59
|
-
/**
|
|
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 */
|
|
60
60
|
pool?: number;
|
|
61
|
-
/** Initial
|
|
61
|
+
/** Initial (configured) stock of the prize. Populated regardless of `expose_game_stat_on_api` */
|
|
62
62
|
pool_initial?: number;
|
|
63
|
-
/** 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 */
|
|
64
64
|
wins_count?: number;
|
|
65
|
-
/**
|
|
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 */
|
|
66
66
|
weekdays?: number[];
|
|
67
|
-
/**
|
|
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 */
|
|
68
68
|
active_from_ts?: number;
|
|
69
|
-
/**
|
|
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 */
|
|
70
70
|
active_till_ts?: number;
|
|
71
|
-
/**
|
|
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) */
|
|
72
72
|
relative_period_timezone?: number;
|
|
73
|
-
/**
|
|
73
|
+
/** When true, the prize stays winnable even when its `pool` reaches 0 (effectively unlimited stock) */
|
|
74
74
|
is_surcharge?: boolean;
|
|
75
|
-
/**
|
|
75
|
+
/** Always `false` in API responses — deleted prizes are excluded server-side */
|
|
76
76
|
is_deleted?: boolean;
|
|
77
77
|
/** The custom data of the mini-game defined by operator in the BackOffice. Can be a JSON object, string or number */
|
|
78
78
|
custom_data?: any;
|
|
@@ -192,7 +192,7 @@ export interface TMiniGameTemplate {
|
|
|
192
192
|
custom_data: any;
|
|
193
193
|
/** List of prizes for mini-games */
|
|
194
194
|
prizes: TMiniGamePrize[];
|
|
195
|
-
/** 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" */
|
|
196
196
|
expose_game_stat_on_api?: boolean;
|
|
197
197
|
/** Time zone to ensure each day aligns with your local midnight. */
|
|
198
198
|
relative_period_timezone?: number;
|
|
@@ -202,7 +202,7 @@ export interface TMiniGameTemplate {
|
|
|
202
202
|
activeTillDate?: number;
|
|
203
203
|
/** The amount of steps to complete the game and gather the prize */
|
|
204
204
|
steps_to_finish_game?: number;
|
|
205
|
-
/**
|
|
205
|
+
/** ID of the operator-defined custom section (widget menu grouping) the mini-game is assigned to */
|
|
206
206
|
custom_section_id?: number;
|
|
207
207
|
/** The UI definition of the mini-game */
|
|
208
208
|
saw_template_ui_definition: SAWTemplateUI;
|
|
@@ -214,7 +214,7 @@ export interface TMiniGameTemplate {
|
|
|
214
214
|
max_number_of_attempts?: number;
|
|
215
215
|
/** The period of time in milliseconds during which the user can do the maximum number of attempts */
|
|
216
216
|
max_spins_period_ms?: number;
|
|
217
|
-
/**
|
|
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 */
|
|
218
218
|
expose_user_spin_id?: SAWExposeUserSpinIdName;
|
|
219
219
|
}
|
|
220
220
|
/**
|
package/dist/index.js
CHANGED
|
@@ -6369,7 +6369,7 @@ var WSAPIJackpots = /*#__PURE__*/function (_WSAPIClans) {
|
|
|
6369
6369
|
*
|
|
6370
6370
|
* @remarks
|
|
6371
6371
|
* **Preconditions**
|
|
6372
|
-
* -
|
|
6372
|
+
* - No authentication required — works in both identified and visitor mode.
|
|
6373
6373
|
* - `jp_template_id` is mandatory.
|
|
6374
6374
|
*
|
|
6375
6375
|
* **`onUpdate` caveat**
|
|
@@ -6387,7 +6387,12 @@ var WSAPIJackpots = /*#__PURE__*/function (_WSAPIClans) {
|
|
|
6387
6387
|
* Non-zero `errCode` on control-group users or generic server errors.
|
|
6388
6388
|
* Branch on `errCode === 0` and surface `errMsg` on failure.
|
|
6389
6389
|
*
|
|
6390
|
-
* **Visitor mode**:
|
|
6390
|
+
* **Visitor mode**: supported via
|
|
6391
|
+
* `_smartico.vapi(lang).getJackpotEligibleGames(...)`. The eligible-games
|
|
6392
|
+
* list is template-level (which games contribute to the pot) and carries no
|
|
6393
|
+
* per-user fields, so a visitor session receives the same list an identified
|
|
6394
|
+
* user would. The `lang` passed to `_smartico.vapi(lang)` drives the
|
|
6395
|
+
* translation of game names.
|
|
6391
6396
|
*
|
|
6392
6397
|
* **UI guidance**: see [UI Guide — `getJackpotEligibleGames`](../../docs/ui/jackpots/UIGuide_getJackpotEligibleGames.md).
|
|
6393
6398
|
*
|
|
@@ -6405,6 +6410,10 @@ var WSAPIJackpots = /*#__PURE__*/function (_WSAPIClans) {
|
|
|
6405
6410
|
*
|
|
6406
6411
|
* const r = await window._smartico.api.getJackpotEligibleGames({ jp_template_id: 42 });
|
|
6407
6412
|
* console.log('[smartico] render', r.eligible_games.length, 'eligible game tiles');
|
|
6413
|
+
*
|
|
6414
|
+
* // Visitor mode — same shape, language driven by the vapi(lang) argument
|
|
6415
|
+
* const visitor = await window._smartico.vapi('EN').getJackpotEligibleGames({ jp_template_id: 42 });
|
|
6416
|
+
* console.log('[smartico] visitor eligible games:', visitor.eligible_games.length);
|
|
6408
6417
|
* ```
|
|
6409
6418
|
*/
|
|
6410
6419
|
;
|
|
@@ -7211,6 +7220,27 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7211
7220
|
* games server (not this SDK); the SAW spin is fired
|
|
7212
7221
|
* server-internally to deduct the buy-in.
|
|
7213
7222
|
*
|
|
7223
|
+
* **Per-prize statistics (`expose_game_stat_on_api`)**
|
|
7224
|
+
* Each template's `prizes` array always carries the definition
|
|
7225
|
+
* fields — name, icon, `prize_type`, `prize_value`, acknowledge
|
|
7226
|
+
* configuration. The stock-statistics fields are gated by an
|
|
7227
|
+
* operator template setting, surfaced as
|
|
7228
|
+
* `expose_game_stat_on_api`:
|
|
7229
|
+
* - Populated when enabled: `pool` (remaining stock),
|
|
7230
|
+
* `wins_count` (total wins across all players), `weekdays`
|
|
7231
|
+
* (ISO 1–7 days the prize can be won), `active_from_ts` /
|
|
7232
|
+
* `active_till_ts` (prize availability window).
|
|
7233
|
+
* - Omitted when disabled (the default) — this keeps the live
|
|
7234
|
+
* prize economy (stock levels, win rates, schedules) hidden
|
|
7235
|
+
* from players.
|
|
7236
|
+
* - Exception: `pool` is always populated for `MatchX` / `Quiz`
|
|
7237
|
+
* templates, whose game flow needs the remaining stock.
|
|
7238
|
+
* - `pool_initial` is populated regardless of the setting.
|
|
7239
|
+
* When enabled, the values are also kept current — the server
|
|
7240
|
+
* refreshes the prize rows on each fetch and drops its template
|
|
7241
|
+
* caches after every play, so `pool` / `wins_count` are safe to
|
|
7242
|
+
* drive an "X prizes left" scarcity UI.
|
|
7243
|
+
*
|
|
7214
7244
|
* **Cache TTL**: the SDK caches the response for 30 seconds. Cache
|
|
7215
7245
|
* is fully cleared on login / logout.
|
|
7216
7246
|
*
|
|
@@ -7438,14 +7468,19 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7438
7468
|
* it later by calling {@link miniGameWinAcknowledgeRequest} with the
|
|
7439
7469
|
* `request_id` returned on this result.
|
|
7440
7470
|
*
|
|
7441
|
-
* What `acknowledge: false`
|
|
7442
|
-
* - For STANDARD prizes the value is credited
|
|
7443
|
-
*
|
|
7444
|
-
*
|
|
7445
|
-
*
|
|
7446
|
-
*
|
|
7447
|
-
*
|
|
7448
|
-
* explicit acknowledge
|
|
7471
|
+
* What `acknowledge: false` defers:
|
|
7472
|
+
* - For STANDARD prizes the value is credited when the spin is
|
|
7473
|
+
* finalised — by your later acknowledge or, failing that, by the
|
|
7474
|
+
* server-side fallback below — so opting out delays the balance
|
|
7475
|
+
* change by at most that fallback window. The `is_claimed` flag in
|
|
7476
|
+
* {@link getMiniGamesHistory} flips on the same finalisation.
|
|
7477
|
+
* - For operator-configured "explicit claim" prizes the credit is
|
|
7478
|
+
* deferred until your explicit acknowledge — the fallback does not
|
|
7479
|
+
* cover them.
|
|
7480
|
+
*
|
|
7481
|
+
* While the spin is un-finalised it can also be finalised as LOST —
|
|
7482
|
+
* prize discarded back to the pool — via
|
|
7483
|
+
* {@link miniGameWinAcknowledgeRequest} with `{ lose: true }`.
|
|
7449
7484
|
*
|
|
7450
7485
|
* A server-side fallback auto-acknowledges ordinary un-acknowledged
|
|
7451
7486
|
* spins after a short delay (about 1–3 minutes), so an ordinary
|
|
@@ -7476,8 +7511,10 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7476
7511
|
* time the call resolves. Balance updates flow via the
|
|
7477
7512
|
* user-properties channel (observe via {@link getUserProfile}).
|
|
7478
7513
|
* - Prize value credited per the prize's type (see "Prize handling"
|
|
7479
|
-
* above)
|
|
7480
|
-
*
|
|
7514
|
+
* above) when the spin is finalised — with the default
|
|
7515
|
+
* auto-acknowledge that happens before the call resolves;
|
|
7516
|
+
* "explicit claim" prizes are credited only by an explicit
|
|
7517
|
+
* acknowledge.
|
|
7481
7518
|
* - The play is recorded server-side for analytics / reporting.
|
|
7482
7519
|
*
|
|
7483
7520
|
* **UI guidance**: see [UI Guide — `playMiniGame`](../../docs/ui/minigames/UIGuide_playMiniGame.md).
|
|
@@ -7542,18 +7579,24 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7542
7579
|
*
|
|
7543
7580
|
* @example
|
|
7544
7581
|
* Manual finalisation (`acknowledge: false`) — e.g. an explicit
|
|
7545
|
-
* "Claim" CTA, or finalising on your own
|
|
7582
|
+
* "Claim" CTA, a decline/forfeit flow, or finalising on your own
|
|
7583
|
+
* schedule:
|
|
7546
7584
|
* ```ts
|
|
7547
7585
|
* const r = await window._smartico.api.playMiniGame(game.id, { acknowledge: false });
|
|
7548
7586
|
* if (r.err_code === 0) {
|
|
7549
|
-
* // Spin resolved but not yet
|
|
7550
|
-
* //
|
|
7551
|
-
* //
|
|
7587
|
+
* // Spin resolved but not yet finalised — the prize is not credited
|
|
7588
|
+
* // yet. Your acknowledge below credits it (for standard prizes the
|
|
7589
|
+
* // server-side fallback would eventually do the same).
|
|
7552
7590
|
* console.log('[smartico] prize won — show the result / Claim CTA, then finalise');
|
|
7553
7591
|
*
|
|
7554
7592
|
* // On the user's Claim click, finalise with the request_id from the result.
|
|
7555
7593
|
* await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
7556
7594
|
* console.log('[smartico] win finalised — refresh getUserProfile / getMiniGames to reflect it');
|
|
7595
|
+
*
|
|
7596
|
+
* // Or, if the game flow ends in the player declining / losing the
|
|
7597
|
+
* // drawn prize, finalise the spin as lost instead — the prize is
|
|
7598
|
+
* // not credited and returns to the prize pool:
|
|
7599
|
+
* // await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id, { lose: true });
|
|
7557
7600
|
* }
|
|
7558
7601
|
* ```
|
|
7559
7602
|
*/
|
|
@@ -7591,9 +7634,10 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7591
7634
|
}
|
|
7592
7635
|
/**
|
|
7593
7636
|
* Manually acknowledges a mini-game spin — marks the win delivered
|
|
7594
|
-
* server-side
|
|
7595
|
-
*
|
|
7596
|
-
* {@link
|
|
7637
|
+
* server-side, or (with `lose: true`) finalises it as lost and
|
|
7638
|
+
* returns the prize to the pool. Most consumers do NOT need this:
|
|
7639
|
+
* {@link playMiniGame} acknowledges by default (`acknowledge: true`)
|
|
7640
|
+
* and {@link playMiniGameBatch} acknowledges automatically. Call this
|
|
7597
7641
|
* directly only when you took ownership of the acknowledge step or
|
|
7598
7642
|
* need to recover a lost one.
|
|
7599
7643
|
*
|
|
@@ -7616,6 +7660,23 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7616
7660
|
* `client_request_id` on a {@link getMiniGamesHistory} row are the
|
|
7617
7661
|
* same correlation id — this method accepts either.
|
|
7618
7662
|
*
|
|
7663
|
+
* **Finalising as lost (`lose: true`)**
|
|
7664
|
+
* Pass `{ lose: true }` to finalise the spin as LOST instead of won:
|
|
7665
|
+
* the prize is NOT credited and is returned to the game's prize pool
|
|
7666
|
+
* (available again for other players), and the spin fires the
|
|
7667
|
+
* mini-game "lose" engagement event instead of the win one. On the
|
|
7668
|
+
* next {@link getMiniGamesHistory} fetch the row shows `is_claimed:
|
|
7669
|
+
* true` with no prize attached. Use this for game mechanics where the
|
|
7670
|
+
* player can decline or forfeit the drawn prize — e.g. a
|
|
7671
|
+
* gamble/discard step, or a client-driven game where the user's final
|
|
7672
|
+
* action decides whether the pre-drawn prize is actually won. It only
|
|
7673
|
+
* works on a spin that is not yet finalised, so it requires playing
|
|
7674
|
+
* with `acknowledge: false` and calling promptly — once the automatic
|
|
7675
|
+
* acknowledge or the server-side fallback (below) has finalised the
|
|
7676
|
+
* spin, `lose: true` is a no-op and the prize stays credited.
|
|
7677
|
+
* ("Explicit claim" prizes are exempt from the fallback, so for them
|
|
7678
|
+
* there is no time pressure.)
|
|
7679
|
+
*
|
|
7619
7680
|
* **Idempotency**: safe. Acknowledging a spin that is already
|
|
7620
7681
|
* finalised — by you, by the automatic acknowledge, or by the
|
|
7621
7682
|
* fallback — is a no-op with no double credit. Acknowledging a
|
|
@@ -7630,11 +7691,12 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7630
7691
|
* call here.
|
|
7631
7692
|
*
|
|
7632
7693
|
* **Side effects** (first successful call for an un-acknowledged spin)
|
|
7633
|
-
* -
|
|
7634
|
-
*
|
|
7635
|
-
*
|
|
7636
|
-
*
|
|
7637
|
-
*
|
|
7694
|
+
* - Default (win): the prize value is credited on this call — this is
|
|
7695
|
+
* the finalisation step that credits standard and "explicit claim"
|
|
7696
|
+
* prizes alike (see {@link playMiniGame} "Prize handling").
|
|
7697
|
+
* - With `lose: true`: no credit; the prize returns to the prize pool
|
|
7698
|
+
* and the "lose" engagement event fires.
|
|
7699
|
+
* - Either way the spin's `is_claimed` flips to `true` on the next
|
|
7638
7700
|
* {@link getMiniGamesHistory} fetch.
|
|
7639
7701
|
*
|
|
7640
7702
|
* **Visitor mode**: not supported.
|
|
@@ -7644,6 +7706,10 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7644
7706
|
* (played with `acknowledge: false`), or the
|
|
7645
7707
|
* `client_request_id` of a
|
|
7646
7708
|
* {@link getMiniGamesHistory} row.
|
|
7709
|
+
* @param options.lose Optional. When `true`, finalises the spin as
|
|
7710
|
+
* lost — the prize is not credited and returns
|
|
7711
|
+
* to the prize pool (see "Finalising as lost").
|
|
7712
|
+
* Omit (or pass `false`) to deliver the win.
|
|
7647
7713
|
*
|
|
7648
7714
|
* @example
|
|
7649
7715
|
* ```ts
|
|
@@ -7654,6 +7720,10 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7654
7720
|
* await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
7655
7721
|
* }
|
|
7656
7722
|
*
|
|
7723
|
+
* // Decline / forfeit — finalise the same spin as lost instead:
|
|
7724
|
+
* // the prize is not credited and goes back to the prize pool.
|
|
7725
|
+
* await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id, { lose: true });
|
|
7726
|
+
*
|
|
7657
7727
|
* // Recovery — re-acknowledge any spins a batch acknowledge missed.
|
|
7658
7728
|
* const history = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
|
|
7659
7729
|
* for (const row of history.filter(h => !h.is_claimed)) {
|
|
@@ -7663,10 +7733,12 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7663
7733
|
* ```
|
|
7664
7734
|
*/
|
|
7665
7735
|
;
|
|
7666
|
-
_proto.miniGameWinAcknowledgeRequest = function miniGameWinAcknowledgeRequest(request_id) {
|
|
7736
|
+
_proto.miniGameWinAcknowledgeRequest = function miniGameWinAcknowledgeRequest(request_id, _temp5) {
|
|
7737
|
+
var _ref4 = _temp5 === void 0 ? {} : _temp5,
|
|
7738
|
+
lose = _ref4.lose;
|
|
7667
7739
|
try {
|
|
7668
7740
|
var _this4 = this;
|
|
7669
|
-
return Promise.resolve(_this4.api.doAcknowledgeRequest(_this4.userExtId, request_id));
|
|
7741
|
+
return Promise.resolve(_this4.api.doAcknowledgeRequest(_this4.userExtId, request_id, lose));
|
|
7670
7742
|
} catch (e) {
|
|
7671
7743
|
return Promise.reject(e);
|
|
7672
7744
|
}
|
|
@@ -7776,9 +7848,9 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7776
7848
|
* ```
|
|
7777
7849
|
*/
|
|
7778
7850
|
;
|
|
7779
|
-
_proto.playMiniGameBatch = function playMiniGameBatch(template_id, spin_count,
|
|
7780
|
-
var
|
|
7781
|
-
onUpdate =
|
|
7851
|
+
_proto.playMiniGameBatch = function playMiniGameBatch(template_id, spin_count, _temp6) {
|
|
7852
|
+
var _ref5 = _temp6 === void 0 ? {} : _temp6,
|
|
7853
|
+
onUpdate = _ref5.onUpdate;
|
|
7782
7854
|
try {
|
|
7783
7855
|
var _this5 = this;
|
|
7784
7856
|
if (typeof onUpdate === 'function') {
|
|
@@ -10833,11 +10905,12 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
10833
10905
|
return Promise.reject(e);
|
|
10834
10906
|
}
|
|
10835
10907
|
};
|
|
10836
|
-
_proto.doAcknowledgeRequest = function doAcknowledgeRequest(user_ext_id, request_id) {
|
|
10908
|
+
_proto.doAcknowledgeRequest = function doAcknowledgeRequest(user_ext_id, request_id, lose) {
|
|
10837
10909
|
try {
|
|
10838
10910
|
var _this16 = this;
|
|
10839
10911
|
var message = _this16.buildMessage(user_ext_id, exports.ClassId.SAW_AKNOWLEDGE_REQUEST, {
|
|
10840
|
-
request_id: request_id
|
|
10912
|
+
request_id: request_id,
|
|
10913
|
+
lose: lose
|
|
10841
10914
|
});
|
|
10842
10915
|
return Promise.resolve(_this16.send(message, exports.ClassId.SAW_AKNOWLEDGE_RESPONSE));
|
|
10843
10916
|
} catch (e) {
|