@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,51 +1,51 @@
1
- import { SAWAskForUsername } from './SAWAskForUsername'
1
+ import { SAWAskForUsername } from './SAWAskForUsername';
2
2
 
3
3
  export interface SAWTemplateUI {
4
- skin: string
5
- name: string
6
- description?: string
7
- over_limit_message?: string
8
- no_attempts_message?: string
9
- thumbnail?: string
10
- sectors_count: number
11
- priority: number
12
- flow_builder_only: boolean
13
- background_image?: string
14
- background_image_mobile?: string
15
- background_sound?: string
16
- spin_animation_duration?: number
17
- scratch_logo?: string
18
- scratch_cover?: string
19
- scratch_bg_desktop?: string
20
- scratch_bg_mobile?: string
21
- scratch_cursor?: string
22
- custom_css?: string
23
- custom_skin_folder?: string
24
- jackpot_symbol?: string
4
+ skin: string;
5
+ name: string;
6
+ description?: string;
7
+ over_limit_message?: string;
8
+ no_attempts_message?: string;
9
+ thumbnail?: string;
10
+ sectors_count: number;
11
+ priority: number;
12
+ flow_builder_only: boolean;
13
+ background_image?: string;
14
+ background_image_mobile?: string;
15
+ background_sound?: string;
16
+ spin_animation_duration?: number;
17
+ scratch_logo?: string;
18
+ scratch_cover?: string;
19
+ scratch_bg_desktop?: string;
20
+ scratch_bg_mobile?: string;
21
+ scratch_cursor?: string;
22
+ custom_css?: string;
23
+ custom_skin_folder?: string;
24
+ jackpot_symbol?: string;
25
25
 
26
- promo_image?: string
27
- promo_text?: string
28
- matchx_banner?: string
29
- matchx_seasonal_ranking?: boolean
30
- matchx_is_completed?: boolean
31
- matchx_general_board_users_count?: number
32
- matchx_hide_ranking?: boolean
33
- ask_for_username?: SAWAskForUsername
34
- show_prize_board?: boolean
26
+ promo_image?: string;
27
+ promo_text?: string;
28
+ matchx_banner?: string;
29
+ matchx_seasonal_ranking?: boolean;
30
+ matchx_is_completed?: boolean;
31
+ matchx_general_board_users_count?: number;
32
+ matchx_hide_ranking?: boolean;
33
+ ask_for_username?: SAWAskForUsername;
34
+ show_prize_board?: boolean;
35
35
 
36
- max_spins_period_ms?: number
37
- show_countdown_for_next_availability?: boolean
38
- disable_background_music?: boolean
39
- custom_section_id?: number
40
- only_in_custom_section?: boolean
36
+ max_spins_period_ms?: number;
37
+ show_countdown_for_next_availability?: boolean;
38
+ disable_background_music?: boolean;
39
+ custom_section_id?: number;
40
+ only_in_custom_section?: boolean;
41
41
 
42
- custom_data: any
42
+ custom_data: any;
43
43
 
44
44
  // prize drop specific
45
- placeholder1?: string
46
- placeholder2?: string
45
+ placeholder1?: string;
46
+ placeholder2?: string;
47
47
  prize_drop_template?: {
48
- id: string
49
- content: string
50
- }
48
+ id: string;
49
+ content: string;
50
+ };
51
51
  }
@@ -1,28 +1,28 @@
1
- import { SAWBuyInType } from './SAWBuyInType'
2
- import { SAWTemplate } from './SAWTemplate'
1
+ import { SAWBuyInType } from './SAWBuyInType';
2
+ import { SAWTemplate } from './SAWTemplate';
3
3
 
