@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
|
@@ -57,28 +57,30 @@ Array of `TMiniGameTemplate`. Each item:
|
|
|
57
57
|
- `acknowledge_action_title` (string) — The name of the action button in modal pop-up
|
|
58
58
|
- `acknowledge_dp_additional` (string) — Deep link that will trigger some action in modal pop-up (additional)
|
|
59
59
|
- `acknowledge_action_title_additional` (string) — The name of the action button in modal pop-up (additional)
|
|
60
|
+
- `second_btn` (string) — Deep link that will trigger some action in modal pop-up (second button)
|
|
61
|
+
- `second_btn_action_title` (string) — The name of the action button in modal pop-up (second button)
|
|
60
62
|
- `out_of_stock_message` (string) — Message when the prize pool is empty for that specific prize
|
|
61
|
-
- `pool` (number) —
|
|
62
|
-
- `pool_initial` (number) — Initial
|
|
63
|
-
- `wins_count` (number) — Number of
|
|
64
|
-
- `weekdays` (number[]) —
|
|
65
|
-
- `active_from_ts` (number) —
|
|
66
|
-
- `active_till_ts` (number) —
|
|
67
|
-
- `relative_period_timezone` (number) —
|
|
68
|
-
- `is_surcharge` (boolean) —
|
|
69
|
-
- `is_deleted` (boolean) —
|
|
63
|
+
- `pool` (number) — 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
|
|
64
|
+
- `pool_initial` (number) — Initial (configured) stock of the prize. Populated regardless of `expose_game_stat_on_api`
|
|
65
|
+
- `wins_count` (number) — Number of times the prize has been won, across all players. Populated only when the template's `expose_game_stat_on_api` is enabled
|
|
66
|
+
- `weekdays` (number[]) — 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
|
|
67
|
+
- `active_from_ts` (number) — 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
|
+
- `active_till_ts` (number) — 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
|
+
- `relative_period_timezone` (number) — 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)
|
|
70
|
+
- `is_surcharge` (boolean) — When true, the prize stays winnable even when its `pool` reaches 0 (effectively unlimited stock)
|
|
71
|
+
- `is_deleted` (boolean) — Always `false` in API responses — deleted prizes are excluded server-side
|
|
70
72
|
- `custom_data` (any) — The custom data of the mini-game defined by operator in the BackOffice. Can be a JSON object, string or number
|
|
71
73
|
- `prize_modifiers` (PrizeModifiers[]) — 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.
|
|
72
74
|
- `allow_split_decimal` (boolean) — When enabled, you can split prize value by decimal values
|
|
73
75
|
- `hide_prize_from_history` (boolean) — When enabled, you can hide prize from prize history
|
|
74
76
|
- `requirements_to_get_prize` (string) — Requirements to claim the prize (lootbox specific)
|
|
75
77
|
- `max_give_period_type_id` (AttemptPeriodType) — The period type for the prize to be given: Time from last attempt, Calendar days UTC, Calendar days user time zone, Lifetime
|
|
76
|
-
- `expose_game_stat_on_api` (boolean) — When enabled, the
|
|
78
|
+
- `expose_game_stat_on_api` (boolean) — 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"
|
|
77
79
|
- `relative_period_timezone` (number) — Time zone to ensure each day aligns with your local midnight.
|
|
78
80
|
- `activeFromDate` (number) — Holds time from which template will become available, for the template that are targeted to be available from specific time (UNIX timestamp)
|
|
79
81
|
- `activeTillDate` (number) — Holds time till which template will become available, for the templates that are targeted to be available from specific time (UNIX timestamp)
|
|
80
82
|
- `steps_to_finish_game` (number) — The amount of steps to complete the game and gather the prize
|
|
81
|
-
- `custom_section_id` (number) —
|
|
83
|
+
- `custom_section_id` (number) — ID of the operator-defined custom section (widget menu grouping) the mini-game is assigned to
|
|
82
84
|
- `saw_template_ui_definition` (SAWTemplateUI) — The UI definition of the mini-game
|
|
83
85
|
- `skin` (string)
|
|
84
86
|
- `name` (string)
|
|
@@ -128,7 +130,7 @@ Array of `TMiniGameTemplate`. Each item:
|
|
|
128
130
|
- `show_prize_history` (boolean) — When enabled the prize history icon is visible on a certain template
|
|
129
131
|
- `max_number_of_attempts` (number) — The maximum number of attempts that user can do during period of time
|
|
130
132
|
- `max_spins_period_ms` (number) — The period of time in milliseconds during which the user can do the maximum number of attempts
|
|
131
|
-
- `expose_user_spin_id` (SAWExposeUserSpinIdName) —
|
|
133
|
+
- `expose_user_spin_id` (SAWExposeUserSpinIdName) — 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
|
|
132
134
|
|
|
133
135
|
## Behavioral contract
|
|
134
136
|
**Subscription model (`onUpdate`)**
|
|
@@ -166,6 +168,27 @@ played via `playMiniGame`; the exceptions are:
|
|
|
166
168
|
games server (not this SDK); the SAW spin is fired
|
|
167
169
|
server-internally to deduct the buy-in.
|
|
168
170
|
|
|
171
|
+
**Per-prize statistics (`expose_game_stat_on_api`)**
|
|
172
|
+
Each template's `prizes` array always carries the definition
|
|
173
|
+
fields — name, icon, `prize_type`, `prize_value`, acknowledge
|
|
174
|
+
configuration. The stock-statistics fields are gated by an
|
|
175
|
+
operator template setting, surfaced as
|
|
176
|
+
`expose_game_stat_on_api`:
|
|
177
|
+
- Populated when enabled: `pool` (remaining stock),
|
|
178
|
+
`wins_count` (total wins across all players), `weekdays`
|
|
179
|
+
(ISO 1–7 days the prize can be won), `active_from_ts` /
|
|
180
|
+
`active_till_ts` (prize availability window).
|
|
181
|
+
- Omitted when disabled (the default) — this keeps the live
|
|
182
|
+
prize economy (stock levels, win rates, schedules) hidden
|
|
183
|
+
from players.
|
|
184
|
+
- Exception: `pool` is always populated for `MatchX` / `Quiz`
|
|
185
|
+
templates, whose game flow needs the remaining stock.
|
|
186
|
+
- `pool_initial` is populated regardless of the setting.
|
|
187
|
+
When enabled, the values are also kept current — the server
|
|
188
|
+
refreshes the prize rows on each fetch and drops its template
|
|
189
|
+
caches after every play, so `pool` / `wins_count` are safe to
|
|
190
|
+
drive an "X prizes left" scarcity UI.
|
|
191
|
+
|
|
169
192
|
**Cache TTL**: the SDK caches the response for 30 seconds. Cache
|
|
170
193
|
is fully cleared on login / logout.
|
|
171
194
|
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
# miniGameWinAcknowledgeRequest — API
|
|
2
2
|
|
|
3
|
-
> Manually acknowledges a mini-game spin — marks the win delivered server-side.
|
|
3
|
+
> Manually acknowledges a mini-game spin — marks the win delivered server-side, or (with `lose: true`) finalises it as lost and returns the prize to the pool.
|
|
4
4
|
> Import: `import { /* types */ } from '@smartico/public-api'`
|
|
5
5
|
> Search terms: miniGameWinAcknowledgeRequest, minigames, doSAWAcknowledge, SAWAcknowledge, acknowledge, SAWAcknowledgeType, request_id, errCode, errMsg, cid, ts, uuid, payload, duration
|
|
6
6
|
|
|
7
7
|
## Signature
|
|
8
8
|
```ts
|
|
9
|
-
_smartico.api.miniGameWinAcknowledgeRequest(request_id: string): void
|
|
9
|
+
_smartico.api.miniGameWinAcknowledgeRequest(request_id: string, { lose }: { lose?: boolean } = {}): void
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
## Parameters
|
|
13
13
|
- `request_id` — Correlation id of the spin to finalise: the `request_id` from a `playMiniGame` result (played with `acknowledge: false`), or the `client_request_id` of a `getMiniGamesHistory` row.
|
|
14
|
+
- `options.lose` — Optional. When `true`, finalises the spin as lost — the prize is not credited and returns to the prize pool (see "Finalising as lost"). Omit (or pass `false`) to deliver the win.
|
|
14
15
|
|
|
15
16
|
## Returns
|
|
16
17
|
_No return value._
|
|
@@ -34,6 +35,23 @@ The `request_id` on a `playMiniGame` result and the
|
|
|
34
35
|
`client_request_id` on a `getMiniGamesHistory` row are the
|
|
35
36
|
same correlation id — this method accepts either.
|
|
36
37
|
|
|
38
|
+
**Finalising as lost (`lose: true`)**
|
|
39
|
+
Pass `{ lose: true }` to finalise the spin as LOST instead of won:
|
|
40
|
+
the prize is NOT credited and is returned to the game's prize pool
|
|
41
|
+
(available again for other players), and the spin fires the
|
|
42
|
+
mini-game "lose" engagement event instead of the win one. On the
|
|
43
|
+
next `getMiniGamesHistory` fetch the row shows `is_claimed:
|
|
44
|
+
true` with no prize attached. Use this for game mechanics where the
|
|
45
|
+
player can decline or forfeit the drawn prize — e.g. a
|
|
46
|
+
gamble/discard step, or a client-driven game where the user's final
|
|
47
|
+
action decides whether the pre-drawn prize is actually won. It only
|
|
48
|
+
works on a spin that is not yet finalised, so it requires playing
|
|
49
|
+
with `acknowledge: false` and calling promptly — once the automatic
|
|
50
|
+
acknowledge or the server-side fallback (below) has finalised the
|
|
51
|
+
spin, `lose: true` is a no-op and the prize stays credited.
|
|
52
|
+
("Explicit claim" prizes are exempt from the fallback, so for them
|
|
53
|
+
there is no time pressure.)
|
|
54
|
+
|
|
37
55
|
**Idempotency**: safe. Acknowledging a spin that is already
|
|
38
56
|
finalised — by you, by the automatic acknowledge, or by the
|
|
39
57
|
fallback — is a no-op with no double credit. Acknowledging a
|
|
@@ -48,11 +66,12 @@ exception — excluded from the fallback, they require an explicit
|
|
|
48
66
|
call here.
|
|
49
67
|
|
|
50
68
|
**Side effects** (first successful call for an un-acknowledged spin)
|
|
51
|
-
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
69
|
+
- Default (win): the prize value is credited on this call — this is
|
|
70
|
+
the finalisation step that credits standard and "explicit claim"
|
|
71
|
+
prizes alike (see `playMiniGame` "Prize handling").
|
|
72
|
+
- With `lose: true`: no credit; the prize returns to the prize pool
|
|
73
|
+
and the "lose" engagement event fires.
|
|
74
|
+
- Either way the spin's `is_claimed` flips to `true` on the next
|
|
56
75
|
`getMiniGamesHistory` fetch.
|
|
57
76
|
|
|
58
77
|
**Visitor mode**: not supported.
|
|
@@ -66,6 +85,10 @@ if (r.err_code === 0) {
|
|
|
66
85
|
await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
67
86
|
}
|
|
68
87
|
|
|
88
|
+
// Decline / forfeit — finalise the same spin as lost instead:
|
|
89
|
+
// the prize is not credited and goes back to the prize pool.
|
|
90
|
+
await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id, { lose: true });
|
|
91
|
+
|
|
69
92
|
// Recovery — re-acknowledge any spins a batch acknowledge missed.
|
|
70
93
|
const history = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
|
|
71
94
|
for (const row of history.filter(h => !h.is_claimed)) {
|
|
@@ -67,14 +67,19 @@ without waiting for the win to be marked delivered. You finalise
|
|
|
67
67
|
it later by calling `miniGameWinAcknowledgeRequest` with the
|
|
68
68
|
`request_id` returned on this result.
|
|
69
69
|
|
|
70
|
-
What `acknowledge: false`
|
|
71
|
-
- For STANDARD prizes the value is credited
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
explicit acknowledge
|
|
70
|
+
What `acknowledge: false` defers:
|
|
71
|
+
- For STANDARD prizes the value is credited when the spin is
|
|
72
|
+
finalised — by your later acknowledge or, failing that, by the
|
|
73
|
+
server-side fallback below — so opting out delays the balance
|
|
74
|
+
change by at most that fallback window. The `is_claimed` flag in
|
|
75
|
+
`getMiniGamesHistory` flips on the same finalisation.
|
|
76
|
+
- For operator-configured "explicit claim" prizes the credit is
|
|
77
|
+
deferred until your explicit acknowledge — the fallback does not
|
|
78
|
+
cover them.
|
|
79
|
+
|
|
80
|
+
While the spin is un-finalised it can also be finalised as LOST —
|
|
81
|
+
prize discarded back to the pool — via
|
|
82
|
+
`miniGameWinAcknowledgeRequest` with `{ lose: true }`.
|
|
78
83
|
|
|
79
84
|
A server-side fallback auto-acknowledges ordinary un-acknowledged
|
|
80
85
|
spins after a short delay (about 1–3 minutes), so an ordinary
|
|
@@ -105,8 +110,10 @@ refreshed array.
|
|
|
105
110
|
time the call resolves. Balance updates flow via the
|
|
106
111
|
user-properties channel (observe via `getUserProfile`).
|
|
107
112
|
- Prize value credited per the prize's type (see "Prize handling"
|
|
108
|
-
above)
|
|
109
|
-
|
|
113
|
+
above) when the spin is finalised — with the default
|
|
114
|
+
auto-acknowledge that happens before the call resolves;
|
|
115
|
+
"explicit claim" prizes are credited only by an explicit
|
|
116
|
+
acknowledge.
|
|
110
117
|
- The play is recorded server-side for analytics / reporting.
|
|
111
118
|
|
|
112
119
|
**UI guidance**: see [UI Guide — `playMiniGame`](../../docs/ui/minigames/UIGuide_playMiniGame.md).
|
|
@@ -153,18 +160,24 @@ if (r.err_code === 0) {
|
|
|
153
160
|
```
|
|
154
161
|
|
|
155
162
|
Manual finalisation (`acknowledge: false`) — e.g. an explicit
|
|
156
|
-
"Claim" CTA, or finalising on your own
|
|
163
|
+
"Claim" CTA, a decline/forfeit flow, or finalising on your own
|
|
164
|
+
schedule:
|
|
157
165
|
```ts
|
|
158
166
|
const r = await window._smartico.api.playMiniGame(game.id, { acknowledge: false });
|
|
159
167
|
if (r.err_code === 0) {
|
|
160
|
-
// Spin resolved but not yet
|
|
161
|
-
//
|
|
162
|
-
//
|
|
168
|
+
// Spin resolved but not yet finalised — the prize is not credited
|
|
169
|
+
// yet. Your acknowledge below credits it (for standard prizes the
|
|
170
|
+
// server-side fallback would eventually do the same).
|
|
163
171
|
console.log('[smartico] prize won — show the result / Claim CTA, then finalise');
|
|
164
172
|
|
|
165
173
|
// On the user's Claim click, finalise with the request_id from the result.
|
|
166
174
|
await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
167
175
|
console.log('[smartico] win finalised — refresh getUserProfile / getMiniGames to reflect it');
|
|
176
|
+
|
|
177
|
+
// Or, if the game flow ends in the player declining / losing the
|
|
178
|
+
// drawn prize, finalise the spin as lost instead — the prize is
|
|
179
|
+
// not credited and returns to the prize pool:
|
|
180
|
+
// await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id, { lose: true });
|
|
168
181
|
}
|
|
169
182
|
```
|
|
170
183
|
|
package/docs/native/PROTOCOL.md
CHANGED
|
@@ -1434,6 +1434,8 @@ Each item in `results`:
|
|
|
1434
1434
|
|
|
1435
1435
|
Acknowledge a mini-game win. Should be called after displaying the win result to the user.
|
|
1436
1436
|
|
|
1437
|
+
Optionally finalises the spin as **lost** instead: with `lose: true` the prize is not credited, it is returned to the game's prize pool, and the mini-game "lose" engagement event fires instead of the win one. Only possible while the spin is not yet acknowledged — once the automatic server-side acknowledge fallback has finalised it, `lose: true` is a no-op and the prize stays credited.
|
|
1438
|
+
|
|
1437
1439
|
#### Request
|
|
1438
1440
|
|
|
1439
1441
|
**ClassId:** `704` (SAW_AKNOWLEDGE_REQUEST)
|
|
@@ -1441,6 +1443,7 @@ Acknowledge a mini-game win. Should be called after displaying the win result to
|
|
|
1441
1443
|
| Field | Type | Description |
|
|
1442
1444
|
|-------|------|-------------|
|
|
1443
1445
|
| `request_id` | `string` | Request ID from the spin response |
|
|
1446
|
+
| `lose` | `boolean` | Optional. `true` finalises the spin as lost: prize not credited, returned to the prize pool. Omit or `false` to deliver the win |
|
|
1444
1447
|
|
|
1445
1448
|
#### Response
|
|
1446
1449
|
|
|
@@ -61,6 +61,14 @@ manually if needed.
|
|
|
61
61
|
- For long sessions, re-call when reopening the tab past the 30 s
|
|
62
62
|
window.
|
|
63
63
|
|
|
64
|
+
## Visitor mode
|
|
65
|
+
|
|
66
|
+
Supported via `_smartico.vapi(lang).getJackpotEligibleGames(...)`. The
|
|
67
|
+
eligible-games list is template-level (which games contribute to the
|
|
68
|
+
pot) and carries no per-user fields, so a visitor session sees the same
|
|
69
|
+
list an identified user would. The `lang` passed to `_smartico.vapi(lang)`
|
|
70
|
+
drives the translation of game names.
|
|
71
|
+
|
|
64
72
|
## Mobile vs desktop
|
|
65
73
|
|
|
66
74
|
- **Mobile**: 2- or 3-column tile grid.
|
|
@@ -99,6 +99,30 @@ error.
|
|
|
99
99
|
| `promo_image` | ~2:1 wide, 500×240 px | Featured / hero artwork |
|
|
100
100
|
| `prizes[].icon` | 1:1 (square) | Per-prize icon |
|
|
101
101
|
|
|
102
|
+
## Prize stock / scarcity UI (`expose_game_stat_on_api`)
|
|
103
|
+
|
|
104
|
+
When the operator enables "expose game statistics" on a template
|
|
105
|
+
(`template.expose_game_stat_on_api === true`), each prize carries
|
|
106
|
+
live stock statistics you can build scarcity affordances from:
|
|
107
|
+
|
|
108
|
+
- `pool` — remaining stock → "Only 3 left!" badges; pair with
|
|
109
|
+
`pool_initial` for a depletion bar (`pool / pool_initial`).
|
|
110
|
+
- `wins_count` — total wins across all players → social proof
|
|
111
|
+
("won 120 times").
|
|
112
|
+
- `weekdays` (ISO 1–7) and `active_from_ts` / `active_till_ts` —
|
|
113
|
+
the prize's availability schedule → grey out prizes not winnable
|
|
114
|
+
today, or show "available Mon–Fri" hints. Evaluate against
|
|
115
|
+
`relative_period_timezone` (minutes, JS `getTimezoneOffset`
|
|
116
|
+
convention), not the device timezone.
|
|
117
|
+
|
|
118
|
+
The values refresh after every play, so re-render stock badges
|
|
119
|
+
from the `onUpdate` callback. When the setting is disabled (the
|
|
120
|
+
default) these fields are absent — build the prize strip from the
|
|
121
|
+
definition fields only and don't reserve empty space for stock
|
|
122
|
+
badges. Exception: `pool` is always present for MatchX / Quiz
|
|
123
|
+
templates. A prize with `is_surcharge: true` never runs out —
|
|
124
|
+
skip stock badges for it.
|
|
125
|
+
|
|
102
126
|
## Status-specific visual treatments
|
|
103
127
|
|
|
104
128
|
- **Playable**: full-color card; Play CTA enabled.
|
|
@@ -24,7 +24,7 @@ Fields rendered per row:
|
|
|
24
24
|
| Field | Source | Notes |
|
|
25
25
|
|---|---|---|
|
|
26
26
|
| Template icon | `template.thumbnail` (or similar) | 1:1 |
|
|
27
|
-
| Prize name | Look up `template.prizes[i]` by `saw_prize_id` | Display the prize's `name`. |
|
|
27
|
+
| Prize name | Look up `template.prizes[i]` by `saw_prize_id` | Display the prize's `name`. A spin finalised as lost (`miniGameWinAcknowledgeRequest` with `lose: true`) has no prize attached — render it as a loss. |
|
|
28
28
|
| Prize amount | `template.prizes[i].prize_value` or `prize_amount` | E.g. "100 points" |
|
|
29
29
|
| Spin date | `create_date_ts` | Format as user-local relative time ("2h ago") or short date |
|
|
30
30
|
| Claim status | `is_claimed` | Show check-mark when true; "Pending claim" CTA when false |
|
|
@@ -91,7 +91,9 @@ with the `request_id` from that play result when the user taps Claim.
|
|
|
91
91
|
[`getMiniGamesHistory`](../../api/classes/WSAPIMiniGames.md#getminigameshistory)
|
|
92
92
|
row if you need to recover it later.) Note: "explicit claim" prizes
|
|
93
93
|
are NOT covered by the server-side auto-acknowledge fallback, so for
|
|
94
|
-
these you MUST acknowledge or the prize is never credited.
|
|
94
|
+
these you MUST acknowledge or the prize is never credited. To let
|
|
95
|
+
the user decline the prize instead of claiming it, see "Decline /
|
|
96
|
+
forfeit" below.
|
|
95
97
|
|
|
96
98
|
Modal contents per prize:
|
|
97
99
|
|
|
@@ -105,6 +107,31 @@ Modal contents per prize:
|
|
|
105
107
|
- Optional additional CTA: `prize.acknowledge_action_title_additional`
|
|
106
108
|
+ `prize.acknowledge_dp_additional`
|
|
107
109
|
|
|
110
|
+
## Decline / forfeit ("lose") flows
|
|
111
|
+
|
|
112
|
+
Some game mechanics let the player decline or forfeit the drawn
|
|
113
|
+
prize — a gamble/discard step, a "keep it or risk it" offer, or a
|
|
114
|
+
game where the player's final action decides whether the pre-drawn
|
|
115
|
+
prize is actually won. Implement these with manual finalisation:
|
|
116
|
+
|
|
117
|
+
1. Play with `acknowledge: false` so the SDK does not auto-finalise.
|
|
118
|
+
2. Run the game / choice UI.
|
|
119
|
+
3. Finalise per the outcome:
|
|
120
|
+
- Keep / win →
|
|
121
|
+
`miniGameWinAcknowledgeRequest(request_id)` — prize credited.
|
|
122
|
+
- Decline / lose →
|
|
123
|
+
`miniGameWinAcknowledgeRequest(request_id, { lose: true })` —
|
|
124
|
+
prize NOT credited, returned to the prize pool for other
|
|
125
|
+
players. Show the same "Better luck next time" treatment as a
|
|
126
|
+
`no-prize` slot (below).
|
|
127
|
+
|
|
128
|
+
Timing: standard prizes are auto-finalised as WON by the
|
|
129
|
+
server-side fallback after ~1–3 minutes, so send the lose decision
|
|
130
|
+
promptly — after the fallback fires, `lose: true` is a no-op and
|
|
131
|
+
the prize stays credited. "Explicit claim" prizes are exempt from
|
|
132
|
+
the fallback, so those have no time pressure. Once a spin is
|
|
133
|
+
finalised either way, further acknowledge calls are no-ops.
|
|
134
|
+
|
|
108
135
|
## "No prize" handling
|
|
109
136
|
|
|
110
137
|
When the won prize has `prize_type === 'no-prize'`, the user has
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartico/public-api",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.410",
|
|
4
4
|
"description": "Smartico public API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"bump-ach": "cd ../tracker/ach && npm install @smartico/public-api@latest --legacy-peer-deps",
|
|
25
25
|
"bump-bo-server": "cd ../bo_server/server && source ~/.nvm/nvm.sh && nvm use v13.13.0 && npm install @smartico/public-api@latest",
|
|
26
26
|
"bump-bo-client": "cd ../bo_server/client && source ~/.nvm/nvm.sh && nvm use v13.13.0 && npm install @smartico/public-api@latest",
|
|
27
|
-
"doc": "typedoc && node scripts/postdoc-cleanup.js",
|
|
27
|
+
"doc": "node scripts/gen-capabilities.js && typedoc && node scripts/postdoc-cleanup.js",
|
|
28
28
|
"gen-capabilities": "node scripts/gen-capabilities.js"
|
|
29
29
|
},
|
|
30
30
|
"author": "",
|
|
@@ -233,7 +233,12 @@ export interface GamePickEvent {
|
|
|
233
233
|
resolution_score?: number;
|
|
234
234
|
/** Whether this event is still accepting predictions */
|
|
235
235
|
is_open_for_bets?: boolean;
|
|
236
|
-
/**
|
|
236
|
+
/** Per-outcome numbers keyed by the outcome value (`'1'` / `'x'` / `'2'`, `'yes'` / `'no'`, …).
|
|
237
|
+
* Dual-purpose by event type:
|
|
238
|
+
* - Sports / MatchX: decimal **betting odds** (e.g. `{ "1": 2.45, "x": 3.26, "2": 3.01 }`).
|
|
239
|
+
* - Quiz: when the round's `show_users_preference` is `true`, these are aggregated
|
|
240
|
+
* **user-preference percentages** — what other users predicted, summing to ~100
|
|
241
|
+
* (e.g. `{ "1": 33, "x": 25, "2": 42 }`). Render as the "what others predicted" bar. */
|
|
237
242
|
odds_details?: { odd_value: { [key: string]: number } };
|
|
238
243
|
/** URL of a question-specific image (quiz events) */
|
|
239
244
|
question_image?: string;
|
|
@@ -2,4 +2,6 @@ import { ProtocolMessage } from '.././Base/ProtocolMessage';
|
|
|
2
2
|
|
|
3
3
|
export interface SAWDoAknowledgeRequest extends ProtocolMessage {
|
|
4
4
|
request_id: string; // guid
|
|
5
|
+
/** When true, finalises the spin as lost: the prize is not credited and is returned to the prize pool. */
|
|
6
|
+
lose?: boolean;
|
|
5
7
|
}
|
|
@@ -77,6 +77,8 @@ export const SAWTemplatesTransform = (items: SAWTemplate[]): TMiniGameTemplate[]
|
|
|
77
77
|
acknowledge_action_title: p.saw_prize_ui_definition.acknowledge_action_title,
|
|
78
78
|
acknowledge_dp_additional: p.saw_prize_ui_definition.acknowledge_dp_additional,
|
|
79
79
|
acknowledge_action_title_additional: p.saw_prize_ui_definition.acknowledge_action_title_additional,
|
|
80
|
+
second_btn: p.saw_prize_ui_definition.second_btn,
|
|
81
|
+
second_btn_action_title: p.saw_prize_ui_definition.second_btn_action_title,
|
|
80
82
|
out_of_stock_message: p.saw_prize_ui_definition.out_of_stock_message,
|
|
81
83
|
pool: p.pool,
|
|
82
84
|
pool_initial: p.pool_initial,
|
|
@@ -10,14 +10,23 @@ export interface SAWPrize {
|
|
|
10
10
|
place_from?: number;
|
|
11
11
|
place_to?: number;
|
|
12
12
|
sawUniqueWinId?: string;
|
|
13
|
+
/** Remaining stock. Present only when the template's `expose_game_stat_on_api` is enabled; always present for MatchX / Quiz games */
|
|
13
14
|
pool?: number;
|
|
15
|
+
/** Initial (configured) stock. Present regardless of `expose_game_stat_on_api` */
|
|
14
16
|
pool_initial?: number;
|
|
17
|
+
/** Times the prize has been won, across all players. Present only when `expose_game_stat_on_api` is enabled */
|
|
15
18
|
wins_count?: number;
|
|
19
|
+
/** 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 */
|
|
16
20
|
weekdays?: number[];
|
|
21
|
+
/** Prize availability window start (epoch ms), evaluated against `relative_period_timezone`. Present only when `expose_game_stat_on_api` is enabled */
|
|
17
22
|
active_from_ts?: number;
|
|
23
|
+
/** Prize availability window end (epoch ms), evaluated against `relative_period_timezone`. Present only when `expose_game_stat_on_api` is enabled */
|
|
18
24
|
active_till_ts?: number;
|
|
25
|
+
/** Timezone offset in minutes for `weekdays` / active-window evaluation (UTC minus local, as in JS `Date.getTimezoneOffset()`) */
|
|
19
26
|
relative_period_timezone?: number;
|
|
27
|
+
/** When true, the prize stays winnable at `pool` 0 (unlimited stock) */
|
|
20
28
|
is_surcharge?: boolean;
|
|
29
|
+
/** Always `false` in API responses — deleted prizes are excluded server-side */
|
|
21
30
|
is_deleted?: boolean;
|
|
22
31
|
prize_details_json?: {[key: string]: any};
|
|
23
32
|
max_give_period_type_id?: AttemptPeriodType;
|
|
@@ -44,6 +44,7 @@ export interface SAWTemplate {
|
|
|
44
44
|
lottie_animation_speed?: number;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
+
/** 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). */
|
|
47
48
|
expose_game_stat_on_api?: boolean;
|
|
48
49
|
|
|
49
50
|
// AA: releavnt only in the context of the SAWPrizeDropWinPush
|
package/src/SmarticoAPI.ts
CHANGED
|
@@ -680,12 +680,13 @@ class SmarticoAPI {
|
|
|
680
680
|
return SAWTemplatesTransform((await this.sawGetTemplates(user_ext_id)).templates);
|
|
681
681
|
}
|
|
682
682
|
|
|
683
|
-
public async doAcknowledgeRequest(user_ext_id: string, request_id: string): Promise<SAWDoAknowledgeResponse> {
|
|
683
|
+
public async doAcknowledgeRequest(user_ext_id: string, request_id: string, lose?: boolean): Promise<SAWDoAknowledgeResponse> {
|
|
684
684
|
const message = this.buildMessage<SAWDoAknowledgeRequest, SAWDoAknowledgeResponse>(
|
|
685
685
|
user_ext_id,
|
|
686
686
|
ClassId.SAW_AKNOWLEDGE_REQUEST,
|
|
687
687
|
{
|
|
688
688
|
request_id,
|
|
689
|
+
lose,
|
|
689
690
|
},
|
|
690
691
|
);
|
|
691
692
|
|
package/src/SmarticoLib/index.ts
CHANGED
|
@@ -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
|
|
|
3
4
|
export interface ClanTournamentPlayerRaw {
|
|
4
5
|
userId: number;
|
|
@@ -19,24 +20,10 @@ export interface GetClanTournamentPlayersResponse extends ProtocolResponse {
|
|
|
19
20
|
players: ClanTournamentPlayerRaw[];
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
avatar_id: string;
|
|
27
|
-
avatar_real_id: number;
|
|
28
|
-
avatar_url?: string;
|
|
29
|
-
position: number;
|
|
30
|
-
scores: number;
|
|
31
|
-
is_me: boolean;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface TClanTournamentPlayersResult {
|
|
35
|
-
tournament_instance_id: number;
|
|
36
|
-
players: TClanTournamentPlayer[];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export const clanTournamentPlayersTransform = (response: GetClanTournamentPlayersResponse): TClanTournamentPlayersResult => {
|
|
23
|
+
// Consumer-facing types live in WSAPITypes.ts (`TClanTournamentPlayers`) — the
|
|
24
|
+
// single source documented + emitted to docs. This transform maps the raw wire
|
|
25
|
+
// shape onto it; do not re-declare a parallel result/player type here.
|
|
26
|
+
export const clanTournamentPlayersTransform = (response: GetClanTournamentPlayersResponse): TClanTournamentPlayers => {
|
|
40
27
|
return {
|
|
41
28
|
tournament_instance_id: response.tournament_instance_id,
|
|
42
29
|
players: (response.players || []).map((p) => ({
|
|
@@ -396,7 +396,7 @@ export class WSAPIJackpots extends WSAPIClans {
|
|
|
396
396
|
*
|
|
397
397
|
* @remarks
|
|
398
398
|
* **Preconditions**
|
|
399
|
-
* -
|
|
399
|
+
* - No authentication required — works in both identified and visitor mode.
|
|
400
400
|
* - `jp_template_id` is mandatory.
|
|
401
401
|
*
|
|
402
402
|
* **`onUpdate` caveat**
|
|
@@ -414,7 +414,12 @@ export class WSAPIJackpots extends WSAPIClans {
|
|
|
414
414
|
* Non-zero `errCode` on control-group users or generic server errors.
|
|
415
415
|
* Branch on `errCode === 0` and surface `errMsg` on failure.
|
|
416
416
|
*
|
|
417
|
-
* **Visitor mode**:
|
|
417
|
+
* **Visitor mode**: supported via
|
|
418
|
+
* `_smartico.vapi(lang).getJackpotEligibleGames(...)`. The eligible-games
|
|
419
|
+
* list is template-level (which games contribute to the pot) and carries no
|
|
420
|
+
* per-user fields, so a visitor session receives the same list an identified
|
|
421
|
+
* user would. The `lang` passed to `_smartico.vapi(lang)` drives the
|
|
422
|
+
* translation of game names.
|
|
418
423
|
*
|
|
419
424
|
* **UI guidance**: see [UI Guide — `getJackpotEligibleGames`](../../docs/ui/jackpots/UIGuide_getJackpotEligibleGames.md).
|
|
420
425
|
*
|
|
@@ -432,6 +437,10 @@ export class WSAPIJackpots extends WSAPIClans {
|
|
|
432
437
|
*
|
|
433
438
|
* const r = await window._smartico.api.getJackpotEligibleGames({ jp_template_id: 42 });
|
|
434
439
|
* console.log('[smartico] render', r.eligible_games.length, 'eligible game tiles');
|
|
440
|
+
*
|
|
441
|
+
* // Visitor mode — same shape, language driven by the vapi(lang) argument
|
|
442
|
+
* const visitor = await window._smartico.vapi('EN').getJackpotEligibleGames({ jp_template_id: 42 });
|
|
443
|
+
* console.log('[smartico] visitor eligible games:', visitor.eligible_games.length);
|
|
435
444
|
* ```
|
|
436
445
|
*/
|
|
437
446
|
public async getJackpotEligibleGames({ jp_template_id, onUpdate } : {
|