@smartico/public-api 0.0.158 → 0.0.160

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.
Files changed (185) hide show
  1. package/.prettierrc +10 -10
  2. package/dist/Bonuses/Bonus.d.ts +20 -0
  3. package/dist/Bonuses/BonusMetaMap.d.ts +3 -0
  4. package/dist/Bonuses/BonusStatus.d.ts +8 -0
  5. package/dist/Bonuses/BonusTemplateMetaMap.d.ts +5 -0
  6. package/dist/Bonuses/ClaimBonusRequest.d.ts +4 -0
  7. package/dist/Bonuses/ClaimBonusResponse.d.ts +4 -0
  8. package/dist/Bonuses/GetBonusesRequest.d.ts +3 -0
  9. package/dist/Bonuses/GetBonusesResponse.d.ts +5 -0
  10. package/dist/Bonuses/index.d.ts +7 -0
  11. package/dist/SmarticoAPI.d.ts +5 -1
  12. package/dist/SmarticoLib/index.d.ts +58 -2
  13. package/dist/WSAPI/WSAPI.d.ts +18 -3
  14. package/dist/WSAPI/WSAPITypes.d.ts +32 -0
  15. package/dist/index.d.ts +1 -0
  16. package/dist/index.js +254 -147
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.modern.mjs +72 -2
  19. package/dist/index.modern.mjs.map +1 -1
  20. package/docs/README.md +2 -0
  21. package/docs/classes/WSAPI.md +109 -72
  22. package/docs/interfaces/TBonus.md +65 -0
  23. package/docs/interfaces/TClaimBonusResult.md +27 -0
  24. package/docs/interfaces/TInboxMessageBody.md +2 -2
  25. package/docs/interfaces/TLevel.md +2 -2
  26. package/docs/interfaces/TMissionOrBadgeTask.md +1 -10
  27. package/docs/interfaces/TTournament.md +1 -1
  28. package/docs/interfaces/TTournamentDetailed.md +2 -2
  29. package/docs/interfaces/TUserProfile.md +2 -2
  30. package/package.json +41 -41
  31. package/src/Base/AchRelatedGame.ts +10 -10
  32. package/src/Base/ProtocolMessage.ts +4 -4
  33. package/src/Base/ProtocolRequest.ts +4 -4
  34. package/src/Base/ProtocolResponse.ts +3 -3
  35. package/src/Bonuses/Bonus.ts +40 -0
  36. package/src/Bonuses/BonusMetaMap.ts +3 -0
  37. package/src/Bonuses/BonusStatus.ts +8 -0
  38. package/src/Bonuses/BonusTemplateMetaMap.ts +6 -0
  39. package/src/Bonuses/ClaimBonusRequest.ts +5 -0
  40. package/src/Bonuses/ClaimBonusResponse.ts +5 -0
  41. package/src/Bonuses/GetBonusesRequest.ts +3 -0
  42. package/src/Bonuses/GetBonusesResponse.ts +6 -0
  43. package/src/Bonuses/index.ts +7 -0
  44. package/src/CookieStore.ts +6 -6
  45. package/src/Core/CheckSegmentMatchRequest.ts +2 -2
  46. package/src/Core/CheckSegmentMatchResponse.ts +4 -4
  47. package/src/Core/CoreUtils.ts +12 -7
  48. package/src/Core/GetAchievementsUserInfoRequest.ts +1 -1
  49. package/src/Core/GetAchievementsUserInfoResponse.ts +3 -3
  50. package/src/Core/GetLabelInfoRequest.ts +1 -1
  51. package/src/Core/GetLabelInfoResponse.ts +3 -3
  52. package/src/Core/GetTranslationsRequest.ts +5 -5
  53. package/src/Core/GetTranslationsResponse.ts +3 -3
  54. package/src/Core/PublicProperties.ts +7 -7
  55. package/src/Core/ResponseIdentify.ts +10 -10
  56. package/src/Core/TranslationArea.ts +1 -1
  57. package/src/Core/index.ts +9 -9
  58. package/src/CustomSections/GetCustomSectionsRequest.ts +1 -1
  59. package/src/CustomSections/GetCustomSectionsResponse.ts +3 -3
  60. package/src/CustomSections/UICustomSection.ts +21 -16
  61. package/src/CustomSections/index.ts +4 -4
  62. package/src/ErrorCodes.ts +2 -2
  63. package/src/GResponse.ts +5 -5
  64. package/src/ILogger.ts +5 -5
  65. package/src/Inbox/GetInboxMessagesRequest.ts +4 -4
  66. package/src/Inbox/GetInboxMessagesResponse.ts +8 -8
  67. package/src/Inbox/InboxMessage.ts +20 -20
  68. package/src/Inbox/MarkInboxMessageDeletedRequest.ts +3 -3
  69. package/src/Inbox/MarkInboxMessageDeletedResponse.ts +3 -3
  70. package/src/Inbox/MarkInboxMessageReadRequest.ts +3 -3
  71. package/src/Inbox/MarkInboxMessageReadResponse.ts +3 -3
  72. package/src/Inbox/MarkInboxMessageStarredRequest.ts +3 -3
  73. package/src/Inbox/MarkInboxMessageStarredResponse.ts +3 -3
  74. package/src/Inbox/index.ts +10 -10
  75. package/src/IntUtils.ts +36 -28
  76. package/src/Jackpots/GetJackpotsPotsRequest.ts +2 -2
  77. package/src/Jackpots/GetJackpotsPotsResponse.ts +3 -3
  78. package/src/Jackpots/GetJackpotsRequest.ts +3 -3
  79. package/src/Jackpots/GetJackpotsResponse.ts +4 -4
  80. package/src/Jackpots/JackPotWinner.ts +6 -6
  81. package/src/Jackpots/JackpotContributionType.ts +1 -1
  82. package/src/Jackpots/JackpotDetails.ts +18 -18
  83. package/src/Jackpots/JackpotHtmlTemplate.ts +3 -3
  84. package/src/Jackpots/JackpotPot.ts +6 -6
  85. package/src/Jackpots/JackpotPublicMeta.ts +9 -9
  86. package/src/Jackpots/JackpotType.ts +1 -1
  87. package/src/Jackpots/JackpotWinPush.ts +5 -5
  88. package/src/Jackpots/JackpotsOptinRequest.ts +2 -2
  89. package/src/Jackpots/JackpotsOptinResponse.ts +1 -1
  90. package/src/Jackpots/JackpotsOptoutRequest.ts +2 -2
  91. package/src/Jackpots/JackpotsOptoutResponse.ts +1 -1
  92. package/src/Jackpots/index.ts +16 -16
  93. package/src/Leaderboard/GetLeaderBoardsRequest.ts +5 -5
  94. package/src/Leaderboard/GetLeaderBoardsResponse.ts +3 -3
  95. package/src/Leaderboard/LeaderBoardDetails.ts +11 -11
  96. package/src/Leaderboard/LeaderBoardPosition.ts +8 -8
  97. package/src/Leaderboard/LeaderBoardPublicMeta.ts +3 -3
  98. package/src/Leaderboard/LeaderBoards.ts +16 -16
  99. package/src/Leaderboard/index.ts +6 -6
  100. package/src/Level/GetLevelMapResponse.ts +7 -7
  101. package/src/Level/Level.ts +9 -9
  102. package/src/Level/LevelPublicMeta.ts +10 -10
  103. package/src/Level/index.ts +3 -3
  104. package/src/MiniGames/SAWAcknowledgeSpinPushRequest.ts +3 -3
  105. package/src/MiniGames/SAWBuyInType.ts +2 -2
  106. package/src/MiniGames/SAWDoAknowledgeRequest.ts +2 -2
  107. package/src/MiniGames/SAWDoAknowledgeResponse.ts +2 -2
  108. package/src/MiniGames/SAWDoSpinRequest.ts +3 -3
  109. package/src/MiniGames/SAWDoSpinResponse.ts +9 -9
  110. package/src/MiniGames/SAWEventSawPush.ts +3 -3
  111. package/src/MiniGames/SAWGameType.ts +2 -2
  112. package/src/MiniGames/SAWGetTemplatesRequest.ts +3 -3
  113. package/src/MiniGames/SAWGetTemplatesResponse.ts +18 -16
  114. package/src/MiniGames/SAWPrize.ts +11 -11
  115. package/src/MiniGames/SAWPrizeDropAknowledgeRequest.ts +4 -4
  116. package/src/MiniGames/SAWPrizeDropAknowledgeResponse.ts +2 -2
  117. package/src/MiniGames/SAWPrizeDropWinPush.ts +8 -8
  118. package/src/MiniGames/SAWPrizeType.ts +2 -2
  119. package/src/MiniGames/SAWPrizeUI.ts +16 -16
  120. package/src/MiniGames/SAWSpinsCountPush.ts +3 -3
  121. package/src/MiniGames/SAWTemplate.ts +26 -26
  122. package/src/MiniGames/SAWTemplateUI.ts +42 -42
  123. package/src/MiniGames/SAWUtils.ts +10 -10
  124. package/src/MiniGames/SAWWinSoundType.ts +1 -1
  125. package/src/MiniGames/index.ts +24 -24
  126. package/src/Missions/AchCategoryPublicMeta.ts +2 -2
  127. package/src/Missions/AchClaimPrizeRequest.ts +3 -3
  128. package/src/Missions/AchClaimPrizeResponse.ts +1 -1
  129. package/src/Missions/AchievementCategory.ts +8 -8
  130. package/src/Missions/AchievementOptinRequest.ts +2 -2
  131. package/src/Missions/AchievementOptinResponse.ts +1 -1
  132. package/src/Missions/AchievementPublicMeta.ts +19 -19
  133. package/src/Missions/AchievementTaskPublicMeta.ts +2 -2
  134. package/src/Missions/GetAchCategoriesRequest.ts +1 -1
  135. package/src/Missions/GetAchCategoriesResponse.ts +3 -3
  136. package/src/Missions/GetAchievementMapRequest.ts +1 -1
  137. package/src/Missions/GetAchievementMapResponse.ts +3 -3
  138. package/src/Missions/GetRelatedAchTourRequest.ts +2 -2
  139. package/src/Missions/GetRelatedAchTourResponse.ts +5 -5
  140. package/src/Missions/ReloadAchievementsEvent.ts +3 -3
  141. package/src/Missions/UserAchievement.ts +48 -46
  142. package/src/Missions/UserAchievementTask.ts +13 -13
  143. package/src/Missions/index.ts +19 -19
  144. package/src/NodeCache.ts +12 -12
  145. package/src/OCache.ts +22 -22
  146. package/src/Quiz/MarketsAnswers.ts +9 -9
  147. package/src/Quiz/MarketsInfo.ts +62 -23
  148. package/src/Quiz/MarketsPerSport.ts +11 -4
  149. package/src/Quiz/ScoreResultTypes.ts +22 -22
  150. package/src/Quiz/SportTypes.ts +1 -1
  151. package/src/Quiz/index.ts +6 -6
  152. package/src/SmarticoAPI.ts +556 -303
  153. package/src/SmarticoLib/index.ts +956 -840
  154. package/src/Store/BuyStoreItemRequest.ts +2 -2
  155. package/src/Store/BuyStoreItemResponse.ts +2 -2
  156. package/src/Store/GetCategoriesStoreResponse.ts +3 -3
  157. package/src/Store/GetStoreHistoryRequest.ts +3 -3
  158. package/src/Store/GetStoreHistoryResponse.ts +4 -4
  159. package/src/Store/GetStoreItemsResponse.ts +3 -3
  160. package/src/Store/StoreCategory.ts +8 -8
  161. package/src/Store/StoreCategoryPublicMeta.ts +2 -2
  162. package/src/Store/StoreItem.ts +13 -13
  163. package/src/Store/StoreItemPublicMeta.ts +10 -10
  164. package/src/Store/StoreItemPurchased.ts +17 -17
  165. package/src/Store/StoreItemType.ts +2 -2
  166. package/src/Store/index.ts +13 -13
  167. package/src/Tournaments/GetTournamentInfoRequest.ts +2 -2
  168. package/src/Tournaments/GetTournamentInfoResponse.ts +18 -18
  169. package/src/Tournaments/GetTournamentsRequest.ts +1 -1
  170. package/src/Tournaments/GetTournamentsResponse.ts +6 -6
  171. package/src/Tournaments/Tournament.ts +43 -39
  172. package/src/Tournaments/TournamentInstanceStatus.ts +2 -2
  173. package/src/Tournaments/TournamentPlayer.ts +7 -7
  174. package/src/Tournaments/TournamentPrize.ts +8 -8
  175. package/src/Tournaments/TournamentPublicMeta.ts +16 -16
  176. package/src/Tournaments/TournamentRegisterRequest.ts +2 -2
  177. package/src/Tournaments/TournamentRegisterResponse.ts +3 -3
  178. package/src/Tournaments/TournamentRegistrationStatus.ts +6 -4
  179. package/src/Tournaments/TournamentRegistrationType.ts +9 -3
  180. package/src/Tournaments/TournamentUtils.ts +44 -38
  181. package/src/Tournaments/index.ts +16 -16
  182. package/src/WSAPI/WSAPI.ts +244 -132
  183. package/src/WSAPI/WSAPITypes.ts +287 -250
  184. package/src/index.ts +16 -15
  185. package/tsconfig.json +41 -43
