@smartico/public-api 0.0.410 → 0.0.411
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/MiniGames/SAWPrize.d.ts +9 -0
- package/dist/MiniGames/SAWPrizeUI.d.ts +1 -0
- package/dist/MiniGames/SAWTemplate.d.ts +23 -0
- package/dist/WSAPI/WSAPIMiniGames.d.ts +7 -1
- package/dist/WSAPI/WSAPITypes.d.ts +33 -32
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +9 -1
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/classes/WSAPIMiniGames.md +7 -1
- package/docs/api/interfaces/SAWPrize.md +18 -0
- package/docs/api/interfaces/SAWPrizeUI.md +2 -0
- package/docs/api/interfaces/SAWTemplate.md +46 -0
- package/docs/api/interfaces/TMiniGamePrize.md +28 -20
- package/docs/api/interfaces/TMiniGameTemplate.md +12 -13
- package/docs/capabilities/getMiniGames.md +30 -29
- package/docs/capabilities/miniGameWinAcknowledgeRequest.md +7 -1
- package/docs/native/PROTOCOL.md +4 -0
- package/docs/ui/minigames/UIGuide_getMiniGames.md +22 -0
- package/docs/ui/minigames/UIGuide_miniGameWinAcknowledgeRequest.md +90 -0
- package/docs/ui/minigames/UIGuide_playMiniGame.md +12 -3
- package/package.json +1 -1
- package/src/MiniGames/SAWGetTemplatesResponse.ts +1 -0
- package/src/MiniGames/SAWPrize.ts +9 -0
- package/src/MiniGames/SAWPrizeUI.ts +2 -1
- package/src/MiniGames/SAWTemplate.ts +26 -4
- package/src/SmarticoAPI.ts +5 -0
- package/src/WSAPI/WSAPIMiniGames.ts +7 -1
- package/src/WSAPI/WSAPITypes.ts +35 -34
|
@@ -30,35 +30,36 @@ Array of `TMiniGameTemplate`. Each item:
|
|
|
30
30
|
- `buyin_cost_gems` (number) — in case of charging type 'Gems', what is the gems amount will be deducted from user balance
|
|
31
31
|
- `buyin_cost_diamonds` (number) — in case of charging type 'Diamonds', what is the diamonds amount will be deducted from user balance
|
|
32
32
|
- `spin_count` (number) — in case of charging type 'Spin attempts', shows the current number of spin attempts that user has
|
|
33
|
-
- `next_available_spin_ts` (number) —
|
|
33
|
+
- `next_available_spin_ts` (number) — If the game limits the number of attempts per period of time, the epoch-ms time (UTC) when the next attempt becomes available. Populated only when the operator enabled the "show time to the next available spin" template setting, and only when the template's maximum attempts per period is 1.
|
|
34
34
|
- `earliest_expiration_dt` (number | null) — Soonest-expiring spin's expiration time for the current user, as an epoch-ms timestamp. `null` when the user has no expirable spins for this template — spins only expire when the template defines a spin-expiration rule (Wheel of Fortune, Loot Boxes, etc.). Pair with `latest_expiration_dt` to render a "spins expire between X and Y" window.
|
|
35
35
|
- `latest_expiration_dt` (number | null) — Latest-expiring spin's expiration time for the current user, as an epoch-ms timestamp. `null` when the user has no expirable spins; equals `earliest_expiration_dt` when a single expiration applies.
|
|
36
36
|
- `over_limit_message` (string) — The message that should be shown to the user when he cannot play the game, server rejected attempt with error code SAWSpinErrorCode.SAW_FAILED_MAX_SPINS_REACHED
|
|
37
37
|
- `no_attempts_message` (string) — The message that should be shown to the user when he cannot play the game because he doesn't have spin attempts or points.
|
|
38
|
-
- `jackpot_current` (number) — Current
|
|
38
|
+
- `jackpot_current` (number) — Current jackpot amount, if jackpot is enabled.
|
|
39
39
|
- `jackpot_add_on_attempt` (number) — The amount that will be added to the jackpot every time when somebody plays the game. Note that the contribution amount is abstract, means that no money or points are deducted from the user balance.
|
|
40
40
|
- `jackpot_symbol` (string) — The symbol of jackpot that is giving the sense to the 'amount' E.g. the symbol could be EUR and connected to the amount it can indicate that amount is monetary, e.g. '100 EUR'. Or the symbol can be 'Free spins' and connected to the amount it can indicate that amount is number of free spins, e.g. '100 Free spins'.
|
|
41
41
|
- `promo_image` (string) — The promo image, 500x240px
|
|
42
42
|
- `promo_text` (string) — The promo text
|
|
43
43
|
- `custom_data` (any) — The custom data of the mini-game defined by operator in the BackOffice. Can be a JSON object, string or number
|
|
44
|
-
- `prizes` (TMiniGamePrize[]) —
|
|
44
|
+
- `prizes` (TMiniGamePrize[]) — Prizes configured for this game — see `TMiniGamePrize`
|
|
45
45
|
- `id` (number) — ID of the prize
|
|
46
|
-
- `name` (string) —
|
|
47
|
-
- `prize_type` (MiniGamePrizeTypeName) — The type of the prize
|
|
46
|
+
- `name` (string) — Display name of the prize, pre-translated; any jackpot placeholder in it arrives resolved to the live jackpot value
|
|
47
|
+
- `prize_type` (MiniGamePrizeTypeName) — The type of the prize — see `MiniGamePrizeTypeName` ('no-prize', 'points', 'gems-and-diamonds', 'spin', 'bonus', 'jackpot', 'raffle-ticket', 'mission', 'change-level', 'manual')
|
|
48
48
|
- `prize_value` (number) — Numeric value of the prize in case it's 'points' or 'spin' type. For other types of prizes this value is not relevant. For example for prize '100 points' the prize_value will be 100. For '100 free spins' the prize_value will be 100.
|
|
49
|
-
- `font_size` (number) — Custom font size for the prize (desktop
|
|
50
|
-
- `font_size_mobile` (number) — Custom font size for the prize
|
|
49
|
+
- `font_size` (number) — Custom font size in px for rendering the prize name on the game surface (e.g. a wheel sector), desktop
|
|
50
|
+
- `font_size_mobile` (number) — Custom font size in px for the prize name, mobile; falls back to `font_size` when absent
|
|
51
51
|
- `icon` (string) — The URL of the icon of the prize, aspect ratio 1:1
|
|
52
|
-
- `position` (number) —
|
|
53
|
-
- `sectors` (number[]) —
|
|
54
|
-
- `acknowledge_type` (SAWAcknowledgeTypeName) —
|
|
52
|
+
- `position` (number) — For Scratch Card games — relative order of the prize in the scratch grid (lower first). May be absent for other game types
|
|
53
|
+
- `sectors` (number[]) — For Spin-a-Wheel games — wheel sector indices this prize occupies. Absent for non-wheel games
|
|
54
|
+
- `acknowledge_type` (SAWAcknowledgeTypeName) — Which win modal the prize uses — see `SAWAcknowledgeTypeName` (Silent / QuickMessage / FullMessage / ExplicitAcknowledge)
|
|
55
55
|
- `aknowledge_message` (string) — Message that will be shown to user in modal pop-up
|
|
56
|
-
- `
|
|
57
|
-
- `
|
|
58
|
-
- `
|
|
59
|
-
- `
|
|
60
|
-
- `
|
|
61
|
-
- `
|
|
56
|
+
- `aknowledge_message_lose` (string) — Message shown instead of `aknowledge_message` when the spin is finalised as lost (`lose: true` acknowledge flows — games with a client-decided outcome, e.g. Voyager). Absent unless configured
|
|
57
|
+
- `acknowledge_dp` (string) — Deep link executed when the user taps the main action button in the win modal (run it via `_smartico.dp()`)
|
|
58
|
+
- `acknowledge_action_title` (string) — Label of the main action button in the win modal
|
|
59
|
+
- `acknowledge_dp_additional` (string) — Deep link of the additional action button in the win modal
|
|
60
|
+
- `acknowledge_action_title_additional` (string) — Label of the additional action button in the win modal
|
|
61
|
+
- `second_btn` (string) — Deep link of the secondary button in the win modal
|
|
62
|
+
- `second_btn_action_title` (string) — Label of the secondary button in the win modal
|
|
62
63
|
- `out_of_stock_message` (string) — Message when the prize pool is empty for that specific prize
|
|
63
64
|
- `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
65
|
- `pool_initial` (number) — Initial (configured) stock of the prize. Populated regardless of `expose_game_stat_on_api`
|
|
@@ -69,19 +70,19 @@ Array of `TMiniGameTemplate`. Each item:
|
|
|
69
70
|
- `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
71
|
- `is_surcharge` (boolean) — When true, the prize stays winnable even when its `pool` reaches 0 (effectively unlimited stock)
|
|
71
72
|
- `is_deleted` (boolean) — Always `false` in API responses — deleted prizes are excluded server-side
|
|
72
|
-
- `custom_data` (any) — The custom data of the
|
|
73
|
-
- `prize_modifiers` (PrizeModifiers[]) —
|
|
74
|
-
- `allow_split_decimal` (boolean) —
|
|
75
|
-
- `hide_prize_from_history` (boolean) —
|
|
76
|
-
- `requirements_to_get_prize` (string) —
|
|
77
|
-
- `max_give_period_type_id` (AttemptPeriodType) —
|
|
73
|
+
- `custom_data` (any) — The custom data of the prize defined by the operator. Can be a JSON object, string or number
|
|
74
|
+
- `prize_modifiers` (PrizeModifiers[]) — Step-modifier tiles for step games (Treasure Hunt / Voyager) — see `PrizeModifiers` (2x / 5x / 10x, /2 / /5 / /10, 0, reset) applied to the running total revealed during the game. Presentation only — the awarded amount is still `prize_value`
|
|
75
|
+
- `allow_split_decimal` (boolean) — Step games (Treasure Hunt / Voyager): when true, the per-step revealed amounts of the prize value may be fractional; when false the split uses whole numbers
|
|
76
|
+
- `hide_prize_from_history` (boolean) — Operator hint to hide this prize when rendering prize-history UIs. Informational only — API responses are not filtered by it
|
|
77
|
+
- `requirements_to_get_prize` (string) — Operator text describing what the user must do to be eligible for this prize (lootbox games); shown when the prize is not yet available to the user
|
|
78
|
+
- `max_give_period_type_id` (AttemptPeriodType) — Period basis for the prize availability restriction — see `AttemptPeriodType`. `CalendarDaysUserTimeZone` evaluates `weekdays` / the active window in the user's timezone; the other types use `relative_period_timezone`
|
|
78
79
|
- `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"
|
|
79
|
-
- `relative_period_timezone` (number) —
|
|
80
|
-
- `activeFromDate` (number) —
|
|
81
|
-
- `activeTillDate` (number) —
|
|
82
|
-
- `steps_to_finish_game` (number) —
|
|
80
|
+
- `relative_period_timezone` (number) — Timezone offset in minutes used to evaluate the template's period-based rules (UTC minus local, as in JS `Date.getTimezoneOffset()` — e.g. `-180` for UTC+3)
|
|
81
|
+
- `activeFromDate` (number) — Time from which the template becomes available (epoch ms); absent when not restricted
|
|
82
|
+
- `activeTillDate` (number) — Time until which the template stays available (epoch ms); absent when not restricted
|
|
83
|
+
- `steps_to_finish_game` (number) — Number of steps to complete the game and collect the prize (step games — Voyager / Treasure Hunt)
|
|
83
84
|
- `custom_section_id` (number) — ID of the operator-defined custom section (widget menu grouping) the mini-game is assigned to
|
|
84
|
-
- `saw_template_ui_definition` (SAWTemplateUI) —
|
|
85
|
+
- `saw_template_ui_definition` (SAWTemplateUI) — Full raw UI definition of the mini-game (skin, colors, per-game visual settings) — see `SAWTemplateUI`. The commonly needed values are already lifted onto this template object
|
|
85
86
|
- `skin` (string)
|
|
86
87
|
- `name` (string)
|
|
87
88
|
- `description` (string)
|
|
@@ -126,8 +127,8 @@ Array of `TMiniGameTemplate`. Each item:
|
|
|
126
127
|
id: string;
|
|
127
128
|
content: string;
|
|
128
129
|
})
|
|
129
|
-
- `game_layout` (SAWGameLayoutName) —
|
|
130
|
-
- `show_prize_history` (boolean) —
|
|
130
|
+
- `game_layout` (SAWGameLayoutName) — Grid layout of the game. Populated only for Lootbox game types (LootboxWeekdays / LootboxCalendarDays)
|
|
131
|
+
- `show_prize_history` (boolean) — Operator setting: show a prize-history entry point (icon / button) on this game's view
|
|
131
132
|
- `max_number_of_attempts` (number) — The maximum number of attempts that user can do during period of time
|
|
132
133
|
- `max_spins_period_ms` (number) — The period of time in milliseconds during which the user can do the maximum number of attempts
|
|
133
134
|
- `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
|
|
@@ -44,7 +44,11 @@ next `getMiniGamesHistory` fetch the row shows `is_claimed:
|
|
|
44
44
|
true` with no prize attached. Use this for game mechanics where the
|
|
45
45
|
player can decline or forfeit the drawn prize — e.g. a
|
|
46
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
|
|
47
|
+
action decides whether the pre-drawn prize is actually won (the
|
|
48
|
+
default Smartico UI does this for the Voyager game: failing the
|
|
49
|
+
star-collection run finalises the spin as lost). When configured,
|
|
50
|
+
the prize's `aknowledge_message_lose` is the operator's result copy
|
|
51
|
+
for this case — show it instead of `aknowledge_message`. It only
|
|
48
52
|
works on a spin that is not yet finalised, so it requires playing
|
|
49
53
|
with `acknowledge: false` and calling promptly — once the automatic
|
|
50
54
|
acknowledge or the server-side fallback (below) has finalised the
|
|
@@ -74,6 +78,8 @@ call here.
|
|
|
74
78
|
- Either way the spin's `is_claimed` flips to `true` on the next
|
|
75
79
|
`getMiniGamesHistory` fetch.
|
|
76
80
|
|
|
81
|
+
**UI guidance**: see [UI Guide — `miniGameWinAcknowledgeRequest`](../../docs/ui/minigames/UIGuide_miniGameWinAcknowledgeRequest.md).
|
|
82
|
+
|
|
77
83
|
**Visitor mode**: not supported.
|
|
78
84
|
|
|
79
85
|
## Example
|
package/docs/native/PROTOCOL.md
CHANGED
|
@@ -1329,6 +1329,8 @@ No method-specific fields. Send only the common fields (see [Common Message Fiel
|
|
|
1329
1329
|
|-------|------|-------------|
|
|
1330
1330
|
| `templates` | [`SAWTemplate[]`](../api/interfaces/SAWTemplate.md) | Array of mini-game templates |
|
|
1331
1331
|
|
|
1332
|
+
Note: per-prize stock statistics (`pool`, `wins_count`, `weekdays`, `active_from_ts` / `active_till_ts`) are present on each template's `prizes` only when the template's `expose_game_stat_on_api` is enabled; otherwise the server strips them (`pool` is kept for MatchX / Quiz game types).
|
|
1333
|
+
|
|
1332
1334
|
---
|
|
1333
1335
|
|
|
1334
1336
|
### playMiniGame
|
|
@@ -1509,6 +1511,8 @@ Acknowledge a mini-game spin push. Sent after handling `SAW_SHOW_SPIN_PUSH` (707
|
|
|
1509
1511
|
|
|
1510
1512
|
Acknowledge multiple mini-game wins at once. Used after `playMiniGameBatch`.
|
|
1511
1513
|
|
|
1514
|
+
The batch acknowledge always finalises spins as **won** — `lose` is not supported here. To finalise a spin as lost, send a single [miniGameWinAcknowledge](#minigamewinacknowledge) (704) with `lose: true`.
|
|
1515
|
+
|
|
1512
1516
|
#### Request
|
|
1513
1517
|
|
|
1514
1518
|
**ClassId:** `714`
|
|
@@ -75,6 +75,28 @@ keyed on `saw_game_type`. For custom UIs, render the matching
|
|
|
75
75
|
component per game type — they share the same `playMiniGame`
|
|
76
76
|
trigger (except `PrizeDrop`, `MatchX`, `Quiz` as noted).
|
|
77
77
|
|
|
78
|
+
## Prize-field usage per game type
|
|
79
|
+
|
|
80
|
+
Several `prizes[]` fields only matter for specific renderers:
|
|
81
|
+
|
|
82
|
+
| Prize field | Used by | How |
|
|
83
|
+
|---|---|---|
|
|
84
|
+
| `sectors` | Spin-a-Wheel | Wheel sector indices the prize occupies — place the prize label/icon on those sectors. |
|
|
85
|
+
| `position` | Scratch Card | Sort prizes ascending by `position` to lay out the scratch grid. |
|
|
86
|
+
| `font_size` / `font_size_mobile` | Wheel, Scratch | Px size for the prize label on the game surface; mobile falls back to desktop. |
|
|
87
|
+
| `prize_modifiers` | Treasure Hunt, Voyager | Modifier tiles (2x…/10, 0, reset) applied to the running revealed total — presentation only; the award is still `prize_value`. |
|
|
88
|
+
| `allow_split_decimal` | Treasure Hunt, Voyager | Whether per-step revealed amounts may be fractional. |
|
|
89
|
+
| `requirements_to_get_prize` | Lootboxes | Text shown when the prize isn't yet available to the user. |
|
|
90
|
+
| `out_of_stock_message` | All (with stock) | Shown when the prize's pool is depleted. |
|
|
91
|
+
| `icon`, `name` | All | Prize strip, game surface, win modal. `name` arrives with the live jackpot value inlined. |
|
|
92
|
+
| `acknowledge_*`, `second_btn*`, `aknowledge_message(_lose)` | All | Win-modal contents — see [UI Guide — `playMiniGame`](UIGuide_playMiniGame.md) "Prize reveal modals". |
|
|
93
|
+
|
|
94
|
+
Template-side companions: `game_layout` picks the Lootbox grid
|
|
95
|
+
variant, `steps_to_finish_game` sizes step games, and
|
|
96
|
+
`expose_user_spin_id` asks the win view to display the player's
|
|
97
|
+
external user id (`'userId'`) or the spin's transaction id
|
|
98
|
+
(`'spinId'`) for transparency/audit.
|
|
99
|
+
|
|
78
100
|
## Action button decision matrix
|
|
79
101
|
|
|
80
102
|
CTA on the card / detail view (evaluate in priority order):
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# UI Guide — `miniGameWinAcknowledgeRequest`
|
|
2
|
+
|
|
3
|
+
Action-focused method — no list/card rendering of its own. It finalises
|
|
4
|
+
a spin played with `acknowledge: false`: as **won** (default) or as
|
|
5
|
+
**lost** (`{ lose: true }`). The UI patterns below cover the three
|
|
6
|
+
call sites: an explicit Claim CTA, a decline/forfeit outcome, and
|
|
7
|
+
history-row recovery.
|
|
8
|
+
|
|
9
|
+
## When the UI calls this
|
|
10
|
+
|
|
11
|
+
| Flow | Trigger | Call |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| Explicit claim | User taps "Claim" in the prize modal (`acknowledge_type === 'ExplicitAcknowledge'`) after `playMiniGame(id, { acknowledge: false })` | `miniGameWinAcknowledgeRequest(r.request_id)` |
|
|
14
|
+
| Decline / forfeit | Game outcome or user choice says the drawn prize is NOT won (skill games like Voyager, gamble/discard steps) | `miniGameWinAcknowledgeRequest(r.request_id, { lose: true })` |
|
|
15
|
+
| History recovery | User taps "Claim" on a `getMiniGamesHistory` row with `is_claimed === false` | `miniGameWinAcknowledgeRequest(row.client_request_id)` |
|
|
16
|
+
|
|
17
|
+
## Action button decision matrix
|
|
18
|
+
|
|
19
|
+
- **Win path (Claim CTA)**: enable the button as soon as the play
|
|
20
|
+
result is shown; disable it (with a spinner) while the request is
|
|
21
|
+
in flight; on resolve, show the prize's `aknowledge_message` modal
|
|
22
|
+
copy and refresh balance widgets (`getUserProfile`) and
|
|
23
|
+
`getMiniGames`.
|
|
24
|
+
- **Lose path**: no user-facing "lose the prize" button in most
|
|
25
|
+
designs — the game flow decides. The default Smartico UI sends
|
|
26
|
+
`lose: true` when the Voyager run fails (not all stars collected),
|
|
27
|
+
then shows the prize's `aknowledge_message_lose` copy (fall back to
|
|
28
|
+
a generic "Better luck next time" treatment when the operator
|
|
29
|
+
didn't configure it).
|
|
30
|
+
- **If you DO offer an explicit decline choice** (keep-or-gamble
|
|
31
|
+
UIs): render "Claim" and "Decline" side by side, disable both on
|
|
32
|
+
first tap, and treat the two calls as mutually exclusive — the
|
|
33
|
+
first one to reach the server wins; the other becomes a no-op.
|
|
34
|
+
- **History recovery rows**: see
|
|
35
|
+
[UI Guide — `getMiniGamesHistory`](UIGuide_getMiniGamesHistory.md)
|
|
36
|
+
for the row-level Claim CTA.
|
|
37
|
+
|
|
38
|
+
## Timing constraints (drive the UX)
|
|
39
|
+
|
|
40
|
+
- Standard prizes are auto-finalised as WON by a server-side fallback
|
|
41
|
+
after ~1–3 minutes. A decline/forfeit decision must therefore be
|
|
42
|
+
sent promptly after the spin — don't park the choice behind an
|
|
43
|
+
unbounded modal. After the fallback fires, `lose: true` is a no-op
|
|
44
|
+
and the prize stays credited.
|
|
45
|
+
- "Explicit claim" prizes are exempt from the fallback: the Claim CTA
|
|
46
|
+
can wait indefinitely, and an unclaimed prize is simply never
|
|
47
|
+
credited. Surface unclaimed spins via the history view.
|
|
48
|
+
|
|
49
|
+
## Idempotency guard
|
|
50
|
+
|
|
51
|
+
The call is idempotent server-side (no double credit), so a
|
|
52
|
+
double-tap is harmless — but still disable the button in flight to
|
|
53
|
+
avoid duplicate requests and modal flicker.
|
|
54
|
+
|
|
55
|
+
## Result handling
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
const r = await window._smartico.api.playMiniGame(game.id, { acknowledge: false });
|
|
59
|
+
if (r.err_code === 0) {
|
|
60
|
+
const prize = game.prizes.find(p => p.id === r.prize_id);
|
|
61
|
+
// ... run the game / show the Claim UI ...
|
|
62
|
+
|
|
63
|
+
if (playerWon) {
|
|
64
|
+
await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
65
|
+
console.log('[smartico] win finalised — show', prize?.aknowledge_message,
|
|
66
|
+
'and refresh getUserProfile / getMiniGames');
|
|
67
|
+
} else {
|
|
68
|
+
await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id, { lose: true });
|
|
69
|
+
console.log('[smartico] spin finalised as lost — show',
|
|
70
|
+
prize?.aknowledge_message_lose ?? 'a generic "Better luck next time" message');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Empty / loading / error states
|
|
76
|
+
|
|
77
|
+
- In flight: spinner on the CTA, inputs locked.
|
|
78
|
+
- On network failure: re-enable the CTA and let the user retry — the
|
|
79
|
+
operation is safe to repeat. For standard prizes the server-side
|
|
80
|
+
fallback will eventually deliver the win even if every retry fails
|
|
81
|
+
(a pending decline, however, is lost once the fallback fires).
|
|
82
|
+
- No dedicated error codes: a non-zero `err_code` is a generic server
|
|
83
|
+
error — show a generic error toast.
|
|
84
|
+
|
|
85
|
+
## Related guides
|
|
86
|
+
|
|
87
|
+
- [UI Guide — `playMiniGame`](UIGuide_playMiniGame.md) — prize reveal
|
|
88
|
+
modals, `acknowledge_type` matrix, decline/forfeit flow.
|
|
89
|
+
- [UI Guide — `getMiniGamesHistory`](UIGuide_getMiniGamesHistory.md) —
|
|
90
|
+
unclaimed-row recovery.
|
|
@@ -100,7 +100,10 @@ Modal contents per prize:
|
|
|
100
100
|
- Icon: `prize.icon` (1:1)
|
|
101
101
|
- Title: `prize.name`
|
|
102
102
|
- Message: `prize.aknowledge_message` (note the typo in the field
|
|
103
|
-
name — `aknowledge` not `acknowledge`)
|
|
103
|
+
name — `aknowledge` not `acknowledge`). When the spin is finalised
|
|
104
|
+
as lost (see "Decline / forfeit" below), show
|
|
105
|
+
`prize.aknowledge_message_lose` instead, falling back to a generic
|
|
106
|
+
"Better luck next time" when not configured.
|
|
104
107
|
- CTA: `prize.acknowledge_action_title` with action
|
|
105
108
|
`prize.acknowledge_dp` (pass through `_smartico.dp()` for safe
|
|
106
109
|
execution)
|
|
@@ -112,7 +115,9 @@ Modal contents per prize:
|
|
|
112
115
|
Some game mechanics let the player decline or forfeit the drawn
|
|
113
116
|
prize — a gamble/discard step, a "keep it or risk it" offer, or a
|
|
114
117
|
game where the player's final action decides whether the pre-drawn
|
|
115
|
-
prize is actually won
|
|
118
|
+
prize is actually won (the default Smartico UI does this for the
|
|
119
|
+
Voyager game: failing the star-collection run forfeits the drawn
|
|
120
|
+
prize). Implement these with manual finalisation:
|
|
116
121
|
|
|
117
122
|
1. Play with `acknowledge: false` so the SDK does not auto-finalise.
|
|
118
123
|
2. Run the game / choice UI.
|
|
@@ -122,7 +127,8 @@ prize is actually won. Implement these with manual finalisation:
|
|
|
122
127
|
- Decline / lose →
|
|
123
128
|
`miniGameWinAcknowledgeRequest(request_id, { lose: true })` —
|
|
124
129
|
prize NOT credited, returned to the prize pool for other
|
|
125
|
-
players. Show
|
|
130
|
+
players. Show `prize.aknowledge_message_lose` when configured,
|
|
131
|
+
else the same "Better luck next time" treatment as a
|
|
126
132
|
`no-prize` slot (below).
|
|
127
133
|
|
|
128
134
|
Timing: standard prizes are auto-finalised as WON by the
|
|
@@ -132,6 +138,9 @@ the prize stays credited. "Explicit claim" prizes are exempt from
|
|
|
132
138
|
the fallback, so those have no time pressure. Once a spin is
|
|
133
139
|
finalised either way, further acknowledge calls are no-ops.
|
|
134
140
|
|
|
141
|
+
Full CTA / retry / timing patterns: see
|
|
142
|
+
[UI Guide — `miniGameWinAcknowledgeRequest`](UIGuide_miniGameWinAcknowledgeRequest.md).
|
|
143
|
+
|
|
135
144
|
## "No prize" handling
|
|
136
145
|
|
|
137
146
|
When the won prize has `prize_type === 'no-prize'`, the user has
|
package/package.json
CHANGED
|
@@ -73,6 +73,7 @@ export const SAWTemplatesTransform = (items: SAWTemplate[]): TMiniGameTemplate[]
|
|
|
73
73
|
sectors: p.saw_prize_ui_definition.sectors,
|
|
74
74
|
acknowledge_type: SAWAcknowledgeTypeNamed(p.saw_prize_ui_definition.acknowledge_type),
|
|
75
75
|
aknowledge_message: p.saw_prize_ui_definition.aknowledge_message,
|
|
76
|
+
aknowledge_message_lose: p.saw_prize_ui_definition.aknowledge_message_lose,
|
|
76
77
|
acknowledge_dp: p.saw_prize_ui_definition.acknowledge_dp,
|
|
77
78
|
acknowledge_action_title: p.saw_prize_ui_definition.acknowledge_action_title,
|
|
78
79
|
acknowledge_dp_additional: p.saw_prize_ui_definition.acknowledge_dp_additional,
|
|
@@ -3,12 +3,19 @@ import { SAWPrizeType } from './SAWPrizeType';
|
|
|
3
3
|
import { SAWPrizeUI } from './SAWPrizeUI';
|
|
4
4
|
|
|
5
5
|
export interface SAWPrize {
|
|
6
|
+
/** ID of the prize */
|
|
6
7
|
saw_prize_id: number;
|
|
8
|
+
/** Visual definition of the prize (name, icon, win-modal buttons, per-game rendering hints) */
|
|
7
9
|
saw_prize_ui_definition: SAWPrizeUI;
|
|
10
|
+
/** Numeric value for 'points' / 'spin' prize types (e.g. 100 for "100 points"); not relevant for other types */
|
|
8
11
|
prize_value?: number;
|
|
12
|
+
/** The type of the prize — see {@link SAWPrizeType} */
|
|
9
13
|
prize_type_id: SAWPrizeType;
|
|
14
|
+
/** Competition games (MatchX / Quiz): first finishing place this prize applies to */
|
|
10
15
|
place_from?: number;
|
|
16
|
+
/** Competition games (MatchX / Quiz): last finishing place this prize applies to; equals `place_from` for a single-place prize */
|
|
11
17
|
place_to?: number;
|
|
18
|
+
/** Client-side only — unique id of a win instance generated by the default Smartico UI to dedupe render effects; never sent by the server */
|
|
12
19
|
sawUniqueWinId?: string;
|
|
13
20
|
/** Remaining stock. Present only when the template's `expose_game_stat_on_api` is enabled; always present for MatchX / Quiz games */
|
|
14
21
|
pool?: number;
|
|
@@ -28,6 +35,8 @@ export interface SAWPrize {
|
|
|
28
35
|
is_surcharge?: boolean;
|
|
29
36
|
/** Always `false` in API responses — deleted prizes are excluded server-side */
|
|
30
37
|
is_deleted?: boolean;
|
|
38
|
+
/** Type-specific prize details — e.g. `gems` / `_gems_diamonds_type` for gems-and-diamonds prizes, `tickets_count` for raffle-ticket prizes */
|
|
31
39
|
prize_details_json?: {[key: string]: any};
|
|
40
|
+
/** Period basis for the prize availability restriction — see {@link AttemptPeriodType} */
|
|
32
41
|
max_give_period_type_id?: AttemptPeriodType;
|
|
33
42
|
}
|
|
@@ -8,7 +8,8 @@ export interface SAWPrizeUI {
|
|
|
8
8
|
name_original?: string; // keeps original name, how it came from the servers. This is needed for the Jackpot value replacemenet
|
|
9
9
|
hide_prize_popup: boolean; // if true, prize popup on Prize Drop will not be shown
|
|
10
10
|
aknowledge_message?: string;
|
|
11
|
-
|
|
11
|
+
/** Message shown instead of `aknowledge_message` when the spin is finalised as lost (`lose: true` acknowledge — games with a client-decided outcome, e.g. Voyager) */
|
|
12
|
+
aknowledge_message_lose?: string;
|
|
12
13
|
sectors?: number[];
|
|
13
14
|
acknowledge_type?: SAWAcknowledgeType;
|
|
14
15
|
acknowledge_dp?: string;
|
|
@@ -4,31 +4,49 @@ import { SAWPrize } from './SAWPrize';
|
|
|
4
4
|
import { SAWTemplateUI } from './SAWTemplateUI';
|
|
5
5
|
|
|
6
6
|
export interface SAWTemplate {
|
|
7
|
+
/** ID of the mini-game template */
|
|
7
8
|
saw_template_id: number;
|
|
9
|
+
/** The type of the game — see {@link SAWGameType} */
|
|
8
10
|
saw_game_type_id: SAWGameType;
|
|
11
|
+
/** Full UI definition of the mini-game (name, description, skin, colors, per-game visual settings) */
|
|
9
12
|
saw_template_ui_definition: SAWTemplateUI;
|
|
10
13
|
|
|
14
|
+
/** How the user is charged per attempt — see {@link SAWBuyInType} */
|
|
11
15
|
saw_buyin_type_id: SAWBuyInType;
|
|
16
|
+
/** Cost per attempt in the buy-in currency (points, gems or diamonds per `saw_buyin_type_id`) */
|
|
12
17
|
buyin_cost_points?: number;
|
|
18
|
+
/** Operator hint: show the game only while the user can actually play it (has attempts / sufficient balance) */
|
|
13
19
|
visibile_when_can_spin: boolean;
|
|
14
20
|
|
|
15
|
-
|
|
21
|
+
/** Number of spin attempts the user currently has (initial value; later changes arrive as spin-count pushes) */
|
|
22
|
+
spin_count?: number;
|
|
16
23
|
|
|
24
|
+
/** Prizes configured for this game — see {@link SAWPrize} */
|
|
17
25
|
prizes: SAWPrize[];
|
|
18
26
|
|
|
27
|
+
/** Operator visibility flag for the template */
|
|
19
28
|
is_visible: boolean;
|
|
20
29
|
|
|
30
|
+
/** Time from which the template becomes available (epoch ms); absent when not restricted */
|
|
21
31
|
activeFromDate?: number;
|
|
32
|
+
/** Time until which the template stays available (epoch ms); absent when not restricted */
|
|
22
33
|
activeTillDate?: number;
|
|
23
34
|
|
|
35
|
+
/** Amount added to the jackpot on every play (abstract contribution — nothing is deducted from the player) */
|
|
24
36
|
jackpot_add_on_attempt: number;
|
|
37
|
+
/** Current jackpot accumulator value */
|
|
25
38
|
jackpot_current: number;
|
|
39
|
+
/** Seed value of the jackpot — the accumulator starts at (and resets to) this amount after a jackpot win */
|
|
26
40
|
jackpot_guaranteed: number;
|
|
27
41
|
|
|
42
|
+
/** Maximum number of unspent spin attempts a user can accumulate */
|
|
28
43
|
maxActiveSpinsAllowed: number;
|
|
44
|
+
/** Maximum number of attempts a user can make during `maxSpinsPediodMs` */
|
|
29
45
|
maxSpinsCount: number;
|
|
46
|
+
/** Length of the attempt-limit period in ms (note the field-name spelling) */
|
|
30
47
|
maxSpinsPediodMs: number;
|
|
31
48
|
|
|
49
|
+
/** Epoch-ms time when the next attempt becomes available; populated only when the operator enabled the "show time to the next available spin" setting and max attempts per period is 1 */
|
|
32
50
|
next_available_spin_ts?: number;
|
|
33
51
|
|
|
34
52
|
/** Soonest-expiring spin's expiration time for this user (epoch ms); `null`/absent when no expirable spins. */
|
|
@@ -36,7 +54,9 @@ export interface SAWTemplate {
|
|
|
36
54
|
/** Latest-expiring spin's expiration time for this user (epoch ms); `null`/absent when no expirable spins. */
|
|
37
55
|
latest_expiration_dt?: number | null;
|
|
38
56
|
|
|
57
|
+
/** Key of the visual skin the operator selected for the game */
|
|
39
58
|
saw_skin_key: string;
|
|
59
|
+
/** Skin assets of the game: `skin_folder` is the base URL for the skin's images, `skin_css` custom CSS overrides, plus optional popup/animation tweaks */
|
|
40
60
|
saw_skin_ui_definition: {
|
|
41
61
|
skin_folder: string;
|
|
42
62
|
skin_css: string;
|
|
@@ -47,9 +67,11 @@ export interface SAWTemplate {
|
|
|
47
67
|
/** 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). */
|
|
48
68
|
expose_game_stat_on_api?: boolean;
|
|
49
69
|
|
|
50
|
-
|
|
70
|
+
/** Prize Drop only: when true, the pushed prize requires an explicit claim by the user before it is credited */
|
|
51
71
|
requires_prize_claim?: boolean;
|
|
52
|
-
|
|
72
|
+
|
|
73
|
+
/** Timezone offset in minutes used to evaluate the template's period-based rules (UTC minus local, as in JS `Date.getTimezoneOffset()`) */
|
|
53
74
|
relative_period_timezone?: number;
|
|
54
|
-
|
|
75
|
+
/** Operator setting: show a prize-history entry point (icon / button) on this game's view */
|
|
76
|
+
show_prize_history?: boolean;
|
|
55
77
|
}
|
package/src/SmarticoAPI.ts
CHANGED
|
@@ -668,6 +668,11 @@ class SmarticoAPI {
|
|
|
668
668
|
'{{jackpot}}',
|
|
669
669
|
jackpotValue,
|
|
670
670
|
);
|
|
671
|
+
p.saw_prize_ui_definition.aknowledge_message_lose = IntUtils.replaceAll(
|
|
672
|
+
p.saw_prize_ui_definition.aknowledge_message_lose,
|
|
673
|
+
'{{jackpot}}',
|
|
674
|
+
jackpotValue,
|
|
675
|
+
);
|
|
671
676
|
});
|
|
672
677
|
}
|
|
673
678
|
});
|
|
@@ -502,7 +502,11 @@ export class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
502
502
|
* true` with no prize attached. Use this for game mechanics where the
|
|
503
503
|
* player can decline or forfeit the drawn prize — e.g. a
|
|
504
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
|
|
505
|
+
* action decides whether the pre-drawn prize is actually won (the
|
|
506
|
+
* default Smartico UI does this for the Voyager game: failing the
|
|
507
|
+
* star-collection run finalises the spin as lost). When configured,
|
|
508
|
+
* the prize's `aknowledge_message_lose` is the operator's result copy
|
|
509
|
+
* for this case — show it instead of `aknowledge_message`. It only
|
|
506
510
|
* works on a spin that is not yet finalised, so it requires playing
|
|
507
511
|
* with `acknowledge: false` and calling promptly — once the automatic
|
|
508
512
|
* acknowledge or the server-side fallback (below) has finalised the
|
|
@@ -532,6 +536,8 @@ export class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
532
536
|
* - Either way the spin's `is_claimed` flips to `true` on the next
|
|
533
537
|
* {@link getMiniGamesHistory} fetch.
|
|
534
538
|
*
|
|
539
|
+
* **UI guidance**: see [UI Guide — `miniGameWinAcknowledgeRequest`](../../docs/ui/minigames/UIGuide_miniGameWinAcknowledgeRequest.md).
|
|
540
|
+
*
|
|
535
541
|
* **Visitor mode**: not supported.
|
|
536
542
|
*
|
|
537
543
|
* @param request_id Correlation id of the spin to finalise: the
|