@smartico/public-api 0.0.121 → 0.0.123

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 (77) hide show
  1. package/dist/Base/ClassId.d.ts +15 -0
  2. package/dist/Core/CheckSegmentMatchRequest.d.ts +4 -0
  3. package/dist/Core/CheckSegmentMatchResponse.d.ts +7 -0
  4. package/dist/Jackpots/GetJackpotsPotsRequest.d.ts +4 -0
  5. package/dist/Jackpots/GetJackpotsPotsResponse.d.ts +5 -0
  6. package/dist/Jackpots/GetJackpotsRequest.d.ts +4 -0
  7. package/dist/Jackpots/GetJackpotsResponse.d.ts +5 -0
  8. package/dist/Jackpots/JackpotContributionType.d.ts +5 -0
  9. package/dist/Jackpots/JackpotDetails.d.ts +17 -0
  10. package/dist/Jackpots/JackpotPot.d.ts +7 -0
  11. package/dist/Jackpots/JackpotPublicMeta.d.ts +6 -0
  12. package/dist/Jackpots/JackpotType.d.ts +4 -0
  13. package/dist/Jackpots/JackpotsOptinRequest.d.ts +4 -0
  14. package/dist/Jackpots/JackpotsOptinResponse.d.ts +3 -0
  15. package/dist/Jackpots/JackpotsOptoutRequest.d.ts +4 -0
  16. package/dist/Jackpots/JackpotsOptoutResponse.d.ts +3 -0
  17. package/dist/MiniGames/SAWGameType.d.ts +3 -1
  18. package/dist/MiniGames/SAWPrizeDropAknowledgeRequest.d.ts +4 -0
  19. package/dist/MiniGames/SAWPrizeDropAknowledgeResponse.d.ts +4 -0
  20. package/dist/MiniGames/SAWPrizeDropWinPush.d.ts +9 -0
  21. package/dist/Missions/AchClaimPrizeResponse.d.ts +2 -2
  22. package/dist/Missions/index.d.ts +2 -0
  23. package/dist/Quiz/MarketsAnswersType.d.ts +22 -0
  24. package/dist/Quiz/MarketsInfo.d.ts +2 -1
  25. package/dist/Quiz/index.d.ts +1 -0
  26. package/dist/SmarticoAPI.d.ts +4 -2
  27. package/dist/Store/GetStoreHistoryRequest.d.ts +5 -0
  28. package/dist/Store/GetStoreHistoryResponse.d.ts +6 -0
  29. package/dist/Store/StorItemPruchased.d.ts +6 -0
  30. package/dist/WSAPI/WSAPI.d.ts +7 -1
  31. package/dist/WSAPI/WSAPITypes.d.ts +19 -0
  32. package/dist/index.js +562 -198
  33. package/dist/index.js.map +1 -1
  34. package/dist/index.modern.mjs +352 -13
  35. package/dist/index.modern.mjs.map +1 -1
  36. package/docs/README.md +2 -0
  37. package/docs/classes/WSAPI.md +55 -0
  38. package/docs/enums/SAWGameTypeName.md +6 -0
  39. package/docs/interfaces/TMiniGamePrize.md +9 -1
  40. package/docs/interfaces/TMiniGameTemplate.md +1 -1
  41. package/docs/interfaces/TMissionClaimRewardResult.md +19 -0
  42. package/docs/interfaces/TMissionOrBadge.md +32 -0
  43. package/docs/interfaces/TSegmentCheckResult.md +13 -0
  44. package/package.json +1 -1
  45. package/src/Base/ClassId.ts +24 -0
  46. package/src/Core/CheckSegmentMatchRequest.ts +6 -0
  47. package/src/Core/CheckSegmentMatchResponse.ts +8 -0
  48. package/src/Jackpots/GetJackpotsPotsRequest.ts +5 -0
  49. package/src/Jackpots/GetJackpotsPotsResponse.ts +8 -0
  50. package/src/Jackpots/GetJackpotsRequest.ts +7 -0
  51. package/src/Jackpots/GetJackpotsResponse.ts +9 -0
  52. package/src/Jackpots/JackpotContributionType.ts +7 -0
  53. package/src/Jackpots/JackpotDetails.ts +20 -0
  54. package/src/Jackpots/JackpotPot.ts +10 -0
  55. package/src/Jackpots/JackpotPublicMeta.ts +8 -0
  56. package/src/Jackpots/JackpotType.ts +8 -0
  57. package/src/Jackpots/JackpotsOptinRequest.ts +7 -0
  58. package/src/Jackpots/JackpotsOptinResponse.ts +5 -0
  59. package/src/Jackpots/JackpotsOptoutRequest.ts +7 -0
  60. package/src/Jackpots/JackpotsOptoutResponse.ts +5 -0
  61. package/src/Jackpots/jackpotsWSApi.zip +0 -0
  62. package/src/MiniGames/SAWGameType.ts +5 -2
  63. package/src/MiniGames/SAWPrizeDropAknowledgeRequest.ts +5 -0
  64. package/src/MiniGames/SAWPrizeDropAknowledgeResponse.ts +5 -0
  65. package/src/MiniGames/SAWPrizeDropWinPush.ts +10 -0
  66. package/src/Missions/AchClaimPrizeResponse.ts +2 -3
  67. package/src/Missions/UserAchievement.ts +3 -0
  68. package/src/Missions/index.ts +3 -1
  69. package/src/Quiz/MarketsAnswersType.ts +22 -0
  70. package/src/Quiz/MarketsInfo.ts +185 -8
  71. package/src/Quiz/index.ts +2 -1
  72. package/src/SmarticoAPI.ts +32 -2
  73. package/src/Store/GetStoreHistoryRequest.ts +6 -0
  74. package/src/Store/GetStoreHistoryResponse.ts +7 -0
  75. package/src/Store/StorItemPruchased.ts +8 -0
  76. package/src/WSAPI/WSAPI.ts +30 -1
  77. package/src/WSAPI/WSAPITypes.ts +24 -0
