@smartico/public-api 0.0.154 → 0.0.155

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 (269) hide show
  1. package/.prettierrc +12 -0
  2. package/dist/Base/ProtocolRequest.d.ts +1 -1
  3. package/dist/Base/ProtocolResponse.d.ts +1 -1
  4. package/dist/Core/CheckSegmentMatchRequest.d.ts +1 -1
  5. package/dist/Core/CheckSegmentMatchResponse.d.ts +1 -1
  6. package/dist/Core/GetAchievementsUserInfoRequest.d.ts +1 -1
  7. package/dist/Core/GetAchievementsUserInfoResponse.d.ts +1 -1
  8. package/dist/Core/GetLabelInfoRequest.d.ts +1 -1
  9. package/dist/Core/GetLabelInfoResponse.d.ts +1 -1
  10. package/dist/Core/GetTranslationsRequest.d.ts +2 -2
  11. package/dist/Core/GetTranslationsResponse.d.ts +1 -1
  12. package/dist/Core/ResponseIdentify.d.ts +2 -2
  13. package/dist/CustomSections/GetCustomSectionsRequest.d.ts +1 -1
  14. package/dist/CustomSections/GetCustomSectionsResponse.d.ts +2 -2
  15. package/dist/CustomSections/UICustomSection.d.ts +2 -2
  16. package/dist/GResponse.d.ts +1 -1
  17. package/dist/Inbox/GetInboxMessagesRequest.d.ts +1 -1
  18. package/dist/Inbox/GetInboxMessagesResponse.d.ts +3 -3
  19. package/dist/Inbox/InboxMessage.d.ts +2 -2
  20. package/dist/Inbox/MarkInboxMessageDeletedRequest.d.ts +1 -1
  21. package/dist/Inbox/MarkInboxMessageDeletedResponse.d.ts +1 -1
  22. package/dist/Inbox/MarkInboxMessageReadRequest.d.ts +1 -1
  23. package/dist/Inbox/MarkInboxMessageReadResponse.d.ts +1 -1
  24. package/dist/Inbox/MarkInboxMessageStarredRequest.d.ts +1 -1
  25. package/dist/Inbox/MarkInboxMessageStarredResponse.d.ts +1 -1
  26. package/dist/Inbox/index.d.ts +8 -8
  27. package/dist/Jackpots/GetJackpotsPotsRequest.d.ts +1 -1
  28. package/dist/Jackpots/GetJackpotsPotsResponse.d.ts +2 -2
  29. package/dist/Jackpots/GetJackpotsRequest.d.ts +1 -1
  30. package/dist/Jackpots/GetJackpotsResponse.d.ts +2 -2
  31. package/dist/Jackpots/JackpotDetails.d.ts +6 -6
  32. package/dist/Jackpots/JackpotWinPush.d.ts +3 -3
  33. package/dist/Jackpots/JackpotsOptinRequest.d.ts +1 -1
  34. package/dist/Jackpots/JackpotsOptinResponse.d.ts +1 -1
  35. package/dist/Jackpots/JackpotsOptoutRequest.d.ts +1 -1
  36. package/dist/Jackpots/JackpotsOptoutResponse.d.ts +1 -1
  37. package/dist/Leaderboard/GetLeaderBoardsRequest.d.ts +2 -2
  38. package/dist/Leaderboard/GetLeaderBoardsResponse.d.ts +2 -2
  39. package/dist/Leaderboard/LeaderBoardDetails.d.ts +3 -3
  40. package/dist/Leaderboard/LeaderBoards.d.ts +2 -2
  41. package/dist/Leaderboard/index.d.ts +6 -6
  42. package/dist/Level/GetLevelMapResponse.d.ts +3 -3
  43. package/dist/Level/Level.d.ts +1 -1
  44. package/dist/MiniGames/SAWAcknowledgeSpinPushRequest.d.ts +1 -1
  45. package/dist/MiniGames/SAWDoAknowledgeRequest.d.ts +1 -1
  46. package/dist/MiniGames/SAWDoAknowledgeResponse.d.ts +1 -1
  47. package/dist/MiniGames/SAWDoSpinRequest.d.ts +1 -1
  48. package/dist/MiniGames/SAWDoSpinResponse.d.ts +2 -2
  49. package/dist/MiniGames/SAWEventSawPush.d.ts +1 -1
  50. package/dist/MiniGames/SAWGetTemplatesRequest.d.ts +1 -1
  51. package/dist/MiniGames/SAWGetTemplatesResponse.d.ts +3 -3
  52. package/dist/MiniGames/SAWPrize.d.ts +2 -2
  53. package/dist/MiniGames/SAWPrizeDropAknowledgeRequest.d.ts +3 -1
  54. package/dist/MiniGames/SAWPrizeDropAknowledgeResponse.d.ts +1 -1
  55. package/dist/MiniGames/SAWPrizeDropWinPush.d.ts +4 -3
  56. package/dist/MiniGames/SAWPrizeUI.d.ts +2 -2
  57. package/dist/MiniGames/SAWSpinsCountPush.d.ts +1 -1
  58. package/dist/MiniGames/SAWTemplate.d.ts +4 -4
  59. package/dist/MiniGames/SAWTemplateUI.d.ts +1 -1
  60. package/dist/MiniGames/SAWUtils.d.ts +1 -1
  61. package/dist/MiniGames/index.d.ts +24 -22
  62. package/dist/Missions/AchClaimPrizeRequest.d.ts +1 -1
  63. package/dist/Missions/AchClaimPrizeResponse.d.ts +1 -1
  64. package/dist/Missions/AchievementCategory.d.ts +2 -2
  65. package/dist/Missions/AchievementOptinRequest.d.ts +1 -1
  66. package/dist/Missions/AchievementOptinResponse.d.ts +1 -1
  67. package/dist/Missions/GetAchCategoriesRequest.d.ts +1 -1
  68. package/dist/Missions/GetAchCategoriesResponse.d.ts +2 -2
  69. package/dist/Missions/GetAchievementMapRequest.d.ts +1 -1
  70. package/dist/Missions/GetAchievementMapResponse.d.ts +2 -2
  71. package/dist/Missions/GetRelatedAchTourRequest.d.ts +1 -1
  72. package/dist/Missions/GetRelatedAchTourResponse.d.ts +3 -3
  73. package/dist/Missions/ReloadAchievementsEvent.d.ts +2 -2
  74. package/dist/Missions/UserAchievement.d.ts +7 -7
  75. package/dist/Missions/UserAchievementTask.d.ts +2 -2
  76. package/dist/Missions/index.d.ts +13 -13
  77. package/dist/Quiz/MarketsInfo.d.ts +2 -2
  78. package/dist/Quiz/MarketsPerSport.d.ts +1 -1
  79. package/dist/SmarticoAPI.d.ts +8 -8
  80. package/dist/SmarticoLib/index.d.ts +39 -39
  81. package/dist/Store/BuyStoreItemRequest.d.ts +1 -1
  82. package/dist/Store/BuyStoreItemResponse.d.ts +1 -1
  83. package/dist/Store/GetCategoriesStoreResponse.d.ts +2 -2
  84. package/dist/Store/GetStoreHistoryRequest.d.ts +1 -1
  85. package/dist/Store/GetStoreHistoryResponse.d.ts +2 -2
  86. package/dist/Store/GetStoreItemsResponse.d.ts +2 -2
  87. package/dist/Store/StoreCategory.d.ts +2 -2
  88. package/dist/Store/StoreItem.d.ts +3 -3
  89. package/dist/Store/StoreItemPurchased.d.ts +2 -2
  90. package/dist/Store/index.d.ts +10 -10
  91. package/dist/Tournaments/GetTournamentInfoRequest.d.ts +1 -1
  92. package/dist/Tournaments/GetTournamentInfoResponse.d.ts +5 -5
  93. package/dist/Tournaments/GetTournamentsRequest.d.ts +1 -1
  94. package/dist/Tournaments/GetTournamentsResponse.d.ts +2 -2
  95. package/dist/Tournaments/Tournament.d.ts +8 -8
  96. package/dist/Tournaments/TournamentPrize.d.ts +1 -1
  97. package/dist/Tournaments/TournamentRegisterRequest.d.ts +1 -1
  98. package/dist/Tournaments/TournamentRegisterResponse.d.ts +2 -2
  99. package/dist/Tournaments/TournamentUtils.d.ts +3 -3
  100. package/dist/Tournaments/index.d.ts +16 -16
  101. package/dist/WSAPI/WSAPI.d.ts +65 -65
  102. package/dist/WSAPI/WSAPITypes.d.ts +18 -18
  103. package/dist/index.js +76 -78
  104. package/dist/index.js.map +1 -1
  105. package/dist/index.modern.mjs +103 -103
  106. package/dist/index.modern.mjs.map +1 -1
  107. package/package.json +1 -1
  108. package/src/Base/AchRelatedGame.ts +13 -13
  109. package/src/Base/ClassId.ts +118 -121
  110. package/src/Base/ProtocolMessage.ts +6 -7
  111. package/src/Base/ProtocolRequest.ts +4 -5
  112. package/src/Base/ProtocolResponse.ts +3 -5
  113. package/src/CookieStore.ts +10 -11
  114. package/src/Core/ActivityTypeLimited.ts +17 -18
  115. package/src/Core/CheckSegmentMatchRequest.ts +2 -3
  116. package/src/Core/CheckSegmentMatchResponse.ts +6 -6
  117. package/src/Core/CoreUtils.ts +37 -39
  118. package/src/Core/GetAchievementsUserInfoRequest.ts +2 -4
  119. package/src/Core/GetAchievementsUserInfoResponse.ts +4 -4
  120. package/src/Core/GetLabelInfoRequest.ts +2 -4
  121. package/src/Core/GetLabelInfoResponse.ts +4 -4
  122. package/src/Core/GetTranslationsRequest.ts +5 -7
  123. package/src/Core/GetTranslationsResponse.ts +3 -5
  124. package/src/Core/PublicLabelSettings.ts +29 -30
  125. package/src/Core/PublicProperties.ts +7 -7
  126. package/src/Core/ResponseIdentify.ts +12 -12
  127. package/src/Core/TranslationArea.ts +8 -9
  128. package/src/Core/index.ts +1 -1
  129. package/src/CustomSections/AchCustomSection.ts +20 -20
  130. package/src/CustomSections/GetCustomSectionsRequest.ts +2 -4
  131. package/src/CustomSections/GetCustomSectionsResponse.ts +4 -5
  132. package/src/CustomSections/UICustomSection.ts +30 -29
  133. package/src/CustomSections/index.ts +4 -4
  134. package/src/ErrorCodes.ts +11 -12
  135. package/src/GResponse.ts +5 -5
  136. package/src/ILogger.ts +6 -10
  137. package/src/Inbox/GetInboxMessagesRequest.ts +4 -5
  138. package/src/Inbox/GetInboxMessagesResponse.ts +15 -17
  139. package/src/Inbox/InboxMessage.ts +31 -33
  140. package/src/Inbox/InboxMessageType.ts +9 -9
  141. package/src/Inbox/MarkInboxMessageDeletedRequest.ts +3 -3
  142. package/src/Inbox/MarkInboxMessageDeletedResponse.ts +3 -3
  143. package/src/Inbox/MarkInboxMessageReadRequest.ts +4 -5
  144. package/src/Inbox/MarkInboxMessageReadResponse.ts +4 -5
  145. package/src/Inbox/MarkInboxMessageStarredRequest.ts +4 -5
  146. package/src/Inbox/MarkInboxMessageStarredResponse.ts +4 -5
  147. package/src/Inbox/index.ts +10 -10
  148. package/src/IntUtils.ts +72 -85
  149. package/src/Jackpots/GetJackpotsPotsRequest.ts +3 -3
  150. package/src/Jackpots/GetJackpotsPotsResponse.ts +3 -5
  151. package/src/Jackpots/GetJackpotsRequest.ts +4 -6
  152. package/src/Jackpots/GetJackpotsResponse.ts +5 -7
  153. package/src/Jackpots/JackPotWinner.ts +11 -12
  154. package/src/Jackpots/JackpotContributionType.ts +3 -4
  155. package/src/Jackpots/JackpotDetails.ts +31 -31
  156. package/src/Jackpots/JackpotHtmlTemplate.ts +3 -3
  157. package/src/Jackpots/JackpotPot.ts +11 -12
  158. package/src/Jackpots/JackpotPublicMeta.ts +16 -16
  159. package/src/Jackpots/JackpotType.ts +2 -5
  160. package/src/Jackpots/JackpotWinPush.ts +6 -6
  161. package/src/Jackpots/JackpotsOptinRequest.ts +3 -5
  162. package/src/Jackpots/JackpotsOptinResponse.ts +2 -4
  163. package/src/Jackpots/JackpotsOptoutRequest.ts +3 -5
  164. package/src/Jackpots/JackpotsOptoutResponse.ts +2 -4
  165. package/src/Jackpots/index.ts +16 -16
  166. package/src/Leaderboard/GetLeaderBoardsRequest.ts +8 -9
  167. package/src/Leaderboard/GetLeaderBoardsResponse.ts +4 -6
  168. package/src/Leaderboard/LeaderBoardDetails.ts +11 -12
  169. package/src/Leaderboard/LeaderBoardPeriodType.ts +3 -3
  170. package/src/Leaderboard/LeaderBoardPosition.ts +9 -10
  171. package/src/Leaderboard/LeaderBoardPublicMeta.ts +3 -4
  172. package/src/Leaderboard/LeaderBoards.ts +42 -42
  173. package/src/Leaderboard/index.ts +6 -6
  174. package/src/Level/GetLevelMapResponse.ts +18 -21
  175. package/src/Level/Level.ts +10 -11
  176. package/src/Level/LevelPublicMeta.ts +17 -17
  177. package/src/Level/index.ts +3 -3
  178. package/src/MiniGames/SAWAcknowledgeSpinPushRequest.ts +3 -4
  179. package/src/MiniGames/SAWAcknowledgeType.ts +3 -4
  180. package/src/MiniGames/SAWAskForUsername.ts +3 -4
  181. package/src/MiniGames/SAWBuyInType.ts +15 -13
  182. package/src/MiniGames/SAWDoAknowledgeRequest.ts +3 -3
  183. package/src/MiniGames/SAWDoAknowledgeResponse.ts +3 -3
  184. package/src/MiniGames/SAWDoSpinRequest.ts +3 -5
  185. package/src/MiniGames/SAWDoSpinResponse.ts +10 -11
  186. package/src/MiniGames/SAWEventSawPush.ts +3 -4
  187. package/src/MiniGames/SAWGameType.ts +23 -21
  188. package/src/MiniGames/SAWGetTemplatesRequest.ts +3 -3
  189. package/src/MiniGames/SAWGetTemplatesResponse.ts +53 -65
  190. package/src/MiniGames/SAWPrize.ts +11 -12
  191. package/src/MiniGames/SAWPrizeDropAknowledgeRequest.ts +5 -3
  192. package/src/MiniGames/SAWPrizeDropAknowledgeResponse.ts +3 -3
  193. package/src/MiniGames/SAWPrizeDropWinPush.ts +9 -8
  194. package/src/MiniGames/SAWPrizeType.ts +23 -22
  195. package/src/MiniGames/SAWPrizeUI.ts +17 -17
  196. package/src/MiniGames/SAWSpinErrorCode.ts +15 -16
  197. package/src/MiniGames/SAWSpinsCountPush.ts +4 -4
  198. package/src/MiniGames/SAWTemplate.ts +29 -29
  199. package/src/MiniGames/SAWTemplateUI.ts +45 -47
  200. package/src/MiniGames/SAWUtils.ts +23 -26
  201. package/src/MiniGames/SAWWinSoundType.ts +10 -11
  202. package/src/MiniGames/index.ts +24 -22
  203. package/src/Missions/AchCategoryPublicMeta.ts +2 -3
  204. package/src/Missions/AchClaimPrizeRequest.ts +4 -5
  205. package/src/Missions/AchClaimPrizeResponse.ts +3 -4
  206. package/src/Missions/AchievementCategory.ts +14 -15
  207. package/src/Missions/AchievementOptinRequest.ts +3 -5
  208. package/src/Missions/AchievementOptinResponse.ts +2 -4
  209. package/src/Missions/AchievementPublicMeta.ts +19 -20
  210. package/src/Missions/AchievementStatus.ts +7 -8
  211. package/src/Missions/AchievementTaskPublicMeta.ts +2 -3
  212. package/src/Missions/AchievementTaskType.ts +2 -2
  213. package/src/Missions/AchievementType.ts +2 -3
  214. package/src/Missions/GetAchCategoriesRequest.ts +2 -4
  215. package/src/Missions/GetAchCategoriesResponse.ts +4 -5
  216. package/src/Missions/GetAchievementMapRequest.ts +2 -4
  217. package/src/Missions/GetAchievementMapResponse.ts +3 -5
  218. package/src/Missions/GetRelatedAchTourRequest.ts +3 -4
  219. package/src/Missions/GetRelatedAchTourResponse.ts +5 -7
  220. package/src/Missions/ReloadAchievementsEvent.ts +5 -5
  221. package/src/Missions/ScheduledMissionType.ts +4 -5
  222. package/src/Missions/UserAchievement.ts +104 -108
  223. package/src/Missions/UserAchievementTask.ts +13 -15
  224. package/src/Missions/index.ts +19 -19
  225. package/src/NodeCache.ts +44 -49
  226. package/src/OCache.ts +51 -57
  227. package/src/Quiz/MarketsAnswers.ts +34 -34
  228. package/src/Quiz/MarketsInfo.ts +184 -177
  229. package/src/Quiz/MarketsPerSport.ts +30 -37
  230. package/src/Quiz/MarketsType.ts +28 -28
  231. package/src/Quiz/ScoreResultTypes.ts +18 -18
  232. package/src/Quiz/SportTypes.ts +4 -4
  233. package/src/Quiz/index.ts +6 -6
  234. package/src/SmarticoAPI.ts +769 -730
  235. package/src/SmarticoLib/index.ts +1053 -1069
  236. package/src/Store/BuyStoreItemErrorCode.ts +10 -10
  237. package/src/Store/BuyStoreItemRequest.ts +2 -2
  238. package/src/Store/BuyStoreItemResponse.ts +2 -3
  239. package/src/Store/GetCategoriesStoreResponse.ts +3 -8
  240. package/src/Store/GetStoreHistoryRequest.ts +3 -3
  241. package/src/Store/GetStoreHistoryResponse.ts +4 -4
  242. package/src/Store/GetStoreItemsResponse.ts +3 -4
  243. package/src/Store/StoreCategory.ts +14 -15
  244. package/src/Store/StoreCategoryPublicMeta.ts +2 -3
  245. package/src/Store/StoreItem.ts +32 -33
  246. package/src/Store/StoreItemPublicMeta.ts +10 -10
  247. package/src/Store/StoreItemPurchased.ts +40 -40
  248. package/src/Store/StoreItemType.ts +20 -19
  249. package/src/Store/index.ts +13 -13
  250. package/src/Tournaments/GetTournamentInfoRequest.ts +2 -3
  251. package/src/Tournaments/GetTournamentInfoResponse.ts +45 -48
  252. package/src/Tournaments/GetTournamentsRequest.ts +2 -4
  253. package/src/Tournaments/GetTournamentsResponse.ts +7 -14
  254. package/src/Tournaments/Tournament.ts +109 -115
  255. package/src/Tournaments/TournamentInstanceStatus.ts +17 -18
  256. package/src/Tournaments/TournamentPlayer.ts +7 -8
  257. package/src/Tournaments/TournamentPrize.ts +9 -10
  258. package/src/Tournaments/TournamentPublicMeta.ts +26 -26
  259. package/src/Tournaments/TournamentRegisterRequest.ts +2 -3
  260. package/src/Tournaments/TournamentRegisterResponse.ts +3 -7
  261. package/src/Tournaments/TournamentRegistrationError.ts +9 -9
  262. package/src/Tournaments/TournamentRegistrationStatus.ts +25 -27
  263. package/src/Tournaments/TournamentRegistrationType.ts +15 -16
  264. package/src/Tournaments/TournamentType.ts +3 -4
  265. package/src/Tournaments/TournamentUtils.ts +90 -89
  266. package/src/Tournaments/index.ts +16 -16
  267. package/src/WSAPI/WSAPI.ts +781 -763
  268. package/src/WSAPI/WSAPITypes.ts +574 -586
  269. package/src/index.ts +15 -15