@@ -1,5 +1,5 @@
1
- import { ProtocolMessage } from '../Base/ProtocolMessage'
1
+ import { ProtocolMessage } from '../Base/ProtocolMessage';
2
2
 
3
3
  export interface BuyStoreItemRequest extends ProtocolMessage {
4
- itemId: number
4
+ itemId: number;
5
5
  }
@@ -1,5 +1,5 @@
1
- import { ProtocolResponse } from '../Base/ProtocolResponse'
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
2
2
 
3
3
  export interface BuyStoreItemResponse extends ProtocolResponse {
4
- success?: boolean
4
+ success?: boolean;
5
5
  }
@@ -1,6 +1,6 @@
1
- import { ProtocolResponse } from '../Base/ProtocolResponse'
2
- import { StoreCategory } from './StoreCategory'
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
2
+ import { StoreCategory } from './StoreCategory';
3
3
 
4
4
  export interface GetCategoriesStoreResponse extends ProtocolResponse {
5
- categories: StoreCategory[]
5
+ categories: StoreCategory[];
6
6
  }
@@ -1,6 +1,6 @@
1
- import { ProtocolMessage } from '../Base/ProtocolMessage'
1
+ import { ProtocolMessage } from '../Base/ProtocolMessage';
2
2
 
3
3
  export interface GetStoreHistoryRequest extends ProtocolMessage {
4
- limit?: number
5
- offset?: number
4
+ limit?: number;
5
+ offset?: number;
6
6
  }