@@ -1,17 +1,194 @@
1
+ import { MarketsValueType } from "./MarketsAnswersType";
1
2
  import { QuizMarketType } from "./MarketsType";
2
3
 
3
- const quizAnswerHomeTeamReplacementText = '%HomeTeam%';
4
- const quizAnswerAwayTeamReplacementText = '%AwayTeam%';
4
+ const quizAnswerHomeTeamReplacementText = '{quiz_home_team}';
5
+ const quizAnswerAwayTeamReplacementText = '{quiz_away_team}';
6
+ const drawReplacementText = '{quiz_draw}';
7
+ const quizYesReplacementText = '{yes}';
8
+ const quizNoReplacementText = '{no}';
9
+ const quizOddReplacementText = '{odd}';
10
+ const quizEvenReplacementText = '{even}';
11
+
12
+ const yesNoAnswers = [
13
+ { text: quizYesReplacementText, value: MarketsValueType.Yes },
14
+ { text: quizNoReplacementText, value: MarketsValueType.No }
15
+ ]
16
+
17
+ const homeAwayAnswers = [
18
+ { text: quizAnswerHomeTeamReplacementText, value: MarketsValueType.HomeTeam },
19
+ { text: quizAnswerAwayTeamReplacementText, value: MarketsValueType.AwayTeam }
20
+ ]
21
+
22
+ const homeAwayDrawAnswers = [
23
+ ...homeAwayAnswers,
24
+ { text: drawReplacementText, value: MarketsValueType.Draw },
25
+ ]
5
26
 