package/src/IntUtils.ts CHANGED
@@ -1,88 +1,75 @@
1
-
2
-
3
-
4
1
  class IntUtils {
5
-
6
- public static uuid(): string {
7
- let a: any;
8
- let b: any;
9
- for (b = a = ""; a++ < 36; b += a * 51 & 52 ? (a ^ 15 ? 8 ^ Math.random() * (a ^ 20 ? 16 : 4) : 4).toString(16) : "-") {}
10
- return b;
11
- }
12
-
13
- public static isNotNull(val: any): boolean {
14
- return typeof val !== "undefined" && val !== null;
15
- }
16
-
17
- public static isNotEmpty(val: string): boolean {
18
- return typeof val !== "undefined" && val !== null && val.length > 0;
19
- }
20
-
21
- public static replaceAll(value: string, regex: string, replacement: string | number): string {
22
- if (IntUtils.isNotNull(value)) {
23
- return value.replace(new RegExp(IntUtils.escapeRegExp(regex), "g"), replacement?.toString());
24
- }
25
- return value;
26
- }
27
-
28
- public static escapeRegExp(v: string): string {
29
- if (IntUtils.isNotEmpty(v)) {
30
- return v.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
31
- }
32
- return v;
33
- }
34
-
35
- public static JsonOrText = (str: string): any => {
36
- if (str && str.includes && (str.includes('{') || str.includes('['))) {
37
- try {
38
- return JSON.parse(str)
39
- } catch (e) {
40
- return str;
41
- }
42
- }
43
- return str;
44
- }
45
-
46
- // public static wsTimeToEpoch = (time: string): number => {
47
- // if (time) {
48
- // return moment.utc(time, "DD/MM/YYYY HH:mm:ss").valueOf()
49
- // } else {
50
- // return null
51
- // }
52
- // }
53
-
54
- public static isWithinPeriod = (timestamp: number, period: 'today' | 'thisWeek' | 'thisMonth'): boolean => {
55
- const now = new Date();
56
- const completedDate = new Date(timestamp);
57
-
58
- switch(period) {
59
- case 'today':
60
- return (
61
- now.getFullYear() === completedDate.getFullYear() &&
62
- now.getMonth() === completedDate.getMonth() &&
63
- now.getDate() === completedDate.getDate()
64
- );
65
- case "thisWeek":
66
- const startOfWeek = new Date(now);
67
- startOfWeek.setDate(now.getDate() - now.getDay());
68
- startOfWeek.setHours(0, 0, 0, 0);
69
-
70
- const endOfWeek = new Date(startOfWeek);
71
- endOfWeek.setDate(startOfWeek.getDate() + 6);
72
- endOfWeek.setHours(23, 59, 59, 999);
73
-
74
- return completedDate >= startOfWeek && completedDate <= endOfWeek;
75
- case "thisMonth":
76
- return (
77
- now.getFullYear() === completedDate.getFullYear() &&
78
- now.getMonth() === completedDate.getMonth()
79
- );
80
- default:
81
- return false;
82
- }
83
- }
2
+ public static uuid(): string {
3
+ let a: any
4
+ let b: any
5
+ for (b = a = ''; a++ < 36; b += (a * 51) & 52 ? (a ^ 15 ? 8 ^ (Math.random() * (a ^ 20 ? 16 : 4)) : 4).toString(16) : '-') {}
6
+ return b
7
+ }
8
+
9
+ public static isNotNull(val: any): boolean {
10
+ return typeof val !== 'undefined' && val !== null
11
+ }
12
+
13
+ public static isNotEmpty(val: string): boolean {
14
+ return typeof val !== 'undefined' && val !== null && val.length > 0
15
+ }
16
+
17
+ public static replaceAll(value: string, regex: string, replacement: string | number): string {
18
+ if (IntUtils.isNotNull(value)) {
19
+ return value.replace(new RegExp(IntUtils.escapeRegExp(regex), 'g'), replacement?.toString())
20
+ }
21
+ return value
22
+ }
23
+
24
+ public static escapeRegExp(v: string): string {
25
+ if (IntUtils.isNotEmpty(v)) {
26
+ return v.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
27
+ }
28
+ return v
29
+ }
30
+
31
+ public static JsonOrText = (str: string): any => {
32
+ if (str && str.includes && (str.includes('{') || str.includes('['))) {
33
+ try {
34
+ return JSON.parse(str)
35
+ } catch (e) {
36
+ return str
37
+ }
38
+ }
39
+ return str
40
+ }
41
+
42
+ // public static wsTimeToEpoch = (time: string): number => {
43
+ // if (time) {
44
+ // return moment.utc(time, "DD/MM/YYYY HH:mm:ss").valueOf()
45
+ // } else {
46
+ // return null
47
+ // }
48
+ // }
49
+
50
+ public static isWithinPeriod = (timestamp: number, period: 'today' | 'thisWeek' | 'thisMonth'): boolean => {
51
+ const now = new Date()
52
+ const completedDate = new Date(timestamp)
53
+
54
+ switch (period) {
55
+ case 'today':
56
+ return now.getFullYear() === completedDate.getFullYear() && now.getMonth() === completedDate.getMonth() && now.getDate() === completedDate.getDate()
57
+ case 'thisWeek':
58
+ const startOfWeek = new Date(now)
59
+ startOfWeek.setDate(now.getDate() - now.getDay())
60
+ startOfWeek.setHours(0, 0, 0, 0)
61
+
62
+ const endOfWeek = new Date(startOfWeek)
63
+ endOfWeek.setDate(startOfWeek.getDate() + 6)
64
+ endOfWeek.setHours(23, 59, 59, 999)
65
+
66
+ return completedDate >= startOfWeek && completedDate <= endOfWeek
67
+ case 'thisMonth':
68
+ return now.getFullYear() === completedDate.getFullYear() && now.getMonth() === completedDate.getMonth()
69
+ default:
70
+ return false
71
+ }
72
+ }
84
73
  }