@@ -1,7 +1,7 @@
1
- import { ProtocolResponse } from '../Base/ProtocolResponse'
2
- import { StoreItemPurchased } from './StoreItemPurchased'
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
2
+ import { StoreItemPurchased } from './StoreItemPurchased';
3
3
 
4
4
  export interface GetStoreHistoryResponse extends ProtocolResponse {
5
- items: StoreItemPurchased[]
6
- hasMore?: boolean
5
+ items: StoreItemPurchased[];
6
+ hasMore?: boolean;
7
7
  }
@@ -1,6 +1,6 @@
1
- import { ProtocolResponse } from '../Base/ProtocolResponse'
2
- import { StoreItem } from './StoreItem'
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
2
+ import { StoreItem } from './StoreItem';
3
3
 
4
4
  export interface GetStoreItemsResponse extends ProtocolResponse {
5
- items: StoreItem[]
5
+ items: StoreItem[];
6
6
  }
@@ -1,9 +1,9 @@
1
- import { TStoreCategory } from '../WSAPI/WSAPITypes'
2
- import { StoreCategoryPublicMeta } from './StoreCategoryPublicMeta'
1
+ import { TStoreCategory } from '../WSAPI/WSAPITypes';
2
+ import { StoreCategoryPublicMeta } from './StoreCategoryPublicMeta';
3
3
 
