@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
|
@@ -400,7 +400,7 @@ Optional callback; not auto-invoked today.
|
|
|
400
400
|
#### Remarks
|
|
401
401
|
|
|
402
402
|
**Preconditions**
|
|
403
|
-
-
|
|
403
|
+
- No authentication required — works in both identified and visitor mode.
|
|
404
404
|
- `jp_template_id` is mandatory.
|
|
405
405
|
|
|
406
406
|
**`onUpdate` caveat**
|
|
@@ -418,7 +418,12 @@ Treat it as a no-op for now.
|
|
|
418
418
|
Non-zero `errCode` on control-group users or generic server errors.
|
|
419
419
|
Branch on `errCode === 0` and surface `errMsg` on failure.
|
|
420
420
|
|
|
421
|
-
**Visitor mode**:
|
|
421
|
+
**Visitor mode**: supported via
|
|
422
|
+
`_smartico.vapi(lang).getJackpotEligibleGames(...)`. The eligible-games
|
|
423
|
+
list is template-level (which games contribute to the pot) and carries no
|
|
424
|
+
per-user fields, so a visitor session receives the same list an identified
|
|
425
|
+
user would. The `lang` passed to `_smartico.vapi(lang)` drives the
|
|
426
|
+
translation of game names.
|
|
422
427
|
|
|
423
428
|
**UI guidance**: see [UI Guide — `getJackpotEligibleGames`](../_media/UIGuide_getJackpotEligibleGames.md).
|
|
424
429
|
|
|
@@ -434,6 +439,10 @@ if (jp?.ach_related_game_allow_all) {
|
|
|
434
439
|
|
|
435
440
|
const r = await window._smartico.api.getJackpotEligibleGames({ jp_template_id: 42 });
|
|
436
441
|
console.log('[smartico] render', r.eligible_games.length, 'eligible game tiles');
|
|
442
|
+
|
|
443
|
+
// Visitor mode — same shape, language driven by the vapi(lang) argument
|
|
444
|
+
const visitor = await window._smartico.vapi('EN').getJackpotEligibleGames({ jp_template_id: 42 });
|
|
445
|
+
console.log('[smartico] visitor eligible games:', visitor.eligible_games.length);
|
|
437
446
|
```
|
|
438
447
|
|
|
439
448
|
***
|
|
@@ -78,6 +78,27 @@ played via [playMiniGame](#playminigame); the exceptions are:
|
|
|
78
78
|
games server (not this SDK); the SAW spin is fired
|
|
79
79
|
server-internally to deduct the buy-in.
|
|
80
80
|
|
|
81
|
+
**Per-prize statistics (`expose_game_stat_on_api`)**
|
|
82
|
+
Each template's `prizes` array always carries the definition
|
|
83
|
+
fields — name, icon, `prize_type`, `prize_value`, acknowledge
|
|
84
|
+
configuration. The stock-statistics fields are gated by an
|
|
85
|
+
operator template setting, surfaced as
|
|
86
|
+
`expose_game_stat_on_api`:
|
|
87
|
+
- Populated when enabled: `pool` (remaining stock),
|
|
88
|
+
`wins_count` (total wins across all players), `weekdays`
|
|
89
|
+
(ISO 1–7 days the prize can be won), `active_from_ts` /
|
|
90
|
+
`active_till_ts` (prize availability window).
|
|
91
|
+
- Omitted when disabled (the default) — this keeps the live
|
|
92
|
+
prize economy (stock levels, win rates, schedules) hidden
|
|
93
|
+
from players.
|
|
94
|
+
- Exception: `pool` is always populated for `MatchX` / `Quiz`
|
|
95
|
+
templates, whose game flow needs the remaining stock.
|
|
96
|
+
- `pool_initial` is populated regardless of the setting.
|
|
97
|
+
When enabled, the values are also kept current — the server
|
|
98
|
+
refreshes the prize rows on each fetch and drops its template
|
|
99
|
+
caches after every play, so `pool` / `wins_count` are safe to
|
|
100
|
+
drive an "X prizes left" scarcity UI.
|
|
101
|
+
|
|
81
102
|
**Cache TTL**: the SDK caches the response for 30 seconds. Cache
|
|
82
103
|
is fully cleared on login / logout.
|
|
83
104
|
|
|
@@ -345,14 +366,19 @@ without waiting for the win to be marked delivered. You finalise
|
|
|
345
366
|
it later by calling [miniGameWinAcknowledgeRequest](#minigamewinacknowledgerequest) with the
|
|
346
367
|
`request_id` returned on this result.
|
|
347
368
|
|
|
348
|
-
What `acknowledge: false`
|
|
349
|
-
- For STANDARD prizes the value is credited
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
explicit acknowledge
|
|
369
|
+
What `acknowledge: false` defers:
|
|
370
|
+
- For STANDARD prizes the value is credited when the spin is
|
|
371
|
+
finalised — by your later acknowledge or, failing that, by the
|
|
372
|
+
server-side fallback below — so opting out delays the balance
|
|
373
|
+
change by at most that fallback window. The `is_claimed` flag in
|
|
374
|
+
[getMiniGamesHistory](#getminigameshistory) flips on the same finalisation.
|
|
375
|
+
- For operator-configured "explicit claim" prizes the credit is
|
|
376
|
+
deferred until your explicit acknowledge — the fallback does not
|
|
377
|
+
cover them.
|
|
378
|
+
|
|
379
|
+
While the spin is un-finalised it can also be finalised as LOST —
|
|
380
|
+
prize discarded back to the pool — via
|
|
381
|
+
[miniGameWinAcknowledgeRequest](#minigamewinacknowledgerequest) with `{ lose: true }`.
|
|
356
382
|
|
|
357
383
|
A server-side fallback auto-acknowledges ordinary un-acknowledged
|
|
358
384
|
spins after a short delay (about 1–3 minutes), so an ordinary
|
|
@@ -383,8 +409,10 @@ refreshed array.
|
|
|
383
409
|
time the call resolves. Balance updates flow via the
|
|
384
410
|
user-properties channel (observe via [getUserProfile](WSAPIUser.md#getuserprofile)).
|
|
385
411
|
- Prize value credited per the prize's type (see "Prize handling"
|
|
386
|
-
above)
|
|
387
|
-
|
|
412
|
+
above) when the spin is finalised — with the default
|
|
413
|
+
auto-acknowledge that happens before the call resolves;
|
|
414
|
+
"explicit claim" prizes are credited only by an explicit
|
|
415
|
+
acknowledge.
|
|
388
416
|
- The play is recorded server-side for analytics / reporting.
|
|
389
417
|
|
|
390
418
|
**UI guidance**: see [UI Guide — `playMiniGame`](../_media/UIGuide_playMiniGame.md).
|
|
@@ -432,18 +460,24 @@ if (r.err_code === 0) {
|
|
|
432
460
|
```
|
|
433
461
|
|
|
434
462
|
Manual finalisation (`acknowledge: false`) — e.g. an explicit
|
|
435
|
-
"Claim" CTA, or finalising on your own
|
|
463
|
+
"Claim" CTA, a decline/forfeit flow, or finalising on your own
|
|
464
|
+
schedule:
|
|
436
465
|
```ts
|
|
437
466
|
const r = await window._smartico.api.playMiniGame(game.id, { acknowledge: false });
|
|
438
467
|
if (r.err_code === 0) {
|
|
439
|
-
// Spin resolved but not yet
|
|
440
|
-
//
|
|
441
|
-
//
|
|
468
|
+
// Spin resolved but not yet finalised — the prize is not credited
|
|
469
|
+
// yet. Your acknowledge below credits it (for standard prizes the
|
|
470
|
+
// server-side fallback would eventually do the same).
|
|
442
471
|
console.log('[smartico] prize won — show the result / Claim CTA, then finalise');
|
|
443
472
|
|
|
444
473
|
// On the user's Claim click, finalise with the request_id from the result.
|
|
445
474
|
await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
446
475
|
console.log('[smartico] win finalised — refresh getUserProfile / getMiniGames to reflect it');
|
|
476
|
+
|
|
477
|
+
// Or, if the game flow ends in the player declining / losing the
|
|
478
|
+
// drawn prize, finalise the spin as lost instead — the prize is
|
|
479
|
+
// not credited and returns to the prize pool:
|
|
480
|
+
// await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id, { lose: true });
|
|
447
481
|
}
|
|
448
482
|
```
|
|
449
483
|
|
|
@@ -451,12 +485,13 @@ if (r.err_code === 0) {
|
|
|
451
485
|
|
|
452
486
|
### miniGameWinAcknowledgeRequest()
|
|
453
487
|
|
|
454
|
-
> **miniGameWinAcknowledgeRequest**(`request_id`): `Promise`\<[`SAWDoAknowledgeResponse`](../interfaces/SAWDoAknowledgeResponse.md)\>
|
|
488
|
+
> **miniGameWinAcknowledgeRequest**(`request_id`, `__namedParameters?`): `Promise`\<[`SAWDoAknowledgeResponse`](../interfaces/SAWDoAknowledgeResponse.md)\>
|
|
455
489
|
|
|
456
490
|
Manually acknowledges a mini-game spin — marks the win delivered
|
|
457
|
-
server-side
|
|
458
|
-
|
|
459
|
-
[
|
|
491
|
+
server-side, or (with `lose: true`) finalises it as lost and
|
|
492
|
+
returns the prize to the pool. Most consumers do NOT need this:
|
|
493
|
+
[playMiniGame](#playminigame) acknowledges by default (`acknowledge: true`)
|
|
494
|
+
and [playMiniGameBatch](#playminigamebatch) acknowledges automatically. Call this
|
|
460
495
|
directly only when you took ownership of the acknowledge step or
|
|
461
496
|
need to recover a lost one.
|
|
462
497
|
|
|
@@ -472,6 +507,12 @@ Correlation id of the spin to finalise: the
|
|
|
472
507
|
`client_request_id` of a
|
|
473
508
|
[getMiniGamesHistory](#getminigameshistory) row.
|
|
474
509
|
|
|
510
|
+
##### \_\_namedParameters?
|
|
511
|
+
|
|
512
|
+
###### lose?
|
|
513
|
+
|
|
514
|
+
`boolean`
|
|
515
|
+
|
|
475
516
|
#### Returns
|
|
476
517
|
|
|
477
518
|
`Promise`\<[`SAWDoAknowledgeResponse`](../interfaces/SAWDoAknowledgeResponse.md)\>
|
|
@@ -496,6 +537,23 @@ The `request_id` on a [playMiniGame](#playminigame) result and the
|
|
|
496
537
|
`client_request_id` on a [getMiniGamesHistory](#getminigameshistory) row are the
|
|
497
538
|
same correlation id — this method accepts either.
|
|
498
539
|
|
|
540
|
+
**Finalising as lost (`lose: true`)**
|
|
541
|
+
Pass `{ lose: true }` to finalise the spin as LOST instead of won:
|
|
542
|
+
the prize is NOT credited and is returned to the game's prize pool
|
|
543
|
+
(available again for other players), and the spin fires the
|
|
544
|
+
mini-game "lose" engagement event instead of the win one. On the
|
|
545
|
+
next [getMiniGamesHistory](#getminigameshistory) fetch the row shows `is_claimed:
|
|
546
|
+
true` with no prize attached. Use this for game mechanics where the
|
|
547
|
+
player can decline or forfeit the drawn prize — e.g. a
|
|
548
|
+
gamble/discard step, or a client-driven game where the user's final
|
|
549
|
+
action decides whether the pre-drawn prize is actually won. It only
|
|
550
|
+
works on a spin that is not yet finalised, so it requires playing
|
|
551
|
+
with `acknowledge: false` and calling promptly — once the automatic
|
|
552
|
+
acknowledge or the server-side fallback (below) has finalised the
|
|
553
|
+
spin, `lose: true` is a no-op and the prize stays credited.
|
|
554
|
+
("Explicit claim" prizes are exempt from the fallback, so for them
|
|
555
|
+
there is no time pressure.)
|
|
556
|
+
|
|
499
557
|
**Idempotency**: safe. Acknowledging a spin that is already
|
|
500
558
|
finalised — by you, by the automatic acknowledge, or by the
|
|
501
559
|
fallback — is a no-op with no double credit. Acknowledging a
|
|
@@ -510,11 +568,12 @@ exception — excluded from the fallback, they require an explicit
|
|
|
510
568
|
call here.
|
|
511
569
|
|
|
512
570
|
**Side effects** (first successful call for an un-acknowledged spin)
|
|
513
|
-
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
571
|
+
- Default (win): the prize value is credited on this call — this is
|
|
572
|
+
the finalisation step that credits standard and "explicit claim"
|
|
573
|
+
prizes alike (see [playMiniGame](#playminigame) "Prize handling").
|
|
574
|
+
- With `lose: true`: no credit; the prize returns to the prize pool
|
|
575
|
+
and the "lose" engagement event fires.
|
|
576
|
+
- Either way the spin's `is_claimed` flips to `true` on the next
|
|
518
577
|
[getMiniGamesHistory](#getminigameshistory) fetch.
|
|
519
578
|
|
|
520
579
|
**Visitor mode**: not supported.
|
|
@@ -529,6 +588,10 @@ if (r.err_code === 0) {
|
|
|
529
588
|
await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
530
589
|
}
|
|
531
590
|
|
|
591
|
+
// Decline / forfeit — finalise the same spin as lost instead:
|
|
592
|
+
// the prize is not credited and goes back to the prize pool.
|
|
593
|
+
await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id, { lose: true });
|
|
594
|
+
|
|
532
595
|
// Recovery — re-acknowledge any spins a batch acknowledge missed.
|
|
533
596
|
const history = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
|
|
534
597
|
for (const row of history.filter(h => !h.is_claimed)) {
|
|
@@ -48,54 +48,72 @@
|
|
|
48
48
|
|
|
49
49
|
> `optional` **pool?**: `number`
|
|
50
50
|
|
|
51
|
+
Remaining stock. Present only when the template's `expose_game_stat_on_api` is enabled; always present for MatchX / Quiz games
|
|
52
|
+
|
|
51
53
|
***
|
|
52
54
|
|
|
53
55
|
### pool\_initial?
|
|
54
56
|
|
|
55
57
|
> `optional` **pool\_initial?**: `number`
|
|
56
58
|
|
|
59
|
+
Initial (configured) stock. Present regardless of `expose_game_stat_on_api`
|
|
60
|
+
|
|
57
61
|
***
|
|
58
62
|
|
|
59
63
|
### wins\_count?
|
|
60
64
|
|
|
61
65
|
> `optional` **wins\_count?**: `number`
|
|
62
66
|
|
|
67
|
+
Times the prize has been won, across all players. Present only when `expose_game_stat_on_api` is enabled
|
|
68
|
+
|
|
63
69
|
***
|
|
64
70
|
|
|
65
71
|
### weekdays?
|
|
66
72
|
|
|
67
73
|
> `optional` **weekdays?**: `number`[]
|
|
68
74
|
|
|
75
|
+
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
|
|
76
|
+
|
|
69
77
|
***
|
|
70
78
|
|
|
71
79
|
### active\_from\_ts?
|
|
72
80
|
|
|
73
81
|
> `optional` **active\_from\_ts?**: `number`
|
|
74
82
|
|
|
83
|
+
Prize availability window start (epoch ms), evaluated against `relative_period_timezone`. Present only when `expose_game_stat_on_api` is enabled
|
|
84
|
+
|
|
75
85
|
***
|
|
76
86
|
|
|
77
87
|
### active\_till\_ts?
|
|
78
88
|
|
|
79
89
|
> `optional` **active\_till\_ts?**: `number`
|
|
80
90
|
|
|
91
|
+
Prize availability window end (epoch ms), evaluated against `relative_period_timezone`. Present only when `expose_game_stat_on_api` is enabled
|
|
92
|
+
|
|
81
93
|
***
|
|
82
94
|
|
|
83
95
|
### relative\_period\_timezone?
|
|
84
96
|
|
|
85
97
|
> `optional` **relative\_period\_timezone?**: `number`
|
|
86
98
|
|
|
99
|
+
Timezone offset in minutes for `weekdays` / active-window evaluation (UTC minus local, as in JS `Date.getTimezoneOffset()`)
|
|
100
|
+
|
|
87
101
|
***
|
|
88
102
|
|
|
89
103
|
### is\_surcharge?
|
|
90
104
|
|
|
91
105
|
> `optional` **is\_surcharge?**: `boolean`
|
|
92
106
|
|
|
107
|
+
When true, the prize stays winnable at `pool` 0 (unlimited stock)
|
|
108
|
+
|
|
93
109
|
***
|
|
94
110
|
|
|
95
111
|
### is\_deleted?
|
|
96
112
|
|
|
97
113
|
> `optional` **is\_deleted?**: `boolean`
|
|
98
114
|
|
|
115
|
+
Always `false` in API responses — deleted prizes are excluded server-side
|
|
116
|
+
|
|
99
117
|
***
|
|
100
118
|
|
|
101
119
|
### prize\_details\_json?
|
|
@@ -158,6 +158,8 @@ Latest-expiring spin's expiration time for this user (epoch ms); `null`/absent w
|
|
|
158
158
|
|
|
159
159
|
> `optional` **expose\_game\_stat\_on\_api?**: `boolean`
|
|
160
160
|
|
|
161
|
+
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).
|
|
162
|
+
|
|
161
163
|
***
|
|
162
164
|
|
|
163
165
|
### requires\_prize\_claim?
|
|
@@ -125,6 +125,22 @@ The name of the action button in modal pop-up (additional)
|
|
|
125
125
|
|
|
126
126
|
***
|
|
127
127
|
|
|
128
|
+
### second\_btn?
|
|
129
|
+
|
|
130
|
+
> `optional` **second\_btn?**: `string`
|
|
131
|
+
|
|
132
|
+
Deep link that will trigger some action in modal pop-up (second button)
|
|
133
|
+
|
|
134
|
+
***
|
|
135
|
+
|
|
136
|
+
### second\_btn\_action\_title?
|
|
137
|
+
|
|
138
|
+
> `optional` **second\_btn\_action\_title?**: `string`
|
|
139
|
+
|
|
140
|
+
The name of the action button in modal pop-up (second button)
|
|
141
|
+
|
|
142
|
+
***
|
|
143
|
+
|
|
128
144
|
### out\_of\_stock\_message?
|
|
129
145
|
|
|
130
146
|
> `optional` **out\_of\_stock\_message?**: `string`
|
|
@@ -137,7 +153,7 @@ Message when the prize pool is empty for that specific prize
|
|
|
137
153
|
|
|
138
154
|
> `optional` **pool?**: `number`
|
|
139
155
|
|
|
140
|
-
|
|
156
|
+
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
|
|
141
157
|
|
|
142
158
|
***
|
|
143
159
|
|
|
@@ -145,7 +161,7 @@ Number of items in stock
|
|
|
145
161
|
|
|
146
162
|
> `optional` **pool\_initial?**: `number`
|
|
147
163
|
|
|
148
|
-
Initial
|
|
164
|
+
Initial (configured) stock of the prize. Populated regardless of `expose_game_stat_on_api`
|
|
149
165
|
|
|
150
166
|
***
|
|
151
167
|
|
|
@@ -153,7 +169,7 @@ Initial number of items in stock
|
|
|
153
169
|
|
|
154
170
|
> `optional` **wins\_count?**: `number`
|
|
155
171
|
|
|
156
|
-
Number of
|
|
172
|
+
Number of times the prize has been won, across all players. Populated only when the template's `expose_game_stat_on_api` is enabled
|
|
157
173
|
|
|
158
174
|
***
|
|
159
175
|
|
|
@@ -161,7 +177,7 @@ Number of wins in game
|
|
|
161
177
|
|
|
162
178
|
> `optional` **weekdays?**: `number`[]
|
|
163
179
|
|
|
164
|
-
|
|
180
|
+
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
|
|
165
181
|
|
|
166
182
|
***
|
|
167
183
|
|
|
@@ -169,7 +185,7 @@ Number of days of week, when the prize can be available
|
|
|
169
185
|
|
|
170
186
|
> `optional` **active\_from\_ts?**: `number`
|
|
171
187
|
|
|
172
|
-
|
|
188
|
+
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
|
|
173
189
|
|
|
174
190
|
***
|
|
175
191
|
|
|
@@ -177,7 +193,7 @@ Holds time from which prize will become available, for the prizes that are targe
|
|
|
177
193
|
|
|
178
194
|
> `optional` **active\_till\_ts?**: `number`
|
|
179
195
|
|
|
180
|
-
|
|
196
|
+
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
|
|
181
197
|
|
|
182
198
|
***
|
|
183
199
|
|
|
@@ -185,7 +201,7 @@ Holds time till which prize will become available, for the prizes that are targe
|
|
|
185
201
|
|
|
186
202
|
> `optional` **relative\_period\_timezone?**: `number`
|
|
187
203
|
|
|
188
|
-
|
|
204
|
+
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)
|
|
189
205
|
|
|
190
206
|
***
|
|
191
207
|
|
|
@@ -193,7 +209,7 @@ Time zone to ensure each day aligns with your local midnight.
|
|
|
193
209
|
|
|
194
210
|
> `optional` **is\_surcharge?**: `boolean`
|
|
195
211
|
|
|
196
|
-
|
|
212
|
+
When true, the prize stays winnable even when its `pool` reaches 0 (effectively unlimited stock)
|
|
197
213
|
|
|
198
214
|
***
|
|
199
215
|
|
|
@@ -201,7 +217,7 @@ Flag indicating that the prize is surcharged (available all the time, despite po
|
|
|
201
217
|
|
|
202
218
|
> `optional` **is\_deleted?**: `boolean`
|
|
203
219
|
|
|
204
|
-
|
|
220
|
+
Always `false` in API responses — deleted prizes are excluded server-side
|
|
205
221
|
|
|
206
222
|
***
|
|
207
223
|
|
|
@@ -200,7 +200,7 @@ List of prizes for mini-games
|
|
|
200
200
|
|
|
201
201
|
> `optional` **expose\_game\_stat\_on\_api?**: `boolean`
|
|
202
202
|
|
|
203
|
-
When enabled, the
|
|
203
|
+
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"
|
|
204
204
|
|
|
205
205
|
***
|
|
206
206
|
|
|
@@ -240,7 +240,7 @@ The amount of steps to complete the game and gather the prize
|
|
|
240
240
|
|
|
241
241
|
> `optional` **custom\_section\_id?**: `number`
|
|
242
242
|
|
|
243
|
-
|
|
243
|
+
ID of the operator-defined custom section (widget menu grouping) the mini-game is assigned to
|
|
244
244
|
|
|
245
245
|
***
|
|
246
246
|
|
|
@@ -288,4 +288,4 @@ The period of time in milliseconds during which the user can do the maximum numb
|
|
|
288
288
|
|
|
289
289
|
> `optional` **expose\_user\_spin\_id?**: [`SAWExposeUserSpinIdName`](../enumerations/SAWExposeUserSpinIdName.md)
|
|
290
290
|
|
|
291
|
-
|
|
291
|
+
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
|
|
@@ -33,7 +33,7 @@ _None._
|
|
|
33
33
|
|
|
34
34
|
## Behavioral contract
|
|
35
35
|
**Preconditions**
|
|
36
|
-
-
|
|
36
|
+
- No authentication required — works in both identified and visitor mode.
|
|
37
37
|
- `jp_template_id` is mandatory.
|
|
38
38
|
|
|
39
39
|
**`onUpdate` caveat**
|
|
@@ -51,7 +51,12 @@ Treat it as a no-op for now.
|
|
|
51
51
|
Non-zero `errCode` on control-group users or generic server errors.
|
|
52
52
|
Branch on `errCode === 0` and surface `errMsg` on failure.
|
|
53
53
|
|
|
54
|
-
**Visitor mode**:
|
|
54
|
+
**Visitor mode**: supported via
|
|
55
|
+
`_smartico.vapi(lang).getJackpotEligibleGames(...)`. The eligible-games
|
|
56
|
+
list is template-level (which games contribute to the pot) and carries no
|
|
57
|
+
per-user fields, so a visitor session receives the same list an identified
|
|
58
|
+
user would. The `lang` passed to `_smartico.vapi(lang)` drives the
|
|
59
|
+
translation of game names.
|
|
55
60
|
|
|
56
61
|
**UI guidance**: see [UI Guide — `getJackpotEligibleGames`](../../docs/ui/jackpots/UIGuide_getJackpotEligibleGames.md).
|
|
57
62
|
|
|
@@ -66,6 +71,10 @@ if (jp?.ach_related_game_allow_all) {
|
|
|
66
71
|
|
|
67
72
|
const r = await window._smartico.api.getJackpotEligibleGames({ jp_template_id: 42 });
|
|
68
73
|
console.log('[smartico] render', r.eligible_games.length, 'eligible game tiles');
|
|
74
|
+
|
|
75
|
+
// Visitor mode — same shape, language driven by the vapi(lang) argument
|
|
76
|
+
const visitor = await window._smartico.vapi('EN').getJackpotEligibleGames({ jp_template_id: 42 });
|
|
77
|
+
console.log('[smartico] visitor eligible games:', visitor.eligible_games.length);
|
|
69
78
|
```
|
|
70
79
|
|
|
71
80
|
### Example response (REAL shape)
|
|
@@ -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)) {
|