@smartico/public-api 0.0.141 → 0.0.143
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.
- package/README.md +14 -1
- package/dist/CustomSections/AchCustomSection.d.ts +27 -0
- package/dist/CustomSections/GetCustomSectionsRequest.d.ts +3 -0
- package/dist/CustomSections/GetCustomSectionsResponse.d.ts +7 -0
- package/dist/CustomSections/UICustomSection.d.ts +15 -0
- package/dist/CustomSections/index.d.ts +4 -0
- package/dist/Missions/AchievementPublicMeta.d.ts +1 -0
- package/dist/Missions/UserAchievement.d.ts +1 -0
- package/dist/OCache.d.ts +1 -0
- package/dist/SmarticoAPI.d.ts +17 -14
- package/dist/WSAPI/WSAPI.d.ts +270 -48
- package/dist/WSAPI/WSAPITypes.d.ts +25 -0
- package/dist/index.js +559 -214
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +382 -95
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +1 -0
- package/docs/classes/WSAPI.md +234 -27
- package/docs/enums/AchCustomLayoutTheme.md +27 -0
- package/docs/enums/AchCustomSectionType.md +43 -0
- package/docs/enums/AchMissionsTabsOptions.md +21 -0
- package/docs/enums/AchOverviewMissionsFilter.md +33 -0
- package/docs/interfaces/TUICustomSection.md +85 -0
- package/package.json +1 -1
- package/src/CustomSections/AchCustomSection.ts +30 -0
- package/src/CustomSections/GetCustomSectionsRequest.ts +5 -0
- package/src/CustomSections/GetCustomSectionsResponse.ts +7 -0
- package/src/CustomSections/UICustomSection.ts +34 -0
- package/src/CustomSections/index.ts +4 -0
- package/src/Level/GetLevelMapResponse.ts +1 -1
- package/src/Missions/AchievementPublicMeta.ts +1 -0
- package/src/Missions/UserAchievement.ts +3 -1
- package/src/OCache.ts +5 -0
- package/src/SmarticoAPI.ts +42 -34
- package/src/WSAPI/WSAPI.ts +296 -64
- package/src/WSAPI/WSAPITypes.ts +27 -0
package/dist/index.modern.mjs
CHANGED
|
@@ -459,6 +459,9 @@ class OCache {
|
|
|
459
459
|
this.cache[cacheContext].flushAll();
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
|
+
static async clearAll() {
|
|
463
|
+
this.cache = {};
|
|
464
|
+
}
|
|
462
465
|
}
|
|
463
466
|
OCache.cache = {};
|
|
464
467
|
const deepClone = o => {
|
|
@@ -799,7 +802,8 @@ const UserAchievementTransform = items => {
|
|
|
799
802
|
complete_date_ts: r.complete_date_ts,
|
|
800
803
|
completed_today: completedToday,
|
|
801
804
|
completed_this_week: completedThisWeek,
|
|
802
|
-
completed_this_month: completedThisMonth
|
|
805
|
+
completed_this_month: completedThisMonth,
|
|
806
|
+
custom_section_type_id: r.ach_public_meta.custom_section_type_id
|
|
803
807
|
};
|
|
804
808
|
return x;
|
|
805
809
|
});
|
|
@@ -1082,7 +1086,7 @@ const GetLevelMapResponseTransform = levels => {
|
|
|
1082
1086
|
description: l.level_public_meta.description,
|
|
1083
1087
|
image: l.level_public_meta.image_url,
|
|
1084
1088
|
required_points: l.required_points,
|
|
1085
|
-
visibility_points: parseInt(l.level_public_meta.visibility_points),
|
|
1089
|
+
visibility_points: l.level_public_meta.visibility_points ? parseInt(l.level_public_meta.visibility_points) : null,
|
|
1086
1090
|
required_level_counter_1: l.required_level_counter_1,
|
|
1087
1091
|
required_level_counter_2: l.required_level_counter_2,
|
|
1088
1092
|
custom_data: IntUtils.JsonOrText((_l$level_public_meta = l.level_public_meta) == null ? void 0 : _l$level_public_meta.custom_data)
|
|
@@ -1112,6 +1116,7 @@ var onUpdateContextKey;
|
|
|
1112
1116
|
onUpdateContextKey["StoreHistory"] = "storeHistory";
|
|
1113
1117
|
onUpdateContextKey["Jackpots"] = "jackpots";
|
|
1114
1118
|
onUpdateContextKey["Pots"] = "Pots";
|
|
1119
|
+
onUpdateContextKey["CustomSections"] = "customSections";
|
|
1115
1120
|
})(onUpdateContextKey || (onUpdateContextKey = {}));
|
|
1116
1121
|
/** @group General API */
|
|
1117
1122
|
class WSAPI {
|
|
@@ -1121,26 +1126,31 @@ class WSAPI {
|
|
|
1121
1126
|
this.onUpdateCallback = new Map();
|
|
1122
1127
|
this.jackpotGetSignature = '';
|
|
1123
1128
|
this.api = api;
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1129
|
+
OCache.clearAll();
|
|
1130
|
+
if (this.api.tracker) {
|
|
1131
|
+
const on = this.api.tracker.on;
|
|
1132
|
+
on(ClassId.SAW_SPINS_COUNT_PUSH, data => this.updateOnSpin(data));
|
|
1133
|
+
on(ClassId.SAW_SHOW_SPIN_PUSH, () => this.updateOnAddSpin());
|
|
1134
|
+
on(ClassId.SAW_DO_SPIN_RESPONSE, data => on(ClassId.SAW_AKNOWLEDGE_RESPONSE, () => this.updateOnPrizeWin(data)));
|
|
1135
|
+
on(ClassId.MISSION_OPTIN_RESPONSE, () => this.updateMissionsOnOptIn());
|
|
1136
|
+
on(ClassId.TOURNAMENT_REGISTER_RESPONSE, () => this.updateTournamentsOnRegistration());
|
|
1137
|
+
on(ClassId.CLIENT_ENGAGEMENT_EVENT_NEW, () => this.updateInboxMessages());
|
|
1138
|
+
on(ClassId.LOGOUT_RESPONSE, () => OCache.clearContext(ECacheContext.WSAPI));
|
|
1139
|
+
on(ClassId.IDENTIFY_RESPONSE, () => OCache.clearContext(ECacheContext.WSAPI));
|
|
1140
|
+
on(ClassId.JP_WIN_PUSH, data => this.jackpotClearCache());
|
|
1141
|
+
on(ClassId.JP_OPTOUT_RESPONSE, data => this.jackpotClearCache());
|
|
1142
|
+
on(ClassId.JP_OPTIN_RESPONSE, data => this.jackpotClearCache());
|
|
1143
|
+
}
|
|
1136
1144
|
}
|
|
1137
1145
|
/** Returns information about current user
|
|
1138
|
-
*
|
|
1146
|
+
*
|
|
1147
|
+
* **Example**:
|
|
1139
1148
|
* ```
|
|
1140
1149
|
* _smartico.api.getUserProfile().then((result) => {
|
|
1141
1150
|
* console.log(result);
|
|
1142
1151
|
* });
|
|
1143
1152
|
* ```
|
|
1153
|
+
* **Visitor mode: not supported**
|
|
1144
1154
|
* */
|
|
1145
1155
|
getUserProfile() {
|
|
1146
1156
|
if (this.api.tracker) {
|
|
@@ -1152,12 +1162,14 @@ class WSAPI {
|
|
|
1152
1162
|
}
|
|
1153
1163
|
}
|
|
1154
1164
|
/** Check if user belongs to specific segments
|
|
1155
|
-
* Example
|
|
1165
|
+
* **Example**:
|
|
1156
1166
|
* ```
|
|
1157
1167
|
* _smartico.api.checkSegmentMatch(1).then((result) => {
|
|
1158
1168
|
* console.log(result);
|
|
1159
1169
|
* });
|
|
1160
1170
|
* ```
|
|
1171
|
+
*
|
|
1172
|
+
* **Visitor mode: not supported**
|
|
1161
1173
|
*/
|
|
1162
1174
|
async checkSegmentMatch(segment_id) {
|
|
1163
1175
|
const r = await this.api.coreCheckSegments(null, [segment_id]);
|
|
@@ -1168,21 +1180,29 @@ class WSAPI {
|
|
|
1168
1180
|
}
|
|
1169
1181
|
}
|
|
1170
1182
|
/** Check if user belongs to specific list of segments
|
|
1171
|
-
* Example
|
|
1183
|
+
* **Example**:
|
|
1172
1184
|
* ```
|
|
1173
1185
|
* _smartico.api.checkSegmentListMatch([1, 2, 3]).then((result) => {
|
|
1174
1186
|
* console.log(result);
|
|
1175
1187
|
* });
|
|
1176
1188
|
* ```
|
|
1189
|
+
* **Visitor mode: not supported**
|
|
1177
1190
|
*/
|
|
1178
1191
|
async checkSegmentListMatch(segment_ids) {
|
|
1179
1192
|
return await this.api.coreCheckSegments(null, Array.isArray(segment_ids) ? segment_ids : [segment_ids]);
|
|
1180
1193
|
}
|
|
1181
1194
|
/** Returns all the levels available the current user
|
|
1182
|
-
* Example
|
|
1195
|
+
* **Example**:
|
|
1183
1196
|
* ```
|
|
1184
1197
|
* _smartico.api.getLevels().then((result) => {
|
|
1185
|
-
*
|
|
1198
|
+
* console.log(result);
|
|
1199
|
+
* });
|
|
1200
|
+
* ```
|
|
1201
|
+
*
|
|
1202
|
+
* **Example in the Visitor mode**:
|
|
1203
|
+
* ```
|
|
1204
|
+
* _smartico.vapi('EN').getLevels().then((result) => {
|
|
1205
|
+
* console.log(result);
|
|
1186
1206
|
* });
|
|
1187
1207
|
* ```
|
|
1188
1208
|
*/
|
|
@@ -1193,14 +1213,20 @@ class WSAPI {
|
|
|
1193
1213
|
* The returned missions are cached for 30 seconds. But you can pass the onUpdate callback as a parameter.
|
|
1194
1214
|
* Note that each time you call getMissions with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
1195
1215
|
* The onUpdate callback will be called on mission OptIn and the updated missions will be passed to it.
|
|
1196
|
-
*
|
|
1216
|
+
*
|
|
1217
|
+
* **Example**:
|
|
1197
1218
|
* ```
|
|
1198
1219
|
* _smartico.api.getMissions().then((result) => {
|
|
1199
|
-
*
|
|
1220
|
+
* console.log(result);
|
|
1221
|
+
* });
|
|
1222
|
+
* ```
|
|
1223
|
+
*
|
|
1224
|
+
* **Example in the Visitor mode**:
|
|
1225
|
+
* ```
|
|
1226
|
+
* _smartico.vapi('EN').getMissions().then((result) => {
|
|
1227
|
+
* console.log(result);
|
|
1200
1228
|
* });
|
|
1201
1229
|
* ```
|
|
1202
|
-
/**
|
|
1203
|
-
* @param params
|
|
1204
1230
|
*/
|
|
1205
1231
|
async getMissions({
|
|
1206
1232
|
onUpdate
|
|
@@ -1210,7 +1236,11 @@ class WSAPI {
|
|
|
1210
1236
|
}
|
|
1211
1237
|
return OCache.use(onUpdateContextKey.Missions, ECacheContext.WSAPI, () => this.api.missionsGetItemsT(null), CACHE_DATA_SEC);
|
|
1212
1238
|
}
|
|
1213
|
-
/**
|
|
1239
|
+
/**
|
|
1240
|
+
* Returns all the badges available the current user
|
|
1241
|
+
*
|
|
1242
|
+
* **Visitor mode: not supported**
|
|
1243
|
+
*/
|
|
1214
1244
|
async getBadges() {
|
|
1215
1245
|
return OCache.use(onUpdateContextKey.Badges, ECacheContext.WSAPI, () => this.api.badgetsGetItemsT(null), CACHE_DATA_SEC);
|
|
1216
1246
|
}
|
|
@@ -1218,32 +1248,49 @@ class WSAPI {
|
|
|
1218
1248
|
* Returns the extra counters for the current user level.
|
|
1219
1249
|
* These are counters that are configured for each Smartico client separatly by request.
|
|
1220
1250
|
* For example 1st counter could be total wagering amount, 2nd counter could be total deposit amount, etc.
|
|
1221
|
-
*
|
|
1251
|
+
*
|
|
1252
|
+
* **Example**:
|
|
1222
1253
|
* ```
|
|
1223
1254
|
* _smartico.api.getUserLevelExtraCounters().then((result) => {
|
|
1224
1255
|
* console.log(result);
|
|
1225
1256
|
* });
|
|
1226
1257
|
* ```
|
|
1258
|
+
*
|
|
1259
|
+
* **Visitor mode: not supported**
|
|
1227
1260
|
*/
|
|
1228
1261
|
async getUserLevelExtraCounters() {
|
|
1229
1262
|
return OCache.use(onUpdateContextKey.LevelExtraCounters, ECacheContext.WSAPI, () => this.api.getUserGamificationInfoT(null), CACHE_DATA_SEC);
|
|
1230
1263
|
}
|
|
1231
|
-
/**
|
|
1232
|
-
*
|
|
1264
|
+
/**
|
|
1265
|
+
*
|
|
1266
|
+
* Returns all the store items available the current user
|
|
1267
|
+
*
|
|
1268
|
+
* **Example**:
|
|
1233
1269
|
* ```
|
|
1234
1270
|
* _smartico.api.getStoreItems().then((result) => {
|
|
1235
1271
|
* console.log(result);
|
|
1236
1272
|
* });
|
|
1273
|
+
* ```
|
|
1274
|
+
*
|
|
1275
|
+
* **Example in the Visitor mode**:
|
|
1276
|
+
* ```
|
|
1277
|
+
* _smartico.vapi('EN').getStoreItems().then((result) => {
|
|
1278
|
+
* console.log(result);
|
|
1279
|
+
* });
|
|
1280
|
+
* ```
|
|
1237
1281
|
*/
|
|
1238
1282
|
async getStoreItems() {
|
|
1239
1283
|
return OCache.use(onUpdateContextKey.StoreItems, ECacheContext.WSAPI, () => this.api.storeGetItemsT(null), CACHE_DATA_SEC);
|
|
1240
1284
|
}
|
|
1241
1285
|
/** Buy the specific shop item by item_id. Returns the err_code in case of success or error.
|
|
1242
|
-
* Example
|
|
1286
|
+
* **Example**:
|
|
1243
1287
|
* ```
|
|
1244
1288
|
* _smartico.api.buyStoreItem(1).then((result) => {
|
|
1245
1289
|
* console.log(result);
|
|
1246
1290
|
* });
|
|
1291
|
+
* ```
|
|
1292
|
+
*
|
|
1293
|
+
* **Visitor mode: not supported**
|
|
1247
1294
|
*/
|
|
1248
1295
|
async buyStoreItem(item_id) {
|
|
1249
1296
|
const r = await this.api.buyStoreItem(null, item_id);
|
|
@@ -1253,19 +1300,40 @@ class WSAPI {
|
|
|
1253
1300
|
};
|
|
1254
1301
|
return o;
|
|
1255
1302
|
}
|
|
1256
|
-
/**
|
|
1303
|
+
/**
|
|
1304
|
+
*
|
|
1305
|
+
* Returns store categories
|
|
1306
|
+
*
|
|
1307
|
+
* **Example**:
|
|
1308
|
+
* ```
|
|
1309
|
+
* _smartico.api.getStoreCategories().then((result) => {
|
|
1310
|
+
* console.log(result);
|
|
1311
|
+
* });
|
|
1312
|
+
* ```
|
|
1313
|
+
*
|
|
1314
|
+
* **Example in the Visitor mode**:
|
|
1315
|
+
* ```
|
|
1316
|
+
* _smartico.vapi('EN').getStoreCategories().then((result) => {
|
|
1317
|
+
* console.log(result);
|
|
1318
|
+
* });
|
|
1319
|
+
* ```
|
|
1320
|
+
*/
|
|
1257
1321
|
async getStoreCategories() {
|
|
1258
1322
|
return OCache.use(onUpdateContextKey.StoreCategories, ECacheContext.WSAPI, () => this.api.storeGetCategoriesT(null), CACHE_DATA_SEC);
|
|
1259
1323
|
}
|
|
1260
|
-
/**
|
|
1324
|
+
/**
|
|
1325
|
+
* Returns purchased items based on the provided parameters. "Limit" and "offset" indicate the range of items to be fetched.
|
|
1261
1326
|
* The maximum number of items per request is limited to 20.
|
|
1262
1327
|
* You can leave this params empty and by default it will return list of purchased items ranging from 0 to 20.
|
|
1263
|
-
*
|
|
1328
|
+
*
|
|
1329
|
+
* **Example**:
|
|
1264
1330
|
* ```
|
|
1265
1331
|
* _smartico.api.getStorePurchasedItems().then((result) => {
|
|
1266
1332
|
* console.log(result);
|
|
1267
1333
|
* });
|
|
1268
1334
|
* ```
|
|
1335
|
+
*
|
|
1336
|
+
* **Visitor mode: not supported**
|
|
1269
1337
|
*/
|
|
1270
1338
|
async getStorePurchasedItems({
|
|
1271
1339
|
limit,
|
|
@@ -1277,16 +1345,67 @@ class WSAPI {
|
|
|
1277
1345
|
}
|
|
1278
1346
|
return OCache.use(onUpdateContextKey.StoreHistory, ECacheContext.WSAPI, () => this.api.storeGetPurchasedItemsT(null, limit, offset), CACHE_DATA_SEC);
|
|
1279
1347
|
}
|
|
1280
|
-
/**
|
|
1348
|
+
/**
|
|
1349
|
+
* Returns missions & badges categories
|
|
1350
|
+
*
|
|
1351
|
+
* **Example**:
|
|
1352
|
+
* ```
|
|
1353
|
+
* _smartico.api.getAchCategories().then((result) => {
|
|
1354
|
+
* console.log(result);
|
|
1355
|
+
* });
|
|
1356
|
+
* ```
|
|
1357
|
+
*
|
|
1358
|
+
* **Example in the Visitor mode**:
|
|
1359
|
+
* ```
|
|
1360
|
+
* _smartico.vapi('EN').getAchCategories().then((result) => {
|
|
1361
|
+
* console.log(result);
|
|
1362
|
+
* });
|
|
1363
|
+
* ```
|
|
1364
|
+
*
|
|
1365
|
+
* */
|
|
1281
1366
|
async getAchCategories() {
|
|
1282
1367
|
return OCache.use(onUpdateContextKey.AchCategories, ECacheContext.WSAPI, () => this.api.achGetCategoriesT(null), CACHE_DATA_SEC);
|
|
1283
1368
|
}
|
|
1284
|
-
/** Returns the list of mini-games available for user
|
|
1285
|
-
* The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getMiniGames with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
1286
|
-
* The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or wined prize is spin/jackpot and if max count of the available user spin equal one, also if the spins were issued to the user manually in the BO. Updated templates will be passed to onUpdate callback. */
|
|
1287
1369
|
/**
|
|
1370
|
+
* Returns list of custom sections
|
|
1371
|
+
*
|
|
1372
|
+
* **Example**:
|
|
1373
|
+
* ```
|
|
1374
|
+
* _smartico.api.getCustomSections().then((result) => {
|
|
1375
|
+
* console.log(result);
|
|
1376
|
+
* });
|
|
1377
|
+
* ```
|
|
1378
|
+
*
|
|
1379
|
+
* **Example in the Visitor mode**:
|
|
1380
|
+
* ```
|
|
1381
|
+
* _smartico.vapi('EN').getCustomSections().then((result) => {
|
|
1382
|
+
* console.log(result);
|
|
1383
|
+
* });
|
|
1384
|
+
* ```
|
|
1385
|
+
*
|
|
1386
|
+
* */
|
|
1387
|
+
async getCustomSections() {
|
|
1388
|
+
return OCache.use(onUpdateContextKey.CustomSections, ECacheContext.WSAPI, () => this.api.getCustomSectionsT(null), CACHE_DATA_SEC);
|
|
1389
|
+
}
|
|
1288
1390
|
/**
|
|
1289
|
-
*
|
|
1391
|
+
* Returns the list of mini-games available for user
|
|
1392
|
+
* The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getMiniGames with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
1393
|
+
* The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or wined prize is spin/jackpot and if max count of the available user spin equal one, also if the spins were issued to the user manually in the BO. Updated templates will be passed to onUpdate callback.
|
|
1394
|
+
*
|
|
1395
|
+
* **Example**:
|
|
1396
|
+
* ```
|
|
1397
|
+
* _smartico.api.getMiniGames().then((result) => {
|
|
1398
|
+
* console.log(result);
|
|
1399
|
+
* });
|
|
1400
|
+
* ```
|
|
1401
|
+
*
|
|
1402
|
+
* **Example in the Visitor mode**:
|
|
1403
|
+
* ```
|
|
1404
|
+
* _smartico.vapi('EN').getMiniGames().then((result) => {
|
|
1405
|
+
* console.log(result);
|
|
1406
|
+
* });
|
|
1407
|
+
* ```
|
|
1408
|
+
*
|
|
1290
1409
|
*/
|
|
1291
1410
|
async getMiniGames({
|
|
1292
1411
|
onUpdate
|
|
@@ -1296,7 +1415,11 @@ class WSAPI {
|
|
|
1296
1415
|
}
|
|
1297
1416
|
return OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, () => this.api.sawGetTemplatesT(null), CACHE_DATA_SEC);
|
|
1298
1417
|
}
|
|
1299
|
-
/**
|
|
1418
|
+
/**
|
|
1419
|
+
* Plays the specified by template_id mini-game on behalf of user and returns prize_id or err_code
|
|
1420
|
+
*
|
|
1421
|
+
* **Visitor mode: not supported**
|
|
1422
|
+
*/
|
|
1300
1423
|
async playMiniGame(template_id) {
|
|
1301
1424
|
const r = await this.api.sawSpinRequest(null, template_id);
|
|
1302
1425
|
this.api.doAcknowledgeRequest(null, r.request_id);
|
|
@@ -1307,7 +1430,11 @@ class WSAPI {
|
|
|
1307
1430
|
};
|
|
1308
1431
|
return o;
|
|
1309
1432
|
}
|
|
1310
|
-
/**
|
|
1433
|
+
/**
|
|
1434
|
+
* Requests an opt-in for the specified mission_id. Returns the err_code.
|
|
1435
|
+
*
|
|
1436
|
+
* **Visitor mode: not supported**
|
|
1437
|
+
*/
|
|
1311
1438
|
async requestMissionOptIn(mission_id) {
|
|
1312
1439
|
const r = await this.api.missionOptIn(null, mission_id);
|
|
1313
1440
|
const o = {
|
|
@@ -1316,7 +1443,11 @@ class WSAPI {
|
|
|
1316
1443
|
};
|
|
1317
1444
|
return o;
|
|
1318
1445
|
}
|
|
1319
|
-
/**
|
|
1446
|
+
/**
|
|
1447
|
+
* Request for claim reward for the specified mission id. Returns the err_code.
|
|
1448
|
+
*
|
|
1449
|
+
* **Visitor mode: not supported**
|
|
1450
|
+
*/
|
|
1320
1451
|
async requestMissionClaimReward(mission_id, ach_completed_id) {
|
|
1321
1452
|
const r = await this.api.missionClaimPrize(null, mission_id, ach_completed_id);
|
|
1322
1453
|
const o = {
|
|
@@ -1327,10 +1458,22 @@ class WSAPI {
|
|
|
1327
1458
|
}
|
|
1328
1459
|
/** Returns all the active instances of tournaments
|
|
1329
1460
|
* 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.
|
|
1330
|
-
* The onUpdate callback will be called when the user has registered in a tournament. Updated list will be passed to onUpdate callback
|
|
1331
|
-
|
|
1332
|
-
*
|
|
1333
|
-
|
|
1461
|
+
* The onUpdate callback will be called when the user has registered in a tournament. Updated list will be passed to onUpdate callback.
|
|
1462
|
+
*
|
|
1463
|
+
* **Example**:
|
|
1464
|
+
* ```
|
|
1465
|
+
* _smartico.api.getTournamentsList().then((result) => {
|
|
1466
|
+
* console.log(result);
|
|
1467
|
+
* });
|
|
1468
|
+
* ```
|
|
1469
|
+
*
|
|
1470
|
+
* **Example in the Visitor mode**:
|
|
1471
|
+
* ```
|
|
1472
|
+
* _smartico.vapi('EN').getTournamentsList().then((result) => {
|
|
1473
|
+
* console.log(result);
|
|
1474
|
+
* });
|
|
1475
|
+
* ```
|
|
1476
|
+
* */
|
|
1334
1477
|
async getTournamentsList({
|
|
1335
1478
|
onUpdate
|
|
1336
1479
|
} = {}) {
|
|
@@ -1339,11 +1482,39 @@ class WSAPI {
|
|
|
1339
1482
|
}
|
|
1340
1483
|
return OCache.use(onUpdateContextKey.TournamentList, ECacheContext.WSAPI, () => this.api.tournamentsGetLobbyT(null), CACHE_DATA_SEC);
|
|
1341
1484
|
}
|
|
1342
|
-
/**
|
|
1485
|
+
/**
|
|
1486
|
+
* Returns details information of specific tournament instance, the response will include tournament info and the leaderboard of players
|
|
1487
|
+
*
|
|
1488
|
+
* **Example**:
|
|
1489
|
+
* ```
|
|
1490
|
+
* _smartico.api.getTournamentsList().then((result) => {
|
|
1491
|
+
* if (result.length > 0) {
|
|
1492
|
+
* _smartico.api.getTournamentInstanceInfo(result[0].instance_id).then((result) => {
|
|
1493
|
+
* console.log(result);
|
|
1494
|
+
* });
|
|
1495
|
+
* }
|
|
1496
|
+
* });
|
|
1497
|
+
* ```
|
|
1498
|
+
*
|
|
1499
|
+
* **Example in the Visitor mode**:
|
|
1500
|
+
* ```
|
|
1501
|
+
* _smartico.vapi('EN').getTournamentsList().then((result) => {
|
|
1502
|
+
* if (result.length > 0) {
|
|
1503
|
+
* _smartico.vapi('EN').getTournamentInstanceInfo(result[0].instance_id).then((result) => {
|
|
1504
|
+
* console.log(result);
|
|
1505
|
+
* });
|
|
1506
|
+
* }
|
|
1507
|
+
* });
|
|
1508
|
+
* ```
|
|
1509
|
+
*/
|
|
1343
1510
|
async getTournamentInstanceInfo(tournamentInstanceId) {
|
|
1344
1511
|
return this.api.tournamentsGetInfoT(null, tournamentInstanceId);
|
|
1345
1512
|
}
|
|
1346
|
-
/**
|
|
1513
|
+
/**
|
|
1514
|
+
* Requests registration for the specified tournament instance. Returns the err_code.
|
|
1515
|
+
*
|
|
1516
|
+
* **Visitor mode: not supported**
|
|
1517
|
+
*/
|
|
1347
1518
|
async registerInTournament(tournamentInstanceId) {
|
|
1348
1519
|
const r = await this.api.registerInTournament(null, tournamentInstanceId);
|
|
1349
1520
|
const o = {
|
|
@@ -1352,8 +1523,23 @@ class WSAPI {
|
|
|
1352
1523
|
};
|
|
1353
1524
|
return o;
|
|
1354
1525
|
}
|
|
1355
|
-
/**
|
|
1356
|
-
|
|
1526
|
+
/**
|
|
1527
|
+
* Returns the leaderboard for the current type (default is Daily). If getPreviousPeriod is passed as true, a leaderboard for the previous period for the current type will be returned.
|
|
1528
|
+
* For example, if the type is Weekly and getPreviousPeriod is true, a leaderboard for the previous week will be returned.
|
|
1529
|
+
*
|
|
1530
|
+
* **Example**:
|
|
1531
|
+
* ```
|
|
1532
|
+
* _smartico.api.getLeaderBoard(1).then((result) => {
|
|
1533
|
+
* console.log(result);
|
|
1534
|
+
* });
|
|
1535
|
+
* ```
|
|
1536
|
+
*
|
|
1537
|
+
* **Example in the Visitor mode**:
|
|
1538
|
+
* ```
|
|
1539
|
+
* _smartico.vapi('EN').getLeaderBoard(1).then((result) => {
|
|
1540
|
+
* console.log(result);
|
|
1541
|
+
* });
|
|
1542
|
+
* ```
|
|
1357
1543
|
*/
|
|
1358
1544
|
async getLeaderBoard(periodType, getPreviousPeriod) {
|
|
1359
1545
|
return OCache.use(onUpdateContextKey.LeaderBoards, ECacheContext.WSAPI, () => this.api.leaderboardsGetT(null, periodType, getPreviousPeriod), CACHE_DATA_SEC);
|
|
@@ -1364,8 +1550,10 @@ class WSAPI {
|
|
|
1364
1550
|
* This functions return list of messages without the body of the message.
|
|
1365
1551
|
* To get the body of the message you need to call getInboxMessageBody function and pass the message guid contained in each message of this request.
|
|
1366
1552
|
* All other action like mark as read, favorite, delete, etc. can be done using this message GUID.
|
|
1367
|
-
* The "onUpdate" callback will be triggered when the user receives a new message. It will provide an updated list of messages, ranging from 0 to 20, to the onUpdate callback function.
|
|
1368
|
-
|
|
1553
|
+
* The "onUpdate" callback will be triggered when the user receives a new message. It will provide an updated list of messages, ranging from 0 to 20, to the onUpdate callback function.
|
|
1554
|
+
*
|
|
1555
|
+
* **Visitor mode: not supported**
|
|
1556
|
+
*
|
|
1369
1557
|
* @param params
|
|
1370
1558
|
*/
|
|
1371
1559
|
async getInboxMessages({
|
|
@@ -1379,11 +1567,19 @@ class WSAPI {
|
|
|
1379
1567
|
}
|
|
1380
1568
|
return await this.api.getInboxMessagesT(null, from, to, onlyFavorite);
|
|
1381
1569
|
}
|
|
1382
|
-
/**
|
|
1570
|
+
/**
|
|
1571
|
+
* Returns the message body of the specified message guid.
|
|
1572
|
+
*
|
|
1573
|
+
* **Visitor mode: not supported**
|
|
1574
|
+
*/
|
|
1383
1575
|
async getInboxMessageBody(messageGuid) {
|
|
1384
1576
|
return await this.api.getInboxMessageBodyT(messageGuid);
|
|
1385
1577
|
}
|
|
1386
|
-
/**
|
|
1578
|
+
/**
|
|
1579
|
+
* Requests to mark inbox message with specified guid as read
|
|
1580
|
+
*
|
|
1581
|
+
* **Visitor mode: not supported**
|
|
1582
|
+
*/
|
|
1387
1583
|
async markInboxMessageAsRead(messageGuid) {
|
|
1388
1584
|
const r = await this.api.markInboxMessageRead(null, messageGuid);
|
|
1389
1585
|
return {
|
|
@@ -1391,7 +1587,11 @@ class WSAPI {
|
|
|
1391
1587
|
err_message: r.errMsg
|
|
1392
1588
|
};
|
|
1393
1589
|
}
|
|
1394
|
-
/**
|
|
1590
|
+
/**
|
|
1591
|
+
* Requests to mark all inbox messages as rea
|
|
1592
|
+
*
|
|
1593
|
+
* **Visitor mode: not supported**
|
|
1594
|
+
*/
|
|
1395
1595
|
async markAllInboxMessagesAsRead() {
|
|
1396
1596
|
const r = await this.api.markAllInboxMessageRead(null);
|
|
1397
1597
|
return {
|
|
@@ -1399,7 +1599,11 @@ class WSAPI {
|
|
|
1399
1599
|
err_message: r.errMsg
|
|
1400
1600
|
};
|
|
1401
1601
|
}
|
|
1402
|
-
/**
|
|
1602
|
+
/**
|
|
1603
|
+
* Requests to mark inbox message with specified guid as favorite. Pass mark true to add message to favorite and false to remove.
|
|
1604
|
+
*
|
|
1605
|
+
* **Visitor mode: not supported**
|
|
1606
|
+
*/
|
|
1403
1607
|
async markUnmarkInboxMessageAsFavorite(messageGuid, mark) {
|
|
1404
1608
|
const r = await this.api.markUnmarkInboxMessageAsFavorite(null, messageGuid, mark);
|
|
1405
1609
|
return {
|
|
@@ -1407,7 +1611,11 @@ class WSAPI {
|
|
|
1407
1611
|
err_message: r.errMsg
|
|
1408
1612
|
};
|
|
1409
1613
|
}
|
|
1410
|
-
/**
|
|
1614
|
+
/**
|
|
1615
|
+
* Requests to delete inbox message
|
|
1616
|
+
*
|
|
1617
|
+
* **Visitor mode: not supported**
|
|
1618
|
+
*/
|
|
1411
1619
|
async deleteInboxMessage(messageGuid) {
|
|
1412
1620
|
const r = await this.api.deleteInboxMessage(null, messageGuid);
|
|
1413
1621
|
return {
|
|
@@ -1415,7 +1623,11 @@ class WSAPI {
|
|
|
1415
1623
|
err_message: r.errMsg
|
|
1416
1624
|
};
|
|
1417
1625
|
}
|
|
1418
|
-
/**
|
|
1626
|
+
/**
|
|
1627
|
+
* Requests to delete all inbox messages
|
|
1628
|
+
*
|
|
1629
|
+
* **Visitor mode: not supported**
|
|
1630
|
+
*/
|
|
1419
1631
|
async deleteAllInboxMessages() {
|
|
1420
1632
|
const r = await this.api.deleteAllInboxMessages(null);
|
|
1421
1633
|
return {
|
|
@@ -1423,7 +1635,9 @@ class WSAPI {
|
|
|
1423
1635
|
err_message: r.errMsg
|
|
1424
1636
|
};
|
|
1425
1637
|
}
|
|
1426
|
-
/**
|
|
1638
|
+
/**
|
|
1639
|
+
* Requests translations for the given language. Returns the object including translation key/translation value pairs. All possible translation keys defined in the back office.
|
|
1640
|
+
*/
|
|
1427
1641
|
async getTranslations(lang_code) {
|
|
1428
1642
|
const r = await this.api.getTranslationsT(null, lang_code, []);
|
|
1429
1643
|
return {
|
|
@@ -1479,12 +1693,20 @@ class WSAPI {
|
|
|
1479
1693
|
* If filter is not provided, all active jackpots will be returned.
|
|
1480
1694
|
* Filter can be used to get jackpots related to specific game or specific jackpot template.
|
|
1481
1695
|
* You can call this method every second in order to get up to date information about current value of the jackpot(s) and present them to the end-users
|
|
1482
|
-
*
|
|
1696
|
+
*
|
|
1697
|
+
* **Example**:
|
|
1483
1698
|
* ```
|
|
1484
1699
|
* _smartico.api.jackpotGet({ related_game_id: 'wooko-slot' }).then((result) => {
|
|
1485
1700
|
* console.log(result);
|
|
1486
1701
|
* });
|
|
1487
1702
|
* ```
|
|
1703
|
+
*
|
|
1704
|
+
* **Example in the Visitor mode**:
|
|
1705
|
+
* ```
|
|
1706
|
+
* _smartico.vapi('EN').jackpotGet({ related_game_id: 'wooko-slot' }).then((result) => {
|
|
1707
|
+
* console.log(result);
|
|
1708
|
+
* });
|
|
1709
|
+
* ```
|
|
1488
1710
|
*/
|
|
1489
1711
|
async jackpotGet(filter) {
|
|
1490
1712
|
var _this = this;
|
|
@@ -1497,16 +1719,16 @@ class WSAPI {
|
|
|
1497
1719
|
let pots = [];
|
|
1498
1720
|
jackpots = await OCache.use(onUpdateContextKey.Jackpots, ECacheContext.WSAPI, async function () {
|
|
1499
1721
|
const _jackpots = await _this.api.jackpotGet(null, filter);
|
|
1500
|
-
const _pots = _jackpots.map(jp => jp.pot);
|
|
1722
|
+
const _pots = _jackpots.items.map(jp => jp.pot);
|
|
1501
1723
|
OCache.set(onUpdateContextKey.Pots, _pots, ECacheContext.WSAPI, JACKPOT_POT_CACHE_SEC);
|
|
1502
|
-
return _jackpots;
|
|
1724
|
+
return _jackpots.items;
|
|
1503
1725
|
}, JACKPOT_TEMPLATE_CACHE_SEC);
|
|
1504
1726
|
if (jackpots.length > 0) {
|
|
1505
1727
|
pots = await OCache.use(onUpdateContextKey.Pots, ECacheContext.WSAPI, async function () {
|
|
1506
1728
|
const jp_template_ids = jackpots.map(jp => jp.jp_template_id);
|
|
1507
|
-
return _this.api.potGet(null, {
|
|
1729
|
+
return (await _this.api.potGet(null, {
|
|
1508
1730
|
jp_template_ids
|
|
1509
|
-
});
|
|
1731
|
+
})).items;
|
|
1510
1732
|
}, JACKPOT_POT_CACHE_SEC);
|
|
1511
1733
|
}
|
|
1512
1734
|
return jackpots.map(jp => {
|
|
@@ -1516,14 +1738,19 @@ class WSAPI {
|
|
|
1516
1738
|
return _jp;
|
|
1517
1739
|
});
|
|
1518
1740
|
}
|
|
1519
|
-
/**
|
|
1741
|
+
/**
|
|
1742
|
+
* Opt-in currently logged in user to the jackpot with the specified jp_template_id.
|
|
1520
1743
|
* You may call jackpotGet method after doing optin to see that user is opted in to the jackpot.
|
|
1521
|
-
*
|
|
1744
|
+
*
|
|
1745
|
+
* **Example**:
|
|
1522
1746
|
* ```
|
|
1523
1747
|
* _smartico.api.jackpotOptIn({ jp_template_id: 123 }).then((result) => {
|
|
1524
1748
|
* console.log('Opted in to the jackpot');
|
|
1525
1749
|
* });
|
|
1526
1750
|
* ```
|
|
1751
|
+
*
|
|
1752
|
+
* **Visitor mode: not supported**
|
|
1753
|
+
*
|
|
1527
1754
|
*/
|
|
1528
1755
|
async jackpotOptIn(filter) {
|
|
1529
1756
|
if (!filter.jp_template_id) {
|
|
@@ -1532,14 +1759,19 @@ class WSAPI {
|
|
|
1532
1759
|
const result = await this.api.jackpotOptIn(null, filter);
|
|
1533
1760
|
return result;
|
|
1534
1761
|
}
|
|
1535
|
-
/**
|
|
1762
|
+
/**
|
|
1763
|
+
* Opt-out currently logged in user from the jackpot with the specified jp_template_id.
|
|
1536
1764
|
* You may call jackpotGet method after doing optout to see that user is not opted in to the jackpot.
|
|
1537
|
-
*
|
|
1765
|
+
*
|
|
1766
|
+
* **Example**:
|
|
1538
1767
|
* ```
|
|
1539
1768
|
* _smartico.api.jackpotOptOut({ jp_template_id: 123 }).then((result) => {
|
|
1540
1769
|
* console.log('Opted out from the jackpot');
|
|
1541
1770
|
* });
|
|
1542
1771
|
* ```
|
|
1772
|
+
*
|
|
1773
|
+
* **Visitor mode: not supported**
|
|
1774
|
+
*
|
|
1543
1775
|
*/
|
|
1544
1776
|
async jackpotOptOut(filter) {
|
|
1545
1777
|
if (!filter.jp_template_id) {
|
|
@@ -1592,6 +1824,56 @@ const getLeaderBoardTransform = board => {
|
|
|
1592
1824
|
return null;
|
|
1593
1825
|
};
|
|
1594
1826
|
|
|
1827
|
+
var AchCustomSectionType;
|
|
1828
|
+
(function (AchCustomSectionType) {
|
|
1829
|
+
AchCustomSectionType[AchCustomSectionType["HTML_PAGE"] = 1] = "HTML_PAGE";
|
|
1830
|
+
AchCustomSectionType[AchCustomSectionType["MISSIONS_CATEGORY"] = 2] = "MISSIONS_CATEGORY";
|
|
1831
|
+
AchCustomSectionType[AchCustomSectionType["TOURNAMENTS_CATEGORY"] = 3] = "TOURNAMENTS_CATEGORY";
|
|
1832
|
+
AchCustomSectionType[AchCustomSectionType["LEVELS"] = 4] = "LEVELS";
|
|
1833
|
+
AchCustomSectionType[AchCustomSectionType["MINI_GAMES"] = 5] = "MINI_GAMES";
|
|
1834
|
+
AchCustomSectionType[AchCustomSectionType["MISSION_CUSTOM_LAYOUT"] = 6] = "MISSION_CUSTOM_LAYOUT";
|
|
1835
|
+
AchCustomSectionType[AchCustomSectionType["MATCH_X"] = 7] = "MATCH_X";
|
|
1836
|
+
})(AchCustomSectionType || (AchCustomSectionType = {}));
|
|
1837
|
+
var AchCustomLayoutTheme;
|
|
1838
|
+
(function (AchCustomLayoutTheme) {
|
|
1839
|
+
AchCustomLayoutTheme["VALENTINES_LIGHT"] = "valentines-light";
|
|
1840
|
+
AchCustomLayoutTheme["VALENTINES_DARK"] = "valentines-dark";
|
|
1841
|
+
AchCustomLayoutTheme["EURO_2024"] = "euro-2024";
|
|
1842
|
+
AchCustomLayoutTheme["GENERIC"] = "generic";
|
|
1843
|
+
})(AchCustomLayoutTheme || (AchCustomLayoutTheme = {}));
|
|
1844
|
+
var AchMissionsTabsOptions;
|
|
1845
|
+
(function (AchMissionsTabsOptions) {
|
|
1846
|
+
AchMissionsTabsOptions[AchMissionsTabsOptions["ONLY_OVERVIEW"] = 1] = "ONLY_OVERVIEW";
|
|
1847
|
+
AchMissionsTabsOptions[AchMissionsTabsOptions["NO_OVERVIEW"] = 2] = "NO_OVERVIEW";
|
|
1848
|
+
AchMissionsTabsOptions[AchMissionsTabsOptions["ALL"] = 3] = "ALL";
|
|
1849
|
+
})(AchMissionsTabsOptions || (AchMissionsTabsOptions = {}));
|
|
1850
|
+
var AchOverviewMissionsFilter;
|
|
1851
|
+
(function (AchOverviewMissionsFilter) {
|
|
1852
|
+
AchOverviewMissionsFilter[AchOverviewMissionsFilter["ANY"] = 1] = "ANY";
|
|
1853
|
+
AchOverviewMissionsFilter[AchOverviewMissionsFilter["ALL_MISSIONS"] = 2] = "ALL_MISSIONS";
|
|
1854
|
+
AchOverviewMissionsFilter[AchOverviewMissionsFilter["ALL_EXCEPT_COMPLETED"] = 3] = "ALL_EXCEPT_COMPLETED";
|
|
1855
|
+
AchOverviewMissionsFilter[AchOverviewMissionsFilter["ALL_EXCEPT_LOCKED"] = 4] = "ALL_EXCEPT_LOCKED";
|
|
1856
|
+
AchOverviewMissionsFilter[AchOverviewMissionsFilter["ALL_EXCEPT_COMPLETED_AND_LOCKED"] = 5] = "ALL_EXCEPT_COMPLETED_AND_LOCKED";
|
|
1857
|
+
})(AchOverviewMissionsFilter || (AchOverviewMissionsFilter = {}));
|
|
1858
|
+
|
|
1859
|
+
const UICustomSectionTransform = items => {
|
|
1860
|
+
return items.filter(r => r.section_type_id !== undefined && r.section_type_id >= 1).map(r => {
|
|
1861
|
+
const x = {
|
|
1862
|
+
body: r.body,
|
|
1863
|
+
menu_img: r.menu_img,
|
|
1864
|
+
menu_name: r.menu_name,
|
|
1865
|
+
section_type_id: r.section_type_id,
|
|
1866
|
+
custom_skin_images: r.custom_skin_images,
|
|
1867
|
+
generic_custom_css: r.generic_custom_css,
|
|
1868
|
+
mission_tabs_options: r.mission_tabs_options,
|
|
1869
|
+
overview_missions_count: r.overview_missions_count,
|
|
1870
|
+
overview_missions_filter: r.overview_missions_filter,
|
|
1871
|
+
theme: r.theme
|
|
1872
|
+
};
|
|
1873
|
+
return x;
|
|
1874
|
+
});
|
|
1875
|
+
};
|
|
1876
|
+
|
|
1595
1877
|
const PUBLIC_API_URL = 'https://papi{ENV_ID}.smartico.ai/services/public';
|
|
1596
1878
|
const C_SOCKET_PROD = 'wss://api{ENV_ID}.smartico.ai/websocket/services';
|
|
1597
1879
|
const AVATAR_DOMAIN = 'https://img{ENV_ID}.smr.vc';
|
|
@@ -1648,10 +1930,13 @@ class SmarticoAPI {
|
|
|
1648
1930
|
static getAvatarUrl(label_api_key) {
|
|
1649
1931
|
return AVATAR_DOMAIN.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
|
|
1650
1932
|
}
|
|
1651
|
-
async send(message, expectCID) {
|
|
1933
|
+
async send(message, expectCID, force_language) {
|
|
1652
1934
|
if (this.logCIDs.includes(message.cid)) {
|
|
1653
1935
|
this.logger.info('REQ', message);
|
|
1654
1936
|
}
|
|
1937
|
+
if (force_language) {
|
|
1938
|
+
message.force_language = force_language;
|
|
1939
|
+
}
|
|
1655
1940
|
let result;
|
|
1656
1941
|
try {
|
|
1657
1942
|
const timeStart = new Date().getTime();
|
|
@@ -1791,15 +2076,13 @@ class SmarticoAPI {
|
|
|
1791
2076
|
const results = await this.send(message, ClassId.CHECK_SEGMENT_MATCH_RESPONSE);
|
|
1792
2077
|
return results.segments || [];
|
|
1793
2078
|
}
|
|
1794
|
-
async jackpotGet(user_ext_id, filter) {
|
|
2079
|
+
async jackpotGet(user_ext_id, filter, force_language) {
|
|
1795
2080
|
const message = this.buildMessage(user_ext_id, ClassId.JP_GET_JACKPOTS_REQUEST, filter);
|
|
1796
|
-
|
|
1797
|
-
return (response == null ? void 0 : response.items) || [];
|
|
2081
|
+
return await this.send(message, ClassId.JP_GET_JACKPOTS_RESPONSE, force_language);
|
|
1798
2082
|
}
|
|
1799
2083
|
async potGet(user_ext_id, filter) {
|
|
1800
2084
|
const message = this.buildMessage(user_ext_id, ClassId.JP_GET_LATEST_POTS_REQUEST, filter);
|
|
1801
|
-
|
|
1802
|
-
return (response == null ? void 0 : response.items) || [];
|
|
2085
|
+
return await this.send(message, ClassId.JP_GET_LATEST_POTS_RESPONSE);
|
|
1803
2086
|
}
|
|
1804
2087
|
async jackpotOptIn(user_ext_id, payload) {
|
|
1805
2088
|
const message = this.buildMessage(user_ext_id, ClassId.JP_OPTIN_REQUEST, payload);
|
|
@@ -1809,14 +2092,11 @@ class SmarticoAPI {
|
|
|
1809
2092
|
const message = this.buildMessage(user_ext_id, ClassId.JP_OPTOUT_REQUEST, payload);
|
|
1810
2093
|
return await this.send(message, ClassId.JP_OPTOUT_RESPONSE);
|
|
1811
2094
|
}
|
|
1812
|
-
async sawGetTemplates(user_ext_id,
|
|
1813
|
-
const message = this.buildMessage(user_ext_id, ClassId.SAW_GET_SPINS_REQUEST,
|
|
1814
|
-
force_language: lang,
|
|
1815
|
-
is_visitor_mode
|
|
1816
|
-
} : {
|
|
2095
|
+
async sawGetTemplates(user_ext_id, force_language, is_visitor_mode = false) {
|
|
2096
|
+
const message = this.buildMessage(user_ext_id, ClassId.SAW_GET_SPINS_REQUEST, {
|
|
1817
2097
|
is_visitor_mode
|
|
1818
2098
|
});
|
|
1819
|
-
const response = await this.send(message, ClassId.SAW_GET_SPINS_RESPONSE);
|
|
2099
|
+
const response = await this.send(message, ClassId.SAW_GET_SPINS_RESPONSE, force_language);
|
|
1820
2100
|
if (response && response.templates) {
|
|
1821
2101
|
response.templates.forEach(t => {
|
|
1822
2102
|
if (t.jackpot_current !== undefined && t.jackpot_current !== null) {
|
|
@@ -1919,16 +2199,16 @@ class SmarticoAPI {
|
|
|
1919
2199
|
});
|
|
1920
2200
|
return await this.send(message, ClassId.GET_INBOX_MESSAGES_RESPONSE);
|
|
1921
2201
|
}
|
|
1922
|
-
async storeGetItems(user_ext_id) {
|
|
2202
|
+
async storeGetItems(user_ext_id, force_language) {
|
|
1923
2203
|
const message = this.buildMessage(user_ext_id, ClassId.GET_SHOP_ITEMS_REQUEST);
|
|
1924
|
-
return await this.send(message, ClassId.GET_SHOP_ITEMS_RESPONSE);
|
|
2204
|
+
return await this.send(message, ClassId.GET_SHOP_ITEMS_RESPONSE, force_language);
|
|
1925
2205
|
}
|
|
1926
2206
|
async storeGetItemsT(user_ext_id) {
|
|
1927
2207
|
return StoreItemTransform((await this.storeGetItems(user_ext_id)).items);
|
|
1928
2208
|
}
|
|
1929
|
-
async storeGetCategories(user_ext_id) {
|
|
2209
|
+
async storeGetCategories(user_ext_id, force_language) {
|
|
1930
2210
|
const message = this.buildMessage(user_ext_id, ClassId.GET_SHOP_CATEGORIES_REQUEST);
|
|
1931
|
-
return await this.send(message, ClassId.GET_SHOP_CATEGORIES_RESPONSE);
|
|
2211
|
+
return await this.send(message, ClassId.GET_SHOP_CATEGORIES_RESPONSE, force_language);
|
|
1932
2212
|
}
|
|
1933
2213
|
async storeGetCategoriesT(user_ext_id) {
|
|
1934
2214
|
return StoreCategoryTransform((await this.storeGetCategories(user_ext_id)).categories);
|
|
@@ -1943,9 +2223,9 @@ class SmarticoAPI {
|
|
|
1943
2223
|
async storeGetPurchasedItemsT(user_ext_id, limit, offset) {
|
|
1944
2224
|
return StoreItemPurchasedTransform((await this.storeGetPurchasedItems(user_ext_id, limit, offset)).items);
|
|
1945
2225
|
}
|
|
1946
|
-
async missionsGetItems(user_ext_id) {
|
|
2226
|
+
async missionsGetItems(user_ext_id, force_language) {
|
|
1947
2227
|
const message = this.buildMessage(user_ext_id, ClassId.GET_ACHIEVEMENT_MAP_REQUEST);
|
|
1948
|
-
const response = await this.send(message, ClassId.GET_ACHIEVEMENT_MAP_RESPONSE);
|
|
2228
|
+
const response = await this.send(message, ClassId.GET_ACHIEVEMENT_MAP_RESPONSE, force_language);
|
|
1949
2229
|
// we need to clone response to avoid changing original object,for cases when its called together with badgesGetItems (e.g. in Promise.all)
|
|
1950
2230
|
const responseClone = _extends({}, response);
|
|
1951
2231
|
if (responseClone.achievements) {
|
|
@@ -1967,16 +2247,16 @@ class SmarticoAPI {
|
|
|
1967
2247
|
level_counter_2: response.level_counter_2
|
|
1968
2248
|
};
|
|
1969
2249
|
}
|
|
1970
|
-
async achGetCategories(user_ext_id) {
|
|
2250
|
+
async achGetCategories(user_ext_id, force_language) {
|
|
1971
2251
|
const message = this.buildMessage(user_ext_id, ClassId.GET_ACH_CATEGORIES_REQUEST);
|
|
1972
|
-
return await this.send(message, ClassId.GET_ACH_CATEGORIES_RESPONSE);
|
|
2252
|
+
return await this.send(message, ClassId.GET_ACH_CATEGORIES_RESPONSE, force_language);
|
|
1973
2253
|
}
|
|
1974
2254
|
async achGetCategoriesT(user_ext_id) {
|
|
1975
2255
|
return AchCategoryTransform((await this.achGetCategories(user_ext_id)).categories);
|
|
1976
2256
|
}
|
|
1977
|
-
async badgetsGetItems(user_ext_id) {
|
|
2257
|
+
async badgetsGetItems(user_ext_id, force_language) {
|
|
1978
2258
|
const message = this.buildMessage(user_ext_id, ClassId.GET_ACHIEVEMENT_MAP_REQUEST);
|
|
1979
|
-
const response = await this.send(message, ClassId.GET_ACHIEVEMENT_MAP_RESPONSE);
|
|
2259
|
+
const response = await this.send(message, ClassId.GET_ACHIEVEMENT_MAP_RESPONSE, force_language);
|
|
1980
2260
|
// we need to clone response to avoid changing original object,for cases when its called together with missionsGetItems (e.g. in Promise.all)
|
|
1981
2261
|
const responseClone = _extends({}, response);
|
|
1982
2262
|
if (responseClone.achievements) {
|
|
@@ -1987,19 +2267,19 @@ class SmarticoAPI {
|
|
|
1987
2267
|
async badgetsGetItemsT(user_ext_id) {
|
|
1988
2268
|
return UserAchievementTransform((await this.badgetsGetItems(user_ext_id)).achievements);
|
|
1989
2269
|
}
|
|
1990
|
-
async tournamentsGetLobby(user_ext_id) {
|
|
2270
|
+
async tournamentsGetLobby(user_ext_id, force_language) {
|
|
1991
2271
|
const message = this.buildMessage(user_ext_id, ClassId.GET_TOURNAMENT_LOBBY_REQUEST);
|
|
1992
|
-
return await this.send(message, ClassId.GET_TOURNAMENT_LOBBY_RESPONSE);
|
|
2272
|
+
return await this.send(message, ClassId.GET_TOURNAMENT_LOBBY_RESPONSE, force_language);
|
|
1993
2273
|
}
|
|
1994
2274
|
async tournamentsGetLobbyT(user_ext_id) {
|
|
1995
2275
|
return TournamentItemsTransform((await this.tournamentsGetLobby(user_ext_id)).tournaments);
|
|
1996
2276
|
}
|
|
1997
|
-
async tournamentsGetInfo(user_ext_id, tournamentInstanceId) {
|
|
2277
|
+
async tournamentsGetInfo(user_ext_id, tournamentInstanceId, force_language) {
|
|
1998
2278
|
var _response$userPositio, _response$tournamentI;
|
|
1999
2279
|
const message = this.buildMessage(user_ext_id, ClassId.GET_TOURNAMENT_INFO_REQUEST, {
|
|
2000
2280
|
tournamentInstanceId
|
|
2001
2281
|
});
|
|
2002
|
-
const response = await this.send(message, ClassId.GET_TOURNAMENT_INFO_RESPONSE);
|
|
2282
|
+
const response = await this.send(message, ClassId.GET_TOURNAMENT_INFO_RESPONSE, force_language);
|
|
2003
2283
|
if ((_response$userPositio = response.userPosition) != null && _response$userPositio.avatar_id) {
|
|
2004
2284
|
response.userPosition.avatar_url = CoreUtils.avatarUrl(response.userPosition.avatar_id, this.avatarDomain);
|
|
2005
2285
|
}
|
|
@@ -2017,14 +2297,14 @@ class SmarticoAPI {
|
|
|
2017
2297
|
const response = await this.tournamentsGetInfo(user_ext_id, tournamentInstanceId);
|
|
2018
2298
|
return tournamentInfoItemTransform(response);
|
|
2019
2299
|
}
|
|
2020
|
-
async leaderboardGet(user_ext_id, period_type_id, prevPeriod = false) {
|
|
2300
|
+
async leaderboardGet(user_ext_id, period_type_id, prevPeriod = false, force_language) {
|
|
2021
2301
|
var _response$map$boardKe, _response$map$boardKe2, _response$map$boardKe3, _response$map$boardKe4;
|
|
2022
2302
|
const message = this.buildMessage(user_ext_id, ClassId.GET_LEADERS_BOARD_REQUEST, {
|
|
2023
2303
|
period_type_id,
|
|
2024
2304
|
snapshot_offset: prevPeriod ? 1 : 0,
|
|
2025
2305
|
include_users: true
|
|
2026
2306
|
});
|
|
2027
|
-
const response = await this.send(message, ClassId.GET_LEADERS_BOARD_RESPONSE);
|
|
2307
|
+
const response = await this.send(message, ClassId.GET_LEADERS_BOARD_RESPONSE, force_language);
|
|
2028
2308
|
const boardKey = Object.keys(response.map).find(k => period_type_id === undefined || k === (period_type_id == null ? void 0 : period_type_id.toString()));
|
|
2029
2309
|
if (boardKey === undefined) {
|
|
2030
2310
|
return undefined;
|
|
@@ -2042,13 +2322,20 @@ class SmarticoAPI {
|
|
|
2042
2322
|
async leaderboardsGetT(user_ext_id, period_type_id = LeaderBoardPeriodType.DAILY, prevPeriod = false) {
|
|
2043
2323
|
return getLeaderBoardTransform(await this.leaderboardGet(user_ext_id, period_type_id, prevPeriod));
|
|
2044
2324
|
}
|
|
2045
|
-
async levelsGet(user_ext_id) {
|
|
2325
|
+
async levelsGet(user_ext_id, force_language) {
|
|
2046
2326
|
const message = this.buildMessage(user_ext_id, ClassId.GET_LEVEL_MAP_REQUEST);
|
|
2047
|
-
return await this.send(message, ClassId.GET_LEVEL_MAP_RESPONSE);
|
|
2327
|
+
return await this.send(message, ClassId.GET_LEVEL_MAP_RESPONSE, force_language);
|
|
2048
2328
|
}
|
|
2049
2329
|
async levelsGetT(user_ext_id) {
|
|
2050
2330
|
return GetLevelMapResponseTransform(await this.levelsGet(user_ext_id));
|
|
2051
2331
|
}
|
|
2332
|
+
async getCustomSections(user_ext_id) {
|
|
2333
|
+
const message = this.buildMessage(user_ext_id, ClassId.GET_CUSTOM_SECTIONS_REQUEST);
|
|
2334
|
+
return await this.send(message, ClassId.GET_CUSTOM_SECTIONS_RESPONSE);
|
|
2335
|
+
}
|
|
2336
|
+
async getCustomSectionsT(user_ext_id) {
|
|
2337
|
+
return UICustomSectionTransform(Object.values((await this.getCustomSections(user_ext_id)).customSections));
|
|
2338
|
+
}
|
|
2052
2339
|
async getTranslationsT(user_ext_id, lang_code, areas, cacheSec = 60) {
|
|
2053
2340
|
return await this.coreGetTranslations(user_ext_id, lang_code, areas, 30);
|
|
2054
2341
|
}
|