4
4
  export interface StoreCategory {
5
- id?: number
6
- publicMeta?: StoreCategoryPublicMeta
5
+ id?: number;
6
+ publicMeta?: StoreCategoryPublicMeta;
7
7
  }
8
8
 
9
9
  export const StoreCategoryTransform = (items: StoreCategory[]): TStoreCategory[] => {
@@ -12,7 +12,7 @@ export const StoreCategoryTransform = (items: StoreCategory[]): TStoreCategory[]
12
12
  id: r.id,
13
13
  name: r.publicMeta?.name,
14
14
  order: r.publicMeta?.order,
15
- }
16
- return x
17
- })
18
- }
15
+ };
16
+ return x;
17
+ });
18
+ };
@@ -1,4 +1,4 @@
1
1
  export interface StoreCategoryPublicMeta {
2
- name?: string
3
- order?: number
2
+ name?: string;
3
+ order?: number;
4
4
  }
@@ -1,14 +1,14 @@
1
- import { TStoreItem } from '../WSAPI/WSAPITypes'
2
- import { StoreItemPublicMeta } from './StoreItemPublicMeta'
3
- import { StoreItemType, StoreItemTypeNamed } from './StoreItemType'
1
+ import { TStoreItem } from '../WSAPI/WSAPITypes';
2
+ import { StoreItemPublicMeta } from './StoreItemPublicMeta';
3
+ import { StoreItemType, StoreItemTypeNamed } from './StoreItemType';
4
4
 
5
5
  export interface StoreItem {
6
- id: number
7
- itemTypeId: StoreItemType
8
- itemPublicMeta: StoreItemPublicMeta
9
- categoryIds?: number[]
10
- canBuy?: boolean
11
- shopPool: number
6
+ id: number;
7
+ itemTypeId: StoreItemType;
8
+ itemPublicMeta: StoreItemPublicMeta;
9
+ categoryIds?: number[];
10
+ canBuy?: boolean;
11
+ shopPool: number;
12
12
  }
13
13
 
14
14
  export const StoreItemTransform = (items: StoreItem[]): TStoreItem[] => {
@@ -30,7 +30,7 @@ export const StoreItemTransform = (items: StoreItem[]): TStoreItem[] => {
30
30
  can_buy: r.canBuy,
31
31
  category_ids: r.categoryIds ?? [],
32
32
  pool: r.shopPool,
33
- }
34
- return x
35
- })
36
- }
33
+ };
34
+ return x;
35
+ });
36
+ };
@@ -1,12 +1,12 @@
1
1
  export interface StoreItemPublicMeta {
2
- price: string
3
- image_url: string
4
- name: string
5
- description: string
6
- label_tag: string
7
- custom_label_tag?: string
8
- limit_message: string
9
- priority: number
10
- related_items: number[]
11
- hint_text: string
2
+ price: string;
3
+ image_url: string;
4
+ name: string;
5
+ description: string;
6
+ label_tag: string;
7
+ custom_label_tag?: string;
8
+ limit_message: string;
9
+ priority: number;
10
+ related_items: number[];
11
+ hint_text: string;
12
12
  }
@@ -1,23 +1,23 @@
1
- import { IntUtils } from '../IntUtils'
2
- import { TStoreItem } from '../WSAPI/WSAPITypes'
3
- import { StoreItem } from './StoreItem'
4
- import { StoreItemTypeNamed } from './StoreItemType'
1
+ import { IntUtils } from '../IntUtils';
2
+ import { TStoreItem } from '../WSAPI/WSAPITypes';
3
+ import { StoreItem } from './StoreItem';
4
+ import { StoreItemTypeNamed } from './StoreItemType';
5
5
 
6
6
  interface StoreItemPurchased extends StoreItem {
7
- purchase_ts: number
8
- purchase_points_amount: number
9
- purchased_today?: boolean
10
- purchased_this_week?: boolean
11
- purchased_this_month?: boolean
7
+ purchase_ts: number;
8
+ purchase_points_amount: number;
9
+ purchased_today?: boolean;
10
+ purchased_this_week?: boolean;
11
+ purchased_this_month?: boolean;
12
12
  }
13
13
 
