@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
|
@@ -6,6 +6,8 @@ export declare 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",
|
|
@@ -10,5 +10,10 @@ export declare enum BadgesTimeLimitStates {
|
|
|
10
10
|
/** After End Date (not started) */
|
|
11
11
|
AfterEndDateNotStarted = 4,
|
|
12
12
|
/** After End Date (player has some progress, but not completed) */
|
|
13
|
-
AfterEndDateWithProgress = 5
|
|
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
|
}
|
|
@@ -7,19 +7,25 @@ export declare enum RaffleDrawInstanceState {
|
|
|
7
7
|
/** Winner selection is in progress */
|
|
8
8
|
WinnerSelection = 2,
|
|
9
9
|
/** Draw is executed and the winners are selected */
|
|
10
|
-
Executed = 3
|
|
10
|
+
Executed = 3,
|
|
11
|
+
/**
|
|
12
|
+
* Draw was cancelled and will never be executed.
|
|
13
|
+
* Treat it as a terminal state: stop any polling of the draw run
|
|
14
|
+
* and do not show the winner-selection progress UI.
|
|
15
|
+
*/
|
|
16
|
+
Cancelled = 4
|
|
11
17
|
}
|
|
12
18
|
export declare enum RaffleDrawTypeExecution {
|
|
13
19
|
/** Draw is executed only once */
|
|
14
|
-
ExecDate =
|
|
20
|
+
ExecDate = 1,
|
|
15
21
|
/** Draw is executed on a recurring basis */
|
|
16
|
-
Recurring =
|
|
22
|
+
Recurring = 2,
|
|
17
23
|
/**
|
|
18
24
|
* Draw is executed once and is marked as grand.
|
|
19
25
|
* This means it is a special or significant draw,
|
|
20
26
|
* often with larger prizes or more importance.
|
|
21
27
|
*/
|
|
22
|
-
Grand =
|
|
28
|
+
Grand = 3
|
|
23
29
|
}
|
|
24
30
|
interface RaffleDraw {
|
|
25
31
|
/**
|
package/dist/SmarticoAPI.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { GetTournamentInfoResponse, GetTournamentsResponse, TournamentRegisterRe
|
|
|
11
11
|
import { LeaderBoardDetails, LeaderBoardPeriodType } from './Leaderboard';
|
|
12
12
|
import { GetLevelMapResponse } from './Level';
|
|
13
13
|
import { WSAPI } from './WSAPI/WSAPI';
|
|
14
|
-
import { TInboxMessage, TInboxMessageBody, TLevel, TMiniGameTemplate, TMissionOrBadge, TStoreCategory, TAchCategory, TStoreItem, TTournament, TTournamentDetailed, LeaderBoardDetailsT, UserLevelExtraCountersT, TSegmentCheckResult, TUICustomSection, TBonus, TRaffle, TLevelCurrent, TActivityLog, TRaffleDraw, TAvatarDefinition, TAvatarCustomized, TAvatarPrompt, TClans, TClanInfo, TClanJoinResult, TClanTournamentPlayers } from './WSAPI/WSAPITypes';
|
|
14
|
+
import { TInboxMessage, TInboxMessageBody, TLevel, TMiniGameTemplate, TMissionOrBadge, TStoreCategory, TAchCategory, TStoreItem, TTournament, TTournamentDetailed, LeaderBoardDetailsT, LeaderBoardSettingsT, UserLevelExtraCountersT, TSegmentCheckResult, TUICustomSection, TBonus, TRaffle, TLevelCurrent, TActivityLog, TRaffleDraw, TAvatarDefinition, TAvatarCustomized, TAvatarPrompt, TClans, TClanInfo, TClanJoinResult, TClanTournamentPlayers } from './WSAPI/WSAPITypes';
|
|
15
15
|
import { GetAchievementsUserInfoResponse } from './Core/GetAchievementsUserInfoResponse';
|
|
16
16
|
import { GetJackpotsPotsResponse, GetJackpotsResponse, JackpotsOptinResponse, JackpotsOptoutResponse } from './Jackpots';
|
|
17
17
|
import { GetCustomSectionsResponse } from './CustomSections';
|
|
@@ -42,6 +42,7 @@ interface Tracker {
|
|
|
42
42
|
getLabelSetting: (key: PublicLabelSettings) => any;
|
|
43
43
|
triggerExternalCallBack: (callBackKey: string, payload: any) => void;
|
|
44
44
|
getExtUserId: () => string;
|
|
45
|
+
getHash?: () => string;
|
|
45
46
|
}
|
|
46
47
|
interface IOptions {
|
|
47
48
|
logger?: ILogger;
|
|
@@ -162,6 +163,8 @@ declare class SmarticoAPI {
|
|
|
162
163
|
leaderboardsGetT(user_ext_id: string, period_type_id?: LeaderBoardPeriodType, prevPeriod?: boolean | number): Promise<LeaderBoardDetailsT>;
|
|
163
164
|
leaderboardsGetList(user_ext_id: string, force_language?: string): Promise<LeaderBoardDetails[]>;
|
|
164
165
|
leaderboardsGetListT(user_ext_id: string): Promise<LeaderBoardDetailsT[]>;
|
|
166
|
+
leaderboardsGetSettings(): LeaderBoardSettingsT;
|
|
167
|
+
private getGamificationUISettings;
|
|
165
168
|
levelsGet(user_ext_id: string, force_language?: string): Promise<GetLevelMapResponse>;
|
|
166
169
|
levelsGetT(user_ext_id: string): Promise<TLevel[]>;
|
|
167
170
|
getLevelCurrent(user_ext_id: string): Promise<TLevelCurrent>;
|
package/dist/SmarticoGlobal.d.ts
CHANGED
|
@@ -154,6 +154,8 @@ export interface SmarticoGlobal {
|
|
|
154
154
|
suspendInbox(flag: boolean): void;
|
|
155
155
|
/** Temporarily suspend/resume mini-games. */
|
|
156
156
|
suspendMiniGames(flag: boolean): void;
|
|
157
|
+
/** Temporarily suspend/resume forms. */
|
|
158
|
+
suspendForms(flag: boolean): void;
|
|
157
159
|
/** Show a visitor-mode game. */
|
|
158
160
|
showVisitorGame(params: Record<string, unknown>): void;
|
|
159
161
|
/** Convert a visitor-mode win into an identified reward. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LeaderBoardDetailsT } from './WSAPITypes';
|
|
1
|
+
import { LeaderBoardDetailsT, LeaderBoardSettingsT } from './WSAPITypes';
|
|
2
2
|
import { LeaderBoardPeriodType } from '../Leaderboard';
|
|
3
3
|
import { WSAPIGamePick } from './WSAPIGamePick';
|
|
4
4
|
/** @group LeaderBoard */
|
|
@@ -194,4 +194,52 @@ export declare class WSAPILeaderBoard extends WSAPIGamePick {
|
|
|
194
194
|
* ```
|
|
195
195
|
*/
|
|
196
196
|
getLeaderBoards(): Promise<LeaderBoardDetailsT[]>;
|
|
197
|
+
/**
|
|
198
|
+
* Returns the operator's privacy configuration for leaderboard rendering.
|
|
199
|
+
* Apply it to every leaderboard row you draw — the standings returned by
|
|
200
|
+
* {@link getLeaderBoard} always carry `avatar_url`, `level_id` and
|
|
201
|
+
* `points`, so honouring these flags is the consumer's responsibility.
|
|
202
|
+
* Ignoring them surfaces data the operator asked to keep private.
|
|
203
|
+
*
|
|
204
|
+
* @remarks
|
|
205
|
+
* **Flags** — each is `true` when the corresponding data must be hidden:
|
|
206
|
+
* - `hide_avatars` — draw rows without the player avatar.
|
|
207
|
+
* - `hide_levels` — draw rows without the player's level name.
|
|
208
|
+
* - `hide_other_points` — hide `points` for every row except the current
|
|
209
|
+
* user's. The current user always sees their own points.
|
|
210
|
+
*
|
|
211
|
+
* **Defaults on an unconfigured label** — `hide_avatars` and
|
|
212
|
+
* `hide_levels` default to `false` (show), while `hide_other_points`
|
|
213
|
+
* defaults to `true` (hide) unless the operator explicitly turned it off.
|
|
214
|
+
* The asymmetry is intentional: it matches the default Smartico UI, so a
|
|
215
|
+
* consumer rendering its own leaderboard next to the built-in one agrees
|
|
216
|
+
* with it rather than exposing points the built-in surface hides.
|
|
217
|
+
*
|
|
218
|
+
* **Synchronous** — the settings arrive with the session handshake, so
|
|
219
|
+
* this returns immediately and never issues a round-trip. Call it on
|
|
220
|
+
* every render rather than caching the result yourself.
|
|
221
|
+
*
|
|
222
|
+
* **Idempotency / Side effects**: safe. Read-only.
|
|
223
|
+
*
|
|
224
|
+
* **Visitor mode**: supported. Returns the same label-level configuration.
|
|
225
|
+
*
|
|
226
|
+
* @returns The resolved leaderboard privacy flags. Never `null`.
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* ```ts
|
|
230
|
+
* import { LeaderBoardPeriodType } from '@smartico/public-api';
|
|
231
|
+
*
|
|
232
|
+
* const settings = window._smartico.api.getLeaderBoardSettings();
|
|
233
|
+
* const board = await window._smartico.api.getLeaderBoard(LeaderBoardPeriodType.WEEKLY);
|
|
234
|
+
*
|
|
235
|
+
* for (const row of board?.users ?? []) {
|
|
236
|
+
* const showPoints = row.is_me || !settings.hide_other_points;
|
|
237
|
+
*
|
|
238
|
+
* console.log('[smartico] render row', row.position, row.public_username,
|
|
239
|
+
* settings.hide_avatars ? '(no avatar)' : row.avatar_url,
|
|
240
|
+
* showPoints ? row.points : '(points hidden)');
|
|
241
|
+
* }
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
getLeaderBoardSettings(): LeaderBoardSettingsT;
|
|
197
245
|
}
|
|
@@ -195,7 +195,11 @@ export declare class WSAPIMissions extends WSAPIGeneral {
|
|
|
195
195
|
* as undefined / default. Time windows are absolute calendar timestamps
|
|
196
196
|
* (`active_from_ts` / `active_till_ts`), not opt-in-relative durations —
|
|
197
197
|
* drive availability chips from the SDK-computed `badgeTimeLimitState`
|
|
198
|
-
* (enum {@link BadgesTimeLimitStates}), not `time_limit_ms`.
|
|
198
|
+
* (enum {@link BadgesTimeLimitStates}), not `time_limit_ms`. A badge
|
|
199
|
+
* with no `active_till_ts` is open-ended and never reaches the
|
|
200
|
+
* "after end date" states — it reports `AfterStartDateNoProgress`
|
|
201
|
+
* or `AfterStartDateWithProgress` — so it must never be rendered as
|
|
202
|
+
* expired. Locking for
|
|
199
203
|
* badges is purely time-based: `is_locked` is `true` only when
|
|
200
204
|
* `badgeTimeLimitState === BadgesTimeLimitStates.BeforeStartDate` (the
|
|
201
205
|
* time window hasn't started yet). The primary navigation field is
|
|
@@ -48,8 +48,12 @@ export declare class WSAPIRaffles extends WSAPIJackpots {
|
|
|
48
48
|
* sold-out message).
|
|
49
49
|
* - Within each draw, `current_state`
|
|
50
50
|
* ({@link RaffleDrawInstanceState}) buckets the draw into Open
|
|
51
|
-
* (accepting tickets), WinnerSelection (currently drawing),
|
|
52
|
-
* Executed (winners selected).
|
|
51
|
+
* (accepting tickets), WinnerSelection (currently drawing),
|
|
52
|
+
* Executed (winners selected), or Cancelled (will never run).
|
|
53
|
+
* Treat every state other than Open and WinnerSelection as
|
|
54
|
+
* terminal — stop polling the draw run and clear any
|
|
55
|
+
* "drawing in progress" indicator, otherwise a cancelled draw
|
|
56
|
+
* leaves the UI spinning forever.
|
|
53
57
|
* - `execution_type` ({@link RaffleDrawTypeExecution}) distinguishes
|
|
54
58
|
* one-shot (`ExecDate`), repeating (`Recurring`), or special
|
|
55
59
|
* one-shot (`Grand`) draws. Recurring draws share a stable
|
|
@@ -41,6 +41,12 @@ export declare class WSAPITournaments extends WSAPIStore {
|
|
|
41
41
|
* tournaments not yet published. SDK consumers receive only items
|
|
42
42
|
* the user is eligible to see; no client-side gating is required.
|
|
43
43
|
*
|
|
44
|
+
* Client-side filtering you may still want: tournaments with
|
|
45
|
+
* `only_in_custom_section: true` are intended for their custom-section
|
|
46
|
+
* view only and should be hidden from the main lobby list — including
|
|
47
|
+
* from any per-tab counters rendered next to the tab labels, otherwise
|
|
48
|
+
* the counts disagree with the number of cards the user can see.
|
|
49
|
+
*
|
|
44
50
|
* **Reading state from the returned item**
|
|
45
51
|
* Drive list bucketing and CTA labels from the SDK-computed booleans
|
|
46
52
|
* (`is_active`, `is_can_register`, `is_cancelled`, `is_finished`,
|
|
@@ -105,19 +111,22 @@ export declare class WSAPITournaments extends WSAPIStore {
|
|
|
105
111
|
* },
|
|
106
112
|
* });
|
|
107
113
|
*
|
|
114
|
+
* // Main lobby list — custom-section-only tournaments belong to that section's own view.
|
|
115
|
+
* const lobby = tournaments.filter(t => !t.only_in_custom_section);
|
|
116
|
+
*
|
|
108
117
|
* // Bucket items by lifecycle state for a tabbed UI.
|
|
109
|
-
* const live =
|
|
110
|
-
* const upcoming =
|
|
118
|
+
* const live = lobby.filter(t => t.is_in_progress);
|
|
119
|
+
* const upcoming = lobby
|
|
111
120
|
* .filter(t => t.is_upcoming && !t.is_user_registered)
|
|
112
121
|
* .sort((a, b) => a.start_time - b.start_time);
|
|
113
|
-
* const mine =
|
|
114
|
-
* const finished =
|
|
122
|
+
* const mine = lobby.filter(t => t.is_user_registered);
|
|
123
|
+
* const finished = lobby.filter(t => t.is_finished);
|
|
115
124
|
*
|
|
116
125
|
* console.log('[smartico] render lobby tabs with these counts: live=', live.length,
|
|
117
126
|
* 'upcoming=', upcoming.length, 'mine=', mine.length, 'finished=', finished.length);
|
|
118
127
|
*
|
|
119
128
|
* // Featured tournament: pin to position 0 of the Overview/Top tabs.
|
|
120
|
-
* const featured =
|
|
129
|
+
* const featured = lobby.find(t => t.is_featured && !t.is_cancelled);
|
|
121
130
|
* if (featured) {
|
|
122
131
|
* console.log('[smartico] featured tournament — pin to position 0 of the Overview tab:', featured.name);
|
|
123
132
|
* }
|
|
@@ -364,6 +364,8 @@ export interface TTournament {
|
|
|
364
364
|
* The list of custom sections can be retrieved using _smartico.api.getCustomSections() method
|
|
365
365
|
*/
|
|
366
366
|
custom_section_id: number;
|
|
367
|
+
/** The indicator if the tournament is visible only in the custom section and should be hidden from the main overview of tournaments */
|
|
368
|
+
only_in_custom_section?: boolean;
|
|
367
369
|
/** The custom data of the tournament defined by operator. Can be a JSON object, string or number */
|
|
368
370
|
custom_data: any;
|
|
369
371
|
/** The indicator if the tournament is 'Featured' */
|
|
@@ -1126,6 +1128,21 @@ export interface LeaderBoardDetailsT {
|
|
|
1126
1128
|
* unranked / outside the ranked window. */
|
|
1127
1129
|
me?: LeaderBoardUserT;
|
|
1128
1130
|
}
|
|
1131
|
+
/**
|
|
1132
|
+
* LeaderBoardSettingsT carries the operator's privacy configuration for
|
|
1133
|
+
* leaderboard rendering. Every flag means "hide" when `true`.
|
|
1134
|
+
*/
|
|
1135
|
+
export interface LeaderBoardSettingsT {
|
|
1136
|
+
/** When `true`, render leaderboard rows without player avatars. */
|
|
1137
|
+
hide_avatars: boolean;
|
|
1138
|
+
/** When `true`, render leaderboard rows without player level names. */
|
|
1139
|
+
hide_levels: boolean;
|
|
1140
|
+
/**
|
|
1141
|
+
* When `true`, hide the points of every player except the current user.
|
|
1142
|
+
* The current user's own points are always shown, regardless of this flag.
|
|
1143
|
+
*/
|
|
1144
|
+
hide_other_points: boolean;
|
|
1145
|
+
}
|
|
1129
1146
|
/**
|
|
1130
1147
|
* LeaderBoardsRewardsT describes one place's prize on a leaderboard.
|
|
1131
1148
|
* Leaderboard prizes are always gamification points (never gems / diamonds / items).
|
|
@@ -1346,6 +1363,13 @@ export interface TRaffle {
|
|
|
1346
1363
|
image_url: string;
|
|
1347
1364
|
/** URL of the mobile image that represents the raffle, 300x142px */
|
|
1348
1365
|
image_url_mobile: string;
|
|
1366
|
+
/**
|
|
1367
|
+
* Terms and Conditions text configured by the operator for this raffle.
|
|
1368
|
+
* Render it as the raffle rules. It is absent or empty when the operator
|
|
1369
|
+
* configured none — hide the rules section in that case rather than
|
|
1370
|
+
* substituting your own copy.
|
|
1371
|
+
*/
|
|
1372
|
+
hint_text?: string;
|
|
1349
1373
|
/**
|
|
1350
1374
|
* Custom data as string or JSON string that can be used in API to build custom UI
|
|
1351
1375
|
* You can request from Smartico to define fields for your specific case that will be managed from Smartico BackOffice
|
|
@@ -1399,6 +1423,12 @@ export interface TRafflePrize {
|
|
|
1399
1423
|
* Can be used to build custom UI for gamification.
|
|
1400
1424
|
*/
|
|
1401
1425
|
custom_data?: string;
|
|
1426
|
+
/**
|
|
1427
|
+
* Indicates whether the chance to win should be hidden in the UI.
|
|
1428
|
+
* When `true`, do not render `chances_to_win_perc` for this prize.
|
|
1429
|
+
* Absent means "not hidden".
|
|
1430
|
+
*/
|
|
1431
|
+
hide_chance_to_win?: boolean;
|
|
1402
1432
|
/**
|
|
1403
1433
|
* The number of prizes available per run of the draw.
|
|
1404
1434
|
* E.g. if the draw is run daily, this is the number of prizes available each day, for example 3 iPhones.
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export * from './SmarticoAPI';
|
|
|
4
4
|
export * from './WSAPI/WSAPI';
|
|
5
5
|
export * from './SmarticoGlobal';
|
|
6
6
|
export * from './CookieStore';
|
|
7
|
-
export type { TAchCategory, TActivityLog, TActivityLogEntry, TAvatarCustomized, TAvatarDefinition, TAvatarPrompt, TBonus, TBuyStoreItemResult, TClaimBonusResult, TClan, TClanInfo, TClanJoinResult, TClanTournamentPlayers, TClans, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TLevelCurrent, TMiniGamePlayBatchResult, TMiniGamePlayResult, TMiniGamePrize, TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TMissionOrBadgeTask, TRaffle, TRaffleDraw, TRaffleDrawRun, TRaffleOptinResponse, TRafflePrize, TRafflePrizeWinner, TRaffleTicket, TSawHistory, TSegmentCheckResult, TSetAvatarResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUICustomSection, TUserProfile, TransformedRaffleClaimPrizeResponse, InboxMarkMessageAction, LeaderBoardDetailsT, LeaderBoardUserT, LeaderBoardsRewardsT, UserLevelExtraCountersT, } from './WSAPI/WSAPITypes';
|
|
7
|
+
export type { TAchCategory, TActivityLog, TActivityLogEntry, TAvatarCustomized, TAvatarDefinition, TAvatarPrompt, TBonus, TBuyStoreItemResult, TClaimBonusResult, TClan, TClanInfo, TClanJoinResult, TClanTournamentPlayers, TClans, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TLevelCurrent, TMiniGamePlayBatchResult, TMiniGamePlayResult, TMiniGamePrize, TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TMissionOrBadgeTask, TRaffle, TRaffleDraw, TRaffleDrawRun, TRaffleOptinResponse, TRafflePrize, TRafflePrizeWinner, TRaffleTicket, TSawHistory, TSegmentCheckResult, TSetAvatarResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUICustomSection, TUserProfile, TransformedRaffleClaimPrizeResponse, InboxMarkMessageAction, LeaderBoardDetailsT, LeaderBoardUserT, LeaderBoardsRewardsT, LeaderBoardSettingsT, UserLevelExtraCountersT, } from './WSAPI/WSAPITypes';
|
|
8
8
|
export * from './Analytics';
|
|
9
9
|
export * from './Core';
|
|
10
10
|
export * from './UserProfile';
|
package/dist/index.js
CHANGED
|
@@ -904,6 +904,8 @@ exports.PublicLabelSettings = void 0;
|
|
|
904
904
|
PublicLabelSettings["GAMIFICATION_UI_WIDGET"] = "GAMIFICATION_UI_WIDGET";
|
|
905
905
|
PublicLabelSettings["GAMIFICATION_UI_MINI_GAME"] = "GAMIFICATION_UI_MINI_GAME";
|
|
906
906
|
PublicLabelSettings["GAMIFICATION_UI_SETTINGS"] = "GAMIFICATION_UI_SETTINGS";
|
|
907
|
+
PublicLabelSettings["GAMIFICATION_UI_SETTINGS_V2"] = "GAMIFICATION_UI_SETTINGS_V2";
|
|
908
|
+
PublicLabelSettings["GAMIFICATION_UI_SETTINGS_TEST_V2"] = "GAMIFICATION_UI_SETTINGS_TEST_V2";
|
|
907
909
|
PublicLabelSettings["GAMIFICATION_UI_MAIN_TEST"] = "GAMIFICATION_UI_MAIN_TEST";
|
|
908
910
|
PublicLabelSettings["GAMIFICATION_UI_WIDGET_TEST"] = "GAMIFICATION_UI_WIDGET_TEST";
|
|
909
911
|
PublicLabelSettings["GAMIFICATION_UI_SETTINGS_TEST"] = "GAMIFICATION_UI_SETTINGS_TEST";
|
|
@@ -1314,6 +1316,11 @@ exports.BadgesTimeLimitStates = void 0;
|
|
|
1314
1316
|
BadgesTimeLimitStates[BadgesTimeLimitStates["AfterEndDateNotStarted"] = 4] = "AfterEndDateNotStarted";
|
|
1315
1317
|
/** After End Date (player has some progress, but not completed) */
|
|
1316
1318
|
BadgesTimeLimitStates[BadgesTimeLimitStates["AfterEndDateWithProgress"] = 5] = "AfterEndDateWithProgress";
|
|
1319
|
+
/**
|
|
1320
|
+
* After Start Date, player has some progress, and the badge has no End Date.
|
|
1321
|
+
* The badge is still earnable — do not render it as expired.
|
|
1322
|
+
*/
|
|
1323
|
+
BadgesTimeLimitStates[BadgesTimeLimitStates["AfterStartDateWithProgress"] = 6] = "AfterStartDateWithProgress";
|
|
1317
1324
|
})(exports.BadgesTimeLimitStates || (exports.BadgesTimeLimitStates = {}));
|
|
1318
1325
|
|
|
1319
1326
|
var _MissionUtils;
|
|
@@ -1580,8 +1587,7 @@ MissionUtils.determineBadgeState = function (badge) {
|
|
|
1580
1587
|
if (progress === 0) {
|
|
1581
1588
|
return exports.BadgesTimeLimitStates.AfterStartDateNoProgress;
|
|
1582
1589
|
}
|
|
1583
|
-
|
|
1584
|
-
// (but if needed we can add one)
|
|
1590
|
+
return exports.BadgesTimeLimitStates.AfterStartDateWithProgress;
|
|
1585
1591
|
}
|
|
1586
1592
|
// 3. AFTER START, BEFORE END DATE
|
|
1587
1593
|
if (now < active_till_ts) {
|
|
@@ -1936,6 +1942,7 @@ var TournamentItemsTransform = function TournamentItemsTransform(items) {
|
|
|
1936
1942
|
prize_pool_short: r.publicMeta.prize_pool_short,
|
|
1937
1943
|
custom_price_text: r.publicMeta.custom_price_text,
|
|
1938
1944
|
custom_section_id: r.publicMeta.custom_section_id,
|
|
1945
|
+
only_in_custom_section: r.publicMeta.only_in_custom_section,
|
|
1939
1946
|
custom_data: IntUtils.JsonOrText(r.publicMeta.custom_data),
|
|
1940
1947
|
is_featured: r.publicMeta.featured,
|
|
1941
1948
|
ribbon: r.publicMeta.label_tag === 'custom' ? r.publicMeta.custom_label_tag : r.publicMeta.label_tag,
|
|
@@ -2328,6 +2335,7 @@ var prizeTransform = function prizeTransform(items) {
|
|
|
2328
2335
|
description: item.public_meta.description,
|
|
2329
2336
|
image_url: item.public_meta.image_url,
|
|
2330
2337
|
custom_data: item.public_meta.custom_data,
|
|
2338
|
+
hide_chance_to_win: item.public_meta.hide_chance_to_win,
|
|
2331
2339
|
prizes_per_run: item.prizes_per_run,
|
|
2332
2340
|
prizes_per_run_actual: item.prizes_per_run_actual,
|
|
2333
2341
|
chances_to_win_perc: item.chances_to_win_perc,
|
|
@@ -2386,6 +2394,7 @@ var raffleTransform = function raffleTransform(items) {
|
|
|
2386
2394
|
custom_section_id: item.public_meta.custom_section_id,
|
|
2387
2395
|
image_url: item.public_meta.image_url,
|
|
2388
2396
|
image_url_mobile: item.public_meta.image_url_mobile,
|
|
2397
|
+
hint_text: item.public_meta.hint_text,
|
|
2389
2398
|
custom_data: item.public_meta.custom_data,
|
|
2390
2399
|
start_date: item.start_date_ts,
|
|
2391
2400
|
end_date: item.end_date_ts,
|
|
@@ -2449,19 +2458,25 @@ exports.RaffleDrawInstanceState = void 0;
|
|
|
2449
2458
|
RaffleDrawInstanceState[RaffleDrawInstanceState["WinnerSelection"] = 2] = "WinnerSelection";
|
|
2450
2459
|
/** Draw is executed and the winners are selected */
|
|
2451
2460
|
RaffleDrawInstanceState[RaffleDrawInstanceState["Executed"] = 3] = "Executed";
|
|
2461
|
+
/**
|
|
2462
|
+
* Draw was cancelled and will never be executed.
|
|
2463
|
+
* Treat it as a terminal state: stop any polling of the draw run
|
|
2464
|
+
* and do not show the winner-selection progress UI.
|
|
2465
|
+
*/
|
|
2466
|
+
RaffleDrawInstanceState[RaffleDrawInstanceState["Cancelled"] = 4] = "Cancelled";
|
|
2452
2467
|
})(exports.RaffleDrawInstanceState || (exports.RaffleDrawInstanceState = {}));
|
|
2453
2468
|
exports.RaffleDrawTypeExecution = void 0;
|
|
2454
2469
|
(function (RaffleDrawTypeExecution) {
|
|
2455
2470
|
/** Draw is executed only once */
|
|
2456
|
-
RaffleDrawTypeExecution[RaffleDrawTypeExecution["ExecDate"] =
|
|
2471
|
+
RaffleDrawTypeExecution[RaffleDrawTypeExecution["ExecDate"] = 1] = "ExecDate";
|
|
2457
2472
|
/** Draw is executed on a recurring basis */
|
|
2458
|
-
RaffleDrawTypeExecution[RaffleDrawTypeExecution["Recurring"] =
|
|
2473
|
+
RaffleDrawTypeExecution[RaffleDrawTypeExecution["Recurring"] = 2] = "Recurring";
|
|
2459
2474
|
/**
|
|
2460
2475
|
* Draw is executed once and is marked as grand.
|
|
2461
2476
|
* This means it is a special or significant draw,
|
|
2462
2477
|
* often with larger prizes or more importance.
|
|
2463
2478
|
*/
|
|
2464
|
-
RaffleDrawTypeExecution[RaffleDrawTypeExecution["Grand"] =
|
|
2479
|
+
RaffleDrawTypeExecution[RaffleDrawTypeExecution["Grand"] = 3] = "Grand";
|
|
2465
2480
|
})(exports.RaffleDrawTypeExecution || (exports.RaffleDrawTypeExecution = {}));
|
|
2466
2481
|
|
|
2467
2482
|
/** @hidden */
|
|
@@ -3579,7 +3594,11 @@ var WSAPIMissions = /*#__PURE__*/function (_WSAPIGeneral) {
|
|
|
3579
3594
|
* as undefined / default. Time windows are absolute calendar timestamps
|
|
3580
3595
|
* (`active_from_ts` / `active_till_ts`), not opt-in-relative durations —
|
|
3581
3596
|
* drive availability chips from the SDK-computed `badgeTimeLimitState`
|
|
3582
|
-
* (enum {@link BadgesTimeLimitStates}), not `time_limit_ms`.
|
|
3597
|
+
* (enum {@link BadgesTimeLimitStates}), not `time_limit_ms`. A badge
|
|
3598
|
+
* with no `active_till_ts` is open-ended and never reaches the
|
|
3599
|
+
* "after end date" states — it reports `AfterStartDateNoProgress`
|
|
3600
|
+
* or `AfterStartDateWithProgress` — so it must never be rendered as
|
|
3601
|
+
* expired. Locking for
|
|
3583
3602
|
* badges is purely time-based: `is_locked` is `true` only when
|
|
3584
3603
|
* `badgeTimeLimitState === BadgesTimeLimitStates.BeforeStartDate` (the
|
|
3585
3604
|
* time window hasn't started yet). The primary navigation field is
|
|
@@ -5075,6 +5094,12 @@ var WSAPITournaments = /*#__PURE__*/function (_WSAPIStore) {
|
|
|
5075
5094
|
* tournaments not yet published. SDK consumers receive only items
|
|
5076
5095
|
* the user is eligible to see; no client-side gating is required.
|
|
5077
5096
|
*
|
|
5097
|
+
* Client-side filtering you may still want: tournaments with
|
|
5098
|
+
* `only_in_custom_section: true` are intended for their custom-section
|
|
5099
|
+
* view only and should be hidden from the main lobby list — including
|
|
5100
|
+
* from any per-tab counters rendered next to the tab labels, otherwise
|
|
5101
|
+
* the counts disagree with the number of cards the user can see.
|
|
5102
|
+
*
|
|
5078
5103
|
* **Reading state from the returned item**
|
|
5079
5104
|
* Drive list bucketing and CTA labels from the SDK-computed booleans
|
|
5080
5105
|
* (`is_active`, `is_can_register`, `is_cancelled`, `is_finished`,
|
|
@@ -5139,19 +5164,22 @@ var WSAPITournaments = /*#__PURE__*/function (_WSAPIStore) {
|
|
|
5139
5164
|
* },
|
|
5140
5165
|
* });
|
|
5141
5166
|
*
|
|
5167
|
+
* // Main lobby list — custom-section-only tournaments belong to that section's own view.
|
|
5168
|
+
* const lobby = tournaments.filter(t => !t.only_in_custom_section);
|
|
5169
|
+
*
|
|
5142
5170
|
* // Bucket items by lifecycle state for a tabbed UI.
|
|
5143
|
-
* const live =
|
|
5144
|
-
* const upcoming =
|
|
5171
|
+
* const live = lobby.filter(t => t.is_in_progress);
|
|
5172
|
+
* const upcoming = lobby
|
|
5145
5173
|
* .filter(t => t.is_upcoming && !t.is_user_registered)
|
|
5146
5174
|
* .sort((a, b) => a.start_time - b.start_time);
|
|
5147
|
-
* const mine =
|
|
5148
|
-
* const finished =
|
|
5175
|
+
* const mine = lobby.filter(t => t.is_user_registered);
|
|
5176
|
+
* const finished = lobby.filter(t => t.is_finished);
|
|
5149
5177
|
*
|
|
5150
5178
|
* console.log('[smartico] render lobby tabs with these counts: live=', live.length,
|
|
5151
5179
|
* 'upcoming=', upcoming.length, 'mine=', mine.length, 'finished=', finished.length);
|
|
5152
5180
|
*
|
|
5153
5181
|
* // Featured tournament: pin to position 0 of the Overview/Top tabs.
|
|
5154
|
-
* const featured =
|
|
5182
|
+
* const featured = lobby.find(t => t.is_featured && !t.is_cancelled);
|
|
5155
5183
|
* if (featured) {
|
|
5156
5184
|
* console.log('[smartico] featured tournament — pin to position 0 of the Overview tab:', featured.name);
|
|
5157
5185
|
* }
|
|
@@ -6552,8 +6580,12 @@ var WSAPIRaffles = /*#__PURE__*/function (_WSAPIJackpots) {
|
|
|
6552
6580
|
* sold-out message).
|
|
6553
6581
|
* - Within each draw, `current_state`
|
|
6554
6582
|
* ({@link RaffleDrawInstanceState}) buckets the draw into Open
|
|
6555
|
-
* (accepting tickets), WinnerSelection (currently drawing),
|
|
6556
|
-
* Executed (winners selected).
|
|
6583
|
+
* (accepting tickets), WinnerSelection (currently drawing),
|
|
6584
|
+
* Executed (winners selected), or Cancelled (will never run).
|
|
6585
|
+
* Treat every state other than Open and WinnerSelection as
|
|
6586
|
+
* terminal — stop polling the draw run and clear any
|
|
6587
|
+
* "drawing in progress" indicator, otherwise a cancelled draw
|
|
6588
|
+
* leaves the UI spinning forever.
|
|
6557
6589
|
* - `execution_type` ({@link RaffleDrawTypeExecution}) distinguishes
|
|
6558
6590
|
* one-shot (`ExecDate`), repeating (`Recurring`), or special
|
|
6559
6591
|
* one-shot (`Grand`) draws. Recurring draws share a stable
|
|
@@ -9365,6 +9397,57 @@ var WSAPILeaderBoard = /*#__PURE__*/function (_WSAPIGamePick) {
|
|
|
9365
9397
|
} catch (e) {
|
|
9366
9398
|
return Promise.reject(e);
|
|
9367
9399
|
}
|
|
9400
|
+
}
|
|
9401
|
+
/**
|
|
9402
|
+
* Returns the operator's privacy configuration for leaderboard rendering.
|
|
9403
|
+
* Apply it to every leaderboard row you draw — the standings returned by
|
|
9404
|
+
* {@link getLeaderBoard} always carry `avatar_url`, `level_id` and
|
|
9405
|
+
* `points`, so honouring these flags is the consumer's responsibility.
|
|
9406
|
+
* Ignoring them surfaces data the operator asked to keep private.
|
|
9407
|
+
*
|
|
9408
|
+
* @remarks
|
|
9409
|
+
* **Flags** — each is `true` when the corresponding data must be hidden:
|
|
9410
|
+
* - `hide_avatars` — draw rows without the player avatar.
|
|
9411
|
+
* - `hide_levels` — draw rows without the player's level name.
|
|
9412
|
+
* - `hide_other_points` — hide `points` for every row except the current
|
|
9413
|
+
* user's. The current user always sees their own points.
|
|
9414
|
+
*
|
|
9415
|
+
* **Defaults on an unconfigured label** — `hide_avatars` and
|
|
9416
|
+
* `hide_levels` default to `false` (show), while `hide_other_points`
|
|
9417
|
+
* defaults to `true` (hide) unless the operator explicitly turned it off.
|
|
9418
|
+
* The asymmetry is intentional: it matches the default Smartico UI, so a
|
|
9419
|
+
* consumer rendering its own leaderboard next to the built-in one agrees
|
|
9420
|
+
* with it rather than exposing points the built-in surface hides.
|
|
9421
|
+
*
|
|
9422
|
+
* **Synchronous** — the settings arrive with the session handshake, so
|
|
9423
|
+
* this returns immediately and never issues a round-trip. Call it on
|
|
9424
|
+
* every render rather than caching the result yourself.
|
|
9425
|
+
*
|
|
9426
|
+
* **Idempotency / Side effects**: safe. Read-only.
|
|
9427
|
+
*
|
|
9428
|
+
* **Visitor mode**: supported. Returns the same label-level configuration.
|
|
9429
|
+
*
|
|
9430
|
+
* @returns The resolved leaderboard privacy flags. Never `null`.
|
|
9431
|
+
*
|
|
9432
|
+
* @example
|
|
9433
|
+
* ```ts
|
|
9434
|
+
* import { LeaderBoardPeriodType } from '@smartico/public-api';
|
|
9435
|
+
*
|
|
9436
|
+
* const settings = window._smartico.api.getLeaderBoardSettings();
|
|
9437
|
+
* const board = await window._smartico.api.getLeaderBoard(LeaderBoardPeriodType.WEEKLY);
|
|
9438
|
+
*
|
|
9439
|
+
* for (const row of board?.users ?? []) {
|
|
9440
|
+
* const showPoints = row.is_me || !settings.hide_other_points;
|
|
9441
|
+
*
|
|
9442
|
+
* console.log('[smartico] render row', row.position, row.public_username,
|
|
9443
|
+
* settings.hide_avatars ? '(no avatar)' : row.avatar_url,
|
|
9444
|
+
* showPoints ? row.points : '(points hidden)');
|
|
9445
|
+
* }
|
|
9446
|
+
* ```
|
|
9447
|
+
*/
|
|
9448
|
+
;
|
|
9449
|
+
_proto.getLeaderBoardSettings = function getLeaderBoardSettings() {
|
|
9450
|
+
return this.api.leaderboardsGetSettings();
|
|
9368
9451
|
};
|
|
9369
9452
|
return WSAPILeaderBoard;
|
|
9370
9453
|
}(WSAPIGamePick);
|
|
@@ -11639,6 +11722,43 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
11639
11722
|
return Promise.reject(e);
|
|
11640
11723
|
}
|
|
11641
11724
|
};
|
|
11725
|
+
_proto.leaderboardsGetSettings = function leaderboardsGetSettings() {
|
|
11726
|
+
// Defaults match the default Smartico UI when the operator has not
|
|
11727
|
+
// configured the gamification UI settings: avatars and levels are
|
|
11728
|
+
// shown, other players' points are not.
|
|
11729
|
+
var settings = this.getGamificationUISettings();
|
|
11730
|
+
return {
|
|
11731
|
+
hide_avatars: (settings == null ? void 0 : settings.hide_avatars_leaderboards) === true,
|
|
11732
|
+
hide_levels: (settings == null ? void 0 : settings.leaderboard_hide_levels) === true,
|
|
11733
|
+
// Deliberately asymmetric: points stay hidden unless the operator
|
|
11734
|
+
// explicitly opted in by setting the flag to false. This mirrors the
|
|
11735
|
+
// default Smartico UI, so a consumer rendering both surfaces agrees
|
|
11736
|
+
// with it on an unconfigured label.
|
|
11737
|
+
hide_other_points: (settings == null ? void 0 : settings.leaderboard_hide_other_points) !== false
|
|
11738
|
+
};
|
|
11739
|
+
};
|
|
11740
|
+
_proto.getGamificationUISettings = function getGamificationUISettings() {
|
|
11741
|
+
var _this$tracker$userPub;
|
|
11742
|
+
if (!this.tracker) {
|
|
11743
|
+
return null;
|
|
11744
|
+
}
|
|
11745
|
+
var parse = function parse(raw) {
|
|
11746
|
+
if (typeof raw !== 'string' || raw.length === 0) {
|
|
11747
|
+
return null;
|
|
11748
|
+
}
|
|
11749
|
+
try {
|
|
11750
|
+
var parsed = JSON.parse(raw);
|
|
11751
|
+
return parsed && Object.keys(parsed).length ? parsed : null;
|
|
11752
|
+
} catch (e) {
|
|
11753
|
+
return null;
|
|
11754
|
+
}
|
|
11755
|
+
};
|
|
11756
|
+
// Test accounts read the operator's test variant when one is configured;
|
|
11757
|
+
// everyone else reads the live settings.
|
|
11758
|
+
var isTestAccount = ((_this$tracker$userPub = this.tracker.userPublicProps) == null ? void 0 : _this$tracker$userPub.core_is_test_account) === true;
|
|
11759
|
+
var testSettings = isTestAccount ? parse(this.tracker.getLabelSetting(exports.PublicLabelSettings.GAMIFICATION_UI_SETTINGS_TEST_V2)) : null;
|
|
11760
|
+
return testSettings || parse(this.tracker.getLabelSetting(exports.PublicLabelSettings.GAMIFICATION_UI_SETTINGS_V2));
|
|
11761
|
+
};
|
|
11642
11762
|
_proto.levelsGet = function levelsGet(user_ext_id, force_language) {
|
|
11643
11763
|
try {
|
|
11644
11764
|
var _this58 = this;
|
|
@@ -11866,12 +11986,16 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
11866
11986
|
}
|
|
11867
11987
|
};
|
|
11868
11988
|
_proto.buildGamesApiParams = function buildGamesApiParams() {
|
|
11869
|
-
var _this$tracker$
|
|
11989
|
+
var _this$tracker$userPub2, _this$tracker$userPub3, _this$tracker$getHash, _this$tracker;
|
|
11870
11990
|
var params = Object.assign({}, this.baseRgApiParams, {
|
|
11871
|
-
ext_user_id: (_this$tracker$
|
|
11991
|
+
ext_user_id: (_this$tracker$userPub2 = this.tracker.userPublicProps) == null ? void 0 : _this$tracker$userPub2.user_id,
|
|
11872
11992
|
smartico_ext_user_id: this.tracker.getExtUserId(),
|
|
11873
|
-
lang: (_this$tracker$
|
|
11993
|
+
lang: (_this$tracker$userPub3 = this.tracker.userPublicProps) == null ? void 0 : _this$tracker$userPub3.core_user_language
|
|
11874
11994
|
});
|
|
11995
|
+
var user_hash = (_this$tracker$getHash = (_this$tracker = this.tracker).getHash) == null ? void 0 : _this$tracker$getHash.call(_this$tracker);
|
|
11996
|
+
if (user_hash) {
|
|
11997
|
+
params.user_hash = user_hash;
|
|
11998
|
+
}
|
|
11875
11999
|
return params;
|
|
11876
12000
|
};
|
|
11877
12001
|
_proto.sendGamesApi = function sendGamesApi(_ref3) {
|