@smartico/public-api 0.0.74 → 0.0.76
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/dist/Core/ActivityTypeLimited.d.ts +12 -1
- package/dist/MiniGames/SAWTemplateUI.d.ts +1 -0
- package/dist/WSAPI/WSAPITypes.d.ts +15 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +35 -0
- package/dist/index.modern.mjs.map +1 -1
- package/docs/interfaces/TTournamentDetailed.md +6 -0
- package/package.json +1 -1
- package/src/Core/ActivityTypeLimited.ts +12 -1
- package/src/MiniGames/SAWTemplateUI.ts +1 -0
- package/src/SmarticoAPI.ts +10 -0
- package/src/Tournaments/GetTournamentInfoResponse.ts +15 -0
- package/src/WSAPI/WSAPITypes.ts +16 -0
package/dist/index.modern.mjs
CHANGED
|
@@ -400,9 +400,20 @@ var ActivityTypeLimited;
|
|
|
400
400
|
(function (ActivityTypeLimited) {
|
|
401
401
|
ActivityTypeLimited[ActivityTypeLimited["DoNothing"] = 8] = "DoNothing";
|
|
402
402
|
ActivityTypeLimited[ActivityTypeLimited["Points"] = 12] = "Points";
|
|
403
|
+
ActivityTypeLimited[ActivityTypeLimited["GiveMission"] = 14] = "GiveMission";
|
|
404
|
+
ActivityTypeLimited[ActivityTypeLimited["StartAnotherCampaign"] = 15] = "StartAnotherCampaign";
|
|
405
|
+
ActivityTypeLimited[ActivityTypeLimited["MiniGameAttempt"] = 16] = "MiniGameAttempt";
|
|
406
|
+
ActivityTypeLimited[ActivityTypeLimited["DeductPoints"] = 21] = "DeductPoints";
|
|
407
|
+
ActivityTypeLimited[ActivityTypeLimited["ResetPoints"] = 22] = "ResetPoints";
|
|
403
408
|
ActivityTypeLimited[ActivityTypeLimited["Popup"] = 30] = "Popup";
|
|
404
409
|
ActivityTypeLimited[ActivityTypeLimited["Inbox"] = 31] = "Inbox";
|
|
410
|
+
ActivityTypeLimited[ActivityTypeLimited["Slack"] = 70] = "Slack";
|
|
411
|
+
ActivityTypeLimited[ActivityTypeLimited["Email_To_Customer_Support"] = 80] = "Email_To_Customer_Support";
|
|
412
|
+
ActivityTypeLimited[ActivityTypeLimited["Email_To_Risk_Operator"] = 90] = "Email_To_Risk_Operator";
|
|
405
413
|
ActivityTypeLimited[ActivityTypeLimited["Bonus"] = 100] = "Bonus";
|
|
414
|
+
ActivityTypeLimited[ActivityTypeLimited["WebHook"] = 200] = "WebHook";
|
|
415
|
+
ActivityTypeLimited[ActivityTypeLimited["TagCustomer"] = 504] = "TagCustomer";
|
|
416
|
+
ActivityTypeLimited[ActivityTypeLimited["UnTagCustomer"] = 505] = "UnTagCustomer";
|
|
406
417
|
})(ActivityTypeLimited || (ActivityTypeLimited = {}));
|
|
407
418
|
|
|
408
419
|
class CoreUtils {}
|
|
@@ -662,6 +673,16 @@ const TournamentItemsTransform = items => {
|
|
|
662
673
|
});
|
|
663
674
|
};
|
|
664
675
|
|
|
676
|
+
const tournamentPrizeTypeToPrizeName = type => {
|
|
677
|
+
return {
|
|
678
|
+
[ActivityTypeLimited.DoNothing]: 'TANGIBLE',
|
|
679
|
+
[ActivityTypeLimited.Points]: 'POINTS_ADD',
|
|
680
|
+
[ActivityTypeLimited.DeductPoints]: 'POINTS_DEDUCT',
|
|
681
|
+
[ActivityTypeLimited.ResetPoints]: 'POINTS_RESET',
|
|
682
|
+
[ActivityTypeLimited.MiniGameAttempt]: "MINI_GAME_ATTEMPT",
|
|
683
|
+
[ActivityTypeLimited.Bonus]: 'BONUS'
|
|
684
|
+
}[type];
|
|
685
|
+
};
|
|
665
686
|
const tournamentInfoItemTransform = t => {
|
|
666
687
|
const response = _extends({}, TournamentItemsTransform([t.tournamentInfo.tournamentLobbyInfo])[0], {
|
|
667
688
|
players: t.tournamentInfo.players.map(p => ({
|
|
@@ -672,6 +693,11 @@ const tournamentInfoItemTransform = t => {
|
|
|
672
693
|
is_me: p.isMe
|
|
673
694
|
}))
|
|
674
695
|
});
|
|
696
|
+
if (t.prizeStructure) {
|
|
697
|
+
response.prizes = t.prizeStructure.prizes.map(p => _extends({}, p, {
|
|
698
|
+
type: tournamentPrizeTypeToPrizeName(p.type)
|
|
699
|
+
}));
|
|
700
|
+
}
|
|
675
701
|
if (t.userPosition) {
|
|
676
702
|
response.me = {
|
|
677
703
|
public_username: t.userPosition.userAltName,
|
|
@@ -1158,6 +1184,9 @@ class SmarticoAPI {
|
|
|
1158
1184
|
return await this.send(message, ClassId.SAW_AKNOWLEDGE_RESPONSE);
|
|
1159
1185
|
}
|
|
1160
1186
|
async sawSpinRequest(user_ext_id, saw_template_id, round_id) {
|
|
1187
|
+
if (!saw_template_id) {
|
|
1188
|
+
throw new Error('Missing template id');
|
|
1189
|
+
}
|
|
1161
1190
|
const request_id = IntUtils.uuid();
|
|
1162
1191
|
const message = this.buildMessage(user_ext_id, ClassId.SAW_DO_SPIN_REQUEST, {
|
|
1163
1192
|
saw_template_id,
|
|
@@ -1183,6 +1212,9 @@ class SmarticoAPI {
|
|
|
1183
1212
|
});
|
|
1184
1213
|
}
|
|
1185
1214
|
async missionOptIn(user_ext_id, mission_id) {
|
|
1215
|
+
if (!mission_id) {
|
|
1216
|
+
throw new Error('Missing mission id');
|
|
1217
|
+
}
|
|
1186
1218
|
const message = this.buildMessage(user_ext_id, ClassId.MISSION_OPTIN_REQUEST, {
|
|
1187
1219
|
achievementId: mission_id
|
|
1188
1220
|
});
|
|
@@ -1256,6 +1288,9 @@ class SmarticoAPI {
|
|
|
1256
1288
|
return response;
|
|
1257
1289
|
}
|
|
1258
1290
|
async tournamentsGetInfoT(user_ext_id, tournamentInstanceId) {
|
|
1291
|
+
if (!tournamentInstanceId) {
|
|
1292
|
+
throw new Error('Missing tournament instance id');
|
|
1293
|
+
}
|
|
1259
1294
|
return tournamentInfoItemTransform(await this.tournamentsGetInfo(user_ext_id, tournamentInstanceId));
|
|
1260
1295
|
}
|
|
1261
1296
|
async leaderboardGet(user_ext_id, period_type_id, prevPeriod = false) {
|