14
14
  export const StoreItemPurchasedTransform = (items: StoreItemPurchased[]): TStoreItem[] => {
15
15
  return items
16
16
  .filter((r) => r.id >= 1)
17
17
  .map((r) => {
18
- const purchasedToday = r.purchase_ts ? IntUtils.isWithinPeriod(r.purchase_ts, 'today') : false
19
- const purchasedThisWeek = r.purchase_ts ? IntUtils.isWithinPeriod(r.purchase_ts, 'thisWeek') : false
20
- const purchasedThisMonth = r.purchase_ts ? IntUtils.isWithinPeriod(r.purchase_ts, 'thisMonth') : false
18
+ const purchasedToday = r.purchase_ts ? IntUtils.isWithinPeriod(r.purchase_ts, 'today') : false;
19
+ const purchasedThisWeek = r.purchase_ts ? IntUtils.isWithinPeriod(r.purchase_ts, 'thisWeek') : false;
20
+ const purchasedThisMonth = r.purchase_ts ? IntUtils.isWithinPeriod(r.purchase_ts, 'thisMonth') : false;
21
21
 
22
22
  const x: TStoreItem = {
23
23
  id: r.id,
@@ -39,10 +39,10 @@ export const StoreItemPurchasedTransform = (items: StoreItemPurchased[]): TStore
39
39
  purchased_today: purchasedToday,
40
40
  purchased_this_week: purchasedThisWeek,
41
41
  purchased_this_month: purchasedThisMonth,
42
- }
42
+ };
43
43
 
44
- return x
45
- })
46
- }
44
+ return x;
45
+ });
46
+ };
47
47
 
48
- export { StoreItemPurchased }
48
+ export { StoreItemPurchased };
@@ -24,5 +24,5 @@ export const StoreItemTypeNamed = (type: StoreItemType): StoreItemTypeName => {
24
24
  [StoreItemType.ChangeLevel]: StoreItemTypeName.ChangeLevel,
25
25
  [StoreItemType.PrizeDrop]: StoreItemTypeName.PrizeDrop,
26
26
  }[type] || StoreItemTypeName.Unknown
27
- )
28
- }
27
+ );
28
+ };
@@ -1,13 +1,13 @@
1
- export * from './BuyStoreItemErrorCode'
2
- export * from './BuyStoreItemRequest'
3
- export * from './BuyStoreItemResponse'
4
- export * from './GetCategoriesStoreResponse'
5
- export * from './GetStoreItemsResponse'
6
- export * from './StoreCategory'
7
- export * from './StoreCategoryPublicMeta'
8
- export * from './StoreItem'
9
- export * from './StoreItemPublicMeta'
10
- export * from './StoreItemType'
11
- export * from './StoreItemPurchased'
12
- export * from './GetStoreHistoryRequest'
13
- export * from './GetStoreHistoryResponse'
1
+ export * from './BuyStoreItemErrorCode';
2
+ export * from './BuyStoreItemRequest';
3
+ export * from './BuyStoreItemResponse';
4
+ export * from './GetCategoriesStoreResponse';
5
+ export * from './GetStoreItemsResponse';
6
+ export * from './StoreCategory';
7
+ export * from './StoreCategoryPublicMeta';
8
+ export * from './StoreItem';
9
+ export * from './StoreItemPublicMeta';
10
+ export * from './StoreItemType';
11
+ export * from './StoreItemPurchased';
12
+ export * from './GetStoreHistoryRequest';
13
+ export * from './GetStoreHistoryResponse';
@@ -1,5 +1,5 @@
1
- import { ProtocolMessage } from '../Base/ProtocolMessage'
1
+ import { ProtocolMessage } from '../Base/ProtocolMessage';
2
2
 
3
3
  export interface GetTournamentInfoRequest extends ProtocolMessage {
4
- tournamentInstanceId: number
4
+ tournamentInstanceId: number;
5
5
  }
@@ -1,25 +1,25 @@
1
- import { Tournament, TournamentItemsTransform } from './Tournament'
2
- import { TournamentPlayer } from './TournamentPlayer'
3
- import { ProtocolResponse } from '../Base/ProtocolResponse'
4
- import { TournamentPrize } from './TournamentPrize'
5
- import { TTournamentDetailed } from '../WSAPI/WSAPITypes'
6
- import { TournamentUtils } from './TournamentUtils'
1
+ import { Tournament, TournamentItemsTransform } from './Tournament';
2
+ import { TournamentPlayer } from './TournamentPlayer';
3
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
4
+ import { TournamentPrize } from './TournamentPrize';
5
+ import { TTournamentDetailed } from '../WSAPI/WSAPITypes';
6
+ import { TournamentUtils } from './TournamentUtils';
7
7
 
8
8
  export interface GetTournamentInfoResponse extends ProtocolResponse {
9
9
  /** tournament info */
10
10
  tournamentInfo: {
11
11
  /** id of label, not in use */
12
- labelId: number
13
- tournamentLobbyInfo: Tournament
12
+ labelId: number;
13
+ tournamentLobbyInfo: Tournament;
14
14
  /** list of registered users */
15
- players: TournamentPlayer[]
16
- }
15
+ players: TournamentPlayer[];
16
+ };
17
17
  /** information about current user position */
18
- userPosition: TournamentPlayer
18
+ userPosition: TournamentPlayer;
19
19
  /** prizes structure */
20
20
  prizeStructure?: {
21
- prizes: TournamentPrize[]
22
- }
21
+ prizes: TournamentPrize[];
22
+ };
23
23
  }
24
24
 
25
25
  export const tournamentInfoItemTransform = (t: GetTournamentInfoResponse): TTournamentDetailed => {
@@ -37,15 +37,15 @@ export const tournamentInfoItemTransform = (t: GetTournamentInfoResponse): TTour
37
37
  },
