@smartico/public-api 0.0.119 → 0.0.121

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 (42) hide show
  1. package/dist/Base/ClassId.d.ts +2 -0
  2. package/dist/Inbox/GetInboxMessagesResponse.d.ts +1 -1
  3. package/dist/Inbox/InboxMessage.d.ts +2 -2
  4. package/dist/Leaderboard/LeaderBoards.d.ts +1 -1
  5. package/dist/Missions/AchClaimPrizeRequest.d.ts +5 -0
  6. package/dist/Missions/AchClaimPrizeResponse.d.ts +3 -0
  7. package/dist/Missions/UserAchievement.d.ts +3 -0
  8. package/dist/Quiz/MarketsInfo.d.ts +13 -0
  9. package/dist/Quiz/MarketsPerSport.d.ts +6 -0
  10. package/dist/Quiz/MarketsType.d.ts +27 -0
  11. package/dist/Quiz/ScoreResultTypes.d.ts +28 -0
  12. package/dist/Quiz/SportTypes.d.ts +6 -0
  13. package/dist/Quiz/index.d.ts +5 -0
  14. package/dist/WSAPI/WSAPI.d.ts +1 -1
  15. package/dist/WSAPI/WSAPITypes.d.ts +3 -3
  16. package/dist/index.d.ts +1 -0
  17. package/dist/index.js +68 -2
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.modern.mjs +69 -3
  20. package/dist/index.modern.mjs.map +1 -1
  21. package/docs/interfaces/TLevel.md +1 -1
  22. package/package.json +1 -1
  23. package/src/Base/ClassId.ts +3 -0
  24. package/src/Inbox/GetInboxMessagesResponse.ts +1 -1
  25. package/src/Inbox/InboxMessage.ts +2 -2
  26. package/src/Leaderboard/LeaderBoards.ts +1 -1
  27. package/src/Level/GetLevelMapResponse.ts +1 -1
  28. package/src/Missions/AchClaimPrizeRequest.ts +7 -0
  29. package/src/Missions/AchClaimPrizeResponse.ts +6 -0
  30. package/src/Missions/UserAchievement.ts +4 -0
  31. package/src/Quiz/MarketsInfo.ts +17 -0
  32. package/src/Quiz/MarketsPerSport.ts +39 -0
  33. package/src/Quiz/MarketsType.ts +27 -0
  34. package/src/Quiz/ScoreResultTypes.ts +32 -0
  35. package/src/Quiz/SportTypes.ts +7 -0
  36. package/src/Quiz/index.ts +5 -0
  37. package/src/SmarticoAPI.ts +2 -2
  38. package/src/Tournaments/GetTournamentInfoResponse.ts +0 -1
  39. package/src/Tournaments/TournamentUtils.ts +1 -1
  40. package/src/WSAPI/WSAPI.ts +1 -1
  41. package/src/WSAPI/WSAPITypes.ts +3 -3
  42. package/src/index.ts +2 -1
@@ -79,4 +79,4 @@ ___
79
79
 
80
80
  • **custom\_data**: `string`
81
81
 
82
- The custom data of the mini-game defined by operator. Can be a JSON object, string or number
82
+ The custom data of the Level defined by operator in the BackOffice. Can be a JSON object, string or number
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartico/public-api",
3
- "version": "0.0.119",
3
+ "version": "0.0.121",
4
4
  "description": "Smartico public API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -75,6 +75,9 @@ export enum ClassId {
75
75
  GET_ACH_CATEGORIES_REQUEST = 537,
76
76
  GET_ACH_CATEGORIES_RESPONSE = 538,
77
77
 
78
+ ACHIEVEMENT_CLAIM_PRIZE_REQUEST = 539,
79
+ ACHIEVEMENT_CLAIM_PRIZE_RESPONSE = 540,
80
+
78
81
  GET_BONUSES_REQUEST = 600,
79
82
  GET_BONUSES_RESPONSE = 601,
80
83
  CLAIM_BONUS_REQUEST = 602,
@@ -1,4 +1,4 @@
1
- import { TInboxMessage } from "src/WSAPI/WSAPITypes";
1
+ import { TInboxMessage } from "../WSAPI/WSAPITypes";
2
2
  import { ProtocolResponse } from "../Base/ProtocolResponse";
3
3
  import { InboxMessage } from "./InboxMessage";
