@smartico/public-api 0.0.432 → 0.0.433
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/Jackpots/GetJackpotWinnersResponse.d.ts +28 -0
- package/dist/SmarticoAPI.d.ts +2 -1
- package/dist/WSAPI/WSAPIJackpots.d.ts +76 -0
- package/dist/index.js +389 -278
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +93 -1
- 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/package.json +1 -1
- package/src/Jackpots/GetJackpotWinnersResponse.ts +41 -0
- package/src/SmarticoAPI.ts +11 -1
- package/src/WSAPI/WSAPIJackpots.ts +89 -0
package/dist/index.modern.mjs
CHANGED
|
@@ -6062,6 +6062,81 @@ class WSAPIJackpots extends WSAPIClans {
|
|
|
6062
6062
|
const cacheKey = `${onUpdateContextKey.JackpotWinners}${jp_template_id}:${limit}:${offset}`;
|
|
6063
6063
|
return OCache.use(cacheKey, ECacheContext.WSAPI, () => this.api.getJackpotWinnersT(this.userExtId, limit, offset, jp_template_id), JACKPOT_WINNERS_CACHE_SEC);
|
|
6064
6064
|
}
|
|
6065
|
+
/**
|
|
6066
|
+
* Returns past winners of a specific jackpot template, paginated, together
|
|
6067
|
+
* with the win statistics of that template: total number of wins, the
|
|
6068
|
+
* biggest win and the most recent win. Use it for a jackpot info modal /
|
|
6069
|
+
* tooltip that shows "Total wins", "Highest win" and "Latest win" next to
|
|
6070
|
+
* the winners list.
|
|
6071
|
+
*
|
|
6072
|
+
* @remarks
|
|
6073
|
+
* **Preconditions**
|
|
6074
|
+
* - User must be authenticated. Visitor mode not supported.
|
|
6075
|
+
* - `jp_template_id` is mandatory.
|
|
6076
|
+
* - The consumer SHOULD check
|
|
6077
|
+
* `JackpotDetails.expose_winners_over_api` before calling, since
|
|
6078
|
+
* the server does not enforce it.
|
|
6079
|
+
*
|
|
6080
|
+
* **Statistics**
|
|
6081
|
+
* - `win_stats` describes the whole jackpot template and does not depend
|
|
6082
|
+
* on `limit` / `offset`. Pass `limit: 1` when only the statistics are needed.
|
|
6083
|
+
* - Only issued wins are counted — a pot that exploded but still waits for
|
|
6084
|
+
* manual approval is not included.
|
|
6085
|
+
* - `highest_win` / `last_win` are `null` while the jackpot has no wins,
|
|
6086
|
+
* `total_wins` is `0` in that case.
|
|
6087
|
+
* - `public_username` of `highest_win` / `last_win` is masked by the same
|
|
6088
|
+
* label setting as the winners list, and is `null` when the template
|
|
6089
|
+
* doesn't expose winners over API.
|
|
6090
|
+
* - The server refreshes the statistics once per minute.
|
|
6091
|
+
*
|
|
6092
|
+
* **Currency caveat**
|
|
6093
|
+
* All amounts (`win_stats.*.winning_amount`,
|
|
6094
|
+
* `winners[].winner.winning_amount_jp_currency`) are in the jackpot's
|
|
6095
|
+
* NATIVE currency, NOT the user's wallet currency.
|
|
6096
|
+
*
|
|
6097
|
+
* **Refresh**
|
|
6098
|
+
* - The SDK caches each page separately (per `jp_template_id` +
|
|
6099
|
+
* `limit` + `offset`) for 30 seconds.
|
|
6100
|
+
* - Caches clear on jackpot-win push events and on opt-in / opt-out.
|
|
6101
|
+
*
|
|
6102
|
+
* **Error handling**
|
|
6103
|
+
* Non-zero `errCode` on control-group users or generic server errors. The
|
|
6104
|
+
* SDK does NOT enumerate distinct codes — branch on `errCode === 0` and
|
|
6105
|
+
* surface `errMsg` on failure.
|
|
6106
|
+
*
|
|
6107
|
+
* **Visitor mode**: not supported.
|
|
6108
|
+
*
|
|
6109
|
+
* @returns {@link TGetJackpotWinStatsResponse} —
|
|
6110
|
+
* `{ winners: JackpotWinnerHistory[], win_stats: JackpotWinStats }`.
|
|
6111
|
+
*
|
|
6112
|
+
* @example
|
|
6113
|
+
* ```ts
|
|
6114
|
+
* const [jp] = await window._smartico.api.jackpotGet({ jp_template_id: 42 });
|
|
6115
|
+
*
|
|
6116
|
+
* if (!jp || !jp.expose_winners_over_api) {
|
|
6117
|
+
* console.log('[smartico] winners hidden by operator config — hide the stats');
|
|
6118
|
+
* return;
|
|
6119
|
+
* }
|
|
6120
|
+
*
|
|
6121
|
+
* const { winners, win_stats } = await window._smartico.api.getJackpotWinStats({
|
|
6122
|
+
* jp_template_id: 42,
|
|
6123
|
+
* limit: 10,
|
|
6124
|
+
* offset: 0,
|
|
6125
|
+
* });
|
|
6126
|
+
* console.log('[smartico] total wins', win_stats.total_wins);
|
|
6127
|
+
* console.log('[smartico] highest win', win_stats.highest_win?.winning_amount, jp.jp_currency);
|
|
6128
|
+
* console.log('[smartico] latest win', win_stats.last_win?.public_username, win_stats.last_win?.win_date_ts);
|
|
6129
|
+
* console.log('[smartico] render', winners.length, 'recent winner rows');
|
|
6130
|
+
* ```
|
|
6131
|
+
*/
|
|
6132
|
+
async getJackpotWinStats({
|
|
6133
|
+
limit,
|
|
6134
|
+
offset,
|
|
6135
|
+
jp_template_id
|
|
6136
|
+
}) {
|
|
6137
|
+
const cacheKey = `${onUpdateContextKey.JackpotWinners}stats:${jp_template_id}:${limit}:${offset}`;
|
|
6138
|
+
return OCache.use(cacheKey, ECacheContext.WSAPI, () => this.api.getJackpotWinStatsT(this.userExtId, limit, offset, jp_template_id), JACKPOT_WINNERS_CACHE_SEC);
|
|
6139
|
+
}
|
|
6065
6140
|
/**
|
|
6066
6141
|
* Returns the casino games eligible to contribute to a specific jackpot —
|
|
6067
6142
|
* the catalog the user must play to grow the pot. Use to power an
|
|
@@ -9810,6 +9885,20 @@ const GetJackpotWinnersResponseTransform = items => {
|
|
|
9810
9885
|
return winnerInfo;
|
|
9811
9886
|
});
|
|
9812
9887
|
};
|
|
9888
|
+
/**
|
|
9889
|
+
* @ignore
|
|
9890
|
+
*/
|
|
9891
|
+
const GetJackpotWinStatsResponseTransform = response => {
|
|
9892
|
+
var _response$winners, _response$win_stats$t, _response$win_stats, _response$win_stats$h, _response$win_stats2, _response$win_stats$l, _response$win_stats3;
|
|
9893
|
+
return {
|
|
9894
|
+
winners: GetJackpotWinnersResponseTransform((_response$winners = response.winners) != null ? _response$winners : []),
|
|
9895
|
+
win_stats: {
|
|
9896
|
+
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,
|
|
9897
|
+
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,
|
|
9898
|
+
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
|
|
9899
|
+
}
|
|
9900
|
+
};
|
|
9901
|
+
};
|
|
9813
9902
|
|
|
9814
9903
|
/**
|
|
9815
9904
|
* @ignore
|
|
@@ -10146,6 +10235,9 @@ class SmarticoAPI {
|
|
|
10146
10235
|
async getJackpotWinnersT(user_ext_id, limit = 20, offset = 0, jp_template_id) {
|
|
10147
10236
|
return GetJackpotWinnersResponseTransform((await this.getJackpotWinners(user_ext_id, limit, offset, jp_template_id)).winners);
|
|
10148
10237
|
}
|
|
10238
|
+
async getJackpotWinStatsT(user_ext_id, limit = 20, offset = 0, jp_template_id) {
|
|
10239
|
+
return GetJackpotWinStatsResponseTransform(await this.getJackpotWinners(user_ext_id, limit, offset, jp_template_id));
|
|
10240
|
+
}
|
|
10149
10241
|
async getJackpotEligibleGames(user_ext_id, {
|
|
10150
10242
|
jp_template_id
|
|
10151
10243
|
}) {
|
|
@@ -11643,5 +11735,5 @@ var JoinClanErrorCode;
|
|
|
11643
11735
|
JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_JOINED_AFTER_TOURNAMENT_START"] = 1011] = "JOIN_CLAN_JOINED_AFTER_TOURNAMENT_START";
|
|
11644
11736
|
})(JoinClanErrorCode || (JoinClanErrorCode = {}));
|
|
11645
11737
|
|
|
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 };
|
|
11738
|
+
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
11739
|
//# sourceMappingURL=index.modern.mjs.map
|