85
74
 
86
-
87
-
88
- export { IntUtils }
75
+ export { IntUtils }
@@ -1,5 +1,5 @@
1
- import { ProtocolMessage } from "../Base/ProtocolMessage";
1
+ import { ProtocolMessage } from '../Base/ProtocolMessage'
2
2
 
3
- export interface GetJackpotsPotsRequest extends ProtocolMessage {
4
- jp_template_ids: number[];
3
+ export interface GetJackpotsPotsRequest extends ProtocolMessage {
4
+ jp_template_ids: number[]
5
5
  }
@@ -1,8 +1,6 @@
1
- import { ProtocolResponse } from "../Base/ProtocolResponse";
2
- import { JackpotPot } from "./JackpotPot";
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse'
2
+ import { JackpotPot } from './JackpotPot'
3
3
 
4
4
  export interface GetJackpotsPotsResponse extends ProtocolResponse {
5
-
6
- items: JackpotPot[];
5
+ items: JackpotPot[]
7
6
  }
8
-
@@ -1,8 +1,6 @@
1
- import { ProtocolMessage } from "../Base/ProtocolMessage";
1
+ import { ProtocolMessage } from '../Base/ProtocolMessage'
2
2
 
3
-
4
- export interface GetJackpotsRequest extends ProtocolMessage {
5
-
6
- related_game_id?: string;
7
- jp_template_id?: number;
3
+ export interface GetJackpotsRequest extends ProtocolMessage {
4
+ related_game_id?: string
5
+ jp_template_id?: number
8
6
  }
@@ -1,9 +1,7 @@
1
- import { AchRelatedGame } from "../Base/AchRelatedGame";
2
- import { ProtocolResponse } from "../Base/ProtocolResponse";
3
- import { JackpotDetails } from "./JackpotDetails";
1
+ import { AchRelatedGame } from '../Base/AchRelatedGame'
2
+ import { ProtocolResponse } from '../Base/ProtocolResponse'
3
+ import { JackpotDetails } from './JackpotDetails'
4
4
 
5
- export interface GetJackpotsResponse extends ProtocolResponse {
6
-
7
- items: JackpotDetails[];
5
+ export interface GetJackpotsResponse extends ProtocolResponse {
6
+ items: JackpotDetails[]
8
7
  }
9
-
@@ -1,15 +1,14 @@
1
-
2
1
  interface JackPotWinner {
3
- /** Flag indicating that this winner is the currently logged in user */
4
- is_me: boolean;
5
- /** Name of the winner, note that for all users except is_me, the name is masked by default, but masking can be disabled by request to Smartico AM team */
6
- public_username: string; // masked for all except "is_me"
7
- /** Won amount in the Jackpot currency */
8
- winning_amount_jp_currency: number;
9
- /** Won amount in the user Wallet currency */
10
- winning_amount_wallet_currency: number;
11
- /** Position of the winner. Relevant for jackpots where there could be multiple winners */
12
- winning_position: number;
2
+ /** Flag indicating that this winner is the currently logged in user */
3
+ is_me: boolean
4
+ /** Name of the winner, note that for all users except is_me, the name is masked by default, but masking can be disabled by request to Smartico AM team */
5
+ public_username: string // masked for all except "is_me"
6
+ /** Won amount in the Jackpot currency */
7
+ winning_amount_jp_currency: number
8
+ /** Won amount in the user Wallet currency */
9
+ winning_amount_wallet_currency: number
10
+ /** Position of the winner. Relevant for jackpots where there could be multiple winners */
11
+ winning_position: number
13
12
  }
14
13
 
15
- export { JackPotWinner }
14
+ export { JackPotWinner }
@@ -1,7 +1,6 @@
1
1
  enum JackpotContributionType {
2
- Fixed = 1,
3
- Percentage = 2
2
+ Fixed = 1,
3
+ Percentage = 2,
4
4
  }
5
5
 
6
-
7
- export { JackpotContributionType }
6
+ export { JackpotContributionType }
@@ -1,39 +1,39 @@
1
- import { AchRelatedGame } from "../Base/AchRelatedGame";
2
- import { JackpotContributionType } from "./JackpotContributionType";
3
- import { JackpotPot } from "./JackpotPot";
4
- import { JackpotPublicMeta } from "./JackpotPublicMeta";
5
- import { JackpotType } from "./JackpotType";
1
+ import { AchRelatedGame } from '../Base/AchRelatedGame'
2
+ import { JackpotContributionType } from './JackpotContributionType'
3
+ import { JackpotPot } from './JackpotPot'
4
+ import { JackpotPublicMeta } from './JackpotPublicMeta'
5
+ import { JackpotType } from './JackpotType'
6
6
 
7
7
  /**
8
8
  * JackpotDetails the information about Jackpot template
9
9
  * It also includes JackpotPot object that holds the current value of the jackpot
10
10
  * Flag is_opted_in indicates if the current user is opted in to the jackpot
11
- */
11
+ */
12
12
  interface JackpotDetails {
13
- /** ID of the jackpot template */
14
- jp_template_id: number;
15
- /** type of jackpot logic */
16
- jp_type_id: JackpotType;
17
- /** UI information of jackpot, like name, description, etc. */
18
- jp_public_meta: JackpotPublicMeta;
19
- /** base currency of the jackpot */
20
- jp_currency: string;
21
- /** wallet currency of currently logged in user */
22
- user_currency: string;
23
- /** list of related games that are eligible for the jackpot */
24
- related_games?: AchRelatedGame[];
25
- /** type of the user contribution to the jackpot */
26
- contribution_type: JackpotContributionType;
27
- /** value of the user contribution. Fixed amount or percentage of bet depending on the contribution type */
28
- contribution_value: number;
29
- /** information of current value of the jackpot */
30
- pot: JackpotPot;
31
- /** indication if the current user is opted in to the jackpot */
32
- is_opted_in: boolean;
33
- /** indicates whether all games are eligible for the jackpot */
34
- ach_related_game_allow_all: boolean;
35
- /** The number of users who have opted in to participate in the jackpot */
36
- registration_count: number;
13
+ /** ID of the jackpot template */
14
+ jp_template_id: number
15
+ /** type of jackpot logic */
16
+ jp_type_id: JackpotType
17
+ /** UI information of jackpot, like name, description, etc. */
18
+ jp_public_meta: JackpotPublicMeta
19
+ /** base currency of the jackpot */
20
+ jp_currency: string
21
+ /** wallet currency of currently logged in user */
22
+ user_currency: string
23
+ /** list of related games that are eligible for the jackpot */
24
+ related_games?: AchRelatedGame[]
25
+ /** type of the user contribution to the jackpot */
26
+ contribution_type: JackpotContributionType
27
+ /** value of the user contribution. Fixed amount or percentage of bet depending on the contribution type */
28
+ contribution_value: number
29
+ /** information of current value of the jackpot */
30
+ pot: JackpotPot
31
+ /** indication if the current user is opted in to the jackpot */
32
+ is_opted_in: boolean
33
+ /** indicates whether all games are eligible for the jackpot */
34
+ ach_related_game_allow_all: boolean
35
+ /** The number of users who have opted in to participate in the jackpot */
36
+ registration_count: number
37
37
  }
38
38
 
39
- export { JackpotDetails }
39
+ export { JackpotDetails }
@@ -1,6 +1,6 @@
1
1
  interface JackpotHtmlTemplate {
2
- id: string;
3
- content: string;
2
+ id: string
3
+ content: string
4
4
  }
5
5
 
6
- export { JackpotHtmlTemplate };
6
+ export { JackpotHtmlTemplate }
@@ -1,15 +1,14 @@
1
-
2
1
  interface JackpotPot {
3
- /** ID of the jackpot template */
4
- jp_template_id: number;
5
- /** ID of the jackpot pot */
6
- jp_pot_id: number;
7
- /** currency of the jackpot pot in the Jackput base currency */
8
- current_pot_amount: number;
9
- /** currency of the jackpot pot in the user wallet currency */
10
- current_pot_amount_user_currency: number;
11
- /** the date/time when this pot exploded */
12
- explode_date_ts: number;
2
+ /** ID of the jackpot template */
3
+ jp_template_id: number
4
+ /** ID of the jackpot pot */
5
+ jp_pot_id: number
6
+ /** currency of the jackpot pot in the Jackput base currency */
7
+ current_pot_amount: number
8
+ /** currency of the jackpot pot in the user wallet currency */
9
+ current_pot_amount_user_currency: number
10
+ /** the date/time when this pot exploded */
11
+ explode_date_ts: number
13
12
  }
14
13
 
15
- export { JackpotPot }
14
+ export { JackpotPot }
@@ -1,19 +1,19 @@
1
- import { JackpotHtmlTemplate } from './JackpotHtmlTemplate';
1
+ import { JackpotHtmlTemplate } from './JackpotHtmlTemplate'
2
2
  interface JackpotPublicMeta {
3
- /** name of the jackpot */
4
- name: string;
5
- /** description/rules of the jackpot */
6
- description: string;
7
- /** image url of the jackpot */
8
- image_url: string;
9
- /** HTML template for the winner of the jackpt */
10
- winner_template: JackpotHtmlTemplate;
11
- /** HTML template for the not winner of the jackpot */
12
- not_winner_template: JackpotHtmlTemplate;
13
- /** custom value of placeholder1 defined by operator and can be used in the HTML templates */
14
- placeholder1: string;
15
- /** custom value of placeholder2 defined by operator and can be used in the HTML templates */
16
- placeholder2: string;
3
+ /** name of the jackpot */
4
+ name: string
5
+ /** description/rules of the jackpot */
6
+ description: string
7
+ /** image url of the jackpot */
8
+ image_url: string
9
+ /** HTML template for the winner of the jackpt */
10
+ winner_template: JackpotHtmlTemplate
11
+ /** HTML template for the not winner of the jackpot */
12
+ not_winner_template: JackpotHtmlTemplate
13
+ /** custom value of placeholder1 defined by operator and can be used in the HTML templates */
14
+ placeholder1: string
15
+ /** custom value of placeholder2 defined by operator and can be used in the HTML templates */
16
+ placeholder2: string
17
17
  }
18
18
 
19
- export { JackpotPublicMeta }
19
+ export { JackpotPublicMeta }
@@ -1,8 +1,5 @@
1
-
2
-
3
1
  enum JackpotType {
4
- Main = 1
2
+ Main = 1,
5
3
  }
6
4
 
7
-
8
- export { JackpotType }
5
+ export { JackpotType }
@@ -1,8 +1,8 @@
1
- import { ProtocolMessage } from "../Base/ProtocolMessage";
2
- import { JackPotWinner } from "./JackPotWinner";
3
- import { JackpotDetails } from "./JackpotDetails";
1
+ import { ProtocolMessage } from '../Base/ProtocolMessage'
2
+ import { JackPotWinner } from './JackPotWinner'
3
+ import { JackpotDetails } from './JackpotDetails'
4
4
 
5
5
  export interface JackpotWinPush extends ProtocolMessage {
6
- jackpot: JackpotDetails;
7
- winners: JackPotWinner[];
8
- }
6
+ jackpot: JackpotDetails
7
+ winners: JackPotWinner[]
8
+ }
@@ -1,7 +1,5 @@
1
- import { ProtocolMessage } from "../Base/ProtocolMessage";
2
-
1
+ import { ProtocolMessage } from '../Base/ProtocolMessage'
3
2
 
4
3
  export interface JackpotsOptinRequest extends ProtocolMessage {
5
-
6
- jp_template_id: number;
7
- }
4
+ jp_template_id: number
5
+ }
@@ -1,5 +1,3 @@
1
- import { ProtocolResponse } from "../Base/ProtocolResponse";
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse'
2
2
 
3
- export interface JackpotsOptinResponse extends ProtocolResponse {
4
-
5
- }
3
+ export interface JackpotsOptinResponse extends ProtocolResponse {}
@@ -1,7 +1,5 @@
1
- import { ProtocolMessage } from "../Base/ProtocolMessage";
2
-
1
+ import { ProtocolMessage } from '../Base/ProtocolMessage'
3
2
 
4
3
  export interface JackpotsOptoutRequest extends ProtocolMessage {
5
-
6
- jp_template_id: number;
7
- }
4
+ jp_template_id: number
5
+ }
@@ -1,5 +1,3 @@
1
- import { ProtocolResponse } from "../Base/ProtocolResponse";
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse'
2
2
 