4
4
  class SAWUtils {
5
5
  public static canPlay = (t: SAWTemplate, pointsBalance: number): boolean => {
6
6
  if (t === null || t === undefined) {
7
- return false
7
+ return false;
8
8
  }
9
9
 
10
10
  switch (t.saw_buyin_type_id) {
11
11
  case SAWBuyInType.Free: {
12
- return true
12
+ return true;
13
13
  }
14
14
  case SAWBuyInType.Spins: {
15
- return t.spin_count !== null && t.spin_count > 0
15
+ return t.spin_count !== null && t.spin_count > 0;
16
16
  }
17
17
  case SAWBuyInType.Points: {
18
- return t.buyin_cost_points <= pointsBalance
18
+ return t.buyin_cost_points <= pointsBalance;
19
19
  }
20
20
  default: {
21
- console.error('MiniGamesUtils.canPlay: Unknwon SAW buyin type ' + t.saw_buyin_type_id)
22
- return false
21
+ console.error('MiniGamesUtils.canPlay: Unknwon SAW buyin type ' + t.saw_buyin_type_id);
22
+ return false;
23
23
  }
24
24
  }
25
- }
25
+ };
26
26
  }
27
27
 
28
- export { SAWUtils }
28
+ export { SAWUtils };
@@ -11,4 +11,4 @@ export const SAWWinSoundFiles = {
11
11
  [SAWWinSoundType.Disappointing]: 'saw-disappointed.m4a',
12
12
  [SAWWinSoundType.Positive]: 'saw-positive.m4a',
13
13
  [SAWWinSoundType.HighlyPositive]: 'saw-highly-positive.m4a',
14
- }
14
+ };
@@ -1,24 +1,24 @@
1
- export * from './SAWUtils'
2
- export * from './SAWAcknowledgeType'
3
- export * from './SAWAskForUsername'
4
- export * from './SAWBuyInType'
5
- export * from './SAWDoSpinRequest'
6
- export * from './SAWDoSpinResponse'
7
- export * from './SAWGameType'
8
- export * from './SAWGetTemplatesRequest'
9
- export * from './SAWGetTemplatesResponse'
10
- export * from './SAWPrize'
11
- export * from './SAWPrizeType'
12
- export * from './SAWPrizeUI'
13
- export * from './SAWSpinErrorCode'
14
- export * from './SAWTemplate'
15
- export * from './SAWTemplateUI'
16
- export * from './SAWWinSoundType'
17
- export * from './SAWDoAknowledgeRequest'
18
- export * from './SAWDoAknowledgeResponse'
19
- export * from './SAWSpinsCountPush'
20
- export * from './SAWPrizeDropWinPush'
21
- export * from './SAWPrizeDropAknowledgeRequest'
22
- export * from './SAWPrizeDropAknowledgeResponse'
23
- export * from './SAWEventSawPush'
24
- export * from './SAWAcknowledgeSpinPushRequest'
1
+ export * from './SAWUtils';
2
+ export * from './SAWAcknowledgeType';
3
+ export * from './SAWAskForUsername';
4
+ export * from './SAWBuyInType';
5
+ export * from './SAWDoSpinRequest';
6
+ export * from './SAWDoSpinResponse';
7
+ export * from './SAWGameType';
8
+ export * from './SAWGetTemplatesRequest';
9
+ export * from './SAWGetTemplatesResponse';
10
+ export * from './SAWPrize';
11
+ export * from './SAWPrizeType';
12
+ export * from './SAWPrizeUI';
13
+ export * from './SAWSpinErrorCode';
14
+ export * from './SAWTemplate';
15
+ export * from './SAWTemplateUI';
16
+ export * from './SAWWinSoundType';
17
+ export * from './SAWDoAknowledgeRequest';
18
+ export * from './SAWDoAknowledgeResponse';
19
+ export * from './SAWSpinsCountPush';
20
+ export * from './SAWPrizeDropWinPush';
21
+ export * from './SAWPrizeDropAknowledgeRequest';
22
+ export * from './SAWPrizeDropAknowledgeResponse';
23
+ export * from './SAWEventSawPush';
24
+ export * from './SAWAcknowledgeSpinPushRequest';
@@ -1,4 +1,4 @@
1
1
  export interface AchCategoryPublicMeta {
2
- name?: string
3
- order?: number
2
+ name?: string;
3
+ order?: number;
4
4
  }
