@smartico/public-api 0.0.363 → 0.0.365
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/Base/ClassId.d.ts +8 -0
- package/dist/Clans/Clan.d.ts +17 -0
- package/dist/Clans/GetClanInfoRequest.d.ts +5 -0
- package/dist/Clans/GetClanInfoResponse.d.ts +22 -0
- package/dist/Clans/GetClanListRequest.d.ts +4 -0
- package/dist/Clans/GetClanListResponse.d.ts +9 -0
- package/dist/Clans/JoinClanRequest.d.ts +5 -0
- package/dist/Clans/JoinClanResponse.d.ts +5 -0
- package/dist/Clans/index.d.ts +7 -0
- package/dist/SmarticoAPI.d.ts +8 -1
- package/dist/SmarticoLib/index.d.ts +196 -0
- package/dist/Tournaments/GetClanTournamentPlayersRequest.d.ts +6 -0
- package/dist/Tournaments/GetClanTournamentPlayersResponse.d.ts +40 -0
- package/dist/Tournaments/GetTournamentInfoResponse.d.ts +11 -0
- package/dist/Tournaments/Tournament.d.ts +2 -0
- package/dist/Tournaments/TournamentClan.d.ts +27 -0
- package/dist/Tournaments/index.d.ts +3 -0
- package/dist/WSAPI/WSAPI.d.ts +34 -1
- package/dist/WSAPI/WSAPITypes.d.ts +144 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +583 -293
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +213 -5
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/README.md +99 -330
- package/docs/api/classes/SAWUtils.md +25 -11
- package/docs/api/classes/WSAPI.md +737 -379
- package/docs/api/enumerations/AchCustomLayoutTheme.md +25 -0
- package/docs/api/enumerations/AchCustomSectionType.md +79 -0
- package/docs/api/{enums → enumerations}/AchMissionsTabsOptions.md +5 -5
- package/docs/api/{enums → enumerations}/AchOverviewMissionsFilter.md +9 -9
- package/docs/api/{enums → enumerations}/AchievementAvailabilityStatus.md +29 -29
- package/docs/api/enumerations/AchievementStatus.md +49 -0
- package/docs/api/{enums → enumerations}/AchievementTaskType.md +3 -3
- package/docs/api/{enums → enumerations}/AchievementType.md +3 -3
- package/docs/api/enumerations/ActivityTypeLimited.md +115 -0
- package/docs/api/{enums → enumerations}/AttemptPeriodType.md +7 -7
- package/docs/api/{enums → enumerations}/BadgesTimeLimitStates.md +11 -11
- package/docs/api/{enums → enumerations}/BonusStatus-1.md +11 -11
- package/docs/api/enumerations/BonusStatus.md +37 -0
- package/docs/api/{enums → enumerations}/BuyStoreItemErrorCode.md +21 -21
- package/docs/api/{enums → enumerations}/GPRoundStatus.md +9 -9
- package/docs/api/{enums → enumerations}/GamePickMarketType.md +3 -3
- package/docs/api/{enums → enumerations}/GamePickResolutionType.md +7 -7
- package/docs/api/{enums → enumerations}/GamePickScoreType.md +3 -3
- package/docs/api/enumerations/GamePickSportType.md +375 -0
- package/docs/api/{enums → enumerations}/GameRoundOrderType.md +7 -7
- package/docs/api/{enums → enumerations}/InboxCategories.md +5 -5
- package/docs/api/enumerations/InboxMessageType.md +55 -0
- package/docs/api/{enums → enumerations}/InboxReadStatus.md +3 -3
- package/docs/api/{enums → enumerations}/JackPotTemparature.md +7 -7
- package/docs/api/{enums → enumerations}/JackpotContributionType.md +3 -3
- package/docs/api/{enums → enumerations}/JackpotType.md +3 -3
- package/docs/api/{enums → enumerations}/LeaderBoardPeriodType.md +5 -5
- package/docs/api/enumerations/LiquidEntityData.md +73 -0
- package/docs/api/enumerations/MiniGamePrizeTypeName.md +67 -0
- package/docs/api/{enums → enumerations}/OpenLinksType.md +3 -3
- package/docs/api/enumerations/PointChangeSourceType.md +109 -0
- package/docs/api/enumerations/PrizeModifiers.md +49 -0
- package/docs/api/enumerations/QuizAnswersValueType.md +121 -0
- package/docs/api/{enums → enumerations}/RaffleDrawInstanceState.md +5 -5
- package/docs/api/{enums → enumerations}/RaffleDrawTypeExecution.md +5 -5
- package/docs/api/{enums → enumerations}/RaffleTicketCapVisualization.md +5 -5
- package/docs/api/{enums → enumerations}/SAWAcknowledgeType.md +7 -7
- package/docs/api/enumerations/SAWAcknowledgeTypeName.md +25 -0
- package/docs/api/{enums → enumerations}/SAWAskForUsername.md +3 -3
- package/docs/api/enumerations/SAWBuyInType.md +31 -0
- package/docs/api/enumerations/SAWBuyInTypeName.md +37 -0
- package/docs/api/{enums → enumerations}/SAWExposeUserSpinId.md +3 -3
- package/docs/api/{enums → enumerations}/SAWExposeUserSpinIdName.md +3 -3
- package/docs/api/enumerations/SAWGPMarketType.md +157 -0
- package/docs/api/{enums → enumerations}/SAWGameDifficultyType.md +5 -5
- package/docs/api/{enums → enumerations}/SAWGameDifficultyTypeName.md +5 -5
- package/docs/api/{enums → enumerations}/SAWGameLayout.md +3 -3
- package/docs/api/{enums → enumerations}/SAWGameLayoutName.md +3 -3
- package/docs/api/enumerations/SAWGameType.md +73 -0
- package/docs/api/enumerations/SAWGameTypeName.md +79 -0
- package/docs/api/enumerations/SAWPrizeType.md +61 -0
- package/docs/api/{enums → enumerations}/SAWSpinErrorCode.md +19 -19
- package/docs/api/{enums → enumerations}/SAWWheelLayout.md +7 -7
- package/docs/api/enumerations/SAWWinSoundType.md +31 -0
- package/docs/api/{enums → enumerations}/ScheduledMissionType.md +5 -5
- package/docs/api/{enums → enumerations}/StoreItemPurchaseType.md +5 -5
- package/docs/api/enumerations/StoreItemType.md +37 -0
- package/docs/api/enumerations/StoreItemTypeName.md +43 -0
- package/docs/api/enumerations/TournamentInstanceStatus.md +43 -0
- package/docs/api/enumerations/TournamentRegistrationError.md +55 -0
- package/docs/api/enumerations/TournamentRegistrationStatus.md +43 -0
- package/docs/api/enumerations/TournamentRegistrationStatusName.md +49 -0
- package/docs/api/enumerations/TournamentRegistrationType.md +43 -0
- package/docs/api/{enums → enumerations}/TournamentType.md +5 -5
- package/docs/api/{enums → enumerations}/UserBalanceType.md +5 -5
- package/docs/api/functions/AchCategoryTransform.md +13 -0
- package/docs/api/functions/BonusItemsTransform.md +13 -0
- package/docs/api/functions/InboxMessageBodyTransform.md +13 -0
- package/docs/api/functions/SAWHistoryTransform.md +13 -0
- package/docs/api/functions/SAWTemplatesTransform.md +13 -0
- package/docs/api/functions/StoreCategoryTransform.md +13 -0
- package/docs/api/functions/StoreItemTransform.md +13 -0
- package/docs/api/functions/StoreItemTypeNamed.md +13 -0
- package/docs/api/functions/TournamentInstanceStatusName.md +13 -0
- package/docs/api/functions/TournamentItemsTransform.md +13 -0
- package/docs/api/functions/UICustomSectionTransform.md +13 -0
- package/docs/api/functions/UserAchievementTransform.md +13 -0
- package/docs/api/functions/enrichUserAchievementsWithBadgeState.md +13 -0
- package/docs/api/functions/tournamentInfoItemTransform.md +13 -0
- package/docs/api/interfaces/AchCategory.md +5 -5
- package/docs/api/interfaces/AchCategoryPublicMeta.md +5 -5
- package/docs/api/interfaces/AchRelatedGame-1.md +50 -15
- package/docs/api/interfaces/AchRelatedGame.md +35 -16
- package/docs/api/interfaces/AchievementPublicMeta.md +65 -65
- package/docs/api/interfaces/AchievementTaskPublicMeta.md +16 -16
- package/docs/api/interfaces/AffectsProgress.md +7 -7
- package/docs/api/interfaces/Bonus.md +37 -37
- package/docs/api/interfaces/BonusMetaMap-1.md +2 -2
- package/docs/api/interfaces/BonusMetaMap.md +2 -2
- package/docs/api/interfaces/BonusTemplateMetaMap-1.md +8 -8
- package/docs/api/interfaces/BonusTemplateMetaMap.md +8 -8
- package/docs/api/interfaces/Clan.md +53 -0
- package/docs/api/interfaces/ClanLeaderboardEntry.md +31 -0
- package/docs/api/interfaces/ClanPrizeStructureEntry.md +45 -0
- package/docs/api/interfaces/ClanPrizeTier.md +43 -0
- package/docs/api/interfaces/ClanPublicMeta.md +19 -0
- package/docs/api/interfaces/GamePickBoardUser.md +17 -17
- package/docs/api/interfaces/GamePickEvent.md +40 -38
- package/docs/api/interfaces/GamePickEventMeta.md +79 -59
- package/docs/api/interfaces/GamePickGameInfo.md +5 -5
- package/docs/api/interfaces/GamePickRequestParams.md +10 -12
- package/docs/api/interfaces/GamePickRound.md +96 -98
- package/docs/api/interfaces/GamePickRoundBase.md +58 -61
- package/docs/api/interfaces/GamePickRoundBoard.md +88 -90
- package/docs/api/interfaces/GamePickRoundPublicMeta.md +26 -26
- package/docs/api/interfaces/GamePickRoundRequestParams.md +15 -17
- package/docs/api/interfaces/GamePickUserInfo.md +34 -34
- package/docs/api/interfaces/GamesApiResponse.md +11 -11
- package/docs/api/interfaces/GetCustomSectionsResponse.md +23 -25
- package/docs/api/interfaces/GetDrawRunRequest.md +21 -23
- package/docs/api/interfaces/GetDrawRunResponse.md +21 -23
- package/docs/api/interfaces/GetJackpotEligibleGamesRequest.md +13 -15
- package/docs/api/interfaces/GetJackpotEligibleGamesResponse.md +21 -23
- package/docs/api/interfaces/GetJackpotWinnersRequest.md +26 -28
- package/docs/api/interfaces/GetJackpotWinnersResponse.md +23 -25
- package/docs/api/interfaces/GetJackpotsPotsRequest.md +13 -15
- package/docs/api/interfaces/GetJackpotsPotsResponse.md +21 -23
- package/docs/api/interfaces/GetJackpotsRequest.md +17 -19
- package/docs/api/interfaces/GetJackpotsResponse.md +21 -23
- package/docs/api/interfaces/GetRaffleDrawRunsHistoryRequest.md +16 -18
- package/docs/api/interfaces/GetRaffleDrawRunsHistoryResponse.md +21 -23
- package/docs/api/interfaces/GetRafflesRequest.md +14 -16
- package/docs/api/interfaces/GetRafflesResponse.md +21 -23
- package/docs/api/interfaces/GetRelatedAchTourResponse.md +24 -26
- package/docs/api/interfaces/GetTournamentInfoResponse.md +68 -38
- package/docs/api/interfaces/InboxMarkMessageAction.md +3 -3
- package/docs/api/interfaces/InboxMessage.md +18 -18
- package/docs/api/interfaces/InboxMessageBody.md +37 -29
- package/docs/api/interfaces/JackPotWinner.md +11 -11
- package/docs/api/interfaces/JackpotDetails.md +23 -23
- package/docs/api/interfaces/JackpotEligibleGame.md +19 -19
- package/docs/api/interfaces/JackpotHtmlTemplate.md +3 -3
- package/docs/api/interfaces/JackpotPot.md +11 -11
- package/docs/api/interfaces/JackpotPublicMeta.md +15 -15
- package/docs/api/interfaces/JackpotWinPush.md +15 -17
- package/docs/api/interfaces/JackpotWinnerHistory.md +5 -5
- package/docs/api/interfaces/JackpotsOptinRequest.md +13 -15
- package/docs/api/interfaces/JackpotsOptinResponse.md +19 -21
- package/docs/api/interfaces/JackpotsOptoutRequest.md +13 -15
- package/docs/api/interfaces/JackpotsOptoutResponse.md +19 -21
- package/docs/api/interfaces/LeaderBoardDetailsT.md +16 -16
- package/docs/api/interfaces/LeaderBoardUserT.md +9 -9
- package/docs/api/interfaces/LeaderBoardsRewardsT.md +3 -3
- package/docs/api/interfaces/Level.md +15 -15
- package/docs/api/interfaces/LevelPublicMeta.md +31 -24
- package/docs/api/interfaces/QuizEventMeta.md +34 -14
- package/docs/api/interfaces/Raffle.md +13 -13
- package/docs/api/interfaces/RaffleClaimPrizeRequest.md +13 -15
- package/docs/api/interfaces/RaffleClaimPrizeResponse.md +18 -20
- package/docs/api/interfaces/RaffleDraw.md +44 -44
- package/docs/api/interfaces/RaffleDrawPublicMeta.md +15 -15
- package/docs/api/interfaces/RaffleDrawRun.md +15 -15
- package/docs/api/interfaces/RaffleOptinRequest.md +17 -19
- package/docs/api/interfaces/RaffleOptinResponse.md +19 -21
- package/docs/api/interfaces/RafflePrize.md +31 -31
- package/docs/api/interfaces/RafflePrizePublicMeta.md +7 -7
- package/docs/api/interfaces/RafflePrizeWinner.md +15 -15
- package/docs/api/interfaces/RafflePublicMeta.md +16 -16
- package/docs/api/interfaces/RaffleTicket.md +3 -3
- package/docs/api/interfaces/SAWAcknowledgeSpinPushRequest.md +24 -26
- package/docs/api/interfaces/SAWDoAknowledgeRequest.md +13 -15
- package/docs/api/interfaces/SAWDoAknowledgeResponse.md +13 -15
- package/docs/api/interfaces/SAWDoSpinRequest.md +24 -26
- package/docs/api/interfaces/SAWDoSpinResponse.md +33 -35
- package/docs/api/interfaces/SAWEventSawPush.md +17 -19
- package/docs/api/interfaces/SAWGetTemplatesRequest.md +26 -28
- package/docs/api/interfaces/SAWGetTemplatesResponse.md +21 -23
- package/docs/api/interfaces/SAWPrize.md +52 -52
- package/docs/api/interfaces/SAWPrizeDropAknowledgeRequest.md +17 -19
- package/docs/api/interfaces/SAWPrizeDropAknowledgeResponse.md +13 -15
- package/docs/api/interfaces/SAWPrizeDropWinPush.md +21 -23
- package/docs/api/interfaces/SAWPrizeUI.md +78 -78
- package/docs/api/interfaces/SAWPrizesHistory.md +15 -15
- package/docs/api/interfaces/SAWSpinsCountPush.md +15 -17
- package/docs/api/interfaces/SAWTemplate.md +70 -63
- package/docs/api/interfaces/SAWTemplateUI.md +155 -150
- package/docs/api/interfaces/SAWWinningHistoryRequest.md +21 -23
- package/docs/api/interfaces/SAWWinningHistoryResponse.md +23 -25
- package/docs/api/interfaces/StoreCategory.md +5 -5
- package/docs/api/interfaces/StoreCategoryPublicMeta.md +5 -5
- package/docs/api/interfaces/StoreItem.md +19 -19
- package/docs/api/interfaces/StoreItemPublicMeta.md +51 -51
- package/docs/api/interfaces/TAchCategory.md +5 -5
- package/docs/api/interfaces/TActivityLog.md +16 -16
- package/docs/api/interfaces/TAvatarCustomized.md +27 -0
- package/docs/api/interfaces/TAvatarDefinition.md +101 -0
- package/docs/api/interfaces/TAvatarPrompt.md +44 -0
- package/docs/api/interfaces/TBonus.md +22 -22
- package/docs/api/interfaces/TBuyStoreItemResult.md +3 -3
- package/docs/api/interfaces/TClaimBonusResult.md +6 -6
- package/docs/api/interfaces/TClan.md +79 -0
- package/docs/api/interfaces/TClanInfo.md +111 -0
- package/docs/api/interfaces/TClanJoinResult.md +15 -0
- package/docs/api/interfaces/TClanTournamentPlayers.md +71 -0
- package/docs/api/interfaces/TClans.md +27 -0
- package/docs/api/interfaces/TGetJackpotEligibleGamesResponse.md +1 -1
- package/docs/api/interfaces/TGetTranslations.md +3 -3
- package/docs/api/interfaces/TInboxMessage.md +13 -13
- package/docs/api/interfaces/TInboxMessageBody.md +28 -16
- package/docs/api/interfaces/TLevel.md +21 -23
- package/docs/api/interfaces/TLevelCurrent.md +32 -34
- package/docs/api/interfaces/TMiniGamePlayBatchResult.md +12 -12
- package/docs/api/interfaces/TMiniGamePlayResult.md +5 -5
- package/docs/api/interfaces/TMiniGamePrize.md +83 -83
- package/docs/api/interfaces/TMiniGameTemplate.md +81 -81
- package/docs/api/interfaces/TMissionClaimRewardResult.md +3 -3
- package/docs/api/interfaces/TMissionOptInResult.md +3 -3
- package/docs/api/interfaces/TMissionOrBadge.md +110 -110
- package/docs/api/interfaces/TMissionOrBadgeTask.md +15 -15
- package/docs/api/interfaces/TRaffle.md +25 -25
- package/docs/api/interfaces/TRaffleDraw.md +61 -61
- package/docs/api/interfaces/TRaffleDrawRun.md +39 -39
- package/docs/api/interfaces/TRaffleOptinResponse.md +4 -4
- package/docs/api/interfaces/TRafflePrize.md +35 -35
- package/docs/api/interfaces/TRafflePrizeWinner.md +13 -13
- package/docs/api/interfaces/TRaffleTicket.md +3 -3
- package/docs/api/interfaces/TSawHistory.md +15 -15
- package/docs/api/interfaces/TSegmentCheckResult.md +3 -3
- package/docs/api/interfaces/TSetAvatarResult.md +19 -0
- package/docs/api/interfaces/TStoreCategory.md +5 -5
- package/docs/api/interfaces/TStoreItem.md +77 -77
- package/docs/api/interfaces/TTournament.md +165 -97
- package/docs/api/interfaces/TTournamentDetailed.md +378 -140
- package/docs/api/interfaces/TTournamentRegistrationResult.md +3 -3
- package/docs/api/interfaces/TUICustomSection.md +52 -52
- package/docs/api/interfaces/TUserProfile.md +32 -32
- package/docs/api/interfaces/Tournament.md +87 -81
- package/docs/api/interfaces/TournamentPlayer.md +18 -18
- package/docs/api/interfaces/TournamentPrize.md +17 -17
- package/docs/api/interfaces/TournamentPublicMeta.md +47 -47
- package/docs/api/interfaces/TransformedRaffleClaimPrizeResponse.md +4 -4
- package/docs/api/interfaces/UICustomSection.md +50 -50
- package/docs/api/interfaces/UserAchievement.md +101 -101
- package/docs/api/interfaces/UserAchievementTask.md +38 -38
- package/docs/api/interfaces/UserLevelExtraCountersT.md +5 -5
- package/docs/api/type-aliases/TournamentRegistrationTypeName.md +3 -0
- package/docs/api/variables/AllRoundsGameBoardID.md +5 -0
- package/docs/api/variables/PrizeModifiersKeysNames.md +37 -0
- package/docs/api/variables/SAWWinSoundFiles.md +21 -0
- package/package.json +1 -1
- package/src/Base/ClassId.ts +12 -0
- package/src/Clans/Clan.ts +18 -0
- package/src/Clans/GetClanInfoRequest.ts +6 -0
- package/src/Clans/GetClanInfoResponse.ts +24 -0
- package/src/Clans/GetClanListRequest.ts +5 -0
- package/src/Clans/GetClanListResponse.ts +10 -0
- package/src/Clans/JoinClanRequest.ts +6 -0
- package/src/Clans/JoinClanResponse.ts +6 -0
- package/src/Clans/index.ts +7 -0
- package/src/Missions/MissionsUtils.ts +32 -4
- package/src/SmarticoAPI.ts +95 -0
- package/src/SmarticoLib/index.ts +163 -0
- package/src/Tournaments/GetClanTournamentPlayersRequest.ts +7 -0
- package/src/Tournaments/GetClanTournamentPlayersResponse.ts +58 -0
- package/src/Tournaments/GetTournamentInfoResponse.ts +52 -0
- package/src/Tournaments/Tournament.ts +2 -0
- package/src/Tournaments/TournamentClan.ts +30 -0
- package/src/Tournaments/index.ts +3 -0
- package/src/WSAPI/WSAPI.ts +61 -2
- package/src/WSAPI/WSAPITypes.ts +131 -0
- package/src/index.ts +2 -1
- package/tsconfig.json +5 -3
- package/docs/api/.nojekyll +0 -1
- package/docs/api/enums/AchCustomLayoutTheme.md +0 -25
- package/docs/api/enums/AchCustomSectionType.md +0 -79
- package/docs/api/enums/AchievementStatus.md +0 -49
- package/docs/api/enums/ActivityTypeLimited.md +0 -115
- package/docs/api/enums/BonusStatus.md +0 -37
- package/docs/api/enums/GamePickSportType.md +0 -375
- package/docs/api/enums/InboxMessageType.md +0 -55
- package/docs/api/enums/LiquidEntityData.md +0 -73
- package/docs/api/enums/MiniGamePrizeTypeName.md +0 -67
- package/docs/api/enums/PointChangeSourceType.md +0 -109
- package/docs/api/enums/PrizeModifiers.md +0 -49
- package/docs/api/enums/QuizAnswersValueType.md +0 -121
- package/docs/api/enums/SAWAcknowledgeTypeName.md +0 -25
- package/docs/api/enums/SAWBuyInType.md +0 -31
- package/docs/api/enums/SAWBuyInTypeName.md +0 -37
- package/docs/api/enums/SAWGPMarketType.md +0 -157
- package/docs/api/enums/SAWGameType.md +0 -73
- package/docs/api/enums/SAWGameTypeName.md +0 -79
- package/docs/api/enums/SAWPrizeType.md +0 -61
- package/docs/api/enums/SAWWinSoundType.md +0 -31
- package/docs/api/enums/StoreItemType.md +0 -37
- package/docs/api/enums/StoreItemTypeName.md +0 -43
- package/docs/api/enums/TournamentInstanceStatus.md +0 -43
- package/docs/api/enums/TournamentRegistrationError.md +0 -55
- package/docs/api/enums/TournamentRegistrationStatus.md +0 -43
- package/docs/api/enums/TournamentRegistrationStatusName.md +0 -49
- package/docs/api/enums/TournamentRegistrationType.md +0 -43
|
@@ -8,6 +8,35 @@ import { BadgesTimeLimitStates } from "./BadgesTimeLimitStates";
|
|
|
8
8
|
type UserStateParamsKeys = 'core_fav_game_top3' | 'core_fav_game_type_top3' | 'core_fav_game_provider_top3' | 'core_recommended_deposit_amount' | 'core_recommended_casino_bet_amount' | 'casino_last_bet_amount' | 'casino_last_bet_amount_real' | 'casino_last_bet_amount_bonus' | 'acc_last_deposit_amount';
|
|
9
9
|
const USER_STATE_PARAMS_KEYS_GAMES: UserStateParamsKeys[] = ['core_fav_game_top3', 'core_fav_game_type_top3', 'core_fav_game_provider_top3'];
|
|
10
10
|
const USER_STATE_PARAMS_KEYS_BET_AMOUNT: UserStateParamsKeys[] = ['core_recommended_deposit_amount', 'core_recommended_casino_bet_amount', 'casino_last_bet_amount', 'casino_last_bet_amount_real', 'casino_last_bet_amount_bonus', 'acc_last_deposit_amount'];
|
|
11
|
+
|
|
12
|
+
const MINOR_WORDS = new Set([
|
|
13
|
+
'of', 'at', 'in', 'on', 'to', 'up', 'as', 'by', 'for',
|
|
14
|
+
'from', 'into', 'onto', 'with', 'upon', 'via',
|
|
15
|
+
'and', 'but', 'or', 'nor', 'so', 'yet',
|
|
16
|
+
'vs', 'v',
|
|
17
|
+
'a', 'an', 'the',
|
|
18
|
+
]);
|
|
19
|
+
|
|
20
|
+
function toGameTitleCase(raw: string): string {
|
|
21
|
+
if (!raw) return raw;
|
|
22
|
+
const tokens = raw.toLowerCase().split(/(\b\w+\b)/);
|
|
23
|
+
const wordTokens = tokens.filter((t) => /^\w+$/.test(t));
|
|
24
|
+
const lastWordIdx = wordTokens.length - 1;
|
|
25
|
+
let wordIndex = 0;
|
|
26
|
+
return tokens
|
|
27
|
+
.map((token) => {
|
|
28
|
+
if (!/^\w+$/.test(token)) return token;
|
|
29
|
+
const isFirst = wordIndex === 0;
|
|
30
|
+
const isLast = wordIndex === lastWordIdx;
|
|
31
|
+
wordIndex++;
|
|
32
|
+
if (isFirst || isLast || !MINOR_WORDS.has(token)) {
|
|
33
|
+
return token.charAt(0).toUpperCase() + token.slice(1);
|
|
34
|
+
}
|
|
35
|
+
return token;
|
|
36
|
+
})
|
|
37
|
+
.join('');
|
|
38
|
+
}
|
|
39
|
+
|
|
11
40
|
export class MissionUtils {
|
|
12
41
|
|
|
13
42
|
public static getAvailabilityStatus = (mission: UserAchievement) => {
|
|
@@ -199,8 +228,8 @@ export class MissionUtils {
|
|
|
199
228
|
const value = userStateParams[k]?.filter(v => Boolean(v));
|
|
200
229
|
if (value && value.length > 0) {
|
|
201
230
|
suggestedGames = value.map((v: string) => {
|
|
202
|
-
const cleaned = v.replace(/_/g, ' ')
|
|
203
|
-
return
|
|
231
|
+
const cleaned = v.replace(/_/g, ' ');
|
|
232
|
+
return toGameTitleCase(cleaned);
|
|
204
233
|
}).join(', ');
|
|
205
234
|
}
|
|
206
235
|
}
|
|
@@ -213,8 +242,7 @@ export class MissionUtils {
|
|
|
213
242
|
suggestedGames = value[pos];
|
|
214
243
|
|
|
215
244
|
if (suggestedGames) {
|
|
216
|
-
suggestedGames = suggestedGames.replace(
|
|
217
|
-
suggestedGames = suggestedGames.charAt(0).toUpperCase() + suggestedGames.slice(1);
|
|
245
|
+
suggestedGames = toGameTitleCase(suggestedGames.replace(/_/g, ' '));
|
|
218
246
|
}
|
|
219
247
|
|
|
220
248
|
}
|
package/src/SmarticoAPI.ts
CHANGED
|
@@ -68,6 +68,8 @@ import {
|
|
|
68
68
|
enrichUserAchievementsWithBadgeState,
|
|
69
69
|
} from './Missions';
|
|
70
70
|
import {
|
|
71
|
+
GetClanTournamentPlayersRequest,
|
|
72
|
+
GetClanTournamentPlayersResponse,
|
|
71
73
|
GetTournamentInfoRequest,
|
|
72
74
|
GetTournamentInfoResponse,
|
|
73
75
|
GetTournamentsRequest,
|
|
@@ -75,6 +77,7 @@ import {
|
|
|
75
77
|
TournamentItemsTransform,
|
|
76
78
|
TournamentRegisterRequest,
|
|
77
79
|
TournamentRegisterResponse,
|
|
80
|
+
clanTournamentPlayersTransform,
|
|
78
81
|
tournamentInfoItemTransform,
|
|
79
82
|
} from './Tournaments';
|
|
80
83
|
import { GetLeaderBoardsRequest, GetLeaderBoardsResponse, LeaderBoardDetails, LeaderBoardPeriodType } from './Leaderboard';
|
|
@@ -103,6 +106,10 @@ import {
|
|
|
103
106
|
TAvatarDefinition,
|
|
104
107
|
TAvatarCustomized,
|
|
105
108
|
TAvatarPrompt,
|
|
109
|
+
TClans,
|
|
110
|
+
TClanInfo,
|
|
111
|
+
TClanJoinResult,
|
|
112
|
+
TClanTournamentPlayers,
|
|
106
113
|
} from './WSAPI/WSAPITypes';
|
|
107
114
|
import { getLeaderBoardTransform } from './Leaderboard/LeaderBoards';
|
|
108
115
|
import { GetAchievementsUserInfoResponse } from './Core/GetAchievementsUserInfoResponse';
|
|
@@ -130,6 +137,7 @@ import { GetRelatedAchTourResponse } from './Missions/GetRelatedAchTourResponse'
|
|
|
130
137
|
import { GetRafflesResponse, raffleTransform } from './Raffle/GetRafflesResponse';
|
|
131
138
|
import { GetRafflesRequest } from './Raffle/GetRafflesRequest';
|
|
132
139
|
import { GetActivityLogRequest, GetActivityLogResponse, ActivityLogTransform } from './ActivityLog';
|
|
140
|
+
import { GetClanListRequest, GetClanListResponse, GetClanInfoRequest, GetClanInfoResponse, JoinClanRequest, JoinClanResponse } from './Clans';
|
|
133
141
|
import { InboxCategories } from './Inbox/InboxCategories';
|
|
134
142
|
import { GetDrawRunRequest, GetDrawRunResponse, GetRaffleDrawRunsHistoryRequest, GetRaffleDrawRunsHistoryResponse, RaffleClaimPrizeRequest, RaffleClaimPrizeResponse, RaffleOptinRequest, RaffleOptinResponse, drawRunTransform } from './Raffle';
|
|
135
143
|
import { GetAvatarsListResponse, avatarDefinitionTransform } from './Avatars/GetAvatarsListResponse';
|
|
@@ -1005,6 +1013,69 @@ class SmarticoAPI {
|
|
|
1005
1013
|
return TournamentItemsTransform((await this.tournamentsGetLobby(user_ext_id)).tournaments);
|
|
1006
1014
|
}
|
|
1007
1015
|
|
|
1016
|
+
public async clansGetList(user_ext_id: string, force_language?: string): Promise<GetClanListResponse> {
|
|
1017
|
+
const message = this.buildMessage<GetClanListRequest, GetClanListResponse>(
|
|
1018
|
+
user_ext_id,
|
|
1019
|
+
ClassId.GET_CLAN_LIST_REQUEST,
|
|
1020
|
+
);
|
|
1021
|
+
return await this.send<GetClanListResponse>(message, ClassId.GET_CLAN_LIST_RESPONSE, force_language);
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
public async clansGetListT(user_ext_id: string): Promise<TClans> {
|
|
1025
|
+
const response = await this.clansGetList(user_ext_id);
|
|
1026
|
+
return {
|
|
1027
|
+
clans: response.clans,
|
|
1028
|
+
user_clan_id: response.user_clan_id,
|
|
1029
|
+
cooldown_until: response.cooldown_until,
|
|
1030
|
+
};
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
public async clansGetInfo(user_ext_id: string, clanId: number, force_language?: string): Promise<GetClanInfoResponse> {
|
|
1034
|
+
const message = this.buildMessage<GetClanInfoRequest, GetClanInfoResponse>(
|
|
1035
|
+
user_ext_id,
|
|
1036
|
+
ClassId.GET_CLAN_INFO_REQUEST,
|
|
1037
|
+
{ clan_id: clanId },
|
|
1038
|
+
);
|
|
1039
|
+
return await this.send<GetClanInfoResponse>(message, ClassId.GET_CLAN_INFO_RESPONSE, force_language);
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
public async clansGetInfoT(user_ext_id: string, clanId: number, force_language?: string): Promise<TClanInfo> {
|
|
1043
|
+
const response = await this.clansGetInfo(user_ext_id, clanId, force_language);
|
|
1044
|
+
const c = response.clan_info;
|
|
1045
|
+
return {
|
|
1046
|
+
clan_id: c.clan_id,
|
|
1047
|
+
public_meta: c.public_meta,
|
|
1048
|
+
member_count: c.member_count,
|
|
1049
|
+
capacity_limit: c.capacity_limit,
|
|
1050
|
+
entry_fee_currency_type_id: response.entry_fee_currency_type_id ?? c.entry_fee_currency_type_id,
|
|
1051
|
+
entry_fee_amount: response.entry_fee_amount ?? c.entry_fee_amount,
|
|
1052
|
+
rating_position: c.rating_position,
|
|
1053
|
+
rating_score: c.rating_score,
|
|
1054
|
+
cooldown_until: response.cooldown_until ?? null,
|
|
1055
|
+
members: (response.members || []).map((m) => ({
|
|
1056
|
+
user_id: m.user_id,
|
|
1057
|
+
public_username: m.public_username,
|
|
1058
|
+
avatar_id: m.avatar_id,
|
|
1059
|
+
avatar_real_id: m.avatar_real_id,
|
|
1060
|
+
avatar_url: CoreUtils.avatarUrl(m.avatar_id, this.avatarDomain),
|
|
1061
|
+
position: m.position,
|
|
1062
|
+
contribution_score: m.contribution_score,
|
|
1063
|
+
is_me: m.is_me,
|
|
1064
|
+
clean_ext_user_id: m.clean_ext_user_id,
|
|
1065
|
+
})),
|
|
1066
|
+
};
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
public async clanJoin(user_ext_id: string, clanId: number, joinSourceId: number = 0): Promise<TClanJoinResult> {
|
|
1070
|
+
const message = this.buildMessage<JoinClanRequest, JoinClanResponse>(
|
|
1071
|
+
user_ext_id,
|
|
1072
|
+
ClassId.JOIN_CLAN_REQUEST,
|
|
1073
|
+
{ clan_id: clanId, join_source_id: joinSourceId },
|
|
1074
|
+
);
|
|
1075
|
+
const response = await this.send<JoinClanResponse>(message, ClassId.JOIN_CLAN_RESPONSE);
|
|
1076
|
+
return { errCode: response.errCode ?? 0, errMsg: response.errMsg ?? '' };
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1008
1079
|
public async tournamentsGetInfo(
|
|
1009
1080
|
user_ext_id: string,
|
|
1010
1081
|
tournamentInstanceId: number,
|
|
@@ -1044,6 +1115,30 @@ class SmarticoAPI {
|
|
|
1044
1115
|
return tournamentInfoItemTransform(response);
|
|
1045
1116
|
}
|
|
1046
1117
|
|
|
1118
|
+
public async clanTournamentGetPlayers(
|
|
1119
|
+
user_ext_id: string,
|
|
1120
|
+
tournamentInstanceId: number,
|
|
1121
|
+
clanId: number,
|
|
1122
|
+
force_language?: string,
|
|
1123
|
+
): Promise<TClanTournamentPlayers> {
|
|
1124
|
+
const message = this.buildMessage<GetClanTournamentPlayersRequest, GetClanTournamentPlayersResponse>(
|
|
1125
|
+
user_ext_id,
|
|
1126
|
+
ClassId.GET_CLAN_TOURNAMENT_PLAYERS_REQUEST,
|
|
1127
|
+
{ tournamentInstanceId, clanId, forceLanguage: force_language },
|
|
1128
|
+
);
|
|
1129
|
+
const response = await this.send<GetClanTournamentPlayersResponse>(
|
|
1130
|
+
message,
|
|
1131
|
+
ClassId.GET_CLAN_TOURNAMENT_PLAYERS_RESPONSE,
|
|
1132
|
+
force_language,
|
|
1133
|
+
);
|
|
1134
|
+
if (response.players?.length) {
|
|
1135
|
+
response.players.forEach((p) => {
|
|
1136
|
+
p.avatar_url = CoreUtils.avatarUrl(p.avatar_id, this.avatarDomain);
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
return clanTournamentPlayersTransform(response);
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1047
1142
|
public async leaderboardGet(
|
|
1048
1143
|
user_ext_id: string,
|
|
1049
1144
|
period_type_id?: LeaderBoardPeriodType,
|
package/src/SmarticoLib/index.ts
CHANGED
|
@@ -1030,6 +1030,155 @@ export interface TTournamentDetailed extends TTournament {
|
|
|
1030
1030
|
/** if the prize is points related, indicates amount of points */
|
|
1031
1031
|
points?: number;
|
|
1032
1032
|
}[];
|
|
1033
|
+
/** True when this tournament groups participants by clan */
|
|
1034
|
+
is_clan_based?: boolean;
|
|
1035
|
+
/** Ranked list of clans in this tournament; null for non-clan tournaments */
|
|
1036
|
+
clan_leaderboard?: {
|
|
1037
|
+
clan_id: number;
|
|
1038
|
+
public_meta: { name: string; description: string; image_url: string };
|
|
1039
|
+
position: number;
|
|
1040
|
+
total_score: number;
|
|
1041
|
+
contributing_members: number;
|
|
1042
|
+
}[] | null;
|
|
1043
|
+
/** The clan ID the current user belongs to; null when clanless or non-clan tournament */
|
|
1044
|
+
user_clan_id?: number | null;
|
|
1045
|
+
/** The user's rank within their own clan; null when clanless or not registered */
|
|
1046
|
+
user_position_in_clan?: number | null;
|
|
1047
|
+
/** The user's score contribution to their clan; null when clanless or not registered */
|
|
1048
|
+
user_score_in_clan?: number | null;
|
|
1049
|
+
/** Per-clan prize structure; null for non-clan tournaments */
|
|
1050
|
+
clan_prize_structure?: {
|
|
1051
|
+
clan_place: number;
|
|
1052
|
+
/** 1 = Fixed, 2 = Dynamic */
|
|
1053
|
+
prize_type_id: number;
|
|
1054
|
+
prize_pool_amount: number | null;
|
|
1055
|
+
activity_type_id: number | null;
|
|
1056
|
+
details_json: Record<string, any>;
|
|
1057
|
+
public_meta: { name: string; description: string; image_url: string } | null;
|
|
1058
|
+
tiers: {
|
|
1059
|
+
player_place_from: number;
|
|
1060
|
+
player_place_to: number;
|
|
1061
|
+
pool_amount: number | null;
|
|
1062
|
+
/** 1 = ScoreWeighted, 2 = EqualSplit; null for Fixed */
|
|
1063
|
+
distribution_type: number | null;
|
|
1064
|
+
activity_type_id: number;
|
|
1065
|
+
details_json: Record<string, any>;
|
|
1066
|
+
public_meta: { name: string; description: string; image_url: string } | null;
|
|
1067
|
+
}[];
|
|
1068
|
+
}[] | null;
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* TClanTournamentPlayers describes the players of a specific clan in a clan-based tournament.
|
|
1072
|
+
*/
|
|
1073
|
+
export interface TClanTournamentPlayers {
|
|
1074
|
+
/** Clan ID */
|
|
1075
|
+
clan_id: number;
|
|
1076
|
+
/** Clan display metadata */
|
|
1077
|
+
public_meta: { name: string; image_url: string };
|
|
1078
|
+
/** Top players of this clan ranked by score DESC */
|
|
1079
|
+
players: {
|
|
1080
|
+
user_id: number;
|
|
1081
|
+
public_username: string;
|
|
1082
|
+
avatar_id: string;
|
|
1083
|
+
avatar_real_id: number;
|
|
1084
|
+
avatar_url?: string;
|
|
1085
|
+
position: number;
|
|
1086
|
+
scores: number;
|
|
1087
|
+
is_me: boolean;
|
|
1088
|
+
clean_ext_user_id: string;
|
|
1089
|
+
}[];
|
|
1090
|
+
}
|
|
1091
|
+
export interface GetClanListResponse extends ProtocolResponse {
|
|
1092
|
+
clans: {
|
|
1093
|
+
clan_id: number;
|
|
1094
|
+
public_meta: { name: string; description: string; image_url: string };
|
|
1095
|
+
member_count: number;
|
|
1096
|
+
capacity_limit: number;
|
|
1097
|
+
entry_fee_currency_type_id: number;
|
|
1098
|
+
entry_fee_amount: number;
|
|
1099
|
+
rating_position: number;
|
|
1100
|
+
rating_score: number;
|
|
1101
|
+
}[];
|
|
1102
|
+
user_clan_id?: number | null;
|
|
1103
|
+
cooldown_until?: string | null;
|
|
1104
|
+
}
|
|
1105
|
+
export interface GetClanInfoResponse extends ProtocolResponse {
|
|
1106
|
+
clan_info: {
|
|
1107
|
+
clan_id: number;
|
|
1108
|
+
public_meta: { name: string; description: string; image_url: string };
|
|
1109
|
+
member_count: number;
|
|
1110
|
+
capacity_limit: number;
|
|
1111
|
+
entry_fee_currency_type_id: number;
|
|
1112
|
+
entry_fee_amount: number;
|
|
1113
|
+
rating_position: number;
|
|
1114
|
+
rating_score: number;
|
|
1115
|
+
};
|
|
1116
|
+
members: {
|
|
1117
|
+
user_id: number;
|
|
1118
|
+
public_username: string;
|
|
1119
|
+
avatar_id: string;
|
|
1120
|
+
avatar_real_id: number;
|
|
1121
|
+
position: number;
|
|
1122
|
+
contribution_score: number;
|
|
1123
|
+
is_me?: boolean;
|
|
1124
|
+
clean_ext_user_id?: string;
|
|
1125
|
+
}[];
|
|
1126
|
+
entry_fee_currency_type_id: number;
|
|
1127
|
+
entry_fee_amount: number;
|
|
1128
|
+
cooldown_until: string | null;
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* TClan describes one clan item from the clans list.
|
|
1132
|
+
*/
|
|
1133
|
+
export interface TClan {
|
|
1134
|
+
clan_id: number;
|
|
1135
|
+
public_meta: { name: string; description: string; image_url: string };
|
|
1136
|
+
member_count: number;
|
|
1137
|
+
capacity_limit: number;
|
|
1138
|
+
entry_fee_currency_type_id: number;
|
|
1139
|
+
entry_fee_amount: number;
|
|
1140
|
+
rating_position: number;
|
|
1141
|
+
rating_score: number;
|
|
1142
|
+
}
|
|
1143
|
+
/**
|
|
1144
|
+
* TClans describes the clans payload returned by the API.
|
|
1145
|
+
*/
|
|
1146
|
+
export interface TClans {
|
|
1147
|
+
clans: TClan[];
|
|
1148
|
+
user_clan_id: number | null;
|
|
1149
|
+
cooldown_until: string | null;
|
|
1150
|
+
}
|
|
1151
|
+
/**
|
|
1152
|
+
* TClanInfo describes the detailed info of a single clan including its members.
|
|
1153
|
+
*/
|
|
1154
|
+
export interface TClanInfo {
|
|
1155
|
+
clan_id: number;
|
|
1156
|
+
public_meta: { name: string; description: string; image_url: string };
|
|
1157
|
+
member_count: number;
|
|
1158
|
+
capacity_limit: number;
|
|
1159
|
+
entry_fee_currency_type_id: number;
|
|
1160
|
+
entry_fee_amount: number;
|
|
1161
|
+
rating_position: number;
|
|
1162
|
+
rating_score: number;
|
|
1163
|
+
cooldown_until: string | null;
|
|
1164
|
+
members: {
|
|
1165
|
+
user_id: number;
|
|
1166
|
+
public_username: string;
|
|
1167
|
+
avatar_id: string;
|
|
1168
|
+
avatar_real_id: number;
|
|
1169
|
+
avatar_url?: string;
|
|
1170
|
+
position: number;
|
|
1171
|
+
contribution_score: number;
|
|
1172
|
+
is_me?: boolean;
|
|
1173
|
+
clean_ext_user_id?: string;
|
|
1174
|
+
}[];
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* TClanJoinResult describes the result of a join clan request.
|
|
1178
|
+
*/
|
|
1179
|
+
export interface TClanJoinResult {
|
|
1180
|
+
errCode: number;
|
|
1181
|
+
errMsg: string;
|
|
1033
1182
|
}
|
|
1034
1183
|
/**
|
|
1035
1184
|
* TStoreCategory describes the store category item. Each store item can be assigned to 1 or more categories
|
|
@@ -1756,8 +1905,16 @@ declare class WSAPI {
|
|
|
1756
1905
|
getTournamentsList({ onUpdate }?: { onUpdate?: (data: TTournament[]) => void }): Promise<TTournament[]>;
|
|
1757
1906
|
/** Returns details information of specific tournament instance, the response will include tournament info and the leaderboard of players */
|
|
1758
1907
|
getTournamentInstanceInfo(tournamentInstanceId: number): Promise<TTournamentDetailed>;
|
|
1908
|
+
/** Returns the players of a specific clan in a clan-based tournament */
|
|
1909
|
+
getClanTournamentPlayers(tournamentInstanceId: number, clanId: number): Promise<TClanTournamentPlayers>;
|
|
1759
1910
|
/** Requests registration for the specified tournament instance. Returns the err_code. */
|
|
1760
1911
|
registerInTournament(tournamentInstanceId: number): Promise<TTournamentRegistrationResult>;
|
|
1912
|
+
/** Returns clans list */
|
|
1913
|
+
getClans({ onUpdate }?: { onUpdate?: (data: TClans) => void }): Promise<TClans>;
|
|
1914
|
+
/** Returns detailed info for a specific clan including its members */
|
|
1915
|
+
getClanInfo(clanId: number): Promise<TClanInfo>;
|
|
1916
|
+
/** Joins a clan on behalf of the current user */
|
|
1917
|
+
joinClan(clanId: number): Promise<TClanJoinResult>;
|
|
1761
1918
|
/** Returns the leaderboard for the current type (default is Daily). If getPreviousPeriod is passed as true, a leaderboard for the previous period for the current type will be returned.
|
|
1762
1919
|
For example, if the type is Weekly and getPreviousPeriod is true, a leaderboard for the previous week will be returned.
|
|
1763
1920
|
*/
|
|
@@ -1887,6 +2044,12 @@ declare class SmarticoAPI {
|
|
|
1887
2044
|
tournamentsGetLobbyT(user_ext_id: string): Promise<TTournament[]>;
|
|
1888
2045
|
tournamentsGetInfo(user_ext_id: string, tournamentInstanceId: number): Promise<GetTournamentInfoResponse>;
|
|
1889
2046
|
tournamentsGetInfoT(user_ext_id: string, tournamentInstanceId: number): Promise<TTournamentDetailed>;
|
|
2047
|
+
clanTournamentGetPlayers(user_ext_id: string, tournamentInstanceId: number, clanId: number, force_language?: string): Promise<TClanTournamentPlayers>;
|
|
2048
|
+
clansGetList(user_ext_id: string, force_language?: string): Promise<GetClanListResponse>;
|
|
2049
|
+
clansGetListT(user_ext_id: string): Promise<TClans>;
|
|
2050
|
+
clansGetInfo(user_ext_id: string, clanId: number, force_language?: string): Promise<GetClanInfoResponse>;
|
|
2051
|
+
clansGetInfoT(user_ext_id: string, clanId: number, force_language?: string): Promise<TClanInfo>;
|
|
2052
|
+
clanJoin(user_ext_id: string, clanId: number, joinSourceId?: number): Promise<TClanJoinResult>;
|
|
1890
2053
|
leaderboardGet(
|
|
1891
2054
|
user_ext_id: string,
|
|
1892
2055
|
period_type_id?: LeaderBoardPeriodType,
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ProtocolResponse } from '../Base/ProtocolResponse';
|
|
2
|
+
|
|
3
|
+
export interface ClanTournamentPlayerRaw {
|
|
4
|
+
user_id: number;
|
|
5
|
+
public_username: string;
|
|
6
|
+
avatar_id: string;
|
|
7
|
+
avatar_real_id: number;
|
|
8
|
+
position: number;
|
|
9
|
+
scores: number;
|
|
10
|
+
is_me: boolean;
|
|
11
|
+
clean_ext_user_id: string;
|
|
12
|
+
avatar_url?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface GetClanTournamentPlayersResponse extends ProtocolResponse {
|
|
16
|
+
clan_id: number;
|
|
17
|
+
clan_public_meta: { name: string; image_url: string };
|
|
18
|
+
players: ClanTournamentPlayerRaw[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface TClanTournamentPlayer {
|
|
22
|
+
user_id: number;
|
|
23
|
+
public_username: string;
|
|
24
|
+
avatar_id: string;
|
|
25
|
+
avatar_real_id: number;
|
|
26
|
+
avatar_url?: string;
|
|
27
|
+
position: number;
|
|
28
|
+
scores: number;
|
|
29
|
+
is_me: boolean;
|
|
30
|
+
clean_ext_user_id: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface TClanTournamentPlayersResult {
|
|
34
|
+
clan_id: number;
|
|
35
|
+
clan_public_meta: { name: string; image_url: string };
|
|
36
|
+
players: TClanTournamentPlayer[];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const clanTournamentPlayersTransform = (response: GetClanTournamentPlayersResponse): TClanTournamentPlayersResult => {
|
|
40
|
+
return {
|
|
41
|
+
clan_id: response.clan_id,
|
|
42
|
+
clan_public_meta: {
|
|
43
|
+
name: response.clan_public_meta.name,
|
|
44
|
+
image_url: response.clan_public_meta.image_url,
|
|
45
|
+
},
|
|
46
|
+
players: (response.players || []).map((p) => ({
|
|
47
|
+
user_id: p.user_id,
|
|
48
|
+
public_username: p.public_username,
|
|
49
|
+
avatar_id: p.avatar_id,
|
|
50
|
+
avatar_real_id: p.avatar_real_id,
|
|
51
|
+
avatar_url: p.avatar_url,
|
|
52
|
+
position: p.position,
|
|
53
|
+
scores: p.scores,
|
|
54
|
+
is_me: p.is_me,
|
|
55
|
+
clean_ext_user_id: p.clean_ext_user_id,
|
|
56
|
+
})),
|
|
57
|
+
};
|
|
58
|
+
};
|
|
@@ -4,6 +4,7 @@ import { ProtocolResponse } from '../Base/ProtocolResponse';
|
|
|
4
4
|
import { TournamentPrize } from './TournamentPrize';
|
|
5
5
|
import { TTournamentDetailed } from '../WSAPI/WSAPITypes';
|
|
6
6
|
import { TournamentUtils } from './TournamentUtils';
|
|
7
|
+
import { ClanLeaderboardEntry, ClanPrizeStructureEntry } from './TournamentClan';
|
|
7
8
|
|
|
8
9
|
export interface GetTournamentInfoResponse extends ProtocolResponse {
|
|
9
10
|
/** tournament info */
|
|
@@ -20,6 +21,16 @@ export interface GetTournamentInfoResponse extends ProtocolResponse {
|
|
|
20
21
|
prizeStructure?: {
|
|
21
22
|
prizes: TournamentPrize[];
|
|
22
23
|
};
|
|
24
|
+
/** Ranked list of clans in this tournament. Empty/null for non-clan tournaments. */
|
|
25
|
+
clanLeaderboard?: ClanLeaderboardEntry[] | null;
|
|
26
|
+
/**
|
|
27
|
+
* The clan ID the current user belongs to.
|
|
28
|
+
* null when the user has no clan or the tournament is not clan-based.
|
|
29
|
+
* Match against clanLeaderboard[i].clan_id to highlight the user's clan row.
|
|
30
|
+
*/
|
|
31
|
+
userClanId?: number | null;
|
|
32
|
+
/** Per-clan prize structure. Empty/null for non-clan tournaments. */
|
|
33
|
+
clanPrizes?: ClanPrizeStructureEntry[] | null;
|
|
23
34
|
}
|
|
24
35
|
|
|
25
36
|
export const tournamentInfoItemTransform = (t: GetTournamentInfoResponse): TTournamentDetailed => {
|
|
@@ -49,5 +60,46 @@ export const tournamentInfoItemTransform = (t: GetTournamentInfoResponse): TTour
|
|
|
49
60
|
response.me = TournamentUtils.getPlayerTransformed(t.userPosition, true);
|
|
50
61
|
}
|
|
51
62
|
|
|
63
|
+
if (t.tournamentInfo?.tournamentLobbyInfo?.isClanBased) {
|
|
64
|
+
response.is_clan_based = true;
|
|
65
|
+
response.user_clan_id = t.userClanId ?? null;
|
|
66
|
+
response.clan_leaderboard = t.clanLeaderboard
|
|
67
|
+
? t.clanLeaderboard.map((entry) => ({
|
|
68
|
+
clan_id: entry.clan_id,
|
|
69
|
+
public_meta: {
|
|
70
|
+
name: entry.public_meta.name,
|
|
71
|
+
description: entry.public_meta.description,
|
|
72
|
+
image_url: entry.public_meta.image_url,
|
|
73
|
+
},
|
|
74
|
+
position: entry.position,
|
|
75
|
+
total_score: entry.total_score,
|
|
76
|
+
contributing_members: entry.contributing_members,
|
|
77
|
+
}))
|
|
78
|
+
: null;
|
|
79
|
+
response.clan_prize_structure = t.clanPrizes
|
|
80
|
+
? t.clanPrizes.map((entry) => ({
|
|
81
|
+
clan_place: entry.clan_place,
|
|
82
|
+
prize_type_id: entry.prize_type_id,
|
|
83
|
+
prize_pool_amount: entry.prize_pool_amount,
|
|
84
|
+
activity_type_id: entry.activity_type_id,
|
|
85
|
+
details_json: entry.details_json,
|
|
86
|
+
public_meta: entry.public_meta
|
|
87
|
+
? { name: entry.public_meta.name, description: entry.public_meta.description, image_url: entry.public_meta.image_url }
|
|
88
|
+
: null,
|
|
89
|
+
tiers: (entry.tiers || []).map((tier) => ({
|
|
90
|
+
player_place_from: tier.player_place_from,
|
|
91
|
+
player_place_to: tier.player_place_to,
|
|
92
|
+
pool_amount: tier.pool_amount,
|
|
93
|
+
distribution_type: tier.distribution_type,
|
|
94
|
+
activity_type_id: tier.activity_type_id,
|
|
95
|
+
details_json: tier.details_json,
|
|
96
|
+
public_meta: tier.public_meta
|
|
97
|
+
? { name: tier.public_meta.name, description: tier.public_meta.description, image_url: tier.public_meta.image_url }
|
|
98
|
+
: null,
|
|
99
|
+
})),
|
|
100
|
+
}))
|
|
101
|
+
: null;
|
|
102
|
+
}
|
|
103
|
+
|
|
52
104
|
return response;
|
|
53
105
|
};
|
|
@@ -70,6 +70,8 @@ export interface Tournament {
|
|
|
70
70
|
hideLeaderboardsMinScores?: boolean;
|
|
71
71
|
/** Total scores across all participants in the tournament */
|
|
72
72
|
totalScores?: number;
|
|
73
|
+
/** Indicates if the tournament is clan-based */
|
|
74
|
+
isClanBased?: boolean;
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
export const TournamentItemsTransform = (items: Tournament[]): TTournament[] => {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ClanPublicMeta } from '../Clans/Clan';
|
|
2
|
+
|
|
3
|
+
export interface ClanLeaderboardEntry {
|
|
4
|
+
clan_id: number;
|
|
5
|
+
public_meta: ClanPublicMeta;
|
|
6
|
+
position: number;
|
|
7
|
+
total_score: number;
|
|
8
|
+
contributing_members: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ClanPrizeTier {
|
|
12
|
+
player_place_from: number;
|
|
13
|
+
player_place_to: number;
|
|
14
|
+
pool_amount: number | null;
|
|
15
|
+
distribution_type: number | null;
|
|
16
|
+
activity_type_id: number;
|
|
17
|
+
details_json: Record<string, any>;
|
|
18
|
+
public_meta: ClanPublicMeta | null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ClanPrizeStructureEntry {
|
|
22
|
+
clan_place: number;
|
|
23
|
+
/** 1 = Fixed, 2 = Dynamic */
|
|
24
|
+
prize_type_id: number;
|
|
25
|
+
prize_pool_amount: number | null;
|
|
26
|
+
activity_type_id: number | null;
|
|
27
|
+
details_json: Record<string, any>;
|
|
28
|
+
public_meta: ClanPublicMeta;
|
|
29
|
+
tiers: ClanPrizeTier[];
|
|
30
|
+
}
|
package/src/Tournaments/index.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
export * from './GetClanTournamentPlayersRequest';
|
|
2
|
+
export * from './GetClanTournamentPlayersResponse';
|
|
1
3
|
export * from './GetTournamentInfoRequest';
|
|
2
4
|
export * from './GetTournamentInfoResponse';
|
|
3
5
|
export * from './GetTournamentsRequest';
|
|
4
6
|
export * from './GetTournamentsResponse';
|
|
5
7
|
export * from './Tournament';
|
|
8
|
+
export * from './TournamentClan';
|
|
6
9
|
export * from './TournamentInstanceStatus';
|
|
7
10
|
export * from './TournamentPlayer';
|
|
8
11
|
export * from './TournamentPrize';
|