6
27
  export const marketsInfo = [
7
28
  {
8
29
  type: QuizMarketType.OneXTwo,
9
- name: '1X2',
10
- question: { text: 'Who will win the match ?', trKey: 'quiz_answer_1x2' },
30
+ name: '1x2',
31
+ question: { text: 'Who will win the match ?', trKey: 'quizQuestion_1x2'},
32
+ answers: homeAwayDrawAnswers
33
+ },
34
+ {
35
+ type: QuizMarketType.OneXTwoHalftime,
36
+ name: '1x2 Halftime',
37
+ question: { text: 'Who will lead the first half of the match ?', trKey: 'quizQuestion_x2half' },
38
+ answers: homeAwayDrawAnswers
39
+ },
40
+ {
41
+ type: QuizMarketType.HalftimeFulltime,
42
+ name: 'Halftime / Fulltime',
43
+ question: { text: 'Who will lead the first half and who will win the match ?', trKey: 'quizQuestion__HalftimeFulltime' },
44
+ answers: [
45
+ { text: `${quizAnswerHomeTeamReplacementText} / ${quizAnswerHomeTeamReplacementText}`, value: MarketsValueType.HomeTeamHomeTeam },
46
+ { text: `${quizAnswerHomeTeamReplacementText} / ${drawReplacementText}`, value: MarketsValueType.HomeTeamDraw },
47
+ { text: `${quizAnswerHomeTeamReplacementText} / ${quizAnswerAwayTeamReplacementText}`, value: MarketsValueType.HomeTeamAwayTeam },
48
+ { text: `${drawReplacementText} / ${quizAnswerHomeTeamReplacementText}`, value: MarketsValueType.DrawHomeTeam },
49
+ { text: `${drawReplacementText} / ${drawReplacementText}`, value: MarketsValueType.DrawDraw },
50
+ { text: `${drawReplacementText} / ${quizAnswerAwayTeamReplacementText}`, value: MarketsValueType.DrawAwayTeam },
51
+ { text: `${quizAnswerAwayTeamReplacementText} / ${quizAnswerHomeTeamReplacementText}`, value: MarketsValueType.AwayTeamHomeTeam },
52
+ { text: `${quizAnswerAwayTeamReplacementText} / ${drawReplacementText}`, value: MarketsValueType.AwayTeamDraw },
53
+ { text: `${quizAnswerAwayTeamReplacementText} / ${quizAnswerAwayTeamReplacementText}`, value: MarketsValueType.AwayTeamAwayTeam }
54
+ ]
55
+ },
56
+ {
57
+ type: QuizMarketType.FirstGoal,
58
+ name: 'First Goal',
59
+ question: { text: 'Who will score the first goal ?', trKey: 'quizQuestion_firstGoal' },
60
+ answers: homeAwayDrawAnswers
61
+ },
62
+ {
63
+ type: QuizMarketType.LastGoal,
64
+ name: 'Last Goal',
65
+ question: { text: 'Who will score the last goal ?', trKey: 'quizQuestion_lastGoal' },
66
+ answers: homeAwayAnswers
67
+ },
68
+ {
69
+ type: QuizMarketType.DoubleChance,
70
+ name: 'Double Chance',
71
+ question: { text: 'Who will win the match? Choose a combination: ?', trKey: 'quizQuestion_doubleChance' },
72
+ answers: [
73
+ { text: `${drawReplacementText} or ${quizAnswerHomeTeamReplacementText}`, value: MarketsValueType.HomeTeamDraw },
74
+ { text: `${quizAnswerHomeTeamReplacementText} or ${quizAnswerAwayTeamReplacementText}`, value: MarketsValueType.HomeTeamAwayTeam },
75
+ { text: `${drawReplacementText} or ${quizAnswerAwayTeamReplacementText}`, value: MarketsValueType.AwayTeamDraw }
76
+ ]
77
+ },
78
+ {
79
+ type: QuizMarketType.OverUnder2_5,
80
+ name: 'Over/Under 2.5',
81
+ question: { text: 'Will there be 3 or more goals in the match?', trKey: 'quizQuestion_overUnder2_5' },
82
+ answers: yesNoAnswers
83
+ },
84
+ {
85
+ type: QuizMarketType.OverUnder1_5Halftime,
86
+ name: 'Over/Under 1.5 Halftime',
87
+ question: { text: 'Will there be 2 or more goals in the first half?', trKey: 'quizQuestion_overUnder1_5Halftime' },
88
+ answers: yesNoAnswers
89
+ },
90
+ {
91
+ type: QuizMarketType.OverUnder1_5__2ndHalf,
92
+ name: 'Over/Under 1.5 2nd Half',
93
+ question: { text: 'Will there be 2 or more goals in the second half?', trKey: 'quizQuestion_overUnder1_5__2ndHalf' },
94
+ answers: yesNoAnswers
95
+ },
96
+ {
97
+ type: QuizMarketType.RedCard,
98
+ name: 'Red Card',
99
+ question: { text: 'Will there be a red card in the match?', trKey: 'quizQuestion_redCard' },
100
+ answers: yesNoAnswers
101
+ },
102
+ {
103
+ type: QuizMarketType.TotalCorners8_5,
104
+ name: 'Total Corners 8.5',
105
+ question: { text: 'Will there be 9 or more corners in the match?', trKey: 'quizQuestion_totalCorners8_5' },
106
+ answers: yesNoAnswers
107
+ },
108
+ {
109
+ type: QuizMarketType.TotalCorners9_5,
110
+ name: 'Total Corners 9.5',
111
+ question: { text: 'Will there be 10 or more corners in the match?', trKey: 'quizQuestion_totalCorners9_5' },
112
+ answers: yesNoAnswers
113
+ },
114
+ {
115
+ type: QuizMarketType.Corners1x2,
116
+ name: 'Corners 1x2',
117
+ question: { text: 'Which team will have more corners in the match?', trKey: 'quizQuestion_corners1x2' },
118
+ answers: homeAwayAnswers
119
+ },
120
+ {
121
+ type: QuizMarketType.One_Two,
122
+ name: '1-2',
123
+ question: { text: 'Who will win the match ?', trKey: 'quizQuestion_1-2'},
124
+ answers: homeAwayAnswers
125
+ },
126
+ {
127
+ type: QuizMarketType.Overtime,
128
+ name: 'Overtime',
129
+ question: { text: 'Will there be overtime in the match?', trKey: 'quizQuestion_overtime' },
130
+ answers: yesNoAnswers
131
+ },
132
+ {
133
+ type: QuizMarketType.OddEven,
134
+ name: 'Odd/Even',
135
+ question: { text: 'Is the sum of all points scored in the game going to be an odd number or even?', trKey: 'quizQuestion_oddEven' },
136
+ answers: [
137
+ { text: quizOddReplacementText, value: MarketsValueType.Odd },
138
+ { text: quizEvenReplacementText, value: MarketsValueType.Even }
139
+ ]
140
+ },
141
+ {
142
+ type: QuizMarketType.OddEvenHomeAway,
143
+ name: 'Odd/Even Home/Away',
144
+ question: { text: 'Which team will win and what will be the sum of the points (Odd or Even)?', trKey: 'quizQuestion_oddEvenHomeAway' },
11
145
  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' }
146
+ { text: `${quizAnswerHomeTeamReplacementText} - ${quizOddReplacementText}`, value: MarketsValueType.HomeOdd },
147
+ { text: `${quizAnswerHomeTeamReplacementText} - ${quizEvenReplacementText}`, value: MarketsValueType.HomeEven },
148
+ { text: `${quizAnswerAwayTeamReplacementText} - ${quizOddReplacementText}`, value: MarketsValueType.AwayOdd },
149
+ { text: `${quizAnswerAwayTeamReplacementText} - ${quizEvenReplacementText}`, value: MarketsValueType.AwayEven }
15
150
  ]
16
- }
151
+ },
152
+ {
153
+ type: QuizMarketType.FirstSet,
154
+ name: 'First Set',
155
+ question: { text: 'Who will win the first set ?', trKey: 'quizQuestion_firstSet' },
156
+ answers: homeAwayAnswers
157
+ },
158
+ {
159
+ type: QuizMarketType.SecondSet,
160
+ name: 'Second Set',
161
+ question: { text: 'Who will win the second set ?', trKey: 'quizQuestion_secondSet' },
162
+ answers: homeAwayAnswers
163
+ },
164
+ {
165
+ type: QuizMarketType.ThirdSet,
166
+ name: 'Third Set',
167
+ question: { text: 'Who will win the third set ?', trKey: 'quizQuestion_thirdSet' },
168
+ answers: homeAwayAnswers
169
+ },
170
+ {
171
+ type: QuizMarketType.FourthSet,
172
+ name: 'Fourth Set',
173
+ question: { text: 'Who will win the fourth set ?', trKey: 'quizQuestion_fourthSet' },
174
+ answers: homeAwayAnswers
175
+ },
176
+ {
177
+ type: QuizMarketType.FifthSet,
178
+ name: 'Fifth Set',
179
+ question: { text: 'Who will win the fifth set ?', trKey: 'quizQuestion_fifthSet' },
180
+ answers: homeAwayAnswers
181
+ },
182
+ {
183
+ type: QuizMarketType.PlayerOneWinsOneSet,
184
+ name: 'Player One Wins One Set',
185
+ question: { text: 'Will Player One win at least one set?', trKey: 'quizQuestion_playerOneWinsOneSet' },
186
+ answers: yesNoAnswers
187
+ },
188
+ {
189
+ type: QuizMarketType.PlayerTwoWinsOneSet,
190
+ name: 'Player Two Wins One Set',
191
+ question: { text: 'Will Player Two win at least one set?', trKey: 'quizQuestion_playerTwoWinsOneSet' },
192
+ answers: yesNoAnswers
193
+ },
17
194
  ]