@@ -1,6 +1,6 @@
1
- import { ProtocolMessage } from '../Base/ProtocolMessage'
1
+ import { ProtocolMessage } from '../Base/ProtocolMessage';
2
2
 
3
3
  export interface AchClaimPrizeRequest extends ProtocolMessage {
4
- ach_id: number
5
- ach_completed_id: number // ID of the completion fact from ach_completed or ach_completed_recurring tables
4
+ ach_id: number;
5
+ ach_completed_id: number; // ID of the completion fact from ach_completed or ach_completed_recurring tables
6
6
  }
@@ -1,4 +1,4 @@
1
- import { ProtocolResponse } from '../Base/ProtocolResponse'
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
2
2
  export interface AchClaimPrizeResponse extends ProtocolResponse {
3
3
  // no details here, just check for errCode and reload list of missions
4
4
  }
@@ -1,9 +1,9 @@
1
- import { TAchCategory } from '../WSAPI/WSAPITypes'
2
- import { AchCategoryPublicMeta } from './AchCategoryPublicMeta'
1
+ import { TAchCategory } from '../WSAPI/WSAPITypes';
2
+ import { AchCategoryPublicMeta } from './AchCategoryPublicMeta';
3
3
 
4
4
  export interface AchCategory {
5
- id?: number
6
- publicMeta?: AchCategoryPublicMeta
5
+ id?: number;
6
+ publicMeta?: AchCategoryPublicMeta;
7
7
  }
8
8
 