4
4
 
@@ -1,4 +1,4 @@
1
- import { TInboxMessageBody } from "src/WSAPI/WSAPITypes";
1
+ import { TInboxMessageBody } from "../WSAPI/WSAPITypes";
2
2
  import { InboxMessageType } from "./InboxMessageType";
3
3
 
4
4
  export interface InboxMessageBody {
@@ -18,7 +18,7 @@ export interface InboxMessage {
18
18
  engagement_uid: string;
19
19
  is_read: boolean;
20
20
  is_starred: boolean;
21
- is_deleted: boolean;
21
+ is_deleted?: boolean;
22
22
  }
23
23
 
24
24
  export const InboxMessageBodyTransform = (item: InboxMessageBody): TInboxMessageBody => {
@@ -1,4 +1,4 @@
1
- import { LeaderBoardDetailsT, LeaderBoardUserT, LeaderBoardsRewardsT } from "src/WSAPI/WSAPITypes";
1
+ import { LeaderBoardDetailsT, LeaderBoardUserT, LeaderBoardsRewardsT } from "../WSAPI/WSAPITypes";
2
2
  import { LeaderBoardDetails } from "./LeaderBoardDetails";
3
3
  import { LeaderBoardPeriodType } from "./LeaderBoardPeriodType";
4
4
  import { LeaderBoardPosition } from "./LeaderBoardPosition";
@@ -1,4 +1,4 @@
1
- import { IntUtils } from "src/IntUtils";
1
+ import { IntUtils } from "../IntUtils";
2
2
  import { ProtocolResponse } from "../Base/ProtocolResponse";
3
3
  import { TLevel } from "../WSAPI/WSAPITypes";
4
4
  import { Level } from "./Level";
@@ -0,0 +1,7 @@
1
+ import { ProtocolMessage } from "../Base/ProtocolMessage";
2
+
3
+ export interface AchClaimPrizeRequest extends ProtocolMessage {
4
+
5
+ ach_id: number;
6
+ ach_completed_id: number; // ID of the completion fact from ach_completed or ach_completed_recurring tables
7
+ }
@@ -0,0 +1,6 @@
1
+ import { ProtocolMessage } from "../Base/ProtocolMessage";
2
+
3
+ export interface AchClaimPrizeRequest extends ProtocolMessage {
4
+
5
+ // no details here, just check for errCode and reload list of missions
6
+ }
@@ -33,6 +33,10 @@ export interface UserAchievement {
33
33
  related_games?: AchRelatedGame[];
34
34
  active_from_ts?: number; // indicates when 'scheduled' mission is active from,
35
35
  ach_categories?: number[];
36
+
37
+ ach_completed_id?: number; // ID of the completion fact from ach_completed or ach_completed_recurring tables
38
+ requires_prize_claim?: boolean; // flag from achievement if the mission prize will be given only after user claims it
39
+ prize_claimed_date_ts?: number; // the date/timestamp indicating when the prize was claimed by the user
36
40
  }
37
41
 
38
42
  export const UserAchievementTransform = (items: UserAchievement[]): TMissionOrBadge[] => {
@@ -0,0 +1,17 @@
1
+ import { QuizMarketType } from "./MarketsType";
2
+
3
+ const quizAnswerHomeTeamReplacementText = '%HomeTeam%';
4
+ const quizAnswerAwayTeamReplacementText = '%AwayTeam%';
5
+
6
+ export const marketsInfo = [
7
+ {
8
+ type: QuizMarketType.OneXTwo,
9
+ name: '1X2',
10
+ question: { text: 'Who will win the match ?', trKey: 'quiz_answer_1x2' },
11
+ answers: [
12
+ { text: quizAnswerHomeTeamReplacementText, trKey: 'quiz_answer_1x2_home' },
13
+ { text: 'Draw', trKey: 'quiz_answer_1x2_draw' },
14
+ { text: quizAnswerAwayTeamReplacementText, trKey: 'quiz_answer_1x2_away' }
15
+ ]
16
+ }
17
+ ]
@@ -0,0 +1,39 @@
1
+ import { QuizMarketType } from "./MarketsType";
2
+ import { QuizSportType } from "./SportTypes";
3
+
4
+ export const QuizMarketPerSport = {
5
+ [QuizSportType.Basketball]: [
6
+ QuizMarketType.One_Two,
7
+ QuizMarketType.Overtime,
8
+ QuizMarketType.OneXTwo,
9
+ QuizMarketType.OddEven,
10
+ QuizMarketType.OddEvenHomeAway,
11
+ QuizMarketType.DoubleChance,
12
+ ],
13
+ [QuizSportType.Soccer]: [
14
+ QuizMarketType.OneXTwo,
15
+ QuizMarketType.OneXTwoHalftime,
16
+ QuizMarketType.HalftimeFulltime,
17
+ QuizMarketType.FirstGoal,
18
+ QuizMarketType.LastGoal,
19
+ QuizMarketType.DoubleChance,
20
+ QuizMarketType.OverUnder2_5,
21
+ QuizMarketType.OverUnder1_5Halftime,
22
+ QuizMarketType.OverUnder1_5__2ndHalf,
23
+ QuizMarketType.RedCard,
24
+ QuizMarketType.TotalCorners8_5,
25
+ QuizMarketType.TotalCorners9_5,
26
+ QuizMarketType.Corners1x2,
27
+ ],
28
+ [QuizSportType.Tennis]: [
29
+ QuizMarketType.One_Two,
30
+ QuizMarketType.FirstSet,
31
+ QuizMarketType.SecondSet,
32
+ QuizMarketType.ThirdSet,
33
+ QuizMarketType.FourthSet,
34
+ QuizMarketType.FifthSet,
35
+ QuizMarketType.PlayerOneWinsOneSet,
36
+ QuizMarketType.PlayerTwoWinsOneSet,
37
+ QuizMarketType.OddEven
38
+ ]
39
+ }
@@ -0,0 +1,27 @@
1
+ export enum QuizMarketType {
2
+ TwoTeamsWithScore = 1,
3
+ RedCard = 2,
4
+ OneXTwo = 3,
5
+ OneXTwoHalftime = 4,
6
+ HalftimeFulltime = 5,
7
+ FirstGoal = 6,
8
+ DoubleChance = 7,
9
+ OverUnder2_5 = 8,
10
+ OverUnder1_5Halftime = 9,
11
+ OverUnder1_5__2ndHalf = 10,
12
+ TotalCorners8_5 = 11,
13
+ TotalCorners9_5 = 12,
14
+ Corners1x2 = 13,
15
+ One_Two = 14,
16
+ Overtime = 15,
17
+ OddEven = 16,
18
+ OddEvenHomeAway = 17,
19
+ FirstSet = 18,
20
+ SecondSet = 19,
21
+ ThirdSet = 20,
22
+ FourthSet = 21,
23
+ FifthSet = 22,
24
+ PlayerOneWinsOneSet = 23,
25
+ PlayerTwoWinsOneSet = 24,
26
+ LastGoal = 25
27
+ }
@@ -0,0 +1,32 @@
1
+ type TeamType = 'Home' | 'Away';
2
+ type CardType = 'Yellow' | 'Red';
3
+ type TimeType = 'FT' | '1st Half' | '2nd Half';
4
+
5
+ export type OverHalfFullTimeScoreType = {
6
+ home: number,
7
+ away: number,
8
+ }
9
+
10
+ export type CardScoreType = {
11
+ time: 'string',
12
+ type: CardType,
13
+ player: string,
14
+ }
15
+
16
+ export type CornerScoreType = {
17
+ team: TeamType,
18
+ timeType: TimeType,
19
+ totalCount: number,
20
+ }
21
+
22
+ export type GoalScoreType = {
23
+ team: TeamType,
24
+ time: string,
25
+ player: string,
26
+ matchScore: OverHalfFullTimeScoreType,
27
+ }
28
+
29
+ export type SetsScoreType = {
30
+ set: number,
31
+ setScore: OverHalfFullTimeScoreType,
32
+ }
@@ -0,0 +1,7 @@
1
+ export enum QuizSportType {
2
+ Soccer = 1,
3
+ Tennis = 5,
4
+ Basketball = 6,
5
+ }
6
+
7
+ export const quizSupportedSports = [QuizSportType.Basketball, QuizSportType.Soccer, QuizSportType.Tennis];
@@ -0,0 +1,5 @@
1
+ export * from './SportTypes';
2
+ export * from './MarketsType';
3
+ export * from './ScoreResultTypes';
4
+ export * from './MarketsInfo';
5
+ export * from './MarketsPerSport';
@@ -128,8 +128,8 @@ class SmarticoAPI {
128
128
  }
129
129
 
130
130
  } catch (e) {
131
- this.logger.error(`Failed to make request to smartico channel. ${e.message}`, { url: this.publicUrl, request: message, error: e.message });
132
- throw(new Error(`Failed to make request to smartico channel. ${e.message}`));
131
+ this.logger.error(`Failed to make request to smartico channel, L2. ${e.message}`, { url: this.publicUrl, request: message, error: e.message });
132
+ throw(new Error(`Failed to make request to smartico channel, L1. ${e.message}`));
133
133
  }
134
134
 
135
135
  if (this.logCIDs.includes(message.cid)) {
@@ -3,7 +3,6 @@ import {TournamentPlayer} from "./TournamentPlayer";
3
3
  import { ProtocolResponse } from "../Base/ProtocolResponse";
4
4
  import { TournamentPrize } from "./TournamentPrize";
5
5
  import { TTournamentDetailed } from "../WSAPI/WSAPITypes";
6
- import { ActivityTypeLimited } from "src/Core";
7
6
  import { TournamentUtils } from "./TournamentUtils";
8
7
 
9
8
  export interface GetTournamentInfoResponse extends ProtocolResponse {
@@ -1,4 +1,4 @@
1
- import { ActivityTypeLimited } from "src/Core";
1
+ import { ActivityTypeLimited } from "../Core";
2
2
  import { Tournament } from "./Tournament";
3
3
  import { TournamentInstanceStatus } from "./TournamentInstanceStatus";
4
4
  import { TournamentPlayer } from "./TournamentPlayer";
@@ -4,7 +4,7 @@ import { MiniGamePrizeTypeName, SAWDoSpinResponse, SAWSpinErrorCode, SAWSpinsCou
4
4
  import { ECacheContext, OCache } from "../OCache";
5
5
  import { SmarticoAPI } from "../SmarticoAPI";
6
6
  import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionOptInResult, TMissionOrBadge, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUserProfile, UserLevelExtraCountersT } from "./WSAPITypes";
7
- import { LeaderBoardPeriodType } from "src/Leaderboard";
7
+ import { LeaderBoardPeriodType } from "../Leaderboard";
8
8
 
9
9
  /** @hidden */
10
10
  const CACHE_DATA_SEC = 30;
@@ -2,7 +2,7 @@ import { BuyStoreItemErrorCode } from "../Store";
2
2
  import { MiniGamePrizeTypeName, SAWBuyInTypeName, SAWGameTypeName, SAWSpinErrorCode } from "../MiniGames";
3
3
  import { TournamentRegistrationError, TournamentRegistrationStatusName, TournamentRegistrationTypeName } from "../Tournaments";
4
4
  import { AchCategory } from "../Missions";
5
- import { LeaderBoardPeriodType } from "src/Leaderboard";
5
+ import { LeaderBoardPeriodType } from "../Leaderboard";
6
6
 
7
7
  type TRibbon = 'sale' | 'hot' | 'new' | 'vip' | string
8
8
 
@@ -91,7 +91,7 @@ export interface TMiniGameTemplate {
91
91
  promo_image: string;
92
92
  /** The promo text */
93
93
  promo_text: string;
94
- /** The custom data of the mini-game defined by operator. Can be a JSON object, string or number */
94
+ /** The custom data of the mini-game defined by operator in the BackOffice. Can be a JSON object, string or number */
95
95
  custom_data: any;
96
96
 
97
97
 
@@ -170,7 +170,7 @@ export interface TLevel {
170
170
  */
171
171
  required_level_counter_2: number,
172
172
 
173
- /** The custom data of the mini-game defined by operator. Can be a JSON object, string or number */
173
+ /** The custom data of the Level defined by operator in the BackOffice. Can be a JSON object, string or number */
174
174
  custom_data: string;
175
175
  }
176
176
 
package/src/index.ts CHANGED
@@ -10,4 +10,5 @@ export * from './MiniGames';
10
10
  export * from './Missions';
11
11
  export * from './Store';
12
12
  export * from './Tournaments';
13
- export * from './Level';
13
+ export * from './Level';
14
+ export * from './Quiz';