@smartico/public-api 0.0.103 → 0.0.105
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 +2 -0
- package/dist/MiniGames/SAWTemplateUI.d.ts +0 -1
- package/dist/Tournaments/Tournament.d.ts +7 -0
- package/dist/Tournaments/TournamentUtils.d.ts +18 -0
- package/dist/WSAPI/WSAPITypes.d.ts +30 -3
- package/dist/index.js +82 -68
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +82 -68
- package/dist/index.modern.mjs.map +1 -1
- package/docs/interfaces/TMiniGameTemplate.md +1 -9
- package/docs/interfaces/TTournament.md +33 -0
- package/docs/interfaces/TTournamentDetailed.md +22 -0
- package/package.json +1 -1
- package/src/MiniGames/SAWGetTemplatesResponse.ts +0 -1
- package/src/MiniGames/SAWTemplateUI.ts +0 -1
- package/src/Tournaments/GetTournamentInfoResponse.ts +3 -28
- package/src/Tournaments/Tournament.ts +19 -4
- package/src/Tournaments/TournamentUtils.ts +42 -0
- package/src/WSAPI/WSAPITypes.ts +32 -4
package/dist/index.modern.mjs
CHANGED
|
@@ -264,7 +264,6 @@ const SAWTemplatesTransform = items => {
|
|
|
264
264
|
thumbnail: (_r$saw_skin_ui_defini = r.saw_skin_ui_definition) != null && _r$saw_skin_ui_defini.skin_folder ? ((_r$saw_skin_ui_defini2 = r.saw_skin_ui_definition) == null ? void 0 : _r$saw_skin_ui_defini2.skin_folder) + '/ico.png' : `https://libs.smartico.ai/gf/images/saw/${r.saw_skin_key}/ico.png`,
|
|
265
265
|
over_limit_message: r.saw_template_ui_definition.over_limit_message,
|
|
266
266
|
no_attempts_message: r.saw_template_ui_definition.no_attempts_message,
|
|
267
|
-
no_points_message: r.saw_template_ui_definition.no_points_message,
|
|
268
267
|
jackpot_symbol: r.saw_template_ui_definition.jackpot_symbol,
|
|
269
268
|
saw_game_type: SAWGameTypeNamed(r.saw_game_type_id),
|
|
270
269
|
saw_buyin_type: SAWBuyInTypeNamed(r.saw_buyin_type_id),
|
|
@@ -681,6 +680,7 @@ const TournamentItemsTransform = items => {
|
|
|
681
680
|
custom_data: IntUtils.JsonOrText(r.publicMeta.custom_data),
|
|
682
681
|
is_featured: r.publicMeta.featured,
|
|
683
682
|
ribbon: r.publicMeta.label_tag,
|
|
683
|
+
priority: r.publicMeta.position,
|
|
684
684
|
start_time: r.startTimeTs,
|
|
685
685
|
end_time: r.endTimeTs,
|
|
686
686
|
registration_count: r.registrationCount,
|
|
@@ -698,57 +698,16 @@ const TournamentItemsTransform = items => {
|
|
|
698
698
|
is_in_progress: TournamentUtils.isInProgress(r),
|
|
699
699
|
is_upcoming: TournamentUtils.isUpcoming(r)
|
|
700
700
|
};
|
|
701
|
+
if (r.prizeStructure) {
|
|
702
|
+
x.prizes = r.prizeStructure.prizes.map(p => TournamentUtils.getPrizeTransformed(p));
|
|
703
|
+
}
|
|
704
|
+
if (r.tournamentPlayer) {
|
|
705
|
+
x.me = TournamentUtils.getPlayerTransformed(r.tournamentPlayer, true);
|
|
706
|
+
}
|
|
701
707
|
return x;
|
|
702
708
|
});
|
|
703
709
|
};
|
|
704
710
|
|
|
705
|
-
const tournamentPrizeTypeToPrizeName = type => {
|
|
706
|
-
return {
|
|
707
|
-
[ActivityTypeLimited.DoNothing]: 'TANGIBLE',
|
|
708
|
-
[ActivityTypeLimited.Points]: 'POINTS_ADD',
|
|
709
|
-
[ActivityTypeLimited.DeductPoints]: 'POINTS_DEDUCT',
|
|
710
|
-
[ActivityTypeLimited.ResetPoints]: 'POINTS_RESET',
|
|
711
|
-
[ActivityTypeLimited.MiniGameAttempt]: "MINI_GAME_ATTEMPT",
|
|
712
|
-
[ActivityTypeLimited.Bonus]: 'BONUS'
|
|
713
|
-
}[type];
|
|
714
|
-
};
|
|
715
|
-
const tournamentInfoItemTransform = t => {
|
|
716
|
-
const response = _extends({}, TournamentItemsTransform([t.tournamentInfo.tournamentLobbyInfo])[0], {
|
|
717
|
-
related_games: (t.tournamentInfo.tournamentLobbyInfo.related_games || []).map(g => ({
|
|
718
|
-
ext_game_id: g.ext_game_id,
|
|
719
|
-
game_public_meta: {
|
|
720
|
-
name: g.game_public_meta.name,
|
|
721
|
-
link: g.game_public_meta.link,
|
|
722
|
-
image: g.game_public_meta.image,
|
|
723
|
-
enabled: g.game_public_meta.enabled,
|
|
724
|
-
game_categories: g.game_public_meta.game_categories,
|
|
725
|
-
game_provider: g.game_public_meta.game_provider
|
|
726
|
-
}
|
|
727
|
-
})),
|
|
728
|
-
players: t.tournamentInfo.players.map(p => ({
|
|
729
|
-
public_username: p.userAltName,
|
|
730
|
-
avatar_url: p.avatar_url,
|
|
731
|
-
position: p.position,
|
|
732
|
-
scores: p.scores,
|
|
733
|
-
is_me: p.isMe
|
|
734
|
-
}))
|
|
735
|
-
});
|
|
736
|
-
if (t.prizeStructure) {
|
|
737
|
-
response.prizes = t.prizeStructure.prizes.map(p => _extends({}, p, {
|
|
738
|
-
type: tournamentPrizeTypeToPrizeName(p.type)
|
|
739
|
-
}));
|
|
740
|
-
}
|
|
741
|
-
if (t.userPosition) {
|
|
742
|
-
response.me = {
|
|
743
|
-
public_username: t.userPosition.userAltName,
|
|
744
|
-
avatar_url: t.userPosition.avatar_url,
|
|
745
|
-
position: t.userPosition.position,
|
|
746
|
-
scores: t.userPosition.scores
|
|
747
|
-
};
|
|
748
|
-
}
|
|
749
|
-
return response;
|
|
750
|
-
};
|
|
751
|
-
|
|
752
711
|
var TournamentInstanceStatus;
|
|
753
712
|
(function (TournamentInstanceStatus) {
|
|
754
713
|
TournamentInstanceStatus[TournamentInstanceStatus["PUBLISHED"] = 1] = "PUBLISHED";
|
|
@@ -771,26 +730,16 @@ const TournamentInstanceStatusName = s => {
|
|
|
771
730
|
}[s];
|
|
772
731
|
};
|
|
773
732
|
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_MAX_REGISTRATIONS_REACHED"] = 30008] = "TOURNAMENT_MAX_REGISTRATIONS_REACHED";
|
|
785
|
-
})(TournamentRegistrationError || (TournamentRegistrationError = {}));
|
|
786
|
-
|
|
787
|
-
var TournamentType;
|
|
788
|
-
(function (TournamentType) {
|
|
789
|
-
TournamentType[TournamentType["SCHEDULED"] = 1] = "SCHEDULED";
|
|
790
|
-
TournamentType[TournamentType["SNG"] = 2] = "SNG";
|
|
791
|
-
TournamentType[TournamentType["TEST"] = 3] = "TEST";
|
|
792
|
-
})(TournamentType || (TournamentType = {}));
|
|
793
|
-
|
|
733
|
+
const tournamentPrizeTypeToPrizeName = type => {
|
|
734
|
+
return {
|
|
735
|
+
[ActivityTypeLimited.DoNothing]: 'TANGIBLE',
|
|
736
|
+
[ActivityTypeLimited.Points]: 'POINTS_ADD',
|
|
737
|
+
[ActivityTypeLimited.DeductPoints]: 'POINTS_DEDUCT',
|
|
738
|
+
[ActivityTypeLimited.ResetPoints]: 'POINTS_RESET',
|
|
739
|
+
[ActivityTypeLimited.MiniGameAttempt]: "MINI_GAME_ATTEMPT",
|
|
740
|
+
[ActivityTypeLimited.Bonus]: 'BONUS'
|
|
741
|
+
}[type];
|
|
742
|
+
};
|
|
794
743
|
class TournamentUtils {}
|
|
795
744
|
TournamentUtils.isCanRegister = tournament => {
|
|
796
745
|
if (tournament) {
|
|
@@ -831,6 +780,71 @@ TournamentUtils.isUpcoming = tournament => {
|
|
|
831
780
|
}
|
|
832
781
|
return false;
|
|
833
782
|
};
|
|
783
|
+
TournamentUtils.getPlayerTransformed = (player, isMe) => {
|
|
784
|
+
if (player) {
|
|
785
|
+
const playerTransformed = {
|
|
786
|
+
public_username: player.userAltName,
|
|
787
|
+
avatar_url: player.avatar_url,
|
|
788
|
+
position: player.position,
|
|
789
|
+
scores: player.scores,
|
|
790
|
+
is_me: player.isMe
|
|
791
|
+
};
|
|
792
|
+
if (isMe) {
|
|
793
|
+
delete playerTransformed.is_me;
|
|
794
|
+
}
|
|
795
|
+
return playerTransformed;
|
|
796
|
+
}
|
|
797
|
+
return null;
|
|
798
|
+
};
|
|
799
|
+
TournamentUtils.getPrizeTransformed = prize => {
|
|
800
|
+
if (prize) {
|
|
801
|
+
return _extends({}, prize, {
|
|
802
|
+
type: tournamentPrizeTypeToPrizeName(prize.type)
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
return null;
|
|
806
|
+
};
|
|
807
|
+
|
|
808
|
+
const tournamentInfoItemTransform = t => {
|
|
809
|
+
const response = _extends({}, TournamentItemsTransform([t.tournamentInfo.tournamentLobbyInfo])[0], {
|
|
810
|
+
related_games: (t.tournamentInfo.tournamentLobbyInfo.related_games || []).map(g => ({
|
|
811
|
+
ext_game_id: g.ext_game_id,
|
|
812
|
+
game_public_meta: {
|
|
813
|
+
name: g.game_public_meta.name,
|
|
814
|
+
link: g.game_public_meta.link,
|
|
815
|
+
image: g.game_public_meta.image,
|
|
816
|
+
enabled: g.game_public_meta.enabled,
|
|
817
|
+
game_categories: g.game_public_meta.game_categories,
|
|
818
|
+
game_provider: g.game_public_meta.game_provider
|
|
819
|
+
}
|
|
820
|
+
})),
|
|
821
|
+
players: t.tournamentInfo.players.map(p => TournamentUtils.getPlayerTransformed(p))
|
|
822
|
+
});
|
|
823
|
+
if (t.userPosition) {
|
|
824
|
+
response.me = TournamentUtils.getPlayerTransformed(t.userPosition, true);
|
|
825
|
+
}
|
|
826
|
+
return response;
|
|
827
|
+
};
|
|
828
|
+
|
|
829
|
+
var TournamentRegistrationError;
|
|
830
|
+
(function (TournamentRegistrationError) {
|
|
831
|
+
TournamentRegistrationError[TournamentRegistrationError["NO_ERROR"] = 0] = "NO_ERROR";
|
|
832
|
+
TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_INSTANCE_NOT_FOUND"] = 30001] = "TOURNAMENT_INSTANCE_NOT_FOUND";
|
|
833
|
+
TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_REGISTRATION_NOT_ENOUGH_POINTS"] = 30002] = "TOURNAMENT_REGISTRATION_NOT_ENOUGH_POINTS";
|
|
834
|
+
TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_INSTANCE_NOT_IN_STATE"] = 30003] = "TOURNAMENT_INSTANCE_NOT_IN_STATE";
|
|
835
|
+
TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_ALREADY_REGISTERED"] = 30004] = "TOURNAMENT_ALREADY_REGISTERED";
|
|
836
|
+
TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_USER_DONT_MATCH_CONDITIONS"] = 30005] = "TOURNAMENT_USER_DONT_MATCH_CONDITIONS";
|
|
837
|
+
TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_USER_NOT_REGISTERED"] = 30006] = "TOURNAMENT_USER_NOT_REGISTERED";
|
|
838
|
+
TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_CANT_CHANGE_REGISTRATION_STATUS"] = 30007] = "TOURNAMENT_CANT_CHANGE_REGISTRATION_STATUS";
|
|
839
|
+
TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_MAX_REGISTRATIONS_REACHED"] = 30008] = "TOURNAMENT_MAX_REGISTRATIONS_REACHED";
|
|
840
|
+
})(TournamentRegistrationError || (TournamentRegistrationError = {}));
|
|
841
|
+
|
|
842
|
+
var TournamentType;
|
|
843
|
+
(function (TournamentType) {
|
|
844
|
+
TournamentType[TournamentType["SCHEDULED"] = 1] = "SCHEDULED";
|
|
845
|
+
TournamentType[TournamentType["SNG"] = 2] = "SNG";
|
|
846
|
+
TournamentType[TournamentType["TEST"] = 3] = "TEST";
|
|
847
|
+
})(TournamentType || (TournamentType = {}));
|
|
834
848
|
|
|
835
849
|
const GetLevelMapResponseTransform = levels => {
|
|
836
850
|
return levels == null ? void 0 : levels.levels.map(l => ({
|