9
9
  export const AchCategoryTransform = (items: AchCategory[]): TAchCategory[] => {
@@ -12,7 +12,7 @@ export const AchCategoryTransform = (items: AchCategory[]): TAchCategory[] => {
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,5 +1,5 @@
1
- import { ProtocolMessage } from '../Base/ProtocolMessage'
1
+ import { ProtocolMessage } from '../Base/ProtocolMessage';
2
2
 
3
3
  export interface AchievementOptinRequest extends ProtocolMessage {
4
- achievementId: number
4
+ achievementId: number;
5
5
  }
@@ -1,3 +1,3 @@
1
- import { ProtocolResponse } from '../Base/ProtocolResponse'
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
2
2
 
3
3
  export interface AchievementOptinResponse extends ProtocolResponse {}
@@ -1,21 +1,21 @@
1
1
  export interface AchievementPublicMeta {
2
- description?: string
3
- unlock_mission_description?: string
4
- custom_data?: string
5
- cta_text?: string
6
- cta_action?: string
7
- label_tag?: string
8
- custom_label_tag?: string
9
- reward?: string
10
- image_url?: string
11
- name?: string
12
- position?: number
13
- hide_tasks?: boolean
14
- hide_locked_mission?: boolean
15
- custom_section_id?: number
16
- only_in_custom_section?: boolean
17
- hint_text?: string
18
- hide_badge_from_ui?: boolean
19
- show_badge_first_task_completed?: boolean
20
- custom_section_type_id?: number
2
+ description?: string;
3
+ unlock_mission_description?: string;
4
+ custom_data?: string;
5
+ cta_text?: string;
6
+ cta_action?: string;
7
+ label_tag?: string;
8
+ custom_label_tag?: string;
9
+ reward?: string;
10
+ image_url?: string;
11
+ name?: string;
12
+ position?: number;
13
+ hide_tasks?: boolean;
14
+ hide_locked_mission?: boolean;
15
+ custom_section_id?: number;
16
+ only_in_custom_section?: boolean;
17
+ hint_text?: string;
18
+ hide_badge_from_ui?: boolean;
19
+ show_badge_first_task_completed?: boolean;
20
+ custom_section_type_id?: number;
21
21
  }
@@ -1,4 +1,4 @@
1
1
  export interface AchievementTaskPublicMeta {
2
- name?: string
3
- display_progress_as_count?: boolean
2
+ name?: string;
3
+ display_progress_as_count?: boolean;
4
4
  }
@@ -1,3 +1,3 @@
1
- import { ProtocolMessage } from '../Base/ProtocolMessage'
1
+ import { ProtocolMessage } from '../Base/ProtocolMessage';
2
2
 
3
3
  export interface GetAchCategoriesRequest extends ProtocolMessage {}
@@ -1,6 +1,6 @@
1
- import { ProtocolResponse } from '../Base/ProtocolResponse'
2
- import { AchCategory } from './AchievementCategory'
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
2
+ import { AchCategory } from './AchievementCategory';
3
3
 
4
4
  export interface GetAchCategoriesResponse extends ProtocolResponse {
5
- categories: AchCategory[]
5
+ categories: AchCategory[];
6
6
  }
@@ -1,3 +1,3 @@
1
- import { ProtocolMessage } from '../Base/ProtocolMessage'
1
+ import { ProtocolMessage } from '../Base/ProtocolMessage';
2
2
 
3
3
  export interface GetAchievementMapRequest extends ProtocolMessage {}
@@ -1,6 +1,6 @@
1
- import { ProtocolResponse } from '../Base/ProtocolResponse'
2
- import { UserAchievement } from './UserAchievement'
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
2
+ import { UserAchievement } from './UserAchievement';
3
3
 
4
4
  export interface GetAchievementMapResponse extends ProtocolResponse {
5
- achievements?: UserAchievement[]
5
+ achievements?: UserAchievement[];
6
6
  }
@@ -1,5 +1,5 @@
1
- import { ProtocolMessage } from '../Base/ProtocolMessage'
1
+ import { ProtocolMessage } from '../Base/ProtocolMessage';
2
2
 
3
3
  export interface GetRelatedAchTourRequest extends ProtocolMessage {
4
- related_game_id?: string
4
+ related_game_id?: string;
5
5
  }
@@ -1,8 +1,8 @@
1
- import { ProtocolResponse } from '../Base/ProtocolResponse'
2
- import { Tournament } from '../Tournaments'
3
- import { UserAchievement } from './UserAchievement'
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
2
+ import { Tournament } from '../Tournaments';
3
+ import { UserAchievement } from './UserAchievement';
4
4
 
5
5
  export interface GetAchievementMapResponse extends ProtocolResponse {
6
- achievements: UserAchievement[]
7
- tournaments?: Tournament[]
6
+ achievements: UserAchievement[];
7
+ tournaments?: Tournament[];
8
8
  }
@@ -1,8 +1,8 @@
1
- import { ProtocolResponse } from '../Base/ProtocolResponse'
2
- import { UserAchievement } from './UserAchievement'
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
2
+ import { UserAchievement } from './UserAchievement';
3
3
 
4
4
  export interface ReloadAchievementsEvent extends ProtocolResponse {
5
5
  // !important, server will push here UserAchievement but public_meta of ach and tasks will be null
6
6
  // we should use only fields that are reflecting updated progress and not meta data for mission/task
7
- achievements: UserAchievement[]
7
+ achievements: UserAchievement[];
8
8
  }
@@ -1,54 +1,54 @@
1
- import { AchRelatedGame } from '../Base/AchRelatedGame'
2
- import { IntUtils } from '../IntUtils'
3
- import { TMissionOrBadge } from '../WSAPI/WSAPITypes'
4
- import { AchievementPublicMeta } from './AchievementPublicMeta'
5
- import { AchievementStatus } from './AchievementStatus'
6
- import { AchievementTaskType } from './AchievementTaskType'
7
- import { AchievementType } from './AchievementType'
8
- import { ScheduledMissionType } from './ScheduledMissionType'
9
- import { UserAchievementTask } from './UserAchievementTask'
1
+ import { AchRelatedGame } from '../Base/AchRelatedGame';
2
+ import { IntUtils } from '../IntUtils';
3
+ import { TMissionOrBadge } from '../WSAPI/WSAPITypes';
4
+ import { AchievementPublicMeta } from './AchievementPublicMeta';
5
+ import { AchievementStatus } from './AchievementStatus';
6
+ import { AchievementTaskType } from './AchievementTaskType';
7
+ import { AchievementType } from './AchievementType';
8
+ import { ScheduledMissionType } from './ScheduledMissionType';
9
+ import { UserAchievementTask } from './UserAchievementTask';
10
10
 
11
11
  export interface UserAchievement {
12
- ach_id?: number
13
- ach_type_id?: AchievementType
14
- ach_public_meta?: AchievementPublicMeta
15
- isCompleted?: boolean
16
- isLocked?: boolean
17
- requiresOptin?: boolean
18
- isOptedIn?: boolean
19
- start_date?: string // time when mission unlocked or opted-in. Needed to calculated "remaining time" in case time_limit_ms is set
20
- start_date_ts?: number
21
- time_limit_ms?: number
22
- progress?: number
23
- complete_date?: string
24
- complete_date_ts?: number
25
- unlock_date?: string
26
- milliseconds_till_available?: number
27
- completed_tasks?: number
28
- achievementTasks?: UserAchievementTask[]
29
- ach_status_id?: AchievementStatus
30
- scheduledMissionType?: ScheduledMissionType
31
- related_games?: AchRelatedGame[]
32
- active_from_ts?: number // indicates when 'scheduled' mission is active from,
33
- ach_categories?: number[]
12
+ ach_id?: number;
13
+ ach_type_id?: AchievementType;
14
+ ach_public_meta?: AchievementPublicMeta;
15
+ isCompleted?: boolean;
16
+ isLocked?: boolean;
17
+ requiresOptin?: boolean;
18
+ isOptedIn?: boolean;
19
+ start_date?: string; // time when mission unlocked or opted-in. Needed to calculated "remaining time" in case time_limit_ms is set
20
+ start_date_ts?: number;
21
+ time_limit_ms?: number;
22
+ progress?: number;
23
+ complete_date?: string;
24
+ complete_date_ts?: number;
25
+ unlock_date?: string;
26
+ milliseconds_till_available?: number;
27
+ completed_tasks?: number;
28
+ achievementTasks?: UserAchievementTask[];
29
+ ach_status_id?: AchievementStatus;
30
+ scheduledMissionType?: ScheduledMissionType;
31
+ related_games?: AchRelatedGame[];
32
+ active_from_ts?: number; // indicates when 'scheduled' mission is active from,
33
+ ach_categories?: number[];
34
34
 
35
- ach_completed_id?: number // ID of the completion fact from ach_completed or ach_completed_recurring tables
36
- requires_prize_claim?: boolean // flag from achievement if the mission prize will be given only after user claims it
37
- prize_claimed_date_ts?: number // the date/timestamp indicating when the prize was claimed by the user
35
+ ach_completed_id?: number; // ID of the completion fact from ach_completed or ach_completed_recurring tables
36
+ requires_prize_claim?: boolean; // flag from achievement if the mission prize will be given only after user claims it
37
+ prize_claimed_date_ts?: number; // the date/timestamp indicating when the prize was claimed by the user
38
38
 
39
- completed_today?: boolean
40
- completed_this_week?: boolean
41
- completed_this_month?: boolean
42
- custom_section_type_id?: number
39
+ completed_today?: boolean;
40
+ completed_this_week?: boolean;
41
+ completed_this_month?: boolean;
42
+ custom_section_type_id?: number;
43
43
  }
44
44
 
45
45
  export const UserAchievementTransform = (items: UserAchievement[]): TMissionOrBadge[] => {
46
46
  return items
47
47
  .filter((r) => r.ach_id >= 1)
48
48
  .map((r) => {
49
- const completedToday = r.complete_date_ts ? IntUtils.isWithinPeriod(r.complete_date_ts, 'today') : false
50
- const completedThisWeek = r.complete_date_ts ? IntUtils.isWithinPeriod(r.complete_date_ts, 'thisWeek') : false
51
- const completedThisMonth = r.complete_date_ts ? IntUtils.isWithinPeriod(r.complete_date_ts, 'thisMonth') : false
49
+ const completedToday = r.complete_date_ts ? IntUtils.isWithinPeriod(r.complete_date_ts, 'today') : false;
50
+ const completedThisWeek = r.complete_date_ts ? IntUtils.isWithinPeriod(r.complete_date_ts, 'thisWeek') : false;
51
+ const completedThisMonth = r.complete_date_ts ? IntUtils.isWithinPeriod(r.complete_date_ts, 'thisMonth') : false;
52
52
 
53
53
  const x: TMissionOrBadge = {
54
54
  id: r.ach_id,
@@ -62,6 +62,7 @@ export const UserAchievementTransform = (items: UserAchievement[]): TMissionOrBa
62
62
  is_requires_optin: r.requiresOptin,
63
63
  is_opted_in: r.isOptedIn,
64
64
  time_limit_ms: r.time_limit_ms,
65
+ active_from_ts: r.active_from_ts,
65
66
  dt_start: r.start_date_ts,
66
67
  reward: r.ach_public_meta.reward,
67
68
  progress: r.progress,
@@ -72,7 +73,8 @@ export const UserAchievementTransform = (items: UserAchievement[]): TMissionOrBa
72
73
  only_in_custom_section: r.ach_public_meta.only_in_custom_section,
73
74
  custom_data: IntUtils.JsonOrText(r.ach_public_meta.custom_data),
74
75
  position: r.ach_public_meta.position,
75
- ribbon: r.ach_public_meta.label_tag === 'custom' ? r.ach_public_meta.custom_label_tag : r.ach_public_meta.label_tag,
76
+ ribbon:
77
+ r.ach_public_meta.label_tag === 'custom' ? r.ach_public_meta.custom_label_tag : r.ach_public_meta.label_tag,
76
78
  tasks: (r.achievementTasks || [])
77
79
  .filter((t) => t.task_type_id === AchievementTaskType.CompleteAchievement)
78
80
  .map((t) => ({
@@ -106,7 +108,7 @@ export const UserAchievementTransform = (items: UserAchievement[]): TMissionOrBa
106
108
  completed_this_week: completedThisWeek,
107
109
  completed_this_month: completedThisMonth,
108
110
  custom_section_type_id: r.ach_public_meta.custom_section_type_id,
109
- }
110
- return x
111
- })
112
- }
111
+ };
112
+ return x;
113
+ });
114
+ };
@@ -1,16 +1,16 @@
1
- import { AchievementTaskPublicMeta } from './AchievementTaskPublicMeta'
2
- import { AchievementTaskType } from './AchievementTaskType'
1
+ import { AchievementTaskPublicMeta } from './AchievementTaskPublicMeta';
2
+ import { AchievementTaskType } from './AchievementTaskType';
3
3
 
4
4
  export interface UserAchievementTask {
5
- task_id?: number
6
- task_public_meta?: AchievementTaskPublicMeta
7
- points_reward?: number
8
- task_type_id: AchievementTaskType
9
- isCompleted?: boolean
10
- userExecutedCount?: number // This is the number of times the user has executed 'activity' of the task. e.g. he bet 5 times out of 100. here will be 5
11
- executionCount?: number // This is the total number of times the user needs to execute to complete task. e.g. he needs to bet 100 times. here will be 100
12
- userProgress?: number
13
- lastExecutionDate: string
14
- unlocked_by_mission_id?: number
15
- unlocked_by_level_id?: number
5
+ task_id?: number;
6
+ task_public_meta?: AchievementTaskPublicMeta;
7
+ points_reward?: number;
8
+ task_type_id: AchievementTaskType;
9
+ isCompleted?: boolean;
10
+ userExecutedCount?: number; // This is the number of times the user has executed 'activity' of the task. e.g. he bet 5 times out of 100. here will be 5
11
+ executionCount?: number; // This is the total number of times the user needs to execute to complete task. e.g. he needs to bet 100 times. here will be 100
12
+ userProgress?: number;
13
+ lastExecutionDate: string;
14
+ unlocked_by_mission_id?: number;
15
+ unlocked_by_level_id?: number;
16
16
  }
@@ -1,19 +1,19 @@
1
- export * from './AchievementOptinRequest'
2
- export * from './AchievementOptinResponse'
3
- export * from './AchievementPublicMeta'
4
- export * from './AchievementStatus'
5
- export * from './AchievementTaskPublicMeta'
6
- export * from './AchievementTaskType'
7
- export * from './AchievementType'
8
- export * from './GetAchievementMapRequest'
9
- export * from './GetAchievementMapResponse'
10
- export * from './ReloadAchievementsEvent'
11
- export * from './UserAchievement'
12
- export * from './UserAchievementTask'
13
- export * from './ScheduledMissionType'
14
- export * from './AchCategoryPublicMeta'
15
- export * from './AchievementCategory'
16
- export * from './GetAchCategoriesResponse'
17
- export * from './GetAchCategoriesRequest'
18
- export * from './AchClaimPrizeRequest'
19
- export * from './AchClaimPrizeResponse'
1
+ export * from './AchievementOptinRequest';
2
+ export * from './AchievementOptinResponse';
3
+ export * from './AchievementPublicMeta';
4
+ export * from './AchievementStatus';
5
+ export * from './AchievementTaskPublicMeta';
6
+ export * from './AchievementTaskType';
7
+ export * from './AchievementType';
8
+ export * from './GetAchievementMapRequest';
9
+ export * from './GetAchievementMapResponse';
10
+ export * from './ReloadAchievementsEvent';
11
+ export * from './UserAchievement';
12
+ export * from './UserAchievementTask';
13
+ export * from './ScheduledMissionType';
14
+ export * from './AchCategoryPublicMeta';
15
+ export * from './AchievementCategory';
16
+ export * from './GetAchCategoriesResponse';
17
+ export * from './GetAchCategoriesRequest';
18
+ export * from './AchClaimPrizeRequest';
19
+ export * from './AchClaimPrizeResponse';
package/src/NodeCache.ts CHANGED
@@ -1,28 +1,28 @@
1
1
  class NodeCache {
2
- private static ttlChecker: NodeJS.Timeout
2
+ private static ttlChecker: NodeJS.Timeout;
3
3
 
4
- private static cache: { [key: string]: any } = {}
4
+ private static cache: { [key: string]: any } = {};
5
5
 
6
6
  constructor() {
7
7
  if (NodeCache.ttlChecker === undefined) {
8
8
  NodeCache.ttlChecker = setInterval(() => {
9
- const now = new Date().getTime()
9
+ const now = new Date().getTime();
10
10
  for (const key in NodeCache.cache) {
11
11
  if (NodeCache.cache.hasOwnProperty(key)) {
12
- const o = NodeCache.cache[key]
12
+ const o = NodeCache.cache[key];
13
13
  if (o.ttl < now) {
14
- delete NodeCache.cache[key]
14
+ delete NodeCache.cache[key];
15
15
  }
16
16
  }
17
17
  }
18
- }, 1000)
18
+ }, 1000);
19
19
  }
20
20
  }
21
21
 
22
22
  public get(key: string): any {
23
- const o = NodeCache.cache[key]
23
+ const o = NodeCache.cache[key];
24
24
  if (o !== undefined && o.ttl > new Date().getTime()) {
25
- return o.value
25
+ return o.value;
26
26
  }
27
27
  }
28
28
 
@@ -30,18 +30,18 @@ class NodeCache {
30
30
  NodeCache.cache[key] = {
31
31
  value,
32
32
  ttl: new Date().getTime() + ttlSeconds * 1000,
33
- }
33
+ };
34
34
  }
35
35
 
36
36
  public remove(key: string) {
37
37
  if (NodeCache.cache.hasOwnProperty(key)) {
38
- delete NodeCache.cache[key]
38
+ delete NodeCache.cache[key];
39
39
  }
40
40
  }
41
41
 
42
42
  public flushAll() {
43
- NodeCache.cache = {}
43
+ NodeCache.cache = {};
44
44
  }
45
45
  }
46
46
 
47
- export { NodeCache }
47
+ export { NodeCache };