package/src/Quiz/index.ts CHANGED
@@ -2,4 +2,5 @@ export * from './SportTypes';
2
2
  export * from './MarketsType';
3
3
  export * from './ScoreResultTypes';
4
4
  export * from './MarketsInfo';
5
- export * from './MarketsPerSport';
5
+ export * from './MarketsPerSport';
6
+ export * from './MarketsAnswersType';
@@ -12,14 +12,16 @@ import { GetLabelInfoResponse } from './Core/GetLabelInfoResponse';
12
12
  import { GetLabelInfoRequest } from './Core/GetLabelInfoRequest';
13
13
  import { GetInboxMessagesRequest, GetInboxMessagesResponse, InboxMessageBody, InboxMessageBodyTransform, InboxMessagesTransform, MarkInboxMessageDeletedRequest, MarkInboxMessageDeletedResponse, MarkInboxMessageReadRequest, MarkInboxMessageReadResponse, MarkInboxMessageStarredRequest, MarkInboxMessageStarredResponse } from './Inbox';
14
14
  import { BuyStoreItemRequest, BuyStoreItemResponse, GetCategoriesStoreResponse, GetStoreItemsResponse, StoreCategoryTransform, StoreItemTransform } from './Store';
15
- import { AchCategoryTransform, AchievementOptinRequest, AchievementOptinResponse, AchievementType, GetAchCategoriesResponse, GetAchievementMapRequest, GetAchievementMapResponse, UserAchievementTransform } from './Missions';
15
+ import { AchCategoryTransform, AchClaimPrizeRequest, AchClaimPrizeResponse, AchievementOptinRequest, AchievementOptinResponse, AchievementType, GetAchCategoriesResponse, GetAchievementMapRequest, GetAchievementMapResponse, UserAchievementTransform } from './Missions';
16
16
  import { GetTournamentInfoRequest, GetTournamentInfoResponse, GetTournamentsRequest, GetTournamentsResponse, TournamentItemsTransform, TournamentRegisterRequest, TournamentRegisterResponse, tournamentInfoItemTransform } from './Tournaments';