38
38
  })),
39
39
  players: t.tournamentInfo.players.map((p) => TournamentUtils.getPlayerTransformed(p)),
40
- }
40
+ };
41
41
 
42
42
  if (t.prizeStructure) {
43
- response.prizes = t.prizeStructure.prizes.map((p) => TournamentUtils.getPrizeTransformed(p))
43
+ response.prizes = t.prizeStructure.prizes.map((p) => TournamentUtils.getPrizeTransformed(p));
44
44
  }
45
45
 
46
46
  if (t.userPosition) {
47
- response.me = TournamentUtils.getPlayerTransformed(t.userPosition, true)
47
+ response.me = TournamentUtils.getPlayerTransformed(t.userPosition, true);
48
48
  }
49
49
 
50
- return response
51
- }
50
+ return response;
51
+ };
@@ -1,3 +1,3 @@
1
- import { ProtocolMessage } from '../Base/ProtocolMessage'
1
+ import { ProtocolMessage } from '../Base/ProtocolMessage';
2
2
 
3
3
  export interface GetTournamentsRequest extends ProtocolMessage {}
@@ -1,10 +1,10 @@
1
- import { ProtocolResponse } from '../Base/ProtocolResponse'
2
- import { Tournament } from './Tournament'
3
- import { TournamentRegistrationStatus } from './TournamentRegistrationStatus'
4
- import { TournamentRegistrationType } from './TournamentRegistrationType'
5
- import { TournamentUtils } from './TournamentUtils'
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
2
+ import { Tournament } from './Tournament';
3
+ import { TournamentRegistrationStatus } from './TournamentRegistrationStatus';
4
+ import { TournamentRegistrationType } from './TournamentRegistrationType';
5
+ import { TournamentUtils } from './TournamentUtils';
6
6
 
7
7
  export interface GetTournamentsResponse extends ProtocolResponse {
8
8
  /** array of the tournaments */
9
- tournaments?: Tournament[]
9
+ tournaments?: Tournament[];
10
10
  }
@@ -1,63 +1,67 @@
1
- import { TournamentRegistrationType, TournamentRegistrationTypeGetName } from './TournamentRegistrationType'
2
- import { TournamentInstanceStatus } from './TournamentInstanceStatus'
3
- import { TournamentRegistrationStatus, TournamentRegistrationStatusName, TournamentRegistrationStatusNamed } from './TournamentRegistrationStatus'
4
- import { TournamentType } from './TournamentType'
5
- import { TournamentPublicMeta } from './TournamentPublicMeta'
6
- import { TTournament } from '../WSAPI/WSAPITypes'
7
- import { TournamentPlayer, TournamentPrize, TournamentUtils } from '.'
8
- import { IntUtils } from '../IntUtils'
9
- import { AchRelatedGame } from '../Base/AchRelatedGame'
1
+ import { TournamentRegistrationType, TournamentRegistrationTypeGetName } from './TournamentRegistrationType';
2
+ import { TournamentInstanceStatus } from './TournamentInstanceStatus';
3
+ import {
4
+ TournamentRegistrationStatus,
5
+ TournamentRegistrationStatusName,
6
+ TournamentRegistrationStatusNamed,
7
+ } from './TournamentRegistrationStatus';
8
+ import { TournamentType } from './TournamentType';
9
+ import { TournamentPublicMeta } from './TournamentPublicMeta';
10
+ import { TTournament } from '../WSAPI/WSAPITypes';
11
+ import { TournamentPlayer, TournamentPrize, TournamentUtils } from '.';
12
+ import { IntUtils } from '../IntUtils';
13
+ import { AchRelatedGame } from '../Base/AchRelatedGame';
10
14
 
11
15
  export interface Tournament {
12
16
  /** ID of tournament template */
13
- tournamentId?: number
17
+ tournamentId?: number;
14
18
  /** ID of tournament instance. Generated every time when tournament based on specific template is scheduled for run */
15
- tournamentInstanceId?: number
19
+ tournamentInstanceId?: number;
16
20
  /** Type of the tournament. For now only SCHEDULED is support */
17
- tournamentType?: TournamentType
21
+ tournamentType?: TournamentType;
18
22
  /** Meta information about tournament that should be used to build UI */
19
- publicMeta?: TournamentPublicMeta
23
+ publicMeta?: TournamentPublicMeta;
20
24
  /** Cost of registration in the tournament in gamification points */
21
- buyInAmount?: number
25
+ buyInAmount?: number;
22
26
  /** Not in use */
23
- prizePool?: number
27
+ prizePool?: number;
24
28
  /** The time when tournament is going to start */
25
- startTime?: string
29
+ startTime?: string;
26
30
  /** The time when tournament is going to finish */
27
- endTime?: string
31
+ endTime?: string;
28
32
  /** The time when tournament is going to start, epoch */
29
- startTimeTs?: number
33
+ startTimeTs?: number;
30
34
  /** The time when tournament is going to finish, epoch */
31
- endTimeTs?: number
35
+ endTimeTs?: number;
32
36
  /** Number of users registered in the tournament */
33
- registrationCount?: number
37
+ registrationCount?: number;
34
38
  /** Not in use */
35
- totalCount?: number
39
+ totalCount?: number;
36
40
  /** Type of registration in the tournament */
37
- registrationType?: TournamentRegistrationType
41
+ registrationType?: TournamentRegistrationType;
38
42
  /** Status of registration in the tournament for current user */
39
- tournamentRegistrationStatus?: TournamentRegistrationStatus
43
+ tournamentRegistrationStatus?: TournamentRegistrationStatus;
40
44
  /** Status of tournament instance */
41
- tournamentInstanceStatus?: TournamentInstanceStatus
45
+ tournamentInstanceStatus?: TournamentInstanceStatus;
42
46
  /** flag indicating if current user is registered in the tournament */
43
- isUserRegistered?: boolean
47
+ isUserRegistered?: boolean;
44
48
  /** Indicator if tournament allows later registration, when tournament is already started */
45
- allowLateRegistration?: boolean
49
+ allowLateRegistration?: boolean;
46
50
  /** Minimum number of participant for this tournament. If tournament doesnt have enough registrations, it will not start */
47
- playersMinCount?: number
51
+ playersMinCount?: number;
48
52
  /** Maximum number of participant for this tournament. When reached, new users won't be able to register */
49
- playersMaxCount?: number
53
+ playersMaxCount?: number;
50
54
  /** Tournament duration in millisecnnds */
51
- durationMs?: number
55
+ durationMs?: number;
52
56
  /** prizes structure */
53
57
  prizeStructure?: {
54
- prizes: TournamentPrize[]
55
- }
58
+ prizes: TournamentPrize[];
59
+ };
56
60
  /** Information about current user */
