@smartico/public-api 0.0.426 → 0.0.428
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/Core/PublicLabelSettings.d.ts +2 -0
- package/dist/Missions/BadgesTimeLimitStates.d.ts +6 -1
- package/dist/Raffle/RaffleDraw.d.ts +10 -4
- package/dist/SmarticoAPI.d.ts +4 -1
- package/dist/SmarticoGlobal.d.ts +2 -0
- package/dist/WSAPI/WSAPILeaderBoard.d.ts +49 -1
- package/dist/WSAPI/WSAPIMissions.d.ts +5 -1
- package/dist/WSAPI/WSAPIRaffles.d.ts +6 -2
- package/dist/WSAPI/WSAPITournaments.d.ts +14 -5
- package/dist/WSAPI/WSAPITypes.d.ts +30 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +140 -16
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +142 -19
- package/dist/index.modern.mjs.map +1 -1
- package/docs/SmarticoObject.md +9 -4
- package/docs/ui/leaderboard/UIGuide_getLeaderBoard.md +18 -3
- package/docs/ui/missions/UIGuide_getBadges.md +6 -0
- package/docs/ui/raffles/UIGuide_getRaffles.md +18 -1
- package/docs/ui/tournaments/UIGuide_getTournamentsList.md +12 -6
- package/package.json +1 -1
- package/src/Core/PublicLabelSettings.ts +2 -0
- package/src/Missions/BadgesTimeLimitStates.ts +5 -0
- package/src/Missions/MissionsUtils.ts +2 -2
- package/src/Raffle/GetRafflesResponse.ts +2 -0
- package/src/Raffle/RaffleDraw.ts +10 -4
- package/src/SmarticoAPI.ts +50 -0
- package/src/SmarticoGlobal.ts +2 -0
- package/src/Tournaments/Tournament.ts +1 -0
- package/src/WSAPI/WSAPILeaderBoard.ts +52 -0
- package/src/WSAPI/WSAPIMissions.ts +5 -1
- package/src/WSAPI/WSAPIRaffles.ts +6 -2
- package/src/WSAPI/WSAPITournaments.ts +14 -5
- package/src/WSAPI/WSAPITypes.ts +31 -0
- package/src/index.ts +1 -1
- package/dist/ActivityLog/ActivityLogMapper.d.ts +0 -4
- package/dist/Quiz/MarketsAnswers.d.ts +0 -40
- package/dist/Quiz/MarketsInfo.d.ts +0 -14
- package/dist/Quiz/MarketsPerSport.d.ts +0 -6
- package/dist/Quiz/MarketsType.d.ts +0 -28
- package/dist/Quiz/ScoreResultTypes.d.ts +0 -28
- package/dist/Quiz/SportTypes.d.ts +0 -6
- package/dist/Quiz/index.d.ts +0 -6
package/docs/SmarticoObject.md
CHANGED
|
@@ -286,12 +286,12 @@ to have run.
|
|
|
286
286
|
Renders an operator-configured banner into a host element, and pushes runtime
|
|
287
287
|
data into a rendered banner placement.
|
|
288
288
|
|
|
289
|
-
### `suspendPopups(flag)` · `suspendInbox(flag)` · `suspendMiniGames(flag)`
|
|
289
|
+
### `suspendPopups(flag)` · `suspendInbox(flag)` · `suspendMiniGames(flag)` · `suspendForms(flag)`
|
|
290
290
|
|
|
291
291
|
Temporarily suppress (or re-enable) automatically-triggered surfaces — popups,
|
|
292
|
-
inbox prompts,
|
|
293
|
-
to suspend, `false` to resume. Useful while the user is mid-flow (e.g. on
|
|
294
|
-
deposit page or completing a KYC
|
|
292
|
+
inbox prompts, server-triggered mini-game pop-ups, and forms respectively. Pass
|
|
293
|
+
`true` to suspend, `false` to resume. Useful while the user is mid-flow (e.g. on
|
|
294
|
+
a deposit page or completing a KYC step) and you don't want Smartico surfaces
|
|
295
295
|
interrupting. Require an identified user.
|
|
296
296
|
|
|
297
297
|
```js
|
|
@@ -304,6 +304,11 @@ When suspension is turned off, the first surface that was missed while
|
|
|
304
304
|
suspended is shown — provided the session is still active (the user hasn't
|
|
305
305
|
refreshed or navigated away).
|
|
306
306
|
|
|
307
|
+
`suspendForms` is the exception: a form requested while forms are suspended is
|
|
308
|
+
dropped, not queued, so nothing replays when you resume. A campaign-triggered
|
|
309
|
+
form that is dropped this way is reported as failed to deliver, which fires the
|
|
310
|
+
journey's failure branch.
|
|
311
|
+
|
|
307
312
|
---
|
|
308
313
|
|
|
309
314
|
## Events & analytics
|
|
@@ -45,10 +45,25 @@ Columns per row (in the Leaders tab):
|
|
|
45
45
|
| Column | Source | Notes |
|
|
46
46
|
|---|---|---|
|
|
47
47
|
| Position | `user.position` | Server-computed DENSE_RANK. Show as `01`, `02`, … `20`. |
|
|
48
|
-
| Avatar | `user.avatar_url` |
|
|
48
|
+
| Avatar | `user.avatar_url` | Hidden when `getLeaderBoardSettings().hide_avatars`. |
|
|
49
49
|
| Username | `user.public_username` | |
|
|
50
|
-
| Points | `user.points` |
|
|
51
|
-
| Level badge | (Drives from separate `getCurrentLevel` lookup, not on this type) |
|
|
50
|
+
| Points | `user.points` | Hidden for every row except the current user's when `getLeaderBoardSettings().hide_other_points`. |
|
|
51
|
+
| Level badge | (Drives from separate `getCurrentLevel` lookup, not on this type) | Hidden when `getLeaderBoardSettings().hide_levels`. |
|
|
52
|
+
|
|
53
|
+
**Privacy flags are the consumer's job.** `getLeaderBoard` always returns
|
|
54
|
+
`avatar_url`, `level_id` and `points` on every row — the server does not
|
|
55
|
+
strip them. Read the operator's configuration with the synchronous
|
|
56
|
+
`getLeaderBoardSettings()` and apply it while rendering:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
const settings = window._smartico.api.getLeaderBoardSettings();
|
|
60
|
+
const showPoints = (row: LeaderBoardUserT) => row.is_me || !settings.hide_other_points;
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Note the default on an unconfigured label: `hide_avatars` and
|
|
64
|
+
`hide_levels` are `false` (show), but `hide_other_points` is `true`
|
|
65
|
+
(hide). Rendering points unconditionally is therefore a divergence from
|
|
66
|
+
the default Smartico UI, not just a missed setting.
|
|
52
67
|
|
|
53
68
|
**Top-3 podium styling**: apply distinct CSS classes (`place-1`,
|
|
54
69
|
`place-2`, `place-3`) to rows with `position <= 3` (and
|
|
@@ -137,6 +137,12 @@ top.
|
|
|
137
137
|
| `AfterStartDateWithProgressAndEndDate` (3) — active with progress, has end date | Full-color | `"<countdown>"` to `active_till_ts` (see "Countdown / timing format") |
|
|
138
138
|
| `AfterEndDateNotStarted` (4) — expired, never started | Grayscale + dim overlay + slash/X overlay | `"Expired"` |
|
|
139
139
|
| `AfterEndDateWithProgress` (5) — expired with some progress | Grayscale + dim overlay | `"Ended"` (or `"Expired"`) |
|
|
140
|
+
| `AfterStartDateWithProgress` (6) — active with progress, no end date | Full-color, no overlay | No chip |
|
|
141
|
+
|
|
142
|
+
States 1 and 6 are the open-ended pair: a badge with no `active_till_ts`
|
|
143
|
+
can only ever report one of them, never states 4 or 5. Never render an
|
|
144
|
+
open-ended badge as expired, and never key an "expired" treatment off
|
|
145
|
+
the absence of a countdown.
|
|
140
146
|
|
|
141
147
|
On top of the time-window treatment, layer the completion state:
|
|
142
148
|
|
|
@@ -20,11 +20,16 @@ raffle expanding to show its draws. There are no top-level tabs.
|
|
|
20
20
|
|
|
21
21
|
Per-raffle, draws are bucketed within the detail panel:
|
|
22
22
|
|
|
23
|
-
1. **Active / Upcoming** — `draws.filter(d => d.current_state
|
|
23
|
+
1. **Active / Upcoming** — `draws.filter(d => d.current_state === 1 || d.current_state === 2)`
|
|
24
24
|
(1 = Open, 2 = WinnerSelection); sort by `execution_ts` ASC.
|
|
25
25
|
2. **Executed** — `draws.filter(d => d.current_state === 3)`;
|
|
26
26
|
rendered after the active draws.
|
|
27
27
|
|
|
28
|
+
Bucket on the active states explicitly rather than on
|
|
29
|
+
`current_state !== 3`: Cancelled (4) is also terminal, and a
|
|
30
|
+
`!== 3` test files it under Active, where it renders as a live draw
|
|
31
|
+
that never resolves.
|
|
32
|
+
|
|
28
33
|
## Ticket-cap banner
|
|
29
34
|
|
|
30
35
|
Drive from `TRaffle.ticket_cap_visualization` (enum):
|
|
@@ -49,6 +54,18 @@ Fields rendered on each raffle row:
|
|
|
49
54
|
operator-defined custom section. `custom_data` is operator-defined
|
|
50
55
|
JSON / string for custom UI extensions.
|
|
51
56
|
|
|
57
|
+
**Rules / Terms & Conditions**: `hint_text` is the operator-authored
|
|
58
|
+
rules text for the raffle. The default Smartico UI surfaces it behind a
|
|
59
|
+
"Rules" button next to the draw-history entry point. It may be empty —
|
|
60
|
+
in that case hide the button entirely. Never substitute generic
|
|
61
|
+
boilerplate for it: the text is a legal artefact the operator is
|
|
62
|
+
responsible for, and inventing your own makes the widget state terms
|
|
63
|
+
the operator never agreed to.
|
|
64
|
+
|
|
65
|
+
**Per-prize privacy**: `hide_chance_to_win` is set per prize. When it
|
|
66
|
+
is `true`, do not render that prize's `chances_to_win_perc` anywhere —
|
|
67
|
+
neither on the card nor in the expanded draw.
|
|
68
|
+
|
|
52
69
|
## Draw card (per-raffle children)
|
|
53
70
|
|
|
54
71
|
Fields rendered on each `draws[i]`:
|
|
@@ -34,10 +34,15 @@ tabs only. No visual difference on the card itself — just position.
|
|
|
34
34
|
- Desktop: Overview · MyTournaments · InProgress · Finished
|
|
35
35
|
- Mobile: Overview · MyTournaments · InProgress
|
|
36
36
|
|
|
37
|
-
**Custom section filtering**:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
**Custom section filtering**: the SDK does not filter by placement —
|
|
38
|
+
do it yourself, and apply the same filter to the tab counters, not just
|
|
39
|
+
to the rendered cards:
|
|
40
|
+
|
|
41
|
+
- Main lobby: drop custom-section-only entries —
|
|
42
|
+
`tournaments.filter(t => !t.only_in_custom_section)`.
|
|
43
|
+
- A lobby scoped to one custom section (e.g. a deep-link
|
|
44
|
+
`?custom_section_id=42`): keep the entries whose `custom_section_id`
|
|
45
|
+
matches that section instead.
|
|
41
46
|
|
|
42
47
|
**Bucketing helper** (raw-state to bucket — for reference):
|
|
43
48
|
|
|
@@ -81,8 +86,9 @@ Fields rendered on the card (top-to-bottom):
|
|
|
81
86
|
`registration_cost_gems` / `registration_cost_diamonds` (only
|
|
82
87
|
one is set per tournament) — show "Free" if all are falsy.
|
|
83
88
|
`custom_price_text` (operator-supplied string) overrides if set.
|
|
84
|
-
- Prize pool: `prize_pool_short` if set, else
|
|
85
|
-
from `prizes[]`
|
|
89
|
+
- Prize pool: `prize_pool_short` if set, else "Mixed". The default
|
|
90
|
+
Smartico UI does not derive a card label from `prizes[]` and never
|
|
91
|
+
renders a bare dash — keep the fallback a single stable string.
|
|
86
92
|
- **CTA button** — see "Action button decision matrix".
|
|
87
93
|
|
|
88
94
|
**Mobile card variant**: ribbon renders ABOVE the image (not as an
|
package/package.json
CHANGED
|
@@ -6,6 +6,8 @@ export enum PublicLabelSettings {
|
|
|
6
6
|
GAMIFICATION_UI_WIDGET = 'GAMIFICATION_UI_WIDGET',
|
|
7
7
|
GAMIFICATION_UI_MINI_GAME = 'GAMIFICATION_UI_MINI_GAME',
|
|
8
8
|
GAMIFICATION_UI_SETTINGS = 'GAMIFICATION_UI_SETTINGS',
|
|
9
|
+
GAMIFICATION_UI_SETTINGS_V2 = 'GAMIFICATION_UI_SETTINGS_V2',
|
|
10
|
+
GAMIFICATION_UI_SETTINGS_TEST_V2 = 'GAMIFICATION_UI_SETTINGS_TEST_V2',
|
|
9
11
|
GAMIFICATION_UI_MAIN_TEST = 'GAMIFICATION_UI_MAIN_TEST',
|
|
10
12
|
GAMIFICATION_UI_WIDGET_TEST = 'GAMIFICATION_UI_WIDGET_TEST',
|
|
11
13
|
GAMIFICATION_UI_SETTINGS_TEST = 'GAMIFICATION_UI_SETTINGS_TEST',
|
|
@@ -11,5 +11,10 @@ export enum BadgesTimeLimitStates {
|
|
|
11
11
|
AfterEndDateNotStarted = 4,
|
|
12
12
|
/** After End Date (player has some progress, but not completed) */
|
|
13
13
|
AfterEndDateWithProgress = 5,
|
|
14
|
+
/**
|
|
15
|
+
* After Start Date, player has some progress, and the badge has no End Date.
|
|
16
|
+
* The badge is still earnable — do not render it as expired.
|
|
17
|
+
*/
|
|
18
|
+
AfterStartDateWithProgress = 6,
|
|
14
19
|
}
|
|
15
20
|
|
|
@@ -302,8 +302,8 @@ export class MissionUtils {
|
|
|
302
302
|
if (progress === 0) {
|
|
303
303
|
return BadgesTimeLimitStates.AfterStartDateNoProgress;
|
|
304
304
|
}
|
|
305
|
-
|
|
306
|
-
|
|
305
|
+
|
|
306
|
+
return BadgesTimeLimitStates.AfterStartDateWithProgress;
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
// 3. AFTER START, BEFORE END DATE
|
|
@@ -43,6 +43,7 @@ export const prizeTransform = (items: RafflePrize[]): TRafflePrize[] => {
|
|
|
43
43
|
description: item.public_meta.description,
|
|
44
44
|
image_url: item.public_meta.image_url,
|
|
45
45
|
custom_data: item.public_meta.custom_data,
|
|
46
|
+
hide_chance_to_win: item.public_meta.hide_chance_to_win,
|
|
46
47
|
prizes_per_run: item.prizes_per_run,
|
|
47
48
|
prizes_per_run_actual: item.prizes_per_run_actual,
|
|
48
49
|
chances_to_win_perc: item.chances_to_win_perc,
|
|
@@ -103,6 +104,7 @@ export const raffleTransform = (items: Raffle[]): TRaffle[] => {
|
|
|
103
104
|
custom_section_id: item.public_meta.custom_section_id,
|
|
104
105
|
image_url: item.public_meta.image_url,
|
|
105
106
|
image_url_mobile: item.public_meta.image_url_mobile,
|
|
107
|
+
hint_text: item.public_meta.hint_text,
|
|
106
108
|
custom_data: item.public_meta.custom_data,
|
|
107
109
|
start_date: item.start_date_ts,
|
|
108
110
|
end_date: item.end_date_ts,
|
package/src/Raffle/RaffleDraw.ts
CHANGED
|
@@ -9,19 +9,25 @@ export enum RaffleDrawInstanceState {
|
|
|
9
9
|
WinnerSelection = 2,
|
|
10
10
|
/** Draw is executed and the winners are selected */
|
|
11
11
|
Executed = 3,
|
|
12
|
+
/**
|
|
13
|
+
* Draw was cancelled and will never be executed.
|
|
14
|
+
* Treat it as a terminal state: stop any polling of the draw run
|
|
15
|
+
* and do not show the winner-selection progress UI.
|
|
16
|
+
*/
|
|
17
|
+
Cancelled = 4,
|
|
12
18
|
}
|
|
13
19
|
|
|
14
20
|
export enum RaffleDrawTypeExecution {
|
|
15
21
|
/** Draw is executed only once */
|
|
16
|
-
ExecDate =
|
|
22
|
+
ExecDate = 1,
|
|
17
23
|
/** Draw is executed on a recurring basis */
|
|
18
|
-
Recurring =
|
|
19
|
-
/**
|
|
24
|
+
Recurring = 2,
|
|
25
|
+
/**
|
|
20
26
|
* Draw is executed once and is marked as grand.
|
|
21
27
|
* This means it is a special or significant draw,
|
|
22
28
|
* often with larger prizes or more importance.
|
|
23
29
|
*/
|
|
24
|
-
Grand =
|
|
30
|
+
Grand = 3,
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
|
package/src/SmarticoAPI.ts
CHANGED
|
@@ -95,6 +95,7 @@ import {
|
|
|
95
95
|
TTournament,
|
|
96
96
|
TTournamentDetailed,
|
|
97
97
|
LeaderBoardDetailsT,
|
|
98
|
+
LeaderBoardSettingsT,
|
|
98
99
|
UserLevelExtraCountersT,
|
|
99
100
|
TSegmentCheckResult,
|
|
100
101
|
TUICustomSection,
|
|
@@ -191,6 +192,7 @@ interface Tracker {
|
|
|
191
192
|
getLabelSetting: (key: PublicLabelSettings) => any;
|
|
192
193
|
triggerExternalCallBack: (callBackKey: string, payload: any) => void;
|
|
193
194
|
getExtUserId: () => string;
|
|
195
|
+
getHash?: () => string;
|
|
194
196
|
}
|
|
195
197
|
interface IOptions {
|
|
196
198
|
logger?: ILogger;
|
|
@@ -1244,6 +1246,49 @@ class SmarticoAPI {
|
|
|
1244
1246
|
return (await this.leaderboardsGetList(user_ext_id)).map(getLeaderBoardTransform);
|
|
1245
1247
|
}
|
|
1246
1248
|
|
|
1249
|
+
public leaderboardsGetSettings(): LeaderBoardSettingsT {
|
|
1250
|
+
// Defaults match the default Smartico UI when the operator has not
|
|
1251
|
+
// configured the gamification UI settings: avatars and levels are
|
|
1252
|
+
// shown, other players' points are not.
|
|
1253
|
+
const settings = this.getGamificationUISettings();
|
|
1254
|
+
|
|
1255
|
+
return {
|
|
1256
|
+
hide_avatars: settings?.hide_avatars_leaderboards === true,
|
|
1257
|
+
hide_levels: settings?.leaderboard_hide_levels === true,
|
|
1258
|
+
// Deliberately asymmetric: points stay hidden unless the operator
|
|
1259
|
+
// explicitly opted in by setting the flag to false. This mirrors the
|
|
1260
|
+
// default Smartico UI, so a consumer rendering both surfaces agrees
|
|
1261
|
+
// with it on an unconfigured label.
|
|
1262
|
+
hide_other_points: settings?.leaderboard_hide_other_points !== false,
|
|
1263
|
+
};
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
private getGamificationUISettings(): Record<string, any> {
|
|
1267
|
+
if (!this.tracker) {
|
|
1268
|
+
return null;
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
const parse = (raw: any): Record<string, any> => {
|
|
1272
|
+
if (typeof raw !== 'string' || raw.length === 0) {
|
|
1273
|
+
return null;
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
try {
|
|
1277
|
+
const parsed = JSON.parse(raw);
|
|
1278
|
+
return parsed && Object.keys(parsed).length ? parsed : null;
|
|
1279
|
+
} catch (e) {
|
|
1280
|
+
return null;
|
|
1281
|
+
}
|
|
1282
|
+
};
|
|
1283
|
+
|
|
1284
|
+
// Test accounts read the operator's test variant when one is configured;
|
|
1285
|
+
// everyone else reads the live settings.
|
|
1286
|
+
const isTestAccount = this.tracker.userPublicProps?.core_is_test_account === true;
|
|
1287
|
+
const testSettings = isTestAccount ? parse(this.tracker.getLabelSetting(PublicLabelSettings.GAMIFICATION_UI_SETTINGS_TEST_V2)) : null;
|
|
1288
|
+
|
|
1289
|
+
return testSettings || parse(this.tracker.getLabelSetting(PublicLabelSettings.GAMIFICATION_UI_SETTINGS_V2));
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1247
1292
|
public async levelsGet(user_ext_id: string, force_language?: string): Promise<GetLevelMapResponse> {
|
|
1248
1293
|
const message = this.buildMessage<any, GetLevelMapResponse>(user_ext_id, ClassId.GET_LEVEL_MAP_REQUEST);
|
|
1249
1294
|
return await this.send<GetLevelMapResponse>(message, ClassId.GET_LEVEL_MAP_RESPONSE, force_language);
|
|
@@ -1455,6 +1500,11 @@ class SmarticoAPI {
|
|
|
1455
1500
|
lang: this.tracker.userPublicProps?.core_user_language,
|
|
1456
1501
|
});
|
|
1457
1502
|
|
|
1503
|
+
const user_hash = this.tracker.getHash?.();
|
|
1504
|
+
if (user_hash) {
|
|
1505
|
+
params.user_hash = user_hash;
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1458
1508
|
return params;
|
|
1459
1509
|
}
|
|
1460
1510
|
|
package/src/SmarticoGlobal.ts
CHANGED
|
@@ -171,6 +171,8 @@ export interface SmarticoGlobal {
|
|
|
171
171
|
suspendInbox(flag: boolean): void;
|
|
172
172
|
/** Temporarily suspend/resume mini-games. */
|
|
173
173
|
suspendMiniGames(flag: boolean): void;
|
|
174
|
+
/** Temporarily suspend/resume forms. */
|
|
175
|
+
suspendForms(flag: boolean): void;
|
|
174
176
|
|
|
175
177
|
/** Show a visitor-mode game. */
|
|
176
178
|
showVisitorGame(params: Record<string, unknown>): void;
|
|
@@ -90,6 +90,7 @@ export const TournamentItemsTransform = (items: Tournament[]): TTournament[] =>
|
|
|
90
90
|
prize_pool_short: r.publicMeta.prize_pool_short,
|
|
91
91
|
custom_price_text: r.publicMeta.custom_price_text,
|
|
92
92
|
custom_section_id: r.publicMeta.custom_section_id,
|
|
93
|
+
only_in_custom_section: r.publicMeta.only_in_custom_section,
|
|
93
94
|
custom_data: IntUtils.JsonOrText(r.publicMeta.custom_data),
|
|
94
95
|
is_featured: r.publicMeta.featured,
|
|
95
96
|
ribbon: r.publicMeta.label_tag === 'custom' ? r.publicMeta.custom_label_tag : r.publicMeta.label_tag,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ECacheContext, OCache } from '../OCache';
|
|
2
2
|
import {
|
|
3
3
|
LeaderBoardDetailsT,
|
|
4
|
+
LeaderBoardSettingsT,
|
|
4
5
|
} from './WSAPITypes';
|
|
5
6
|
import { LeaderBoardPeriodType } from '../Leaderboard';
|
|
6
7
|
import {
|
|
@@ -223,4 +224,55 @@ export class WSAPILeaderBoard extends WSAPIGamePick {
|
|
|
223
224
|
CACHE_DATA_SEC,
|
|
224
225
|
);
|
|
225
226
|
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Returns the operator's privacy configuration for leaderboard rendering.
|
|
230
|
+
* Apply it to every leaderboard row you draw — the standings returned by
|
|
231
|
+
* {@link getLeaderBoard} always carry `avatar_url`, `level_id` and
|
|
232
|
+
* `points`, so honouring these flags is the consumer's responsibility.
|
|
233
|
+
* Ignoring them surfaces data the operator asked to keep private.
|
|
234
|
+
*
|
|
235
|
+
* @remarks
|
|
236
|
+
* **Flags** — each is `true` when the corresponding data must be hidden:
|
|
237
|
+
* - `hide_avatars` — draw rows without the player avatar.
|
|
238
|
+
* - `hide_levels` — draw rows without the player's level name.
|
|
239
|
+
* - `hide_other_points` — hide `points` for every row except the current
|
|
240
|
+
* user's. The current user always sees their own points.
|
|
241
|
+
*
|
|
242
|
+
* **Defaults on an unconfigured label** — `hide_avatars` and
|
|
243
|
+
* `hide_levels` default to `false` (show), while `hide_other_points`
|
|
244
|
+
* defaults to `true` (hide) unless the operator explicitly turned it off.
|
|
245
|
+
* The asymmetry is intentional: it matches the default Smartico UI, so a
|
|
246
|
+
* consumer rendering its own leaderboard next to the built-in one agrees
|
|
247
|
+
* with it rather than exposing points the built-in surface hides.
|
|
248
|
+
*
|
|
249
|
+
* **Synchronous** — the settings arrive with the session handshake, so
|
|
250
|
+
* this returns immediately and never issues a round-trip. Call it on
|
|
251
|
+
* every render rather than caching the result yourself.
|
|
252
|
+
*
|
|
253
|
+
* **Idempotency / Side effects**: safe. Read-only.
|
|
254
|
+
*
|
|
255
|
+
* **Visitor mode**: supported. Returns the same label-level configuration.
|
|
256
|
+
*
|
|
257
|
+
* @returns The resolved leaderboard privacy flags. Never `null`.
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```ts
|
|
261
|
+
* import { LeaderBoardPeriodType } from '@smartico/public-api';
|
|
262
|
+
*
|
|
263
|
+
* const settings = window._smartico.api.getLeaderBoardSettings();
|
|
264
|
+
* const board = await window._smartico.api.getLeaderBoard(LeaderBoardPeriodType.WEEKLY);
|
|
265
|
+
*
|
|
266
|
+
* for (const row of board?.users ?? []) {
|
|
267
|
+
* const showPoints = row.is_me || !settings.hide_other_points;
|
|
268
|
+
*
|
|
269
|
+
* console.log('[smartico] render row', row.position, row.public_username,
|
|
270
|
+
* settings.hide_avatars ? '(no avatar)' : row.avatar_url,
|
|
271
|
+
* showPoints ? row.points : '(points hidden)');
|
|
272
|
+
* }
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
public getLeaderBoardSettings(): LeaderBoardSettingsT {
|
|
276
|
+
return this.api.leaderboardsGetSettings();
|
|
277
|
+
}
|
|
226
278
|
}
|
|
@@ -216,7 +216,11 @@ export class WSAPIMissions extends WSAPIGeneral {
|
|
|
216
216
|
* as undefined / default. Time windows are absolute calendar timestamps
|
|
217
217
|
* (`active_from_ts` / `active_till_ts`), not opt-in-relative durations —
|
|
218
218
|
* drive availability chips from the SDK-computed `badgeTimeLimitState`
|
|
219
|
-
* (enum {@link BadgesTimeLimitStates}), not `time_limit_ms`.
|
|
219
|
+
* (enum {@link BadgesTimeLimitStates}), not `time_limit_ms`. A badge
|
|
220
|
+
* with no `active_till_ts` is open-ended and never reaches the
|
|
221
|
+
* "after end date" states — it reports `AfterStartDateNoProgress`
|
|
222
|
+
* or `AfterStartDateWithProgress` — so it must never be rendered as
|
|
223
|
+
* expired. Locking for
|
|
220
224
|
* badges is purely time-based: `is_locked` is `true` only when
|
|
221
225
|
* `badgeTimeLimitState === BadgesTimeLimitStates.BeforeStartDate` (the
|
|
222
226
|
* time window hasn't started yet). The primary navigation field is
|
|
@@ -68,8 +68,12 @@ export class WSAPIRaffles extends WSAPIJackpots {
|
|
|
68
68
|
* sold-out message).
|
|
69
69
|
* - Within each draw, `current_state`
|
|
70
70
|
* ({@link RaffleDrawInstanceState}) buckets the draw into Open
|
|
71
|
-
* (accepting tickets), WinnerSelection (currently drawing),
|
|
72
|
-
* Executed (winners selected).
|
|
71
|
+
* (accepting tickets), WinnerSelection (currently drawing),
|
|
72
|
+
* Executed (winners selected), or Cancelled (will never run).
|
|
73
|
+
* Treat every state other than Open and WinnerSelection as
|
|
74
|
+
* terminal — stop polling the draw run and clear any
|
|
75
|
+
* "drawing in progress" indicator, otherwise a cancelled draw
|
|
76
|
+
* leaves the UI spinning forever.
|
|
73
77
|
* - `execution_type` ({@link RaffleDrawTypeExecution}) distinguishes
|
|
74
78
|
* one-shot (`ExecDate`), repeating (`Recurring`), or special
|
|
75
79
|
* one-shot (`Grand`) draws. Recurring draws share a stable
|
|
@@ -52,6 +52,12 @@ export class WSAPITournaments extends WSAPIStore {
|
|
|
52
52
|
* tournaments not yet published. SDK consumers receive only items
|
|
53
53
|
* the user is eligible to see; no client-side gating is required.
|
|
54
54
|
*
|
|
55
|
+
* Client-side filtering you may still want: tournaments with
|
|
56
|
+
* `only_in_custom_section: true` are intended for their custom-section
|
|
57
|
+
* view only and should be hidden from the main lobby list — including
|
|
58
|
+
* from any per-tab counters rendered next to the tab labels, otherwise
|
|
59
|
+
* the counts disagree with the number of cards the user can see.
|
|
60
|
+
*
|
|
55
61
|
* **Reading state from the returned item**
|
|
56
62
|
* Drive list bucketing and CTA labels from the SDK-computed booleans
|
|
57
63
|
* (`is_active`, `is_can_register`, `is_cancelled`, `is_finished`,
|
|
@@ -116,19 +122,22 @@ export class WSAPITournaments extends WSAPIStore {
|
|
|
116
122
|
* },
|
|
117
123
|
* });
|
|
118
124
|
*
|
|
125
|
+
* // Main lobby list — custom-section-only tournaments belong to that section's own view.
|
|
126
|
+
* const lobby = tournaments.filter(t => !t.only_in_custom_section);
|
|
127
|
+
*
|
|
119
128
|
* // Bucket items by lifecycle state for a tabbed UI.
|
|
120
|
-
* const live =
|
|
121
|
-
* const upcoming =
|
|
129
|
+
* const live = lobby.filter(t => t.is_in_progress);
|
|
130
|
+
* const upcoming = lobby
|
|
122
131
|
* .filter(t => t.is_upcoming && !t.is_user_registered)
|
|
123
132
|
* .sort((a, b) => a.start_time - b.start_time);
|
|
124
|
-
* const mine =
|
|
125
|
-
* const finished =
|
|
133
|
+
* const mine = lobby.filter(t => t.is_user_registered);
|
|
134
|
+
* const finished = lobby.filter(t => t.is_finished);
|
|
126
135
|
*
|
|
127
136
|
* console.log('[smartico] render lobby tabs with these counts: live=', live.length,
|
|
128
137
|
* 'upcoming=', upcoming.length, 'mine=', mine.length, 'finished=', finished.length);
|
|
129
138
|
*
|
|
130
139
|
* // Featured tournament: pin to position 0 of the Overview/Top tabs.
|
|
131
|
-
* const featured =
|
|
140
|
+
* const featured = lobby.find(t => t.is_featured && !t.is_cancelled);
|
|
132
141
|
* if (featured) {
|
|
133
142
|
* console.log('[smartico] featured tournament — pin to position 0 of the Overview tab:', featured.name);
|
|
134
143
|
* }
|
package/src/WSAPI/WSAPITypes.ts
CHANGED
|
@@ -389,6 +389,8 @@ export interface TTournament {
|
|
|
389
389
|
* The list of custom sections can be retrieved using _smartico.api.getCustomSections() method
|
|
390
390
|
*/
|
|
391
391
|
custom_section_id: number;
|
|
392
|
+
/** The indicator if the tournament is visible only in the custom section and should be hidden from the main overview of tournaments */
|
|
393
|
+
only_in_custom_section?: boolean;
|
|
392
394
|
/** The custom data of the tournament defined by operator. Can be a JSON object, string or number */
|
|
393
395
|
custom_data: any;
|
|
394
396
|
|
|
@@ -1192,6 +1194,22 @@ export interface LeaderBoardDetailsT {
|
|
|
1192
1194
|
me?: LeaderBoardUserT;
|
|
1193
1195
|
}
|
|
1194
1196
|
|
|
1197
|
+
/**
|
|
1198
|
+
* LeaderBoardSettingsT carries the operator's privacy configuration for
|
|
1199
|
+
* leaderboard rendering. Every flag means "hide" when `true`.
|
|
1200
|
+
*/
|
|
1201
|
+
export interface LeaderBoardSettingsT {
|
|
1202
|
+
/** When `true`, render leaderboard rows without player avatars. */
|
|
1203
|
+
hide_avatars: boolean;
|
|
1204
|
+
/** When `true`, render leaderboard rows without player level names. */
|
|
1205
|
+
hide_levels: boolean;
|
|
1206
|
+
/**
|
|
1207
|
+
* When `true`, hide the points of every player except the current user.
|
|
1208
|
+
* The current user's own points are always shown, regardless of this flag.
|
|
1209
|
+
*/
|
|
1210
|
+
hide_other_points: boolean;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1195
1213
|
/**
|
|
1196
1214
|
* LeaderBoardsRewardsT describes one place's prize on a leaderboard.
|
|
1197
1215
|
* Leaderboard prizes are always gamification points (never gems / diamonds / items).
|
|
@@ -1421,6 +1439,13 @@ export interface TRaffle {
|
|
|
1421
1439
|
image_url: string;
|
|
1422
1440
|
/** URL of the mobile image that represents the raffle, 300x142px */
|
|
1423
1441
|
image_url_mobile: string;
|
|
1442
|
+
/**
|
|
1443
|
+
* Terms and Conditions text configured by the operator for this raffle.
|
|
1444
|
+
* Render it as the raffle rules. It is absent or empty when the operator
|
|
1445
|
+
* configured none — hide the rules section in that case rather than
|
|
1446
|
+
* substituting your own copy.
|
|
1447
|
+
*/
|
|
1448
|
+
hint_text?: string;
|
|
1424
1449
|
/**
|
|
1425
1450
|
* Custom data as string or JSON string that can be used in API to build custom UI
|
|
1426
1451
|
* You can request from Smartico to define fields for your specific case that will be managed from Smartico BackOffice
|
|
@@ -1477,6 +1502,12 @@ export interface TRafflePrize {
|
|
|
1477
1502
|
* Can be used to build custom UI for gamification.
|
|
1478
1503
|
*/
|
|
1479
1504
|
custom_data?: string;
|
|
1505
|
+
/**
|
|
1506
|
+
* Indicates whether the chance to win should be hidden in the UI.
|
|
1507
|
+
* When `true`, do not render `chances_to_win_perc` for this prize.
|
|
1508
|
+
* Absent means "not hidden".
|
|
1509
|
+
*/
|
|
1510
|
+
hide_chance_to_win?: boolean;
|
|
1480
1511
|
/**
|
|
1481
1512
|
* The number of prizes available per run of the draw.
|
|
1482
1513
|
* E.g. if the draw is run daily, this is the number of prizes available each day, for example 3 iPhones.
|
package/src/index.ts
CHANGED
|
@@ -22,7 +22,7 @@ export type {
|
|
|
22
22
|
TSetAvatarResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed,
|
|
23
23
|
TTournamentRegistrationResult, TUICustomSection, TUserProfile,
|
|
24
24
|
TransformedRaffleClaimPrizeResponse, InboxMarkMessageAction, LeaderBoardDetailsT,
|
|
25
|
-
LeaderBoardUserT, LeaderBoardsRewardsT, UserLevelExtraCountersT,
|
|
25
|
+
LeaderBoardUserT, LeaderBoardsRewardsT, LeaderBoardSettingsT, UserLevelExtraCountersT,
|
|
26
26
|
} from './WSAPI/WSAPITypes';
|
|
27
27
|
|
|
28
28
|
export * from './Analytics';
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { UserBalanceType } from './UserBalanceType';
|
|
2
|
-
import { TActivityLogEntry } from '../WSAPI/WSAPITypes';
|
|
3
|
-
export declare const mapActivityLogHistory: (logHistory: unknown[]) => TActivityLogEntry[];
|
|
4
|
-
export declare const resolveWalletDisplayType: (entry: TActivityLogEntry) => UserBalanceType;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export declare enum QuizAnswersValueType {
|
|
2
|
-
HomeTeam = "1",
|
|
3
|
-
AwayTeam = "2",
|
|
4
|
-
Draw = "x",
|
|
5
|
-
HomeTeamHomeTeam = "1/1",
|
|
6
|
-
HomeTeamDraw = "1/x",
|
|
7
|
-
HomeTeamAwayTeam = "1/2",
|
|
8
|
-
DrawHomeTeam = "x/1",
|
|
9
|
-
DrawDraw = "x/x",
|
|
10
|
-
DrawAwayTeam = "x/2",
|
|
11
|
-
AwayTeamHomeTeam = "2/1",
|
|
12
|
-
AwayTeamDraw = "2/x",
|
|
13
|
-
AwayTeamAwayTeam = "2/2",
|
|
14
|
-
Yes = "yes",
|
|
15
|
-
No = "no",
|
|
16
|
-
Odd = "odd",
|
|
17
|
-
Even = "even",
|
|
18
|
-
HomeOdd = "1/odd",
|
|
19
|
-
HomeEven = "1/even",
|
|
20
|
-
AwayOdd = "2/odd",
|
|
21
|
-
AwayEven = "2/even"
|
|
22
|
-
}
|
|
23
|
-
export declare const quizAnswerHomeTeamReplacementText = "{quiz_home_team}";
|
|
24
|
-
export declare const quizAnswerAwayTeamReplacementText = "{quiz_away_team}";
|
|
25
|
-
export declare const quizDrawReplacementText = "{quiz_draw}";
|
|
26
|
-
export declare const quizYesReplacementText = "{yes}";
|
|
27
|
-
export declare const quizNoReplacementText = "{no}";
|
|
28
|
-
export declare const quizOddReplacementText = "{odd}";
|
|
29
|
-
export declare const quizEvenReplacementText = "{even}";
|
|
30
|
-
export declare const quizOrReplacementText = "{or}";
|
|
31
|
-
export declare const quizNoGoalsReplacementText = "{quiz_no_goals}";
|
|
32
|
-
export declare const quizAnswersTrKeys: {
|
|
33
|
-
"{quiz_draw}": string;
|
|
34
|
-
"{yes}": string;
|
|
35
|
-
"{no}": string;
|
|
36
|
-
"{odd}": string;
|
|
37
|
-
"{even}": string;
|
|
38
|
-
"{or}": string;
|
|
39
|
-
"{quiz_no_goals}": string;
|
|
40
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { QuizAnswersValueType } from './MarketsAnswers';
|
|
2
|
-
import { SAWGPMarketType } from './MarketsType';
|
|
3
|
-
export declare const marketsInfo: {
|
|
4
|
-
type: SAWGPMarketType;
|
|
5
|
-
name: string;
|
|
6
|
-
question: {
|
|
7
|
-
text: string;
|
|
8
|
-
trKey: string;
|
|
9
|
-
};
|
|
10
|
-
answers: {
|
|
11
|
-
text: string;
|
|
12
|
-
value: QuizAnswersValueType;
|
|
13
|
-
}[];
|
|
14
|
-
}[];
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export declare enum SAWGPMarketType {
|
|
2
|
-
TwoTeamsWithScore = 1,
|
|
3
|
-
RedCard = 2,
|
|
4
|
-
OneXTwo = 3,
|
|
5
|
-
OneXTwoHalftime = 4,
|
|
6
|
-
FirstGoal = 6,
|
|
7
|
-
DoubleChance = 7,
|
|
8
|
-
OverUnder2_5 = 8,
|
|
9
|
-
OverUnder1_5Halftime = 9,
|
|
10
|
-
OverUnder1_5__2ndHalf = 10,
|
|
11
|
-
TotalCorners8_5 = 11,
|
|
12
|
-
TotalCorners9_5 = 12,
|
|
13
|
-
Corners1x2 = 13,
|
|
14
|
-
One_Two = 14,
|
|
15
|
-
Overtime = 15,
|
|
16
|
-
OddEven = 16,
|
|
17
|
-
OddEvenHomeAway = 17,
|
|
18
|
-
FirstSet = 18,
|
|
19
|
-
SecondSet = 19,
|
|
20
|
-
ThirdSet = 20,
|
|
21
|
-
FourthSet = 21,
|
|
22
|
-
FifthSet = 22,
|
|
23
|
-
PlayerOneWinsOneSet = 23,
|
|
24
|
-
PlayerTwoWinsOneSet = 24,
|
|
25
|
-
LastGoal = 25,
|
|
26
|
-
CustomSport = 26,
|
|
27
|
-
CustomNonSport = 27
|
|
28
|
-
}
|