17
17
  import { GetLeaderBoardsRequest, GetLeaderBoardsResponse, LeaderBoardDetails, LeaderBoardPeriodType } from "./Leaderboard";
18
18
  import { GetLevelMapResponse, GetLevelMapResponseTransform } from "./Level";
19
19
  import { WSAPI } from "./WSAPI/WSAPI";
20
- import { TInboxMessage, TInboxMessageBody, TLevel, TMiniGameTemplate, TMissionOrBadge, TStoreCategory, TAchCategory, TStoreItem, TTournament, TTournamentDetailed, LeaderBoardDetailsT, UserLevelExtraCountersT } from "./WSAPI/WSAPITypes";
20
+ import { TInboxMessage, TInboxMessageBody, TLevel, TMiniGameTemplate, TMissionOrBadge, TStoreCategory, TAchCategory, TStoreItem, TTournament, TTournamentDetailed, LeaderBoardDetailsT, UserLevelExtraCountersT, TSegmentCheckResult } from "./WSAPI/WSAPITypes";
21
21
  import { getLeaderBoardTransform } from "./Leaderboard/LeaderBoards";
22
22
  import { GetAchievementsUserInfoResponse } from "./Core/GetAchievementsUserInfoResponse";
23
+ import { CheckSegmentMatchResponse } from "./Core/CheckSegmentMatchResponse";
24
+ import { CheckSegmentMatchRequest } from "./Core/CheckSegmentMatchRequest";
23
25
 