57
- tournamentPlayer?: TournamentPlayer
61
+ tournamentPlayer?: TournamentPlayer;
58
62
 
59
63
  /** List of casino games (or other types of entities) related to the tournament */
60
- related_games?: AchRelatedGame[]
64
+ related_games?: AchRelatedGame[];
61
65
  }
62
66
 
63
67
  export const TournamentItemsTransform = (items: Tournament[]): TTournament[] => {
@@ -99,16 +103,16 @@ export const TournamentItemsTransform = (items: Tournament[]): TTournament[] =>
99
103
  is_finished: TournamentUtils.isFinished(r),
100
104
  is_in_progress: TournamentUtils.isInProgress(r),
101
105
  is_upcoming: TournamentUtils.isUpcoming(r),
102
- }
106
+ };
103
107
 
104
108
  if (r.prizeStructure) {
105
- x.prizes = r.prizeStructure.prizes.map((p) => TournamentUtils.getPrizeTransformed(p))
109
+ x.prizes = r.prizeStructure.prizes.map((p) => TournamentUtils.getPrizeTransformed(p));
106
110
  }
107
111
 
108
112
  if (r.tournamentPlayer) {
109
- x.me = TournamentUtils.getPlayerTransformed(r.tournamentPlayer, true)
113
+ x.me = TournamentUtils.getPlayerTransformed(r.tournamentPlayer, true);
110
114
  }
111
115
 
112
- return x
113
- })
114
- }
116
+ return x;
117
+ });
118
+ };
@@ -17,5 +17,5 @@ export const TournamentInstanceStatusName = (s: TournamentInstanceStatus): strin
17
17
  [TournamentInstanceStatus.CANCELLED]: 'CANCELLED',
18
18
  [TournamentInstanceStatus.FAILED]: 'FAILED',
19
19
  [TournamentInstanceStatus.FINALIZING]: 'FINALIZING',
20
- }[s]
21
- }
20
+ }[s];
21
+ };
@@ -1,10 +1,10 @@
1
1
  export interface TournamentPlayer {
2
- userAltName: string
3
- position: number
4
- scores: number
5
- isMe: boolean
6
- userId: number
7
- avatar_id: string
2
+ userAltName: string;
3
+ position: number;
4
+ scores: number;
5
+ isMe: boolean;
6
+ userId: number;
7
+ avatar_id: string;
8
8
 
9
- avatar_url?: string
9
+ avatar_url?: string;
10
10
  }
@@ -1,11 +1,11 @@
1
- import { ActivityTypeLimited } from '../Core/ActivityTypeLimited'
1
+ import { ActivityTypeLimited } from '../Core/ActivityTypeLimited';
2
2
 
3
3
  export interface TournamentPrize {
4
- name: string
5
- description: string
6
- image_url: string
7
- place_from: number
8
- place_to: number
9
- type: ActivityTypeLimited
10
- points: number
4
+ name: string;
5
+ description: string;
6
+ image_url: string;
7
+ place_from: number;
8
+ place_to: number;
9
+ type: ActivityTypeLimited;
10
+ points: number;
11
11
  }