3
- export interface JackpotsOptoutResponse extends ProtocolResponse {
4
-
5
- }
3
+ export interface JackpotsOptoutResponse extends ProtocolResponse {}
@@ -1,16 +1,16 @@
1
- export * from './GetJackpotsPotsRequest';
2
- export * from './GetJackpotsPotsResponse';
3
- export * from './GetJackpotsRequest';
4
- export * from './GetJackpotsResponse';
5
- export * from './JackPotWinner';
6
- export * from './JackpotContributionType';
7
- export * from './JackpotDetails';
8
- export * from './JackpotPot';
9
- export * from './JackpotPublicMeta';
10
- export * from './JackpotType';
11
- export * from './JackpotWinPush';
12
- export * from './JackpotsOptinRequest';
13
- export * from './JackpotsOptinResponse';
14
- export * from './JackpotsOptoutRequest';
15
- export * from './JackpotsOptoutResponse';
16
- export * from './JackpotHtmlTemplate';
1
+ export * from './GetJackpotsPotsRequest'
2
+ export * from './GetJackpotsPotsResponse'
3
+ export * from './GetJackpotsRequest'
4
+ export * from './GetJackpotsResponse'
5
+ export * from './JackPotWinner'
6
+ export * from './JackpotContributionType'
7
+ export * from './JackpotDetails'
8
+ export * from './JackpotPot'
9
+ export * from './JackpotPublicMeta'
10
+ export * from './JackpotType'
11
+ export * from './JackpotWinPush'
12
+ export * from './JackpotsOptinRequest'
13
+ export * from './JackpotsOptinResponse'
14
+ export * from './JackpotsOptoutRequest'
15
+ export * from './JackpotsOptoutResponse'
16
+ export * from './JackpotHtmlTemplate'
@@ -1,11 +1,10 @@
1
- import { ProtocolMessage } from "../Base/ProtocolMessage";
2
- import { LeaderBoardPeriodType } from "./LeaderBoardPeriodType";
1
+ import { ProtocolMessage } from '../Base/ProtocolMessage'
2
+ import { LeaderBoardPeriodType } from './LeaderBoardPeriodType'
3
3
 