24
26
  const PUBLIC_API_URL = 'https://papi{ENV_ID}.smartico.ai/services/public';
25
27
  const C_SOCKET_PROD = 'wss://api{ENV_ID}.smartico.ai/websocket/services';
@@ -271,6 +273,19 @@ class SmarticoAPI {
271
273
  return await this.send(message, ClassId.CLIENT_SET_CUSTOM_USERNAME_RESPONSE);
272
274
  }
273
275
 
276
+ public async coreCheckSegments(user_ext_id: string, segment_id: number[]): Promise<TSegmentCheckResult[]> {
277
+
278
+ const message = this.buildMessage<CheckSegmentMatchRequest, any>(user_ext_id, ClassId.CHECK_SEGMENT_MATCH_REQUEST, {
279
+ segment_id
280
+ });
281
+
282
+ const results = await this.send<CheckSegmentMatchResponse>(message, ClassId.CHECK_SEGMENT_MATCH_RESPONSE);
283
+
284
+ return results.segments || [];
285
+ }
286
+
287
+
288
+
274
289
  public async sawGetTemplates(user_ext_id: string, lang?: string, is_visitor_mode: boolean = false): Promise<SAWGetTemplatesResponse> {
275
290
 
276
291
  const message = this.buildMessage<SAWGetTemplatesRequest, SAWGetTemplatesResponse>(user_ext_id, ClassId.SAW_GET_SPINS_REQUEST, lang ? { force_language: lang, is_visitor_mode } : { is_visitor_mode });
@@ -355,6 +370,21 @@ class SmarticoAPI {
355
370
  return res;
356
371
  }
357
372
 
373
+ public async missionClaimPrize(user_ext_id: string, mission_id: number, ach_completed_id: number) {
374
+ if (!mission_id) {
375
+ throw new Error('Missing mission id');
376
+ }
377
+
378
+ const message = this.buildMessage<AchClaimPrizeRequest, AchClaimPrizeResponse>(user_ext_id, ClassId.ACHIEVEMENT_CLAIM_PRIZE_REQUEST, {
379
+ ach_id: mission_id,
380
+ ach_completed_id: ach_completed_id
381
+ })
382
+
383
+ const res = await this.send<AchClaimPrizeResponse>(message, ClassId.ACHIEVEMENT_CLAIM_PRIZE_RESPONSE);
384
+
385
+ return res;
386
+ }
387
+
358
388
  public async registerInTournament(user_ext_id: string, tournamentInstanceId: number) {
359
389
  if (!tournamentInstanceId) {
360
390
  throw new Error('Missing tournament instance id');
@@ -0,0 +1,6 @@
1
+ import { ProtocolMessage } from "../Base/ProtocolMessage";
2
+
3
+ export interface GetStoreHistoryRequest extends ProtocolMessage {
4
+ offset: number;
5
+ limit: number;
6
+ }
@@ -0,0 +1,7 @@
1
+ import { ProtocolMessage } from "../Base/ProtocolMessage";
2
+ import { StorItemPruchased } from "./StorItemPruchased";
3
+
4
+ export interface GetStoreHistoryResponse extends ProtocolMessage {
5
+ items: StorItemPruchased[];
6
+ hasMore: boolean;
7
+ }
@@ -0,0 +1,8 @@
1
+ import { StoreItem } from "./StoreItem";
2
+
3
+ interface StorItemPruchased extends StoreItem {
4
+ purchase_ts: number;
5
+ purchase_points_amount: number;
6
+ }
7
+
8
+ export { StorItemPruchased }
@@ -3,7 +3,7 @@ import { CoreUtils } from "../Core";
3
3
  import { MiniGamePrizeTypeName, SAWDoSpinResponse, SAWSpinErrorCode, SAWSpinsCountPush } from "../MiniGames";
4
4
  import { ECacheContext, OCache } from "../OCache";
5
5
  import { SmarticoAPI } from "../SmarticoAPI";
6
- import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionOptInResult, TMissionOrBadge, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUserProfile, UserLevelExtraCountersT } from "./WSAPITypes";
6
+ import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TSegmentCheckResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUserProfile, UserLevelExtraCountersT } from "./WSAPITypes";
7
7
  import { LeaderBoardPeriodType } from "../Leaderboard";
8
8
 
9
9
  /** @hidden */
@@ -21,6 +21,7 @@ enum onUpdateContextKey {
21
21
  AchCategories = 'achCategories',
22
22
  LeaderBoards = 'leaderBoards',
23
23
  LevelExtraCounters = 'levelExtraCounters',
24
+ Segments = 'segments',
24
25
  }
25
26
 
26
27
 
@@ -53,6 +54,22 @@ export class WSAPI {
53
54
  }
54
55
  }
