@smartico/public-api 0.0.351 → 0.0.352

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.
@@ -40,6 +40,14 @@ import {
40
40
  TActivityLog,
41
41
  TRaffleOptinResponse,
42
42
  } from './WSAPITypes';
43
+ import {
44
+ GamesApiResponse,
45
+ GamePickRound,
46
+ GamePickRoundBoard,
47
+ GamePickUserInfo,
48
+ GamePickGameInfo,
49
+ GamePickRequestParams,
50
+ } from '../GamePick';
43
51
  import { LeaderBoardPeriodType } from '../Leaderboard';
44
52
  import {
45
53
  JackpotDetails,
@@ -1067,6 +1075,274 @@ export class WSAPI {
1067
1075
  );
1068
1076
  }
1069
1077
 
1078
+ /**
1079
+ * Returns the active rounds for the specified MatchX or Quiz game (identified by saw_template_id).
1080
+ * Each round contains events (matches/questions) with user selections.
1081
+ *
1082
+ * **Example**:
1083
+ * ```
1084
+ * _smartico.api.getGamePickActiveRounds({
1085
+ * saw_template_id: 123,
1086
+ * ext_user_id: '149598632',
1087
+ * smartico_ext_user_id: 'user@example.com',
1088
+ * lang: 'EN'
1089
+ * }).then((result) => {
1090
+ * console.log(result);
1091
+ * });
1092
+ * ```
1093
+ *
1094
+ * **Visitor mode: not supported**
1095
+ */
1096
+ public async getGamePickActiveRounds(props: GamePickRequestParams): Promise<GamesApiResponse<GamePickRound[]>> {
1097
+ if (!props.saw_template_id) {
1098
+ throw new Error('saw_template_id is required');
1099
+ }
1100
+ return this.api.gpGetActiveRounds(props.ext_user_id, props.smartico_ext_user_id, props.saw_template_id, props.lang);
1101
+ }
1102
+
1103
+ /**
1104
+ * Returns a single active round (the "home" round or a specific round by ID) for the specified MatchX or Quiz game.
1105
+ * If round_id is not provided, returns the most relevant active round.
1106
+ *
1107
+ * **Example**:
1108
+ * ```
1109
+ * _smartico.api.getGamePickActiveRound({
1110
+ * saw_template_id: 123,
1111
+ * ext_user_id: '149598632',
1112
+ * smartico_ext_user_id: 'user@example.com',
1113
+ * }).then((result) => {
1114
+ * console.log(result);
1115
+ * });
1116
+ * ```
1117
+ *
1118
+ * **Visitor mode: not supported**
1119
+ */
1120
+ public async getGamePickActiveRound(props: GamePickRequestParams & { round_id?: number }): Promise<GamesApiResponse<GamePickRound>> {
1121
+ if (!props.saw_template_id) {
1122
+ throw new Error('saw_template_id is required');
1123
+ }
1124
+ return this.api.gpGetActiveRound(props.ext_user_id, props.smartico_ext_user_id, props.saw_template_id, props.lang, props.round_id);
1125
+ }
1126
+
1127
+ /**
1128
+ * Returns the history of all rounds (including resolved) for the specified MatchX or Quiz game.
1129
+ *
1130
+ * **Example**:
1131
+ * ```
1132
+ * _smartico.api.getGamePickHistory({
1133
+ * saw_template_id: 123,
1134
+ * ext_user_id: '149598632',
1135
+ * smartico_ext_user_id: 'user@example.com',
1136
+ * }).then((result) => {
1137
+ * console.log(result);
1138
+ * });
1139
+ * ```
1140
+ *
1141
+ * **Visitor mode: not supported**
1142
+ */
1143
+ public async getGamePickHistory(props: GamePickRequestParams): Promise<GamesApiResponse<GamePickRound[]>> {
1144
+ if (!props.saw_template_id) {
1145
+ throw new Error('saw_template_id is required');
1146
+ }
1147
+ return this.api.gpGetGamesHistory(props.ext_user_id, props.smartico_ext_user_id, props.saw_template_id, props.lang);
1148
+ }
1149
+
1150
+ /**
1151
+ * Returns the leaderboard for a specific round within a MatchX or Quiz game.
1152
+ * Use round_id = -1 (AllRoundsGameBoardID) for the season/overall leaderboard.
1153
+ *
1154
+ * **Example**:
1155
+ * ```
1156
+ * _smartico.api.getGamePickBoard({
1157
+ * saw_template_id: 123,
1158
+ * ext_user_id: '149598632',
1159
+ * smartico_ext_user_id: 'user@example.com',
1160
+ * round_id: 456
1161
+ * }).then((result) => {
1162
+ * console.log(result.data.users, result.data.my_user);
1163
+ * });
1164
+ * ```
1165
+ *
1166
+ * **Visitor mode: not supported**
1167
+ */
1168
+ public async getGamePickBoard(props: GamePickRequestParams & { round_id: number }): Promise<GamesApiResponse<GamePickRoundBoard>> {
1169
+ if (!props.saw_template_id) {
1170
+ throw new Error('saw_template_id is required');
1171
+ }
1172
+ if (props.round_id === undefined || props.round_id === null) {
1173
+ throw new Error('round_id is required');
1174
+ }
1175
+ return this.api.gpGetGameBoard(props.ext_user_id, props.smartico_ext_user_id, props.saw_template_id, props.round_id, props.lang);
1176
+ }
1177
+
1178
+ /**
1179
+ * Submits picks for a round in a MatchX game.
1180
+ * Sends the entire round with user selections for all events at once.
1181
+ * Each event should have team1_user_selection and team2_user_selection (predicted scores).
1182
+ *
1183
+ * **Example**:
1184
+ * ```
1185
+ * _smartico.api.submitGamePickSelection({
1186
+ * saw_template_id: 123,
1187
+ * ext_user_id: '149598632',
1188
+ * smartico_ext_user_id: 'user@example.com',
1189
+ * round: {
1190
+ * round_id: 456,
1191
+ * events: [
1192
+ * { gp_event_id: 789, team1_user_selection: 2, team2_user_selection: 1 },
1193
+ * { gp_event_id: 790, team1_user_selection: 0, team2_user_selection: 3 }
1194
+ * ]
1195
+ * }
1196
+ * }).then((result) => {
1197
+ * console.log(result);
1198
+ * });
1199
+ * ```
1200
+ *
1201
+ * **Visitor mode: not supported**
1202
+ */
1203
+ public async submitGamePickSelection(props: GamePickRequestParams & { round: any }): Promise<GamesApiResponse<GamePickRound>> {
1204
+ if (!props.saw_template_id) {
1205
+ throw new Error('saw_template_id is required');
1206
+ }
1207
+ return this.api.gpSubmitSelection(props.ext_user_id, props.smartico_ext_user_id, props.saw_template_id, props.round, false, props.lang);
1208
+ }
1209
+
1210
+ /**
1211
+ * Submits answers for a round in a Quiz game.
1212
+ * Sends the entire round with user answers for all events at once.
1213
+ * Each event should have user_selection (answer value from QuizAnswersValueType).
1214
+ *
1215
+ * **Example**:
1216
+ * ```
1217
+ * _smartico.api.submitGamePickSelectionQuiz({
1218
+ * saw_template_id: 123,
1219
+ * ext_user_id: '149598632',
1220
+ * smartico_ext_user_id: 'user@example.com',
1221
+ * round: {
1222
+ * round_id: 456,
1223
+ * events: [
1224
+ * { gp_event_id: 789, user_selection: '1' },
1225
+ * { gp_event_id: 790, user_selection: 'x' }
1226
+ * ]
1227
+ * }
1228
+ * }).then((result) => {
1229
+ * console.log(result);
1230
+ * });
1231
+ * ```
1232
+ *
1233
+ * **Visitor mode: not supported**
1234
+ */
1235
+ public async submitGamePickSelectionQuiz(props: GamePickRequestParams & { round: any }): Promise<GamesApiResponse<GamePickRound>> {
1236
+ if (!props.saw_template_id) {
1237
+ throw new Error('saw_template_id is required');
1238
+ }
1239
+ return this.api.gpSubmitSelection(props.ext_user_id, props.smartico_ext_user_id, props.saw_template_id, props.round, true, props.lang);
1240
+ }
1241
+
1242
+ /**
1243
+ * Returns the current user's profile information within the specified MatchX or Quiz game.
1244
+ * Includes username, avatar, position, scores, and balances.
1245
+ *
1246
+ * **Example**:
1247
+ * ```
1248
+ * _smartico.api.getGamePickUserInfo({
1249
+ * saw_template_id: 123,
1250
+ * ext_user_id: '149598632',
1251
+ * smartico_ext_user_id: 'user@example.com',
1252
+ * }).then((result) => {
1253
+ * console.log(result.data.public_username, result.data.gp_position);
1254
+ * });
1255
+ * ```
1256
+ *
1257
+ * **Visitor mode: not supported**
1258
+ */
1259
+ public async getGamePickUserInfo(props: GamePickRequestParams): Promise<GamesApiResponse<GamePickUserInfo>> {
1260
+ if (!props.saw_template_id) {
1261
+ throw new Error('saw_template_id is required');
1262
+ }
1263
+ return this.api.gpGetUserInfo(props.ext_user_id, props.smartico_ext_user_id, props.saw_template_id, props.lang);
1264
+ }
1265
+
1266
+ /**
1267
+ * Returns the game configuration (template, label info) and the list of all rounds for the specified MatchX or Quiz game.
1268
+ *
1269
+ * **Example**:
1270
+ * ```
1271
+ * _smartico.api.getGamePickGameInfo({
1272
+ * saw_template_id: 123,
1273
+ * ext_user_id: '149598632',
1274
+ * smartico_ext_user_id: 'user@example.com',
1275
+ * }).then((result) => {
1276
+ * console.log(result.data.sawTemplate, result.data.allRounds);
1277
+ * });
1278
+ * ```
1279
+ *
1280
+ * **Visitor mode: not supported**
1281
+ */
1282
+ public async getGamePickGameInfo(props: GamePickRequestParams): Promise<GamesApiResponse<GamePickGameInfo>> {
1283
+ if (!props.saw_template_id) {
1284
+ throw new Error('saw_template_id is required');
1285
+ }
1286
+ return this.api.gpGetGameInfo(props.ext_user_id, props.smartico_ext_user_id, props.saw_template_id, props.lang);
1287
+ }
1288
+
1289
+ /**
1290
+ * Returns translations for the MatchX/Quiz game UI.
1291
+ * Translations are returned as a key-value map based on the user's language.
1292
+ *
1293
+ * **Example**:
1294
+ * ```
1295
+ * _smartico.api.getGamePickTranslations({
1296
+ * saw_template_id: 123,
1297
+ * ext_user_id: '149598632',
1298
+ * smartico_ext_user_id: 'user@example.com',
1299
+ * lang: 'EN'
1300
+ * }).then((result) => {
1301
+ * console.log(result.data);
1302
+ * });
1303
+ * ```
1304
+ *
1305
+ * **Visitor mode: not supported**
1306
+ */
1307
+ public async getGamePickTranslations(props: GamePickRequestParams): Promise<GamesApiResponse<any>> {
1308
+ if (!props.saw_template_id) {
1309
+ throw new Error('saw_template_id is required');
1310
+ }
1311
+ return this.api.gpGetTranslations(props.ext_user_id, props.smartico_ext_user_id, props.saw_template_id, props.lang);
1312
+ }
1313
+
1314
+ /**
1315
+ * Returns round data with events and picks for a specific user (identified by their internal user ID).
1316
+ * Useful for showing another user's predictions from the leaderboard.
1317
+ *
1318
+ * **Example**:
1319
+ * ```
1320
+ * _smartico.api.getGamePickRoundInfoForUser({
1321
+ * saw_template_id: 123,
1322
+ * ext_user_id: '149598632',
1323
+ * smartico_ext_user_id: 'user@example.com',
1324
+ * round_id: 456,
1325
+ * int_user_id: 789
1326
+ * }).then((result) => {
1327
+ * console.log(result.data.events);
1328
+ * });
1329
+ * ```
1330
+ *
1331
+ * **Visitor mode: not supported**
1332
+ */
1333
+ public async getGamePickRoundInfoForUser(props: GamePickRequestParams & { round_id: number; int_user_id: number }): Promise<GamesApiResponse<GamePickRound>> {
1334
+ if (!props.saw_template_id) {
1335
+ throw new Error('saw_template_id is required');
1336
+ }
1337
+ if (!props.round_id) {
1338
+ throw new Error('round_id is required');
1339
+ }
1340
+ if (!props.int_user_id) {
1341
+ throw new Error('int_user_id is required');
1342
+ }
1343
+ return this.api.gpGetRoundInfoForUser(props.ext_user_id, props.smartico_ext_user_id, props.saw_template_id, props.round_id, props.int_user_id, props.lang);
1344
+ }
1345
+
1070
1346
  private async updateOnSpin(data: SAWSpinsCountPush) {
1071
1347
  const templates: TMiniGameTemplate[] = await OCache.use(
1072
1348
  onUpdateContextKey.Saw,
@@ -6,9 +6,11 @@ import { LeaderBoardPeriodType } from '../Leaderboard';
6
6
  import { AchCustomLayoutTheme, AchCustomSectionType, AchMissionsTabsOptions, AchOverviewMissionsFilter, LiquidEntityData } from '../CustomSections';
7
7
  import { PrizeModifiers } from '../MiniGames/PrizeModifiers';
8
8
  import { InboxCategories } from '../Inbox/InboxCategories';
9
- import { RaffleDrawInstanceState, RaffleDrawTypeExecution } from '../Raffle';
9
+ import { RaffleDrawInstanceState, RaffleDrawTypeExecution, RaffleTicketCapVisualization } from '../Raffle';
10
10
  import { PointChangeSourceType } from '../ActivityLog/PointChangeSourceType';
11
11
  import { UserBalanceType } from '../ActivityLog/UserBalanceType';
12
+ import { SAWGPMarketType } from '../Quiz/MarketsType';
13
+ import { QuizAnswersValueType } from '../Quiz/MarketsAnswers';
12
14
 
13
15
 
14
16
  type TRibbon = 'sale' | 'hot' | 'new' | 'vip' | string;
@@ -413,6 +415,8 @@ export interface TTournament {
413
415
  min_scores_win?: number;
414
416
  /** When enabled, users who don’t meet the minimum qualifying score will be hidden from the Leaderboard */
415
417
  hide_leaderboard_min_scores?: boolean;
418
+ /** Total scores across all participants in the tournament */
419
+ total_scores?: number;
416
420
  }
417
421
 
418
422
  /**
@@ -1050,6 +1054,10 @@ export interface TRaffle {
1050
1054
  * Then the list will always return 3 draws, no matter if the draws are already executed or they are in the future.
1051
1055
  */
1052
1056
  draws: TRaffleDraw[];
1057
+ /**
1058
+ * Ticket cap visualization
1059
+ */
1060
+ ticket_cap_visualization: RaffleTicketCapVisualization;
1053
1061
  }
1054
1062
 
1055
1063
  export interface TRaffleTicket {
@@ -1377,4 +1385,4 @@ export interface TRaffleOptinResponse {
1377
1385
  err_message?: string;
1378
1386
  }
1379
1387
 
1380
- export { SAWAcknowledgeTypeName, PrizeModifiers, SAWTemplateUI, InboxCategories, AchCustomSectionType, SAWAskForUsername, SAWGameLayout, PointChangeSourceType, UserBalanceType }
1388
+ export { SAWAcknowledgeTypeName, PrizeModifiers, SAWTemplateUI, InboxCategories, AchCustomSectionType, SAWAskForUsername, SAWGameLayout, PointChangeSourceType, UserBalanceType, SAWGPMarketType, QuizAnswersValueType }
package/src/index.ts CHANGED
@@ -20,4 +20,5 @@ export * from './Raffle';
20
20
  export * from './OCache';
21
21
  export * from './Bonuses';
22
22
  export * from './CustomSections';
23
- export * from './ActivityLog';
23
+ export * from './ActivityLog';
24
+ export * from './GamePick';