4
-
5
- export interface GetLeaderBoardsRequest extends ProtocolMessage {
6
- // if not set will return all boards
7
- period_type_id?: LeaderBoardPeriodType;
8
- // can be >=1, if set will return snapshot for the previous period (1), or period before previous (2) etc
9
- snapshot_offset?: number;
10
- include_users?: boolean;
4
+ export interface GetLeaderBoardsRequest extends ProtocolMessage {
5
+ // if not set will return all boards
6
+ period_type_id?: LeaderBoardPeriodType
7
+ // can be >=1, if set will return snapshot for the previous period (1), or period before previous (2) etc
8
+ snapshot_offset?: number
9
+ include_users?: boolean
11
10
  }
@@ -1,8 +1,6 @@
1
- import { ProtocolResponse } from "../Base/ProtocolResponse";
2
- import { LeaderBoardDetails } from "./LeaderBoardDetails";
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse'
2
+ import { LeaderBoardDetails } from './LeaderBoardDetails'
3
3
 
4
- export interface GetLeaderBoardsResponse extends ProtocolResponse {
5
-
6
- map: { [key: string]: LeaderBoardDetails };
4
+ export interface GetLeaderBoardsResponse extends ProtocolResponse {
5
+ map: { [key: string]: LeaderBoardDetails }
7
6
  }
8
-
@@ -1,15 +1,14 @@
1
- import { LeaderBoardPeriodType } from "./LeaderBoardPeriodType";
2
- import { LeaderBoardPosition } from "./LeaderBoardPosition";
3
- import { LeaderBoardPublicMeta } from "./LeaderBoardPublicMeta";
1
+ import { LeaderBoardPeriodType } from './LeaderBoardPeriodType'
2
+ import { LeaderBoardPosition } from './LeaderBoardPosition'
3
+ import { LeaderBoardPublicMeta } from './LeaderBoardPublicMeta'
4
4
 
5
5
  export interface LeaderBoardDetails {
6
-
7
- board_id: number;
8
- period_type_id: LeaderBoardPeriodType;
9
- create_date?: number; // 0 for the current
10
- versiod_id: number; // 0 for the current
11
- reward_points: number[];
12
- board_public_meta: LeaderBoardPublicMeta;
13
- positions: LeaderBoardPosition[];
14
- userPosition: LeaderBoardPosition;
6
+ board_id: number
7
+ period_type_id: LeaderBoardPeriodType
8
+ create_date?: number // 0 for the current
9
+ versiod_id: number // 0 for the current
10
+ reward_points: number[]
11
+ board_public_meta: LeaderBoardPublicMeta
12
+ positions: LeaderBoardPosition[]
13
+ userPosition: LeaderBoardPosition
15
14
  }
@@ -1,5 +1,5 @@
1
1
  export enum LeaderBoardPeriodType {
2
- DAILY = 1,
3
- WEEKLY = 2,
4
- MONTHLY = 3
2
+ DAILY = 1,
3
+ WEEKLY = 2,
4
+ MONTHLY = 3,
5
5
  }
@@ -1,12 +1,11 @@
1
1
  export interface LeaderBoardPosition {
2
+ public_username?: string
3
+ user_alt_name: string // TODO Need remove it in future
4
+ position_in_board: number
5
+ points_accumulated: number
6
+ is_me: boolean
7
+ level_id: number
8
+ avatar_id: string
2
9
 
3
- public_username?: string;
4
- user_alt_name: string; // TODO Need remove it in future
5
- position_in_board: number;
6
- points_accumulated: number;
7
- is_me: boolean;
8
- level_id: number;
9
- avatar_id: string;
10
-
11
- avatar_url?: string;
12
- }
10
+ avatar_url?: string
11
+ }
@@ -1,6 +1,5 @@
1
1
  export interface LeaderBoardPublicMeta {
2
-
3
- name: string;
4
- description: string;
5
- rules: string;
2
+ name: string
3
+ description: string
4
+ rules: string
6
5
  }