@@ -1,34 +1,34 @@
1
1
  export interface TournamentPublicMeta {
2
2
  /** Name of tournament */
3
- name?: string
3
+ name?: string;
4
4
  /** 1st image */
5
- image_url?: string
5
+ image_url?: string;
6
6
  /** 2nd image */
7
- image_url2?: string
7
+ image_url2?: string;
8
8
  /** 2nd image for mobile */
9
- image_url2_mobile?: string
9
+ image_url2_mobile?: string;
10
10
  /** Description, html capable */
11
- description?: string
11
+ description?: string;
12
12
  /** Short explanation of prize pool */
13
- prize_pool_short?: string
13
+ prize_pool_short?: string;
14
14
  /** Message to show when user is not matching to the segment allowed to register (error code 30005 in registration response) */
15
- segment_dont_match_message?: string
15
+ segment_dont_match_message?: string;
16
16
  /** Short explanation of registration price */
17
- custom_price_text?: string
17
+ custom_price_text?: string;
18
18
  /** Indicator if the scores of other users should be shown in the leaderboard of tournament */
19
- show_other_users_score?: boolean
19
+ show_other_users_score?: boolean;
20
20
 
21
- custom_section_id?: number
21
+ custom_section_id?: number;
22
22
 
23
- only_in_custom_section?: boolean
23
+ only_in_custom_section?: boolean;
24
24
 
25
- label_tag?: string
26
- custom_label_tag?: string
25
+ label_tag?: string;
26
+ custom_label_tag?: string;
27
27
 
28
- featured?: boolean
28
+ featured?: boolean;
29
29
 
30
- position?: number
30
+ position?: number;
31
31
 
32
32
  // custom data as string or JSON string that can be used in UIWidget
33
- custom_data?: string
33
+ custom_data?: string;
34
34
  }
@@ -1,5 +1,5 @@
1
- import { ProtocolMessage } from '../Base/ProtocolMessage'
1
+ import { ProtocolMessage } from '../Base/ProtocolMessage';
2
2
 
3
3
  export interface TournamentRegisterRequest extends ProtocolMessage {
4
- tournamentInstanceId: number
4
+ tournamentInstanceId: number;
5
5
  }
@@ -1,6 +1,6 @@
1
- import { ProtocolResponse } from '../Base/ProtocolResponse'
2
- import { TournamentRegistrationError } from './TournamentRegistrationError'
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
2
+ import { TournamentRegistrationError } from './TournamentRegistrationError';
3
3
 
4
4
  export interface TournamentRegisterResponse extends ProtocolResponse {
5
- errCode?: TournamentRegistrationError
5
+ errCode?: TournamentRegistrationError;
6
6
  }
@@ -27,8 +27,10 @@ export const TournamentRegistrationStatusNamed = (type: TournamentRegistrationSt
27
27
  [TournamentRegistrationStatus.FINISHED]: TournamentRegistrationStatusName.FINISHED,
28
28
  [TournamentRegistrationStatus.NOT_REGISTERED]: TournamentRegistrationStatusName.NOT_REGISTERED,
29
29
  [TournamentRegistrationStatus.PENDING]: TournamentRegistrationStatusName.PENDING,
30
- [TournamentRegistrationStatus.QUALIFIED_PENDING_REGISTRATION]: TournamentRegistrationStatusName.QUALIFIED_PENDING_REGISTRATION,
30
+ [TournamentRegistrationStatus.QUALIFIED_PENDING_REGISTRATION]:
31
+ TournamentRegistrationStatusName.QUALIFIED_PENDING_REGISTRATION,
31
32
  [TournamentRegistrationStatus.REGISTERED]: TournamentRegistrationStatusName.REGISTERED,
32
- [TournamentRegistrationStatus.REGISTERED_PENDING_QUALIFICATION]: TournamentRegistrationStatusName.REGISTERED_PENDING_QUALIFICATION,
33
- }[type] || TournamentRegistrationStatusName.UNKNOWN) as TournamentRegistrationStatusName
34
- }
33
+ [TournamentRegistrationStatus.REGISTERED_PENDING_QUALIFICATION]:
34
+ TournamentRegistrationStatusName.REGISTERED_PENDING_QUALIFICATION,
35
+ }[type] || TournamentRegistrationStatusName.UNKNOWN) as TournamentRegistrationStatusName;
36
+ };
@@ -8,7 +8,13 @@ export enum TournamentRegistrationType {
8
8
  // BUY_IN_CASH = 5???,
9
9
  }
10
10
 
11
- export type TournamentRegistrationTypeName = 'AUTO' | 'OPT_IN' | 'BUY_IN_POINTS' | 'MANUAL_APPROVAL' | 'REQUIRES_QUALIFICATION' | 'UNKNOWN'
11
+ export type TournamentRegistrationTypeName =
12
+ | 'AUTO'
13
+ | 'OPT_IN'
14
+ | 'BUY_IN_POINTS'
15
+ | 'MANUAL_APPROVAL'
16
+ | 'REQUIRES_QUALIFICATION'
17
+ | 'UNKNOWN';
12
18
 
13
19
  /** @hidden */
14
20
  export const TournamentRegistrationTypeGetName = (type: TournamentRegistrationType): TournamentRegistrationTypeName => {
@@ -18,5 +24,5 @@ export const TournamentRegistrationTypeGetName = (type: TournamentRegistrationTy
18
24
  [TournamentRegistrationType.MANUAL_APPROVAL]: 'MANUAL_APPROVAL',
19
25
  [TournamentRegistrationType.OPT_IN]: 'OPT_IN',
20
26
  [TournamentRegistrationType.REQUIRES_QUALIFICATION]: 'REQUIRES_QUALIFICATION',
21
- }[type] || 'UNKNOWN') as any as TournamentRegistrationTypeName
22
- }
27
+ }[type] || 'UNKNOWN') as any as TournamentRegistrationTypeName;
28
+ };