@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/dist/index.modern.mjs
CHANGED
|
@@ -943,7 +943,9 @@ const InboxMessageBodyTransform = item => {
|
|
|
943
943
|
icon: item.image,
|
|
944
944
|
title: item.title,
|
|
945
945
|
preview_body: item.body,
|
|
946
|
-
custom_data: IntUtils.JsonOrText(item == null ? void 0 : item.custom_data)
|
|
946
|
+
custom_data: IntUtils.JsonOrText(item == null ? void 0 : item.custom_data),
|
|
947
|
+
show_preview: item.show_preview,
|
|
948
|
+
show_duration_sec: item.show_duration_sec
|
|
947
949
|
};
|
|
948
950
|
if (item.action === 'dp:inbox') {
|
|
949
951
|
if (item.additional_buttons && item.additional_buttons.length) {
|
|
@@ -6062,6 +6064,81 @@ class WSAPIJackpots extends WSAPIClans {
|
|
|
6062
6064
|
const cacheKey = `${onUpdateContextKey.JackpotWinners}${jp_template_id}:${limit}:${offset}`;
|
|
6063
6065
|
return OCache.use(cacheKey, ECacheContext.WSAPI, () => this.api.getJackpotWinnersT(this.userExtId, limit, offset, jp_template_id), JACKPOT_WINNERS_CACHE_SEC);
|
|
6064
6066
|
}
|
|
6067
|
+
/**
|
|
6068
|
+
* Returns past winners of a specific jackpot template, paginated, together
|
|
6069
|
+
* with the win statistics of that template: total number of wins, the
|
|
6070
|
+
* biggest win and the most recent win. Use it for a jackpot info modal /
|
|
6071
|
+
* tooltip that shows "Total wins", "Highest win" and "Latest win" next to
|
|
6072
|
+
* the winners list.
|
|
6073
|
+
*
|
|
6074
|
+
* @remarks
|
|
6075
|
+
* **Preconditions**
|
|
6076
|
+
* - User must be authenticated. Visitor mode not supported.
|
|
6077
|
+
* - `jp_template_id` is mandatory.
|
|
6078
|
+
* - The consumer SHOULD check
|
|
6079
|
+
* `JackpotDetails.expose_winners_over_api` before calling, since
|
|
6080
|
+
* the server does not enforce it.
|
|
6081
|
+
*
|
|
6082
|
+
* **Statistics**
|
|
6083
|
+
* - `win_stats` describes the whole jackpot template and does not depend
|
|
6084
|
+
* on `limit` / `offset`. Pass `limit: 1` when only the statistics are needed.
|
|
6085
|
+
* - Only issued wins are counted — a pot that exploded but still waits for
|
|
6086
|
+
* manual approval is not included.
|
|
6087
|
+
* - `highest_win` / `last_win` are `null` while the jackpot has no wins,
|
|
6088
|
+
* `total_wins` is `0` in that case.
|
|
6089
|
+
* - `public_username` of `highest_win` / `last_win` is masked by the same
|
|
6090
|
+
* label setting as the winners list, and is `null` when the template
|
|
6091
|
+
* doesn't expose winners over API.
|
|
6092
|
+
* - The server refreshes the statistics once per minute.
|
|
6093
|
+
*
|
|
6094
|
+
* **Currency caveat**
|
|
6095
|
+
* All amounts (`win_stats.*.winning_amount`,
|
|
6096
|
+
* `winners[].winner.winning_amount_jp_currency`) are in the jackpot's
|
|
6097
|
+
* NATIVE currency, NOT the user's wallet currency.
|
|
6098
|
+
*
|
|
6099
|
+
* **Refresh**
|
|
6100
|
+
* - The SDK caches each page separately (per `jp_template_id` +
|
|
6101
|
+
* `limit` + `offset`) for 30 seconds.
|
|
6102
|
+
* - Caches clear on jackpot-win push events and on opt-in / opt-out.
|
|
6103
|
+
*
|
|
6104
|
+
* **Error handling**
|
|
6105
|
+
* Non-zero `errCode` on control-group users or generic server errors. The
|
|
6106
|
+
* SDK does NOT enumerate distinct codes — branch on `errCode === 0` and
|
|
6107
|
+
* surface `errMsg` on failure.
|
|
6108
|
+
*
|
|
6109
|
+
* **Visitor mode**: not supported.
|
|
6110
|
+
*
|
|
6111
|
+
* @returns {@link TGetJackpotWinStatsResponse} —
|
|
6112
|
+
* `{ winners: JackpotWinnerHistory[], win_stats: JackpotWinStats }`.
|
|
6113
|
+
*
|
|
6114
|
+
* @example
|
|
6115
|
+
* ```ts
|
|
6116
|
+
* const [jp] = await window._smartico.api.jackpotGet({ jp_template_id: 42 });
|
|
6117
|
+
*
|
|
6118
|
+
* if (!jp || !jp.expose_winners_over_api) {
|
|
6119
|
+
* console.log('[smartico] winners hidden by operator config — hide the stats');
|
|
6120
|
+
* return;
|
|
6121
|
+
* }
|
|
6122
|
+
*
|
|
6123
|
+
* const { winners, win_stats } = await window._smartico.api.getJackpotWinStats({
|
|
6124
|
+
* jp_template_id: 42,
|
|
6125
|
+
* limit: 10,
|
|
6126
|
+
* offset: 0,
|
|
6127
|
+
* });
|
|
6128
|
+
* console.log('[smartico] total wins', win_stats.total_wins);
|
|
6129
|
+
* console.log('[smartico] highest win', win_stats.highest_win?.winning_amount, jp.jp_currency);
|
|
6130
|
+
* console.log('[smartico] latest win', win_stats.last_win?.public_username, win_stats.last_win?.win_date_ts);
|
|
6131
|
+
* console.log('[smartico] render', winners.length, 'recent winner rows');
|
|
6132
|
+
* ```
|
|
6133
|
+
*/
|
|
6134
|
+
async getJackpotWinStats({
|
|
6135
|
+
limit,
|
|
6136
|
+
offset,
|
|
6137
|
+
jp_template_id
|
|
6138
|
+
}) {
|
|
6139
|
+
const cacheKey = `${onUpdateContextKey.JackpotWinners}stats:${jp_template_id}:${limit}:${offset}`;
|
|
6140
|
+
return OCache.use(cacheKey, ECacheContext.WSAPI, () => this.api.getJackpotWinStatsT(this.userExtId, limit, offset, jp_template_id), JACKPOT_WINNERS_CACHE_SEC);
|
|
6141
|
+
}
|
|
6065
6142
|
/**
|
|
6066
6143
|
* Returns the casino games eligible to contribute to a specific jackpot —
|
|
6067
6144
|
* the catalog the user must play to grow the pot. Use to power an
|
|
@@ -9150,6 +9227,16 @@ class WSAPIInbox extends WSAPILeaderBoard {
|
|
|
9150
9227
|
* for safe execution — that helper handles URL vs deep-link
|
|
9151
9228
|
* routing.
|
|
9152
9229
|
*
|
|
9230
|
+
* **Preview vs silent delivery**
|
|
9231
|
+
* Every message belongs in your inbox list. `show_preview` decides
|
|
9232
|
+
* whether it should also pop up briefly when it arrives:
|
|
9233
|
+
* - `show_preview !== false` → show a preview popup for
|
|
9234
|
+
* `show_duration_sec ?? 7` seconds.
|
|
9235
|
+
* - `show_preview === false` → store it silently, with no popup.
|
|
9236
|
+
* These fields are returned exactly as the operator configured them;
|
|
9237
|
+
* a missing value means the default above, the same as the default
|
|
9238
|
+
* Smartico UI.
|
|
9239
|
+
*
|
|
9153
9240
|
* **Idempotency / Side effects**: safe. Read-only HTTP fetch.
|
|
9154
9241
|
*
|
|
9155
9242
|
* **UI guidance**: see [UI Guide — `getInboxMessageBody`](../../docs/ui/inbox/UIGuide_getInboxMessageBody.md).
|
|
@@ -9175,6 +9262,12 @@ class WSAPIInbox extends WSAPILeaderBoard {
|
|
|
9175
9262
|
* console.log('[smartico] simple message — show preview_body + single CTA wired to:', body.action,
|
|
9176
9263
|
* '— execute via _smartico.dp(body.action)');
|
|
9177
9264
|
* }
|
|
9265
|
+
*
|
|
9266
|
+
* if (body.show_preview !== false) {
|
|
9267
|
+
* console.log('[smartico] new message — show a preview popup for', body.show_duration_sec ?? 7, 'seconds');
|
|
9268
|
+
* } else {
|
|
9269
|
+
* console.log('[smartico] new message — store it in the inbox silently, no popup');
|
|
9270
|
+
* }
|
|
9178
9271
|
* ```
|
|
9179
9272
|
*/
|
|
9180
9273
|
async getInboxMessageBody(messageGuid) {
|
|
@@ -9810,6 +9903,20 @@ const GetJackpotWinnersResponseTransform = items => {
|
|
|
9810
9903
|
return winnerInfo;
|
|
9811
9904
|
});
|
|
9812
9905
|
};
|
|
9906
|
+
/**
|
|
9907
|
+
* @ignore
|
|
9908
|
+
*/
|
|
9909
|
+
const GetJackpotWinStatsResponseTransform = response => {
|
|
9910
|
+
var _response$winners, _response$win_stats$t, _response$win_stats, _response$win_stats$h, _response$win_stats2, _response$win_stats$l, _response$win_stats3;
|
|
9911
|
+
return {
|
|
9912
|
+
winners: GetJackpotWinnersResponseTransform((_response$winners = response.winners) != null ? _response$winners : []),
|
|
9913
|
+
win_stats: {
|
|
9914
|
+
total_wins: (_response$win_stats$t = (_response$win_stats = response.win_stats) == null ? void 0 : _response$win_stats.total_wins) != null ? _response$win_stats$t : 0,
|
|
9915
|
+
highest_win: (_response$win_stats$h = (_response$win_stats2 = response.win_stats) == null ? void 0 : _response$win_stats2.highest_win) != null ? _response$win_stats$h : null,
|
|
9916
|
+
last_win: (_response$win_stats$l = (_response$win_stats3 = response.win_stats) == null ? void 0 : _response$win_stats3.last_win) != null ? _response$win_stats$l : null
|
|
9917
|
+
}
|
|
9918
|
+
};
|
|
9919
|
+
};
|
|
9813
9920
|
|
|
9814
9921
|
/**
|
|
9815
9922
|
* @ignore
|
|
@@ -10146,6 +10253,9 @@ class SmarticoAPI {
|
|
|
10146
10253
|
async getJackpotWinnersT(user_ext_id, limit = 20, offset = 0, jp_template_id) {
|
|
10147
10254
|
return GetJackpotWinnersResponseTransform((await this.getJackpotWinners(user_ext_id, limit, offset, jp_template_id)).winners);
|
|
10148
10255
|
}
|
|
10256
|
+
async getJackpotWinStatsT(user_ext_id, limit = 20, offset = 0, jp_template_id) {
|
|
10257
|
+
return GetJackpotWinStatsResponseTransform(await this.getJackpotWinners(user_ext_id, limit, offset, jp_template_id));
|
|
10258
|
+
}
|
|
10149
10259
|
async getJackpotEligibleGames(user_ext_id, {
|
|
10150
10260
|
jp_template_id
|
|
10151
10261
|
}) {
|
|
@@ -11643,5 +11753,5 @@ var JoinClanErrorCode;
|
|
|
11643
11753
|
JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_JOINED_AFTER_TOURNAMENT_START"] = 1011] = "JOIN_CLAN_JOINED_AFTER_TOURNAMENT_START";
|
|
11644
11754
|
})(JoinClanErrorCode || (JoinClanErrorCode = {}));
|
|
11645
11755
|
|
|
11646
|
-
export { AchCategoryTransform, AchCustomLayoutTheme, AchCustomSectionType, AchMissionsTabsOptions, AchOverviewMissionsFilter, AchievementAvailabilityStatus, AchievementClaimPeriodTypeId, AchievementStatus, AchievementTaskType, AchievementType, ActivityLogActivities, ActivityLogTransform, ActivityTypeLimited, AllRoundsGameBoardID, AnalyticsInboxSubScreenNameId, AnalyticsInterfaceType, AnalyticsScreenNameId, AnalyticsTournamentsLobbySubScreenNameId, AttemptPeriodType, AvatarCustomizeErrorCode, BadgesTimeLimitStates, BonusItemsTransform, BonusStatus, BuyStoreItemErrorCode, ClassId, CookieStore, CoreUtils, ECacheContext, GPRoundStatus, GamePickMarketType, GamePickResolutionType, GamePickScoreType, GamePickSportType, GameRoundOrderType, GetJackpotEligibleGamesResponseTransform, GetJackpotWinnersResponseTransform, GetLevelMapResponseTransform, InboxCategories, InboxMessageBodyTransform, InboxMessageType, InboxMessagesTransform, InboxReadStatus, JackPotTemparature, JackpotContributionType, JackpotType, JoinClanErrorCode, LeaderBoardPeriodType, LiquidEntityData, MiniGamePrizeTypeName, MiniGamePrizeTypeNamed, MissionCategory, MissionUtils, OCache, OpenLinksType, PointChangeSourceType, PrizeModifiers, PrizeModifiersKeysNames, PublicLabelSettings, QuizAnswersValueType, QuizMarketPerSport, QuizSportType, RaffleDrawInstanceState, RaffleDrawTypeExecution, RaffleTicketCapVisualization, SAWAcknowledgeType, SAWAcknowledgeTypeName, SAWAcknowledgeTypeNamed, SAWAskForUsername, SAWBuyInType, SAWBuyInTypeName, SAWBuyInTypeNamed, SAWExposeUserSpinId, SAWExposeUserSpinIdName, SAWExposeUserSpinIdNamed, SAWGPMarketType, SAWGameDifficultyType, SAWGameDifficultyTypeName, SAWGameLayout, SAWGameLayoutName, SAWGameLayoutNamed, SAWGameType, SAWGameTypeName, SAWGameTypeNamed, SAWHistoryTransform, SAWPrizeType, SAWSpinErrorCode, SAWTemplatesTransform, SAWUtils, SAWWheelLayout, SAWWinSoundFiles, SAWWinSoundType, SawGameDifficultyTypeNamed, ScheduledMissionType, SmarticoAPI, StoreCategoryTransform, StoreItemPurchaseType, StoreItemPurchasedTransform, StoreItemTransform, StoreItemType, StoreItemTypeName, StoreItemTypeNamed, TournamentInstanceStatus, TournamentInstanceStatusName, TournamentItemsTransform, TournamentRegistrationError, TournamentRegistrationStatus, TournamentRegistrationStatusName, TournamentRegistrationStatusNamed, TournamentRegistrationType, TournamentRegistrationTypeGetName, TournamentType, TournamentUtils, TranslationArea, UICustomSectionTransform, UserAchievementTransform, UserBalanceType, WSAPI, avatarCustomizedTransform, avatarDefinitionTransform, avatarPromptTransform, clanTournamentPlayersTransform, drawRunHistoryTransform, drawRunTransform, drawTransform, enrichUserAchievementsWithBadgeState, getLeaderBoardTransform, marketsInfo, prizeTransform, quizAnswerAwayTeamReplacementText, quizAnswerHomeTeamReplacementText, quizAnswersTrKeys, quizDrawReplacementText, quizEvenReplacementText, quizNoGoalsReplacementText, quizNoReplacementText, quizOddReplacementText, quizOrReplacementText, quizSupportedSports, quizYesReplacementText, raffleClaimPrizeResponseTransform, raffleTransform, ticketsTransform, tournamentInfoItemTransform, winnersTransform };
|
|
11756
|
+
export { AchCategoryTransform, AchCustomLayoutTheme, AchCustomSectionType, AchMissionsTabsOptions, AchOverviewMissionsFilter, AchievementAvailabilityStatus, AchievementClaimPeriodTypeId, AchievementStatus, AchievementTaskType, AchievementType, ActivityLogActivities, ActivityLogTransform, ActivityTypeLimited, AllRoundsGameBoardID, AnalyticsInboxSubScreenNameId, AnalyticsInterfaceType, AnalyticsScreenNameId, AnalyticsTournamentsLobbySubScreenNameId, AttemptPeriodType, AvatarCustomizeErrorCode, BadgesTimeLimitStates, BonusItemsTransform, BonusStatus, BuyStoreItemErrorCode, ClassId, CookieStore, CoreUtils, ECacheContext, GPRoundStatus, GamePickMarketType, GamePickResolutionType, GamePickScoreType, GamePickSportType, GameRoundOrderType, GetJackpotEligibleGamesResponseTransform, GetJackpotWinStatsResponseTransform, GetJackpotWinnersResponseTransform, GetLevelMapResponseTransform, InboxCategories, InboxMessageBodyTransform, InboxMessageType, InboxMessagesTransform, InboxReadStatus, JackPotTemparature, JackpotContributionType, JackpotType, JoinClanErrorCode, LeaderBoardPeriodType, LiquidEntityData, MiniGamePrizeTypeName, MiniGamePrizeTypeNamed, MissionCategory, MissionUtils, OCache, OpenLinksType, PointChangeSourceType, PrizeModifiers, PrizeModifiersKeysNames, PublicLabelSettings, QuizAnswersValueType, QuizMarketPerSport, QuizSportType, RaffleDrawInstanceState, RaffleDrawTypeExecution, RaffleTicketCapVisualization, SAWAcknowledgeType, SAWAcknowledgeTypeName, SAWAcknowledgeTypeNamed, SAWAskForUsername, SAWBuyInType, SAWBuyInTypeName, SAWBuyInTypeNamed, SAWExposeUserSpinId, SAWExposeUserSpinIdName, SAWExposeUserSpinIdNamed, SAWGPMarketType, SAWGameDifficultyType, SAWGameDifficultyTypeName, SAWGameLayout, SAWGameLayoutName, SAWGameLayoutNamed, SAWGameType, SAWGameTypeName, SAWGameTypeNamed, SAWHistoryTransform, SAWPrizeType, SAWSpinErrorCode, SAWTemplatesTransform, SAWUtils, SAWWheelLayout, SAWWinSoundFiles, SAWWinSoundType, SawGameDifficultyTypeNamed, ScheduledMissionType, SmarticoAPI, StoreCategoryTransform, StoreItemPurchaseType, StoreItemPurchasedTransform, StoreItemTransform, StoreItemType, StoreItemTypeName, StoreItemTypeNamed, TournamentInstanceStatus, TournamentInstanceStatusName, TournamentItemsTransform, TournamentRegistrationError, TournamentRegistrationStatus, TournamentRegistrationStatusName, TournamentRegistrationStatusNamed, TournamentRegistrationType, TournamentRegistrationTypeGetName, TournamentType, TournamentUtils, TranslationArea, UICustomSectionTransform, UserAchievementTransform, UserBalanceType, WSAPI, avatarCustomizedTransform, avatarDefinitionTransform, avatarPromptTransform, clanTournamentPlayersTransform, drawRunHistoryTransform, drawRunTransform, drawTransform, enrichUserAchievementsWithBadgeState, getLeaderBoardTransform, marketsInfo, prizeTransform, quizAnswerAwayTeamReplacementText, quizAnswerHomeTeamReplacementText, quizAnswersTrKeys, quizDrawReplacementText, quizEvenReplacementText, quizNoGoalsReplacementText, quizNoReplacementText, quizOddReplacementText, quizOrReplacementText, quizSupportedSports, quizYesReplacementText, raffleClaimPrizeResponseTransform, raffleTransform, ticketsTransform, tournamentInfoItemTransform, winnersTransform };
|
|
11647
11757
|
//# sourceMappingURL=index.modern.mjs.map
|