55
56
 
57
+ /** Check if user belongs to specific segments */
58
+
59
+ public async checkSegmentMatch(segment_id: number): Promise<boolean> {
60
+ const r = await this.api.coreCheckSegments(null, [segment_id]);
61
+ if (r && r.find(s => s.segment_id === segment_id && s.is_matching)) {
62
+ return true;
63
+ } else {
64
+ return false;
65
+ }
66
+ }
67
+
68
+ /** Check if user belongs to specific list of segments */
69
+ public async checkSegmentListMatch(segment_ids: number[]): Promise<TSegmentCheckResult[]> {
70
+ return await this.api.coreCheckSegments(null, segment_ids)
71
+ }
72
+
56
73
  /** Returns all the levels available the current user */
57
74
  public async getLevels(): Promise<TLevel[]> {
58
75
  return OCache.use(onUpdateContextKey.Levels, ECacheContext.WSAPI, () => this.api.levelsGetT(null), CACHE_DATA_SEC);
@@ -150,6 +167,18 @@ export class WSAPI {
150
167
  return o;
151
168
  }
152
169
 
170
+ /** Request for claim reward for the specified mission id. Returns the err_code. */
171
+ public async requestMissionClaimReward(mission_id: number, ach_completed_id: number): Promise<TMissionClaimRewardResult> {
172
+ const r = await this.api.missionClaimPrize(null, mission_id, ach_completed_id);
173
+
174
+ const o: TMissionClaimRewardResult = {
175
+ err_code: r.errCode,
176
+ err_message: r.errMsg,
177
+ }
178
+
179
+ return o;
180
+ }
181
+
153
182
  /** Returns all the active instances of tournaments
154
183
  * The returned list is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getTournamentsList with a new onUpdate callback, the old one will be overwritten by the new one.
155
184
  * The onUpdate callback will be called when the user has registered in a tournament. Updated list will be passed to onUpdate callback.*/
@@ -457,6 +457,15 @@ export interface TMissionOrBadge {
457
457
 
458
458
  /** The ribbon of the mission/badge item. Can be 'sale', 'hot', 'new', 'vip' or URL to the image in case of custom ribbon */
459
459
  ribbon?: TRibbon;
460
+
461
+ /** ID of the completion fact from ach_completed or ach_completed_recurring tables */
462
+ ach_completed_id?: number;
463
+
464
+ /** Flag from achievement if the mission prize will be given only after user claims it */
465
+ requires_prize_claim?: boolean;
466
+
467
+ /** The date/timestamp indicating when the prize was claimed by the user */
468
+ prize_claimed_date_ts?: number;
460
469
  }
461
470
 
462
471
  export interface AchRelatedGame {
@@ -505,6 +514,16 @@ export interface TMissionOptInResult {
505
514
  err_message: string;
506
515
  }
507
516
 
517
+ /**
518
+ * TMissionClaimRewardResult describes the response of call to _smartico.api.requestMissionClaimReward(mission_id, ach_completed_id) method
519
+ */
520
+ export interface TMissionClaimRewardResult {
521
+ /** Error code that represents outcome of the claim request. Successful claim reward in case err_code is 0 */
522
+ err_code: number;
523
+ /** Optional error message */
524
+ err_message: string;
525
+ }
526
+
508
527
  export interface TTournamentRegistrationResult {
509
528
  /** Error code that represents outcome of the tournament registration request. Successful registration in case err_code is 0 */
510
529
  err_code: TournamentRegistrationError;
@@ -608,3 +627,8 @@ export interface UserLevelExtraCountersT {
608
627
  level_counter_2?: number,
609
628
  }
610
629
 
630
+
631
+ export interface TSegmentCheckResult {
632
+ segment_id: number;
633
+ is_matching: boolean;
634
+ }