@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
|
@@ -64,6 +64,27 @@ export class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
64
64
|
* games server (not this SDK); the SAW spin is fired
|
|
65
65
|
* server-internally to deduct the buy-in.
|
|
66
66
|
*
|
|
67
|
+
* **Per-prize statistics (`expose_game_stat_on_api`)**
|
|
68
|
+
* Each template's `prizes` array always carries the definition
|
|
69
|
+
* fields — name, icon, `prize_type`, `prize_value`, acknowledge
|
|
70
|
+
* configuration. The stock-statistics fields are gated by an
|
|
71
|
+
* operator template setting, surfaced as
|
|
72
|
+
* `expose_game_stat_on_api`:
|
|
73
|
+
* - Populated when enabled: `pool` (remaining stock),
|
|
74
|
+
* `wins_count` (total wins across all players), `weekdays`
|
|
75
|
+
* (ISO 1–7 days the prize can be won), `active_from_ts` /
|
|
76
|
+
* `active_till_ts` (prize availability window).
|
|
77
|
+
* - Omitted when disabled (the default) — this keeps the live
|
|
78
|
+
* prize economy (stock levels, win rates, schedules) hidden
|
|
79
|
+
* from players.
|
|
80
|
+
* - Exception: `pool` is always populated for `MatchX` / `Quiz`
|
|
81
|
+
* templates, whose game flow needs the remaining stock.
|
|
82
|
+
* - `pool_initial` is populated regardless of the setting.
|
|
83
|
+
* When enabled, the values are also kept current — the server
|
|
84
|
+
* refreshes the prize rows on each fetch and drops its template
|
|
85
|
+
* caches after every play, so `pool` / `wins_count` are safe to
|
|
86
|
+
* drive an "X prizes left" scarcity UI.
|
|
87
|
+
*
|
|
67
88
|
* **Cache TTL**: the SDK caches the response for 30 seconds. Cache
|
|
68
89
|
* is fully cleared on login / logout.
|
|
69
90
|
*
|
|
@@ -290,14 +311,19 @@ export class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
290
311
|
* it later by calling {@link miniGameWinAcknowledgeRequest} with the
|
|
291
312
|
* `request_id` returned on this result.
|
|
292
313
|
*
|
|
293
|
-
* What `acknowledge: false`
|
|
294
|
-
* - For STANDARD prizes the value is credited
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
* explicit acknowledge
|
|
314
|
+
* What `acknowledge: false` defers:
|
|
315
|
+
* - For STANDARD prizes the value is credited when the spin is
|
|
316
|
+
* finalised — by your later acknowledge or, failing that, by the
|
|
317
|
+
* server-side fallback below — so opting out delays the balance
|
|
318
|
+
* change by at most that fallback window. The `is_claimed` flag in
|
|
319
|
+
* {@link getMiniGamesHistory} flips on the same finalisation.
|
|
320
|
+
* - For operator-configured "explicit claim" prizes the credit is
|
|
321
|
+
* deferred until your explicit acknowledge — the fallback does not
|
|
322
|
+
* cover them.
|
|
323
|
+
*
|
|
324
|
+
* While the spin is un-finalised it can also be finalised as LOST —
|
|
325
|
+
* prize discarded back to the pool — via
|
|
326
|
+
* {@link miniGameWinAcknowledgeRequest} with `{ lose: true }`.
|
|
301
327
|
*
|
|
302
328
|
* A server-side fallback auto-acknowledges ordinary un-acknowledged
|
|
303
329
|
* spins after a short delay (about 1–3 minutes), so an ordinary
|
|
@@ -328,8 +354,10 @@ export class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
328
354
|
* time the call resolves. Balance updates flow via the
|
|
329
355
|
* user-properties channel (observe via {@link getUserProfile}).
|
|
330
356
|
* - Prize value credited per the prize's type (see "Prize handling"
|
|
331
|
-
* above)
|
|
332
|
-
*
|
|
357
|
+
* above) when the spin is finalised — with the default
|
|
358
|
+
* auto-acknowledge that happens before the call resolves;
|
|
359
|
+
* "explicit claim" prizes are credited only by an explicit
|
|
360
|
+
* acknowledge.
|
|
333
361
|
* - The play is recorded server-side for analytics / reporting.
|
|
334
362
|
*
|
|
335
363
|
* **UI guidance**: see [UI Guide — `playMiniGame`](../../docs/ui/minigames/UIGuide_playMiniGame.md).
|
|
@@ -394,18 +422,24 @@ export class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
394
422
|
*
|
|
395
423
|
* @example
|
|
396
424
|
* Manual finalisation (`acknowledge: false`) — e.g. an explicit
|
|
397
|
-
* "Claim" CTA, or finalising on your own
|
|
425
|
+
* "Claim" CTA, a decline/forfeit flow, or finalising on your own
|
|
426
|
+
* schedule:
|
|
398
427
|
* ```ts
|
|
399
428
|
* const r = await window._smartico.api.playMiniGame(game.id, { acknowledge: false });
|
|
400
429
|
* if (r.err_code === 0) {
|
|
401
|
-
* // Spin resolved but not yet
|
|
402
|
-
* //
|
|
403
|
-
* //
|
|
430
|
+
* // Spin resolved but not yet finalised — the prize is not credited
|
|
431
|
+
* // yet. Your acknowledge below credits it (for standard prizes the
|
|
432
|
+
* // server-side fallback would eventually do the same).
|
|
404
433
|
* console.log('[smartico] prize won — show the result / Claim CTA, then finalise');
|
|
405
434
|
*
|
|
406
435
|
* // On the user's Claim click, finalise with the request_id from the result.
|
|
407
436
|
* await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
408
437
|
* console.log('[smartico] win finalised — refresh getUserProfile / getMiniGames to reflect it');
|
|
438
|
+
*
|
|
439
|
+
* // Or, if the game flow ends in the player declining / losing the
|
|
440
|
+
* // drawn prize, finalise the spin as lost instead — the prize is
|
|
441
|
+
* // not credited and returns to the prize pool:
|
|
442
|
+
* // await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id, { lose: true });
|
|
409
443
|
* }
|
|
410
444
|
* ```
|
|
411
445
|
*/
|
|
@@ -433,9 +467,10 @@ export class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
433
467
|
|
|
434
468
|
/**
|
|
435
469
|
* Manually acknowledges a mini-game spin — marks the win delivered
|
|
436
|
-
* server-side
|
|
437
|
-
*
|
|
438
|
-
* {@link
|
|
470
|
+
* server-side, or (with `lose: true`) finalises it as lost and
|
|
471
|
+
* returns the prize to the pool. Most consumers do NOT need this:
|
|
472
|
+
* {@link playMiniGame} acknowledges by default (`acknowledge: true`)
|
|
473
|
+
* and {@link playMiniGameBatch} acknowledges automatically. Call this
|
|
439
474
|
* directly only when you took ownership of the acknowledge step or
|
|
440
475
|
* need to recover a lost one.
|
|
441
476
|
*
|
|
@@ -458,6 +493,23 @@ export class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
458
493
|
* `client_request_id` on a {@link getMiniGamesHistory} row are the
|
|
459
494
|
* same correlation id — this method accepts either.
|
|
460
495
|
*
|
|
496
|
+
* **Finalising as lost (`lose: true`)**
|
|
497
|
+
* Pass `{ lose: true }` to finalise the spin as LOST instead of won:
|
|
498
|
+
* the prize is NOT credited and is returned to the game's prize pool
|
|
499
|
+
* (available again for other players), and the spin fires the
|
|
500
|
+
* mini-game "lose" engagement event instead of the win one. On the
|
|
501
|
+
* next {@link getMiniGamesHistory} fetch the row shows `is_claimed:
|
|
502
|
+
* true` with no prize attached. Use this for game mechanics where the
|
|
503
|
+
* player can decline or forfeit the drawn prize — e.g. a
|
|
504
|
+
* gamble/discard step, or a client-driven game where the user's final
|
|
505
|
+
* action decides whether the pre-drawn prize is actually won. It only
|
|
506
|
+
* works on a spin that is not yet finalised, so it requires playing
|
|
507
|
+
* with `acknowledge: false` and calling promptly — once the automatic
|
|
508
|
+
* acknowledge or the server-side fallback (below) has finalised the
|
|
509
|
+
* spin, `lose: true` is a no-op and the prize stays credited.
|
|
510
|
+
* ("Explicit claim" prizes are exempt from the fallback, so for them
|
|
511
|
+
* there is no time pressure.)
|
|
512
|
+
*
|
|
461
513
|
* **Idempotency**: safe. Acknowledging a spin that is already
|
|
462
514
|
* finalised — by you, by the automatic acknowledge, or by the
|
|
463
515
|
* fallback — is a no-op with no double credit. Acknowledging a
|
|
@@ -472,11 +524,12 @@ export class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
472
524
|
* call here.
|
|
473
525
|
*
|
|
474
526
|
* **Side effects** (first successful call for an un-acknowledged spin)
|
|
475
|
-
* -
|
|
476
|
-
*
|
|
477
|
-
*
|
|
478
|
-
*
|
|
479
|
-
*
|
|
527
|
+
* - Default (win): the prize value is credited on this call — this is
|
|
528
|
+
* the finalisation step that credits standard and "explicit claim"
|
|
529
|
+
* prizes alike (see {@link playMiniGame} "Prize handling").
|
|
530
|
+
* - With `lose: true`: no credit; the prize returns to the prize pool
|
|
531
|
+
* and the "lose" engagement event fires.
|
|
532
|
+
* - Either way the spin's `is_claimed` flips to `true` on the next
|
|
480
533
|
* {@link getMiniGamesHistory} fetch.
|
|
481
534
|
*
|
|
482
535
|
* **Visitor mode**: not supported.
|
|
@@ -486,6 +539,10 @@ export class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
486
539
|
* (played with `acknowledge: false`), or the
|
|
487
540
|
* `client_request_id` of a
|
|
488
541
|
* {@link getMiniGamesHistory} row.
|
|
542
|
+
* @param options.lose Optional. When `true`, finalises the spin as
|
|
543
|
+
* lost — the prize is not credited and returns
|
|
544
|
+
* to the prize pool (see "Finalising as lost").
|
|
545
|
+
* Omit (or pass `false`) to deliver the win.
|
|
489
546
|
*
|
|
490
547
|
* @example
|
|
491
548
|
* ```ts
|
|
@@ -496,6 +553,10 @@ export class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
496
553
|
* await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
497
554
|
* }
|
|
498
555
|
*
|
|
556
|
+
* // Decline / forfeit — finalise the same spin as lost instead:
|
|
557
|
+
* // the prize is not credited and goes back to the prize pool.
|
|
558
|
+
* await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id, { lose: true });
|
|
559
|
+
*
|
|
499
560
|
* // Recovery — re-acknowledge any spins a batch acknowledge missed.
|
|
500
561
|
* const history = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
|
|
501
562
|
* for (const row of history.filter(h => !h.is_claimed)) {
|
|
@@ -504,8 +565,8 @@ export class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
504
565
|
* }
|
|
505
566
|
* ```
|
|
506
567
|
*/
|
|
507
|
-
public async miniGameWinAcknowledgeRequest(request_id: string) {
|
|
508
|
-
return this.api.doAcknowledgeRequest(this.userExtId, request_id);
|
|
568
|
+
public async miniGameWinAcknowledgeRequest(request_id: string, { lose }: { lose?: boolean } = {}) {
|
|
569
|
+
return this.api.doAcknowledgeRequest(this.userExtId, request_id, lose);
|
|
509
570
|
}
|
|
510
571
|
|
|
511
572
|
/**
|
package/src/WSAPI/WSAPITypes.ts
CHANGED
|
@@ -53,25 +53,29 @@ export interface TMiniGamePrize {
|
|
|
53
53
|
acknowledge_dp_additional?: string;
|
|
54
54
|
/** The name of the action button in modal pop-up (additional) */
|
|
55
55
|
acknowledge_action_title_additional?: string;
|
|
56
|
+
/** Deep link that will trigger some action in modal pop-up (second button) */
|
|
57
|
+
second_btn?: string,
|
|
58
|
+
/** The name of the action button in modal pop-up (second button) */
|
|
59
|
+
second_btn_action_title?: string;
|
|
56
60
|
/** Message when the prize pool is empty for that specific prize */
|
|
57
61
|
out_of_stock_message?: string;
|
|
58
|
-
/**
|
|
62
|
+
/** 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 */
|
|
59
63
|
pool?: number;
|
|
60
|
-
/** Initial
|
|
64
|
+
/** Initial (configured) stock of the prize. Populated regardless of `expose_game_stat_on_api` */
|
|
61
65
|
pool_initial?: number;
|
|
62
|
-
/** Number of
|
|
66
|
+
/** Number of times the prize has been won, across all players. Populated only when the template's `expose_game_stat_on_api` is enabled */
|
|
63
67
|
wins_count?: number;
|
|
64
|
-
/**
|
|
68
|
+
/** 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 */
|
|
65
69
|
weekdays?: number[];
|
|
66
|
-
/**
|
|
70
|
+
/** 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 */
|
|
67
71
|
active_from_ts?: number;
|
|
68
|
-
/**
|
|
72
|
+
/** 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 */
|
|
69
73
|
active_till_ts?: number;
|
|
70
|
-
/**
|
|
74
|
+
/** 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) */
|
|
71
75
|
relative_period_timezone?: number;
|
|
72
|
-
/**
|
|
76
|
+
/** When true, the prize stays winnable even when its `pool` reaches 0 (effectively unlimited stock) */
|
|
73
77
|
is_surcharge?: boolean;
|
|
74
|
-
/**
|
|
78
|
+
/** Always `false` in API responses — deleted prizes are excluded server-side */
|
|
75
79
|
is_deleted?: boolean;
|
|
76
80
|
/** The custom data of the mini-game defined by operator in the BackOffice. Can be a JSON object, string or number */
|
|
77
81
|
custom_data?: any;
|
|
@@ -204,7 +208,7 @@ export interface TMiniGameTemplate {
|
|
|
204
208
|
/** List of prizes for mini-games */
|
|
205
209
|
prizes: TMiniGamePrize[];
|
|
206
210
|
|
|
207
|
-
/** When enabled, the
|
|
211
|
+
/** 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" */
|
|
208
212
|
expose_game_stat_on_api?: boolean;
|
|
209
213
|
|
|
210
214
|
/** Time zone to ensure each day aligns with your local midnight. */
|
|
@@ -215,7 +219,7 @@ export interface TMiniGameTemplate {
|
|
|
215
219
|
activeTillDate?: number;
|
|
216
220
|
/** The amount of steps to complete the game and gather the prize */
|
|
217
221
|
steps_to_finish_game?: number;
|
|
218
|
-
/**
|
|
222
|
+
/** ID of the operator-defined custom section (widget menu grouping) the mini-game is assigned to */
|
|
219
223
|
custom_section_id?: number;
|
|
220
224
|
|
|
221
225
|
/** The UI definition of the mini-game */
|
|
@@ -228,7 +232,7 @@ export interface TMiniGameTemplate {
|
|
|
228
232
|
max_number_of_attempts?: number;
|
|
229
233
|
/** The period of time in milliseconds during which the user can do the maximum number of attempts */
|
|
230
234
|
max_spins_period_ms?: number;
|
|
231
|
-
/**
|
|
235
|
+
/** 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 */
|
|
232
236
|
expose_user_spin_id?: SAWExposeUserSpinIdName;
|
|
233
237
|
}
|
|
234
238
|
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# Interface: TClanTournamentPlayer
|
|
2
|
-
|
|
3
|
-
## Properties
|
|
4
|
-
|
|
5
|
-
### user\_id
|
|
6
|
-
|
|
7
|
-
> **user\_id**: `number`
|
|
8
|
-
|
|
9
|
-
***
|
|
10
|
-
|
|
11
|
-
### clean\_ext\_user\_id
|
|
12
|
-
|
|
13
|
-
> **clean\_ext\_user\_id**: `string`
|
|
14
|
-
|
|
15
|
-
***
|
|
16
|
-
|
|
17
|
-
### public\_username
|
|
18
|
-
|
|
19
|
-
> **public\_username**: `string`
|
|
20
|
-
|
|
21
|
-
***
|
|
22
|
-
|
|
23
|
-
### avatar\_id
|
|
24
|
-
|
|
25
|
-
> **avatar\_id**: `string`
|
|
26
|
-
|
|
27
|
-
***
|
|
28
|
-
|
|
29
|
-
### avatar\_real\_id
|
|
30
|
-
|
|
31
|
-
> **avatar\_real\_id**: `number`
|
|
32
|
-
|
|
33
|
-
***
|
|
34
|
-
|
|
35
|
-
### avatar\_url?
|
|
36
|
-
|
|
37
|
-
> `optional` **avatar\_url?**: `string`
|
|
38
|
-
|
|
39
|
-
***
|
|
40
|
-
|
|
41
|
-
### position
|
|
42
|
-
|
|
43
|
-
> **position**: `number`
|
|
44
|
-
|
|
45
|
-
***
|
|
46
|
-
|
|
47
|
-
### scores
|
|
48
|
-
|
|
49
|
-
> **scores**: `number`
|
|
50
|
-
|
|
51
|
-
***
|
|
52
|
-
|
|
53
|
-
### is\_me
|
|
54
|
-
|
|
55
|
-
> **is\_me**: `boolean`
|