@smartico/public-api 0.0.432 → 0.0.434
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/Inbox/InboxMessage.d.ts +1 -1
- package/dist/Jackpots/GetJackpotWinnersResponse.d.ts +28 -0
- package/dist/MiniGames/SAWTemplateUI.d.ts +26 -0
- package/dist/SmarticoAPI.d.ts +2 -1
- package/dist/SmarticoGlobal.d.ts +18 -0
- package/dist/WSAPI/WSAPIInbox.d.ts +16 -0
- package/dist/WSAPI/WSAPIJackpots.d.ts +76 -0
- package/dist/WSAPI/WSAPITypes.d.ts +6 -0
- package/dist/index.js +408 -279
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +112 -2
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/README.md +3 -0
- package/docs/api/classes/WSAPIJackpots.md +100 -0
- package/docs/api/interfaces/GetJackpotWinnersResponse.md +8 -0
- package/docs/api/interfaces/JackpotWin.md +25 -0
- package/docs/api/interfaces/JackpotWinStats.md +25 -0
- package/docs/api/interfaces/TGetJackpotWinStatsResponse.md +17 -0
- package/docs/capabilities/getJackpotWinStats.md +111 -0
- package/docs/ui/inbox/UIGuide_getInboxMessageBody.md +24 -2
- package/package.json +1 -1
- package/src/Inbox/InboxMessage.ts +3 -1
- package/src/Jackpots/GetJackpotWinnersResponse.ts +41 -0
- package/src/MiniGames/SAWTemplateUI.ts +29 -0
- package/src/SmarticoAPI.ts +11 -1
- package/src/SmarticoGlobal.ts +18 -0
- package/src/WSAPI/WSAPIInbox.ts +16 -0
- package/src/WSAPI/WSAPIJackpots.ts +89 -0
- package/src/WSAPI/WSAPITypes.ts +6 -0
package/docs/api/README.md
CHANGED
|
@@ -123,6 +123,9 @@
|
|
|
123
123
|
- [GetJackpotWinnersRequest](interfaces/GetJackpotWinnersRequest.md)
|
|
124
124
|
- [GetJackpotWinnersResponse](interfaces/GetJackpotWinnersResponse.md)
|
|
125
125
|
- [JackpotWinnerHistory](interfaces/JackpotWinnerHistory.md)
|
|
126
|
+
- [JackpotWinStats](interfaces/JackpotWinStats.md)
|
|
127
|
+
- [JackpotWin](interfaces/JackpotWin.md)
|
|
128
|
+
- [TGetJackpotWinStatsResponse](interfaces/TGetJackpotWinStatsResponse.md)
|
|
126
129
|
- [GetJackpotsPotsRequest](interfaces/GetJackpotsPotsRequest.md)
|
|
127
130
|
- [GetJackpotsPotsResponse](interfaces/GetJackpotsPotsResponse.md)
|
|
128
131
|
- [GetJackpotsRequest](interfaces/GetJackpotsRequest.md)
|
|
@@ -364,6 +364,106 @@ console.log('[smartico] render', winners.length, 'recent winner rows (amounts in
|
|
|
364
364
|
|
|
365
365
|
***
|
|
366
366
|
|
|
367
|
+
### getJackpotWinStats()
|
|
368
|
+
|
|
369
|
+
> **getJackpotWinStats**(`__namedParameters`): `Promise`\<[`TGetJackpotWinStatsResponse`](../interfaces/TGetJackpotWinStatsResponse.md)\>
|
|
370
|
+
|
|
371
|
+
Returns past winners of a specific jackpot template, paginated, together
|
|
372
|
+
with the win statistics of that template: total number of wins, the
|
|
373
|
+
biggest win and the most recent win. Use it for a jackpot info modal /
|
|
374
|
+
tooltip that shows "Total wins", "Highest win" and "Latest win" next to
|
|
375
|
+
the winners list.
|
|
376
|
+
|
|
377
|
+
#### Parameters
|
|
378
|
+
|
|
379
|
+
##### \_\_namedParameters
|
|
380
|
+
|
|
381
|
+
###### limit?
|
|
382
|
+
|
|
383
|
+
`number`
|
|
384
|
+
|
|
385
|
+
Page size of the winners list (default 20).
|
|
386
|
+
|
|
387
|
+
###### offset?
|
|
388
|
+
|
|
389
|
+
`number`
|
|
390
|
+
|
|
391
|
+
Pagination offset of the winners list (default 0).
|
|
392
|
+
|
|
393
|
+
###### jp_template_id?
|
|
394
|
+
|
|
395
|
+
`number`
|
|
396
|
+
|
|
397
|
+
Jackpot template ID (required).
|
|
398
|
+
|
|
399
|
+
#### Returns
|
|
400
|
+
|
|
401
|
+
`Promise`\<[`TGetJackpotWinStatsResponse`](../interfaces/TGetJackpotWinStatsResponse.md)\>
|
|
402
|
+
|
|
403
|
+
[TGetJackpotWinStatsResponse](../interfaces/TGetJackpotWinStatsResponse.md) —
|
|
404
|
+
`{ winners: JackpotWinnerHistory[], win_stats: JackpotWinStats }`.
|
|
405
|
+
|
|
406
|
+
#### Remarks
|
|
407
|
+
|
|
408
|
+
**Preconditions**
|
|
409
|
+
- User must be authenticated. Visitor mode not supported.
|
|
410
|
+
- `jp_template_id` is mandatory.
|
|
411
|
+
- The consumer SHOULD check
|
|
412
|
+
`JackpotDetails.expose_winners_over_api` before calling, since
|
|
413
|
+
the server does not enforce it.
|
|
414
|
+
|
|
415
|
+
**Statistics**
|
|
416
|
+
- `win_stats` describes the whole jackpot template and does not depend
|
|
417
|
+
on `limit` / `offset`. Pass `limit: 1` when only the statistics are needed.
|
|
418
|
+
- Only issued wins are counted — a pot that exploded but still waits for
|
|
419
|
+
manual approval is not included.
|
|
420
|
+
- `highest_win` / `last_win` are `null` while the jackpot has no wins,
|
|
421
|
+
`total_wins` is `0` in that case.
|
|
422
|
+
- `public_username` of `highest_win` / `last_win` is masked by the same
|
|
423
|
+
label setting as the winners list, and is `null` when the template
|
|
424
|
+
doesn't expose winners over API.
|
|
425
|
+
- The server refreshes the statistics once per minute.
|
|
426
|
+
|
|
427
|
+
**Currency caveat**
|
|
428
|
+
All amounts (`win_stats.*.winning_amount`,
|
|
429
|
+
`winners[].winner.winning_amount_jp_currency`) are in the jackpot's
|
|
430
|
+
NATIVE currency, NOT the user's wallet currency.
|
|
431
|
+
|
|
432
|
+
**Refresh**
|
|
433
|
+
- The SDK caches each page separately (per `jp_template_id` +
|
|
434
|
+
`limit` + `offset`) for 30 seconds.
|
|
435
|
+
- Caches clear on jackpot-win push events and on opt-in / opt-out.
|
|
436
|
+
|
|
437
|
+
**Error handling**
|
|
438
|
+
Non-zero `errCode` on control-group users or generic server errors. The
|
|
439
|
+
SDK does NOT enumerate distinct codes — branch on `errCode === 0` and
|
|
440
|
+
surface `errMsg` on failure.
|
|
441
|
+
|
|
442
|
+
**Visitor mode**: not supported.
|
|
443
|
+
|
|
444
|
+
#### Example
|
|
445
|
+
|
|
446
|
+
```ts
|
|
447
|
+
const [jp] = await window._smartico.api.jackpotGet({ jp_template_id: 42 });
|
|
448
|
+
|
|
449
|
+
if (!jp || !jp.expose_winners_over_api) {
|
|
450
|
+
console.log('[smartico] winners hidden by operator config — hide the stats');
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
const { winners, win_stats } = await window._smartico.api.getJackpotWinStats({
|
|
455
|
+
jp_template_id: 42,
|
|
456
|
+
limit: 10,
|
|
457
|
+
offset: 0,
|
|
458
|
+
});
|
|
459
|
+
console.log('[smartico] total wins', win_stats.total_wins);
|
|
460
|
+
console.log('[smartico] highest win', win_stats.highest_win?.winning_amount, jp.jp_currency);
|
|
461
|
+
console.log('[smartico] latest win', win_stats.last_win?.public_username, win_stats.last_win?.win_date_ts);
|
|
462
|
+
console.log('[smartico] render', winners.length, 'recent winner rows');
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
***
|
|
466
|
+
|
|
367
467
|
### getJackpotEligibleGames()
|
|
368
468
|
|
|
369
469
|
> **getJackpotEligibleGames**(`__namedParameters`): `Promise`\<[`TGetJackpotEligibleGamesResponse`](../interfaces/TGetJackpotEligibleGamesResponse.md)\>
|
|
@@ -69,3 +69,11 @@ The list of jackpot winners
|
|
|
69
69
|
> **has\_more**: `boolean`
|
|
70
70
|
|
|
71
71
|
Whether there are more winners to fetch
|
|
72
|
+
|
|
73
|
+
***
|
|
74
|
+
|
|
75
|
+
### win\_stats?
|
|
76
|
+
|
|
77
|
+
> `optional` **win\_stats?**: [`JackpotWinStats`](JackpotWinStats.md)
|
|
78
|
+
|
|
79
|
+
Win statistics of the jackpot template
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Interface: JackpotWin
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
### winning\_amount
|
|
6
|
+
|
|
7
|
+
> **winning\_amount**: `number`
|
|
8
|
+
|
|
9
|
+
Won amount in the Jackpot currency
|
|
10
|
+
|
|
11
|
+
***
|
|
12
|
+
|
|
13
|
+
### win\_date\_ts
|
|
14
|
+
|
|
15
|
+
> **win\_date\_ts**: `number`
|
|
16
|
+
|
|
17
|
+
Date of winning in milliseconds
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### public\_username
|
|
22
|
+
|
|
23
|
+
> **public\_username**: `string`
|
|
24
|
+
|
|
25
|
+
Name of the winner, masked by default. `null` when the jackpot template doesn't expose winners over API
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Interface: JackpotWinStats
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
### total\_wins
|
|
6
|
+
|
|
7
|
+
> **total\_wins**: `number`
|
|
8
|
+
|
|
9
|
+
Total number of issued wins of the jackpot template. Wins waiting for manual approval are not counted
|
|
10
|
+
|
|
11
|
+
***
|
|
12
|
+
|
|
13
|
+
### highest\_win
|
|
14
|
+
|
|
15
|
+
> **highest\_win**: [`JackpotWin`](JackpotWin.md)
|
|
16
|
+
|
|
17
|
+
The biggest win of the jackpot template, `null` when there are no wins yet
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### last\_win
|
|
22
|
+
|
|
23
|
+
> **last\_win**: [`JackpotWin`](JackpotWin.md)
|
|
24
|
+
|
|
25
|
+
The most recent win of the jackpot template, `null` when there are no wins yet
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Interface: TGetJackpotWinStatsResponse
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
### winners
|
|
6
|
+
|
|
7
|
+
> **winners**: [`JackpotWinnerHistory`](JackpotWinnerHistory.md)[]
|
|
8
|
+
|
|
9
|
+
The list of jackpot winners
|
|
10
|
+
|
|
11
|
+
***
|
|
12
|
+
|
|
13
|
+
### win\_stats
|
|
14
|
+
|
|
15
|
+
> **win\_stats**: [`JackpotWinStats`](JackpotWinStats.md)
|
|
16
|
+
|
|
17
|
+
Win statistics of the jackpot template
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# getJackpotWinStats — API (TGetJackpotWinStatsResponse)
|
|
2
|
+
|
|
3
|
+
> Returns past winners of a specific jackpot template, paginated, together with the win statistics of that template: total number of wins, the biggest win and the most recent win.
|
|
4
|
+
> Import: `import { TGetJackpotWinStatsResponse } from '@smartico/public-api'`
|
|
5
|
+
> Search terms: getJackpotWinStats, jackpots, TGetJackpotWinStatsResponse, JackpotWinnerHistory, JackPotWinner, JackpotWinStats, JackpotWin
|
|
6
|
+
|
|
7
|
+
## Signature
|
|
8
|
+
```ts
|
|
9
|
+
_smartico.api.getJackpotWinStats({
|
|
10
|
+
limit,
|
|
11
|
+
offset,
|
|
12
|
+
jp_template_id,
|
|
13
|
+
}: {
|
|
14
|
+
/** Page size of the winners list (default 20). */
|
|
15
|
+
limit?: number;
|
|
16
|
+
/** Pagination offset of the winners list (default 0). */
|
|
17
|
+
offset?: number;
|
|
18
|
+
/** Jackpot template ID (required). */
|
|
19
|
+
jp_template_id?: number;
|
|
20
|
+
}): Promise<TGetJackpotWinStatsResponse>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Parameters
|
|
24
|
+
_None._
|
|
25
|
+
|
|
26
|
+
## Returns — `Promise<TGetJackpotWinStatsResponse>`
|
|
27
|
+
`TGetJackpotWinStatsResponse`:
|
|
28
|
+
- `winners` (JackpotWinnerHistory[]) — The list of jackpot winners
|
|
29
|
+
- `jp_pot_id` (number) — Id of the jackpot pot
|
|
30
|
+
- `win_date_ts` (number) — Date of winning in milliseconds
|
|
31
|
+
- `winner` (JackPotWinner) — Info about jackpot winner
|
|
32
|
+
- `is_me` (boolean) — Flag indicating that this winner is the currently logged in user
|
|
33
|
+
- `public_username` (string) — Name of the winner, note that for all users except is_me, the name is masked by default, but masking can be disabled by request to Smartico AM team
|
|
34
|
+
- `winning_amount_jp_currency` (number) — Won amount in the Jackpot currency
|
|
35
|
+
- `winning_amount_wallet_currency` (number) — Won amount in the user Wallet currency
|
|
36
|
+
- `winning_position` (number) — Position of the winner. Relevant for jackpots where there could be multiple winners
|
|
37
|
+
- `avatar_id` (string) — Avatar image URL of the winner
|
|
38
|
+
- `avatar_real_id` (number | null) — Numeric ID of the winner's avatar; `null` when the winner has not picked one
|
|
39
|
+
- `win_stats` (JackpotWinStats) — Win statistics of the jackpot template
|
|
40
|
+
- `total_wins` (number) — Total number of issued wins of the jackpot template. Wins waiting for manual approval are not counted
|
|
41
|
+
- `highest_win` (JackpotWin | null) — The biggest win of the jackpot template, `null` when there are no wins yet
|
|
42
|
+
- `winning_amount` (number) — Won amount in the Jackpot currency
|
|
43
|
+
- `win_date_ts` (number) — Date of winning in milliseconds
|
|
44
|
+
- `public_username` (string | null) — Name of the winner, masked by default. `null` when the jackpot template doesn't expose winners over API
|
|
45
|
+
- `last_win` (JackpotWin | null) — The most recent win of the jackpot template, `null` when there are no wins yet
|
|
46
|
+
- `winning_amount` (number) — Won amount in the Jackpot currency
|
|
47
|
+
- `win_date_ts` (number) — Date of winning in milliseconds
|
|
48
|
+
- `public_username` (string | null) — Name of the winner, masked by default. `null` when the jackpot template doesn't expose winners over API
|
|
49
|
+
|
|
50
|
+
## Behavioral contract
|
|
51
|
+
**Preconditions**
|
|
52
|
+
- User must be authenticated. Visitor mode not supported.
|
|
53
|
+
- `jp_template_id` is mandatory.
|
|
54
|
+
- The consumer SHOULD check
|
|
55
|
+
`JackpotDetails.expose_winners_over_api` before calling, since
|
|
56
|
+
the server does not enforce it.
|
|
57
|
+
|
|
58
|
+
**Statistics**
|
|
59
|
+
- `win_stats` describes the whole jackpot template and does not depend
|
|
60
|
+
on `limit` / `offset`. Pass `limit: 1` when only the statistics are needed.
|
|
61
|
+
- Only issued wins are counted — a pot that exploded but still waits for
|
|
62
|
+
manual approval is not included.
|
|
63
|
+
- `highest_win` / `last_win` are `null` while the jackpot has no wins,
|
|
64
|
+
`total_wins` is `0` in that case.
|
|
65
|
+
- `public_username` of `highest_win` / `last_win` is masked by the same
|
|
66
|
+
label setting as the winners list, and is `null` when the template
|
|
67
|
+
doesn't expose winners over API.
|
|
68
|
+
- The server refreshes the statistics once per minute.
|
|
69
|
+
|
|
70
|
+
**Currency caveat**
|
|
71
|
+
All amounts (`win_stats.*.winning_amount`,
|
|
72
|
+
`winners[].winner.winning_amount_jp_currency`) are in the jackpot's
|
|
73
|
+
NATIVE currency, NOT the user's wallet currency.
|
|
74
|
+
|
|
75
|
+
**Refresh**
|
|
76
|
+
- The SDK caches each page separately (per `jp_template_id` +
|
|
77
|
+
`limit` + `offset`) for 30 seconds.
|
|
78
|
+
- Caches clear on jackpot-win push events and on opt-in / opt-out.
|
|
79
|
+
|
|
80
|
+
**Error handling**
|
|
81
|
+
Non-zero `errCode` on control-group users or generic server errors. The
|
|
82
|
+
SDK does NOT enumerate distinct codes — branch on `errCode === 0` and
|
|
83
|
+
surface `errMsg` on failure.
|
|
84
|
+
|
|
85
|
+
**Visitor mode**: not supported.
|
|
86
|
+
|
|
87
|
+
## Example
|
|
88
|
+
```ts
|
|
89
|
+
const [jp] = await window._smartico.api.jackpotGet({ jp_template_id: 42 });
|
|
90
|
+
|
|
91
|
+
if (!jp || !jp.expose_winners_over_api) {
|
|
92
|
+
console.log('[smartico] winners hidden by operator config — hide the stats');
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const { winners, win_stats } = await window._smartico.api.getJackpotWinStats({
|
|
97
|
+
jp_template_id: 42,
|
|
98
|
+
limit: 10,
|
|
99
|
+
offset: 0,
|
|
100
|
+
});
|
|
101
|
+
console.log('[smartico] total wins', win_stats.total_wins);
|
|
102
|
+
console.log('[smartico] highest win', win_stats.highest_win?.winning_amount, jp.jp_currency);
|
|
103
|
+
console.log('[smartico] latest win', win_stats.last_win?.public_username, win_stats.last_win?.win_date_ts);
|
|
104
|
+
console.log('[smartico] render', winners.length, 'recent winner rows');
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Errors
|
|
108
|
+
See this method's TSDoc / the mutation pages for `err_code` handling.
|
|
109
|
+
|
|
110
|
+
## Related
|
|
111
|
+
- `TGetJackpotWinStatsResponse`
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
- Returns the rich body (title, preview, icon, action, html_body,
|
|
5
|
-
buttons, custom_data)
|
|
6
|
-
`
|
|
5
|
+
buttons, custom_data) and the preview-popup settings
|
|
6
|
+
(`show_preview`, `show_duration_sec`) for one message identified
|
|
7
|
+
by its `message_guid`.
|
|
7
8
|
- Fetched from a CDN, NOT over the WebSocket — latency depends on
|
|
8
9
|
CDN proximity. No SDK-level cache (browser HTTP cache may apply
|
|
9
10
|
via CDN Cache-Control headers).
|
|
@@ -42,6 +43,27 @@ payload has `html_body` or `buttons` but the action isn't
|
|
|
42
43
|
consumer. Don't try to render `html_body` for non-`'dp:inbox'`
|
|
43
44
|
messages — it will be `undefined`.
|
|
44
45
|
|
|
46
|
+
## Preview popup vs silent delivery
|
|
47
|
+
|
|
48
|
+
Every message is stored in the inbox list. The preview settings
|
|
49
|
+
decide whether a newly arrived message also pops up briefly (the
|
|
50
|
+
"toast" the default Smartico UI shows while the user is online).
|
|
51
|
+
|
|
52
|
+
| Field | Value | Behaviour |
|
|
53
|
+
|---|---|---|
|
|
54
|
+
| `show_preview` | `true` or missing | Show a preview popup and store the message in the list |
|
|
55
|
+
| `show_preview` | `false` | Store the message silently, with no popup |
|
|
56
|
+
| `show_duration_sec` | number | Hide the popup after this many seconds |
|
|
57
|
+
| `show_duration_sec` | `null` or missing | Hide the popup after 7 seconds (the default Smartico UI's default) |
|
|
58
|
+
|
|
59
|
+
Values are returned exactly as the operator configured them, so
|
|
60
|
+
apply the defaults above yourself (e.g. `body.show_preview !== false`,
|
|
61
|
+
`body.show_duration_sec ?? 7`).
|
|
62
|
+
|
|
63
|
+
Only show the popup for messages that arrive while the user is
|
|
64
|
+
online. Messages loaded from history via {@link getInboxMessages}
|
|
65
|
+
should go straight into the list.
|
|
66
|
+
|
|
45
67
|
## Sandboxed iframe (for `html_body`)
|
|
46
68
|
|
|
47
69
|
`html_body` is operator-supplied HTML. **Render in a sandboxed
|
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@ export interface InboxMessageBody {
|
|
|
23
23
|
// default is 'true'
|
|
24
24
|
show_preview?: boolean;
|
|
25
25
|
// duration in seconds for how long to show preview, default is 7 seconds
|
|
26
|
-
show_duration_sec?: number;
|
|
26
|
+
show_duration_sec?: number | null;
|
|
27
27
|
// indicator if the image in html_body can be zoomed out
|
|
28
28
|
// default is 'false'
|
|
29
29
|
enable_zoom_mode?: boolean;
|
|
@@ -62,6 +62,8 @@ export const InboxMessageBodyTransform = (item: InboxMessageBody): TInboxMessage
|
|
|
62
62
|
title: item.title,
|
|
63
63
|
preview_body: item.body,
|
|
64
64
|
custom_data: IntUtils.JsonOrText(item?.custom_data),
|
|
65
|
+
show_preview: item.show_preview,
|
|
66
|
+
show_duration_sec: item.show_duration_sec,
|
|
65
67
|
};
|
|
66
68
|
|
|
67
69
|
if (item.action === 'dp:inbox') {
|
|
@@ -6,6 +6,8 @@ export interface GetJackpotWinnersResponse extends ProtocolResponse {
|
|
|
6
6
|
winners: JackpotWinnerHistory[];
|
|
7
7
|
/** Whether there are more winners to fetch */
|
|
8
8
|
has_more: boolean;
|
|
9
|
+
/** Win statistics of the jackpot template */
|
|
10
|
+
win_stats?: JackpotWinStats;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
export interface JackpotWinnerHistory {
|
|
@@ -17,6 +19,31 @@ export interface JackpotWinnerHistory {
|
|
|
17
19
|
winner: JackPotWinner;
|
|
18
20
|
}
|
|
19
21
|
|
|
22
|
+
export interface JackpotWinStats {
|
|
23
|
+
/** Total number of issued wins of the jackpot template. Wins waiting for manual approval are not counted */
|
|
24
|
+
total_wins: number;
|
|
25
|
+
/** The biggest win of the jackpot template, `null` when there are no wins yet */
|
|
26
|
+
highest_win: JackpotWin | null;
|
|
27
|
+
/** The most recent win of the jackpot template, `null` when there are no wins yet */
|
|
28
|
+
last_win: JackpotWin | null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface JackpotWin {
|
|
32
|
+
/** Won amount in the Jackpot currency */
|
|
33
|
+
winning_amount: number;
|
|
34
|
+
/** Date of winning in milliseconds */
|
|
35
|
+
win_date_ts: number;
|
|
36
|
+
/** Name of the winner, masked by default. `null` when the jackpot template doesn't expose winners over API */
|
|
37
|
+
public_username: string | null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface TGetJackpotWinStatsResponse {
|
|
41
|
+
/** The list of jackpot winners */
|
|
42
|
+
winners: JackpotWinnerHistory[];
|
|
43
|
+
/** Win statistics of the jackpot template */
|
|
44
|
+
win_stats: JackpotWinStats;
|
|
45
|
+
}
|
|
46
|
+
|
|
20
47
|
/**
|
|
21
48
|
* @ignore
|
|
22
49
|
*/
|
|
@@ -31,3 +58,17 @@ export const GetJackpotWinnersResponseTransform = (items: JackpotWinnerHistory[]
|
|
|
31
58
|
return winnerInfo;
|
|
32
59
|
});
|
|
33
60
|
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @ignore
|
|
64
|
+
*/
|
|
65
|
+
export const GetJackpotWinStatsResponseTransform = (response: GetJackpotWinnersResponse): TGetJackpotWinStatsResponse => {
|
|
66
|
+
return {
|
|
67
|
+
winners: GetJackpotWinnersResponseTransform(response.winners ?? []),
|
|
68
|
+
win_stats: {
|
|
69
|
+
total_wins: response.win_stats?.total_wins ?? 0,
|
|
70
|
+
highest_win: response.win_stats?.highest_win ?? null,
|
|
71
|
+
last_win: response.win_stats?.last_win ?? null,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
};
|
|
@@ -486,6 +486,35 @@ export interface SAWTemplateUI {
|
|
|
486
486
|
*/
|
|
487
487
|
use_custom?: boolean;
|
|
488
488
|
|
|
489
|
+
/**
|
|
490
|
+
* Whether a custom mini-game fills the whole mini-game window instead of
|
|
491
|
+
* the default fixed-size frame (800×516 on desktop, 400×745 on mobile).
|
|
492
|
+
*
|
|
493
|
+
* Applies wherever the game is opened — a spin attempt shown to the user,
|
|
494
|
+
* a deep link, or `_smartico.miniGame()` in standalone or inline mode.
|
|
495
|
+
* The `fullscreen` option of `_smartico.miniGame()` overrides it per call.
|
|
496
|
+
*
|
|
497
|
+
* When `false` or omitted, the default frame size is used.
|
|
498
|
+
* Back-Office label: _"Standalone full screen"_.
|
|
499
|
+
*/
|
|
500
|
+
standalone_fullscreen?: boolean;
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Width of the custom mini-game frame on desktop when opened standalone or inline,
|
|
504
|
+
* as a CSS size (`800px`, `100%`, `90vw`; a bare number is treated as pixels).
|
|
505
|
+
* Empty or invalid values fall back to the default 800px. Ignored on mobile.
|
|
506
|
+
* Back-Office label: _"Standalone width"_.
|
|
507
|
+
*/
|
|
508
|
+
standalone_width?: string;
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Height of the custom mini-game frame on desktop when opened standalone or inline,
|
|
512
|
+
* as a CSS size (`516px`, `100%`, `90vh`; a bare number is treated as pixels).
|
|
513
|
+
* Empty or invalid values fall back to the default 516px. Ignored on mobile.
|
|
514
|
+
* Back-Office label: _"Standalone height"_.
|
|
515
|
+
*/
|
|
516
|
+
standalone_height?: string;
|
|
517
|
+
|
|
489
518
|
/**
|
|
490
519
|
* Minutes for the Voyager seed window.
|
|
491
520
|
* The seed window is the range of seeds that can be used to generate the map.
|
package/src/SmarticoAPI.ts
CHANGED
|
@@ -146,7 +146,13 @@ import { GetAvatarsCustomizedResponse, avatarCustomizedTransform } from './Avata
|
|
|
146
146
|
import { GetAvatarPromptsResponse, avatarPromptTransform } from './Avatars/GetAvatarPromptsResponse';
|
|
147
147
|
import { SetAvatarRequest, SetAvatarResponse } from './Avatars';
|
|
148
148
|
import { AvatarCustomizeResponse } from './Avatars/AvatarCustomizeResponse';
|
|
149
|
-
import {
|
|
149
|
+
import {
|
|
150
|
+
GetJackpotWinnersResponse,
|
|
151
|
+
GetJackpotWinnersResponseTransform,
|
|
152
|
+
GetJackpotWinStatsResponseTransform,
|
|
153
|
+
JackpotWinnerHistory,
|
|
154
|
+
TGetJackpotWinStatsResponse,
|
|
155
|
+
} from './Jackpots/GetJackpotWinnersResponse';
|
|
150
156
|
import { GetJackpotWinnersRequest } from './Jackpots/GetJackpotWinnersRequest';
|
|
151
157
|
import { GetJackpotEligibleGamesRequest } from './Jackpots/GetJackpotEligibleGamesRequest';
|
|
152
158
|
import { GetJackpotEligibleGamesResponse, GetJackpotEligibleGamesResponseTransform, JackpotEligibleGame, TGetJackpotEligibleGamesResponse } from './Jackpots/GetJackpotEligibleGamesResponse';
|
|
@@ -611,6 +617,10 @@ class SmarticoAPI {
|
|
|
611
617
|
return GetJackpotWinnersResponseTransform((await this.getJackpotWinners(user_ext_id, limit, offset, jp_template_id)).winners);
|
|
612
618
|
}
|
|
613
619
|
|
|
620
|
+
public async getJackpotWinStatsT(user_ext_id: string, limit: number = 20, offset: number = 0, jp_template_id: number): Promise<TGetJackpotWinStatsResponse> {
|
|
621
|
+
return GetJackpotWinStatsResponseTransform(await this.getJackpotWinners(user_ext_id, limit, offset, jp_template_id));
|
|
622
|
+
}
|
|
623
|
+
|
|
614
624
|
public async getJackpotEligibleGames(user_ext_id: string, { jp_template_id }: { jp_template_id: number }): Promise<GetJackpotEligibleGamesResponse> {
|
|
615
625
|
const message = this.buildMessage<GetJackpotEligibleGamesRequest, GetJackpotEligibleGamesResponse>(
|
|
616
626
|
user_ext_id,
|
package/src/SmarticoGlobal.ts
CHANGED
|
@@ -50,6 +50,24 @@ export interface SmarticoWidgetParams {
|
|
|
50
50
|
zoom?: number;
|
|
51
51
|
/** Force the mobile layout regardless of viewport. */
|
|
52
52
|
force_mobile?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Custom mini-games only ({@link SmarticoGlobal.miniGame}): `true` fills the whole mini-game window,
|
|
55
|
+
* `false` keeps the default fixed-size frame. Overrides the template's "Standalone full screen" setting;
|
|
56
|
+
* when omitted, the template setting is used.
|
|
57
|
+
*/
|
|
58
|
+
fullscreen?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Custom mini-games only ({@link SmarticoGlobal.miniGame}): desktop width of the game frame as a CSS size
|
|
61
|
+
* (`1000px`, `100%`, `90vw`; a number is treated as pixels). Overrides the template's "Standalone width"
|
|
62
|
+
* and "Standalone full screen" settings. Ignored on mobile.
|
|
63
|
+
*/
|
|
64
|
+
frame_width?: string | number;
|
|
65
|
+
/**
|
|
66
|
+
* Custom mini-games only ({@link SmarticoGlobal.miniGame}): desktop height of the game frame as a CSS size
|
|
67
|
+
* (`600px`, `100%`, `90vh`; a number is treated as pixels). Overrides the template's "Standalone height"
|
|
68
|
+
* and "Standalone full screen" settings. Ignored on mobile.
|
|
69
|
+
*/
|
|
70
|
+
frame_height?: string | number;
|
|
53
71
|
}
|
|
54
72
|
|
|
55
73
|
/**
|
package/src/WSAPI/WSAPIInbox.ts
CHANGED
|
@@ -363,6 +363,16 @@ export class WSAPIInbox extends WSAPILeaderBoard {
|
|
|
363
363
|
* for safe execution — that helper handles URL vs deep-link
|
|
364
364
|
* routing.
|
|
365
365
|
*
|
|
366
|
+
* **Preview vs silent delivery**
|
|
367
|
+
* Every message belongs in your inbox list. `show_preview` decides
|
|
368
|
+
* whether it should also pop up briefly when it arrives:
|
|
369
|
+
* - `show_preview !== false` → show a preview popup for
|
|
370
|
+
* `show_duration_sec ?? 7` seconds.
|
|
371
|
+
* - `show_preview === false` → store it silently, with no popup.
|
|
372
|
+
* These fields are returned exactly as the operator configured them;
|
|
373
|
+
* a missing value means the default above, the same as the default
|
|
374
|
+
* Smartico UI.
|
|
375
|
+
*
|
|
366
376
|
* **Idempotency / Side effects**: safe. Read-only HTTP fetch.
|
|
367
377
|
*
|
|
368
378
|
* **UI guidance**: see [UI Guide — `getInboxMessageBody`](../../docs/ui/inbox/UIGuide_getInboxMessageBody.md).
|
|
@@ -388,6 +398,12 @@ export class WSAPIInbox extends WSAPILeaderBoard {
|
|
|
388
398
|
* console.log('[smartico] simple message — show preview_body + single CTA wired to:', body.action,
|
|
389
399
|
* '— execute via _smartico.dp(body.action)');
|
|
390
400
|
* }
|
|
401
|
+
*
|
|
402
|
+
* if (body.show_preview !== false) {
|
|
403
|
+
* console.log('[smartico] new message — show a preview popup for', body.show_duration_sec ?? 7, 'seconds');
|
|
404
|
+
* } else {
|
|
405
|
+
* console.log('[smartico] new message — store it in the inbox silently, no popup');
|
|
406
|
+
* }
|
|
391
407
|
* ```
|
|
392
408
|
*/
|
|
393
409
|
public async getInboxMessageBody(messageGuid: string): Promise<TInboxMessageBody> {
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
} from '../Jackpots';
|
|
9
9
|
import { IntUtils } from '../IntUtils';
|
|
10
10
|
import { TGetJackpotEligibleGamesResponse } from '../Jackpots/GetJackpotEligibleGamesResponse';
|
|
11
|
+
import { TGetJackpotWinStatsResponse } from '../Jackpots/GetJackpotWinnersResponse';
|
|
11
12
|
import {
|
|
12
13
|
JACKPOT_TEMPLATE_CACHE_SEC,
|
|
13
14
|
JACKPOT_POT_CACHE_SEC,
|
|
@@ -390,6 +391,94 @@ export class WSAPIJackpots extends WSAPIClans {
|
|
|
390
391
|
);
|
|
391
392
|
}
|
|
392
393
|
|
|
394
|
+
/**
|
|
395
|
+
* Returns past winners of a specific jackpot template, paginated, together
|
|
396
|
+
* with the win statistics of that template: total number of wins, the
|
|
397
|
+
* biggest win and the most recent win. Use it for a jackpot info modal /
|
|
398
|
+
* tooltip that shows "Total wins", "Highest win" and "Latest win" next to
|
|
399
|
+
* the winners list.
|
|
400
|
+
*
|
|
401
|
+
* @remarks
|
|
402
|
+
* **Preconditions**
|
|
403
|
+
* - User must be authenticated. Visitor mode not supported.
|
|
404
|
+
* - `jp_template_id` is mandatory.
|
|
405
|
+
* - The consumer SHOULD check
|
|
406
|
+
* `JackpotDetails.expose_winners_over_api` before calling, since
|
|
407
|
+
* the server does not enforce it.
|
|
408
|
+
*
|
|
409
|
+
* **Statistics**
|
|
410
|
+
* - `win_stats` describes the whole jackpot template and does not depend
|
|
411
|
+
* on `limit` / `offset`. Pass `limit: 1` when only the statistics are needed.
|
|
412
|
+
* - Only issued wins are counted — a pot that exploded but still waits for
|
|
413
|
+
* manual approval is not included.
|
|
414
|
+
* - `highest_win` / `last_win` are `null` while the jackpot has no wins,
|
|
415
|
+
* `total_wins` is `0` in that case.
|
|
416
|
+
* - `public_username` of `highest_win` / `last_win` is masked by the same
|
|
417
|
+
* label setting as the winners list, and is `null` when the template
|
|
418
|
+
* doesn't expose winners over API.
|
|
419
|
+
* - The server refreshes the statistics once per minute.
|
|
420
|
+
*
|
|
421
|
+
* **Currency caveat**
|
|
422
|
+
* All amounts (`win_stats.*.winning_amount`,
|
|
423
|
+
* `winners[].winner.winning_amount_jp_currency`) are in the jackpot's
|
|
424
|
+
* NATIVE currency, NOT the user's wallet currency.
|
|
425
|
+
*
|
|
426
|
+
* **Refresh**
|
|
427
|
+
* - The SDK caches each page separately (per `jp_template_id` +
|
|
428
|
+
* `limit` + `offset`) for 30 seconds.
|
|
429
|
+
* - Caches clear on jackpot-win push events and on opt-in / opt-out.
|
|
430
|
+
*
|
|
431
|
+
* **Error handling**
|
|
432
|
+
* Non-zero `errCode` on control-group users or generic server errors. The
|
|
433
|
+
* SDK does NOT enumerate distinct codes — branch on `errCode === 0` and
|
|
434
|
+
* surface `errMsg` on failure.
|
|
435
|
+
*
|
|
436
|
+
* **Visitor mode**: not supported.
|
|
437
|
+
*
|
|
438
|
+
* @returns {@link TGetJackpotWinStatsResponse} —
|
|
439
|
+
* `{ winners: JackpotWinnerHistory[], win_stats: JackpotWinStats }`.
|
|
440
|
+
*
|
|
441
|
+
* @example
|
|
442
|
+
* ```ts
|
|
443
|
+
* const [jp] = await window._smartico.api.jackpotGet({ jp_template_id: 42 });
|
|
444
|
+
*
|
|
445
|
+
* if (!jp || !jp.expose_winners_over_api) {
|
|
446
|
+
* console.log('[smartico] winners hidden by operator config — hide the stats');
|
|
447
|
+
* return;
|
|
448
|
+
* }
|
|
449
|
+
*
|
|
450
|
+
* const { winners, win_stats } = await window._smartico.api.getJackpotWinStats({
|
|
451
|
+
* jp_template_id: 42,
|
|
452
|
+
* limit: 10,
|
|
453
|
+
* offset: 0,
|
|
454
|
+
* });
|
|
455
|
+
* console.log('[smartico] total wins', win_stats.total_wins);
|
|
456
|
+
* console.log('[smartico] highest win', win_stats.highest_win?.winning_amount, jp.jp_currency);
|
|
457
|
+
* console.log('[smartico] latest win', win_stats.last_win?.public_username, win_stats.last_win?.win_date_ts);
|
|
458
|
+
* console.log('[smartico] render', winners.length, 'recent winner rows');
|
|
459
|
+
* ```
|
|
460
|
+
*/
|
|
461
|
+
public async getJackpotWinStats({
|
|
462
|
+
limit,
|
|
463
|
+
offset,
|
|
464
|
+
jp_template_id,
|
|
465
|
+
}: {
|
|
466
|
+
/** Page size of the winners list (default 20). */
|
|
467
|
+
limit?: number;
|
|
468
|
+
/** Pagination offset of the winners list (default 0). */
|
|
469
|
+
offset?: number;
|
|
470
|
+
/** Jackpot template ID (required). */
|
|
471
|
+
jp_template_id?: number;
|
|
472
|
+
}): Promise<TGetJackpotWinStatsResponse> {
|
|
473
|
+
const cacheKey = `${onUpdateContextKey.JackpotWinners}stats:${jp_template_id}:${limit}:${offset}`;
|
|
474
|
+
return OCache.use(
|
|
475
|
+
cacheKey,
|
|
476
|
+
ECacheContext.WSAPI,
|
|
477
|
+
() => this.api.getJackpotWinStatsT(this.userExtId, limit, offset, jp_template_id),
|
|
478
|
+
JACKPOT_WINNERS_CACHE_SEC,
|
|
479
|
+
);
|
|
480
|
+
}
|
|
481
|
+
|
|
393
482
|
/**
|
|
394
483
|
* Returns the casino games eligible to contribute to a specific jackpot —
|
|
395
484
|
* the catalog the user must play to grow the pot. Use to power an
|
package/src/WSAPI/WSAPITypes.ts
CHANGED
|
@@ -1146,6 +1146,12 @@ export interface TInboxMessageBody {
|
|
|
1146
1146
|
/** Operator-defined custom data. The SDK auto-parses JSON-looking
|
|
1147
1147
|
* strings, so at runtime this is `any` despite the `string` type. */
|
|
1148
1148
|
custom_data?: string;
|
|
1149
|
+
/** Whether to show a short preview popup when the message arrives.
|
|
1150
|
+
* `false` means store it in the inbox silently; missing means `true`. */
|
|
1151
|
+
show_preview?: boolean;
|
|
1152
|
+
/** How long the preview popup stays visible, in seconds.
|
|
1153
|
+
* `null` or missing means 7 seconds. */
|
|
1154
|
+
show_duration_sec?: number | null;
|
|
1149
1155
|
}
|
|
1150
1156
|
|
|
1151
1157
|
/**
|