@smartico/public-api 0.0.50 → 0.0.52

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.
@@ -23,6 +23,8 @@ export interface SAWTemplateUI {
23
23
  promo_image?: string;
24
24
  promo_text?: string;
25
25
  matchx_banner?: string;
26
+ matchx_seasonal_ranking?: boolean;
27
+ matchx_general_board_users_count: number;
26
28
  ask_for_username?: SAWAskForUsername;
27
29
  show_prize_board?: boolean;
28
30
  max_spins_period_ms?: number;
@@ -11,7 +11,7 @@ import { GetTournamentInfoResponse, GetTournamentsResponse } from './Tournaments
11
11
  import { LeaderBoardDetails, LeaderBoardPeriodType } from "./Leaderboard";
12
12
  import { GetLevelMapResponse } from "./Level";
13
13
  import { WSAPI } from "./WSAPI/WSAPI";
14
- import { TLevel, TMissionOrBadge } from "./WSAPI/WSAPITypes";
14
+ import { TLevel, TMissionOrBadge, TStoreItem, TTournament, TTournamentDetailed } from "./WSAPI/WSAPITypes";
15
15
  interface Tracker {
16
16
  label_api_key: string;
17
17
  userPublicProps: any;
@@ -54,15 +54,18 @@ declare class SmarticoAPI {
54
54
  sawSpinRequest(user_ext_id: string, saw_template_id: number, round_id: number): Promise<SAWDoSpinResponse>;
55
55
  inboxGetMessages(user_ext_id: string, limit?: number, offset?: number): Promise<GetInboxMessagesResponse>;
56
56
  storeGetItems(user_ext_id: string): Promise<GetStoreItemsResponse>;
57
+ storeGetItemsT(user_ext_id: string): Promise<TStoreItem[]>;
57
58
  missionsGetItems(user_ext_id: string): Promise<GetAchievementMapResponse>;
58
- missionsGetItemsT(user_ext_id?: string): Promise<TMissionOrBadge[]>;
59
+ missionsGetItemsT(user_ext_id: string): Promise<TMissionOrBadge[]>;
59
60
  badgetsGetItems(user_ext_id: string): Promise<GetAchievementMapResponse>;
60
- badgetsGetItemsT(user_ext_id?: string): Promise<TMissionOrBadge[]>;
61
+ badgetsGetItemsT(user_ext_id: string): Promise<TMissionOrBadge[]>;
61
62
  tournamentsGetLobby(user_ext_id: string): Promise<GetTournamentsResponse>;
63
+ tournamentsGetLobbyT(user_ext_id: string): Promise<TTournament[]>;
62
64
  tournamentsGetInfo(user_ext_id: string, tournamentInstanceId: number): Promise<GetTournamentInfoResponse>;
65
+ tournamentsGetInfoT(user_ext_id: string, tournamentInstanceId: number): Promise<TTournamentDetailed>;
63
66
  leaderboardGet(user_ext_id: string, period_type_id?: LeaderBoardPeriodType, prevPeriod?: boolean): Promise<LeaderBoardDetails>;
64
- levelsGet(user_ext_id?: string): Promise<GetLevelMapResponse>;
65
- levelsGetT(user_ext_id?: string): Promise<TLevel[]>;
67
+ levelsGet(user_ext_id: string): Promise<GetLevelMapResponse>;
68
+ levelsGetT(user_ext_id: string): Promise<TLevel[]>;
66
69
  getWSCalls(): WSAPI;
67
70
  }
68
71
  export { SmarticoAPI, MessageSender };
@@ -1,3 +1,4 @@
1
+ import { TStoreItem } from "../WSAPI/WSAPITypes";
1
2
  import { StoreItemPublicMeta } from "./StoreItemPublicMeta";
2
3
  import { StoreItemType } from "./StoreItemType";
3
4
  export interface StoreItem {
@@ -7,3 +8,4 @@ export interface StoreItem {
7
8
  categoryIds?: number[];
8
9
  canBuy?: boolean;
9
10
  }
11
+ export declare const StoreItemTransform: (items: StoreItem[]) => TStoreItem[];
@@ -2,6 +2,7 @@ import { Tournament } from "./Tournament";
2
2
  import { TournamentPlayer } from "./TournamentPlayer";
3
3
  import { ProtocolResponse } from "../Base/ProtocolResponse";
4
4
  import { TournamentPrize } from "./TournamentPrize";
5
+ import { TTournamentDetailed } from "../WSAPI/WSAPITypes";
5
6
  export interface GetTournamentInfoResponse extends ProtocolResponse {
6
7
  /** tournament info */
7
8
  tournamentInfo: {
@@ -18,3 +19,4 @@ export interface GetTournamentInfoResponse extends ProtocolResponse {
18
19
  prizes: TournamentPrize[];
19
20
  };
20
21
  }
22
+ export declare const tournamentInfoItemTransform: (t: GetTournamentInfoResponse) => TTournamentDetailed;
@@ -3,6 +3,7 @@ import { TournamentInstanceStatus } from "./TournamentInstanceStatus";
3
3
  import { TournamentRegistrationStatus } from "./TournamentRegistrationStatus";
4
4
  import { TournamentType } from "./TournamentType";
5
5
  import { TournamentPublicMeta } from "./TournamentPublicMeta";
6
+ import { TTournament } from "../WSAPI/WSAPITypes";
6
7
  export interface Tournament {
7
8
  /** ID of tournament template */
8
9
  tournamentId?: number;
@@ -20,6 +21,10 @@ export interface Tournament {
20
21
  startTime?: string;
21
22
  /** The time when tournament is going to finish */
22
23
  endTime?: string;
24
+ /** The time when tournament is going to start, epoch */
25
+ startTimeTs?: number;
26
+ /** The time when tournament is going to finish, epoch */
27
+ endTimeTs?: number;
23
28
  /** Number of users registered in the tournament */
24
29
  registrationCount?: number;
25
30
  /** Not in use */
@@ -41,3 +46,4 @@ export interface Tournament {
41
46
  /** Tournament duration in millisecnnds */
42
47
  durationMs?: number;
43
48
  }
49
+ export declare const TournamentItemsTransform: (items: Tournament[]) => TTournament[];
@@ -1,3 +1,4 @@
1
+ /** @hidden */
1
2
  export declare enum TournamentRegistrationStatus {
2
3
  NOT_REGISTERED = 0,
3
4
  REGISTERED = 1,
@@ -7,3 +8,6 @@ export declare enum TournamentRegistrationStatus {
7
8
  REGISTERED_PENDING_QUALIFICATION = 5,
8
9
  QUALIFIED_PENDING_REGISTRATION = 6
9
10
  }
11
+ export type TournamentRegistrationStatusName = 'NOT_REGISTERED' | 'REGISTERED' | 'FINISHED' | 'PENDING' | 'CANCELLED' | 'REGISTERED_PENDING_QUALIFICATION' | 'QUALIFIED_PENDING_REGISTRATION';
12
+ /** @hidden */
13
+ export declare const TournamentRegistrationStatusName: (type: TournamentRegistrationStatus) => TournamentRegistrationStatusName;
@@ -1,3 +1,4 @@
1
+ /** @hidden */
1
2
  export declare enum TournamentRegistrationType {
2
3
  AUTO = 1,
3
4
  OPT_IN = 2,
@@ -5,3 +6,6 @@ export declare enum TournamentRegistrationType {
5
6
  MANUAL_APPROVAL = 4,
6
7
  REQUIRES_QUALIFICATION = 5
7
8
  }
9
+ export type TournamentRegistrationTypeName = 'AUTO' | 'OPT_IN' | 'BUY_IN_POINTS' | 'MANUAL_APPROVAL' | 'REQUIRES_QUALIFICATION' | 'UNKNOWN';
10
+ /** @hidden */
11
+ export declare const TournamentRegistrationTypeGetName: (type: TournamentRegistrationType) => TournamentRegistrationTypeName;
@@ -1,5 +1,5 @@
1
1
  import { SmarticoAPI } from "../SmarticoAPI";
2
- import { TLevel, TMissionOrBadge, TUserProfile } from "./WSAPITypes";
2
+ import { TLevel, TMissionOrBadge, TStoreItem, TTournament, TTournamentDetailed, TUserProfile } from "./WSAPITypes";
3
3
  /** @group General API */
4
4
  export declare class WSAPI {
5
5
  private api;
@@ -13,4 +13,10 @@ export declare class WSAPI {
13
13
  getMissions(): Promise<TMissionOrBadge[]>;
14
14
  /** Returns all the badges available the current user */
15
15
  getBadges(): Promise<TMissionOrBadge[]>;
16
+ /** Returns all the store items available the current user */
17
+ getStoreItems(): Promise<TStoreItem[]>;
18
+ /** Returns all the active instances of tournaments */
19
+ getTournamentsList(): Promise<TTournament[]>;
20
+ /** Returns details information of specific tournament instance, the response will includ tournamnet info and the leaderboard of players */
21
+ getTournamentInstanceInfo(tournamentInstanceId: number): Promise<TTournamentDetailed>;
16
22
  }
@@ -1,3 +1,5 @@
1
+ import { TournamentRegistrationStatusName, TournamentRegistrationTypeName } from "../Tournaments";
2
+ type TRibbon = 'sale' | 'hot' | 'new' | 'vip' | string;
1
3
  /**
2
4
  * TUser interface describes the information of the user
3
5
  * The user object is returned by _smartico.api.getUserProfile() method.
@@ -63,6 +65,132 @@ export interface TLevel {
63
65
  */
64
66
  required_level_counter_2: number;
65
67
  }
68
+ /**
69
+ * TTournament interface describes the general information of the tournament item
70
+ */
71
+ export interface TTournament {
72
+ /** ID of tournament instance. Generated every time when tournament based on specific template is scheduled for run */
73
+ instance_id: number;
74
+ /** ID of tournament template */
75
+ tournament_id: number;
76
+ /** Name of the tournament, translated to the user language */
77
+ name: string;
78
+ /** Description of the tournament, translated to the user language */
79
+ description: string;
80
+ image1: string;
81
+ image2: string;
82
+ prize_pool_short: string;
83
+ custom_price_text: string;
84
+ /** The message that should be shown to the user when the user cannot register in tournament with error code TOURNAMENT_USER_DONT_MATCH_CONDITIONS */
85
+ segment_dont_match_message: string;
86
+ /**
87
+ * The ID of the custom section where the tournament is assigned
88
+ * The list of custom sections can be retrieved using _smartico.api.getCustomSections() method (TODO-API)
89
+ */
90
+ custom_section_id: number;
91
+ /** The custom data of the tournament defined by operator. Can be a JSON object, string or number */
92
+ custom_data: any;
93
+ /** The indicator if the tournament is 'Featured' */
94
+ is_featured: boolean;
95
+ /** The ribbon of the tournament item. Can be 'sale', 'hot', 'new', 'vip' or URL to the image in case of custom ribbon */
96
+ ribbon: TRibbon;
97
+ /** The time when tournament is going to start, epoch with milliseconds */
98
+ start_time: number;
99
+ /** The time when tournament is going to finish, epoch with milliseconds */
100
+ end_time: number;
101
+ /** Type of registration in the tournament */
102
+ registration_type: TournamentRegistrationTypeName;
103
+ /** Number of users registered in the tournament */
104
+ registration_count: number;
105
+ /** flag indicating if current user is registered in the tournament */
106
+ is_user_registered: boolean;
107
+ /** Minimum number of participant for this tournament. If tournament doesnt have enough registrations, it will not start */
108
+ players_min_count: number;
109
+ /** Maximum number of participant for this tournament. When reached, new users won't be able to register */
110
+ players_max_count: number;
111
+ /** Status of registration in the tournament for current user */
112
+ registration_status: TournamentRegistrationStatusName;
113
+ /** Tournament duration in millisecnnds */
114
+ duration_ms: number;
115
+ /** Cost of registration in the tournament in gamification points */
116
+ registration_cost_points: number;
117
+ /** Indicator if tournament instance is active, means in one of the statues - PUBLISHED, REGISTED, STARTED */
118
+ is_active: boolean;
119
+ /** Indicator if user can register in this tournament instance, e.g tournament is active, max users is not reached, user is not registered yet */
120
+ is_can_register: boolean;
121
+ /** Indicator if tournament instance is cancelled (status CANCELLED) */
122
+ is_cancelled: boolean;
123
+ /** Indicator if tournament instance is finished (status FINISHED, CANCELLED OR FINIALIZING) */
124
+ is_finished: boolean;
125
+ /** Indicator if tournament instance is running (status STARTED) */
126
+ is_in_progress: boolean;
127
+ /** Indicator if tournament instance is upcoming (status PUBLISHED or REGISTER) */
128
+ is_upcoming: boolean;
129
+ }
130
+ /**
131
+ * TTournamentDetailed interface describes the information of the tournament item and includes list of participants, their scores and position in the tournament leaderboard
132
+ */
133
+ export interface TTournamentDetailed extends TTournament {
134
+ /** The list of the tournament participants */
135
+ players?: {
136
+ /** The username of the participant */
137
+ public_username: string;
138
+ /** The URL to the avatar of the participant */
139
+ avatar_url: string;
140
+ /** The position of the participant in the tournament */
141
+ position: number;
142
+ /** The scores of the participant in the tournament */
143
+ scores: number;
144
+ /** The indicator if the participant is current user */
145
+ is_me: boolean;
146
+ }[];
147
+ /** The information about current user in the tournament if he is registered in the tournamnet */
148
+ me?: {
149
+ /** The username of the current user */
150
+ public_username: string;
151
+ /** The URL to the avatar of the current user */
152
+ avatar_url: string;
153
+ /** The position of the current user in the tournament */
154
+ position: number;
155
+ /** The scores of the current user in the tournament */
156
+ scores: number;
157
+ };
158
+ }
159
+ /**
160
+ * TStoreItem interface describes the information of the store item defined in the system
161
+ */
162
+ export interface TStoreItem {
163
+ /** ID of the store item */
164
+ id: number;
165
+ /** Name of the store item, translated to the user language */
166
+ name: string;
167
+ /** Description of the store item, translated to the user language */
168
+ description: string;
169
+ /** URL of the image of the store item */
170
+ image: string;
171
+ /** Type of the store item. Can be 'bonus' or 'manual'. Manual, means it's tangible item, e.g. iPhone */
172
+ type: 'bonus' | 'manual';
173
+ /** The price of the store item in the gamification points */
174
+ price: number;
175
+ /** The ribbon of the store item. Can be 'sale', 'hot', 'new', 'vip' or URL to the image in case of custom ribbon */
176
+ ribbon: TRibbon;
177
+ /**
178
+ * The message that should be shown to the user if he is not eligible to buy it. this message can be used to explain the reason why user cannot buy the item, e.g. 'You should be VIP to buy this item' and can be used in case can_buy property is false.
179
+ The message is translated to the user language.
180
+ **Note**: when user is trying to buy the item, the response from server can return custom error messages that can be shown to the user as well
181
+ */
182
+ limit_message: string;
183
+ /** The priority of the store item. Can be used to sort the items in the store */
184
+ priority: number;
185
+ /** The list of IDs of the related items. Can be used to show the related items in the store */
186
+ related_item_ids: number[];
187
+ /** The indicator if the user can buy the item
188
+ * This indicator is taking into account the segment conditions for the store item, the price of item towards users balance,
189
+ */
190
+ can_buy: boolean;
191
+ /** The list of IDs of the categories where the store item is assigned, information about categories can be retrievend with getStoreCategories method */
192
+ category_ids: number[];
193
+ }
66
194
  /**
67
195
  * TMissionOrBadge interface describes the information of mission or badge defined in the system
68
196
  */
@@ -130,3 +258,4 @@ export interface TMissionOrBadgeTask {
130
258
  /** The progress of the task in percents */
131
259
  progress: number;
132
260
  }
261
+ export {};