@smartico/public-api 0.0.8 → 0.0.9

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.
Files changed (72) hide show
  1. package/dist/Core/ActivityTypeLimited.d.ts +7 -0
  2. package/dist/Core/index.d.ts +2 -1
  3. package/dist/SmarticoAPI.d.ts +7 -2
  4. package/dist/Store/BuyStoreItemErrorCode.d.ts +10 -0
  5. package/dist/Store/BuyStoreItemRequest.d.ts +4 -0
  6. package/dist/Store/BuyStoreItemResponse.d.ts +4 -0
  7. package/dist/Store/GetCategoriesStoreResponse.d.ts +5 -0
  8. package/dist/Store/GetStoreItemsResponse.d.ts +5 -0
  9. package/dist/Store/StoreCategory.d.ts +5 -0
  10. package/dist/Store/StoreCategoryPublicMeta.d.ts +4 -0
  11. package/dist/Store/StoreItem.d.ts +9 -0
  12. package/dist/Store/StoreItemPublicMeta.d.ts +10 -0
  13. package/dist/Store/StoreItemType.d.ts +4 -0
  14. package/dist/Store/index.d.ts +11 -11
  15. package/dist/Tournaments/GetTournamentInfoRequest.d.ts +4 -0
  16. package/dist/Tournaments/GetTournamentInfoResponse.d.ts +20 -0
  17. package/dist/Tournaments/GetTournamentsRequest.d.ts +3 -0
  18. package/dist/Tournaments/GetTournamentsResponse.d.ts +6 -0
  19. package/dist/Tournaments/Tournament.d.ts +43 -0
  20. package/dist/Tournaments/TournamentInstanceStatus.d.ts +10 -0
  21. package/dist/Tournaments/TournamentPlayer.d.ts +9 -0
  22. package/dist/Tournaments/TournamentPrize.d.ts +10 -0
  23. package/dist/Tournaments/TournamentPublicMeta.d.ts +22 -0
  24. package/dist/Tournaments/TournamentRegisterRequest.d.ts +4 -0
  25. package/dist/Tournaments/TournamentRegisterResponse.d.ts +5 -0
  26. package/dist/Tournaments/TournamentRegistrationError.d.ts +11 -0
  27. package/dist/Tournaments/TournamentRegistrationStatus.d.ts +9 -0
  28. package/dist/Tournaments/TournamentRegistrationType.d.ts +7 -0
  29. package/dist/Tournaments/TournamentType.d.ts +5 -0
  30. package/dist/Tournaments/index.d.ts +16 -0
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.js +125 -63
  33. package/dist/index.js.map +1 -1
  34. package/dist/index.modern.mjs +105 -40
  35. package/dist/index.modern.mjs.map +1 -1
  36. package/package.json +2 -1
  37. package/src/Core/ActivityTypeLimited.ts +8 -0
  38. package/src/Core/index.ts +3 -1
  39. package/src/SmarticoAPI.ts +43 -31
  40. package/src/Store/{BuyShopItemErrorCode.ts → BuyStoreItemErrorCode.ts} +1 -1
  41. package/src/Store/{BuyShopItemRequest.ts → BuyStoreItemRequest.ts} +1 -1
  42. package/src/Store/{BuyShopItemResponse.ts → BuyStoreItemResponse.ts} +1 -1
  43. package/src/Store/GetCategoriesStoreResponse.ts +11 -0
  44. package/src/Store/GetStoreItemsResponse.ts +7 -0
  45. package/src/Store/StoreCategory.ts +7 -0
  46. package/src/Store/StoreCategoryPublicMeta.ts +5 -0
  47. package/src/Store/StoreItem.ts +10 -0
  48. package/src/Store/{ShopItemPublicMeta.ts → StoreItemPublicMeta.ts} +1 -1
  49. package/src/Store/{ShopItemType.ts → StoreItemType.ts} +1 -1
  50. package/src/Store/index.ts +20 -20
  51. package/src/Tournaments/GetTournamentInfoRequest.ts +6 -0
  52. package/src/Tournaments/GetTournamentInfoResponse.ts +25 -0
  53. package/src/Tournaments/GetTournamentsRequest.ts +5 -0
  54. package/src/Tournaments/GetTournamentsResponse.ts +8 -0
  55. package/src/Tournaments/Tournament.ts +47 -0
  56. package/src/Tournaments/TournamentInstanceStatus.ts +22 -0
  57. package/src/Tournaments/TournamentPlayer.ts +11 -0
  58. package/src/Tournaments/TournamentPrize.ts +12 -0
  59. package/src/Tournaments/TournamentPublicMeta.ts +26 -0
  60. package/src/Tournaments/TournamentRegisterRequest.ts +6 -0
  61. package/src/Tournaments/TournamentRegisterResponse.ts +10 -0
  62. package/src/Tournaments/TournamentRegistrationError.ts +11 -0
  63. package/src/Tournaments/TournamentRegistrationStatus.ts +11 -0
  64. package/src/Tournaments/TournamentRegistrationType.ts +9 -0
  65. package/src/Tournaments/TournamentType.ts +6 -0
  66. package/src/Tournaments/index.ts +33 -0
  67. package/src/index.ts +1 -0
  68. package/src/Store/GetCategoriesShopResponse.ts +0 -11
  69. package/src/Store/GetShopItemsResponse.ts +0 -7
  70. package/src/Store/ShopCategory.ts +0 -7
  71. package/src/Store/ShopCategoryPublicMeta.ts +0 -5
  72. package/src/Store/ShopItem.ts +0 -10
@@ -0,0 +1,7 @@
1
+ export declare enum ActivityTypeLimited {
2
+ DoNothing = 8,
3
+ Points = 12,
4
+ Popup = 30,
5
+ Inbox = 31,
6
+ Bonus = 100
7
+ }
@@ -1,3 +1,4 @@
1
+ import { ActivityTypeLimited } from './ActivityTypeLimited';
1
2
  import { GetLabelInfoRequest } from './GetLabelInfoRequest';
2
3
  import { GetLabelInfoResponse } from './GetLabelInfoResponse';
3
4
  import { GetTranslationsRequest } from './GetTranslationsRequest';
@@ -5,4 +6,4 @@ import { GetTranslationsResponse } from './GetTranslationsResponse';
5
6
  import { PublicLabelSettings } from './PublicLabelSettings';
6
7
  import { ResponseIdentify } from './ResponseIdentify';
7
8
  import { TranslationArea } from './TranslationArea';
8
- export { GetTranslationsRequest, GetTranslationsResponse, GetLabelInfoRequest, GetLabelInfoResponse, TranslationArea, PublicLabelSettings, ResponseIdentify };
9
+ export { GetTranslationsRequest, GetTranslationsResponse, GetLabelInfoRequest, GetLabelInfoResponse, TranslationArea, PublicLabelSettings, ResponseIdentify, ActivityTypeLimited };
@@ -1,11 +1,13 @@
1
1
  import { ClassId } from "./Base/ClassId";
2
2
  import { SAWGetTemplatesResponse } from './MiniGames/SAWGetTemplatesResponse';
3
- import { SAWTemplate } from './MiniGames/SAWTemplate';
4
3
  import { ILogger } from './ILogger';
5
4
  import { SAWDoSpinResponse } from './MiniGames';
6
5
  import { GetTranslationsResponse, ResponseIdentify, TranslationArea } from './Core';
7
6
  import { GetLabelInfoResponse } from './Core/GetLabelInfoResponse';
8
7
  import { GetInboxMessagesResponse } from './Inbox';
8
+ import { GetStoreItemsResponse } from './Store';
9
+ import { GetAchievementMapResponse } from './Missions';
10
+ import { GetTournamentInfoResponse, GetTournamentsResponse } from './Tournaments';
9
11
  interface IOptions {
10
12
  logger?: ILogger;
11
13
  logCIDs?: ClassId[];
@@ -30,8 +32,11 @@ declare class SmarticoAPI {
30
32
  public_username_custom: string;
31
33
  }>;
32
34
  sawGetTemplates(user_ext_id: string): Promise<SAWGetTemplatesResponse>;
33
- sawFormatTemplatesForWidget(templates: SAWTemplate[], pointsBalance: number): Promise<any[]>;
34
35
  sawSpinRequest(user_ext_id: string, saw_template_id: number, round_id: number): Promise<SAWDoSpinResponse>;
35
36
  inboxGetMessages(user_ext_id: string, limit?: number, offset?: number): Promise<GetInboxMessagesResponse>;
37
+ storeGetItems(user_ext_id: string): Promise<GetStoreItemsResponse>;
38
+ missionsGetItems(user_ext_id: string): Promise<GetAchievementMapResponse>;
39
+ tournamentsGetLobby(user_ext_id: string): Promise<GetTournamentsResponse>;
40
+ tournamentsGetInfo(user_ext_id: string, tournamentInstanceId: number): Promise<GetTournamentInfoResponse>;
36
41
  }
37
42
  export { SmarticoAPI };
@@ -0,0 +1,10 @@
1
+ export declare enum BuyStoreItemErrorCode {
2
+ FAILED_TO_BUY_SHOP_ITEM = 121,
3
+ SHOP_NO_BALANCE = 11000,
4
+ SHOP_WRONG_LABEL = 11001,
5
+ SHOP_FAILED_TO_BUY_BONUS = 11002,
6
+ SHOP_FAILED_TO_BUY_SHOP_ITEM_CONDITION = 11003,
7
+ SHOP_FAILED_TO_BUY_SHOP_ITEM_CONDITION_PURSHASE = 11004,
8
+ SHOP_FAILED_TO_BUY_MATCHING_BONUS = 11005,
9
+ SHOP_FAILED_MAX_BOUGHT_ITEMS_REACHED = 11006
10
+ }
@@ -0,0 +1,4 @@
1
+ import { ProtocolMessage } from "../Base/ProtocolMessage";
2
+ export interface BuyStoreItemRequest extends ProtocolMessage {
3
+ itemId: number;
4
+ }
@@ -0,0 +1,4 @@
1
+ import { ProtocolResponse } from "../Base/ProtocolResponse";
2
+ export interface BuyStoreItemResponse extends ProtocolResponse {
3
+ success?: boolean;
4
+ }
@@ -0,0 +1,5 @@
1
+ import { ProtocolResponse } from "../Base/ProtocolResponse";
2
+ import { StoreCategory } from "./StoreCategory";
3
+ export interface GetCategoriesStoreResponse extends ProtocolResponse {
4
+ categories: StoreCategory[];
5
+ }
@@ -0,0 +1,5 @@
1
+ import { ProtocolResponse } from "../Base/ProtocolResponse";
2
+ import { StoreItem } from "./StoreItem";
3
+ export interface GetStoreItemsResponse extends ProtocolResponse {
4
+ items: StoreItem[];
5
+ }
@@ -0,0 +1,5 @@
1
+ import { StoreCategoryPublicMeta } from "./StoreCategoryPublicMeta";
2
+ export interface StoreCategory {
3
+ id?: number;
4
+ publicMeta?: StoreCategoryPublicMeta;
5
+ }
@@ -0,0 +1,4 @@
1
+ export interface StoreCategoryPublicMeta {
2
+ name?: string;
3
+ order?: number;
4
+ }
@@ -0,0 +1,9 @@
1
+ import { StoreItemPublicMeta } from "./StoreItemPublicMeta";
2
+ import { StoreItemType } from "./StoreItemType";
3
+ export interface StoreItem {
4
+ id: number;
5
+ itemTypeId: StoreItemType;
6
+ itemPublicMeta: StoreItemPublicMeta;
7
+ categoryIds?: number[];
8
+ canBuy?: boolean;
9
+ }
@@ -0,0 +1,10 @@
1
+ export interface StoreItemPublicMeta {
2
+ price: string;
3
+ image_url: string;
4
+ name: string;
5
+ description: string;
6
+ label_tag: string;
7
+ limit_message: string;
8
+ priority: number;
9
+ related_items: number[];
10
+ }
@@ -0,0 +1,4 @@
1
+ export declare enum StoreItemType {
2
+ Bonus = 1,
3
+ Manual = 2
4
+ }
@@ -1,11 +1,11 @@
1
- import { BuyShopItemErrorCode } from "./BuyShopItemErrorCode";
2
- import { BuyShopItemRequest } from "./BuyShopItemRequest";
3
- import { BuyShopItemResponse } from "./BuyShopItemResponse";
4
- import { GetCategoriesShopResponse } from "./GetCategoriesShopResponse";
5
- import { GetShopItemsResponse } from "./GetShopItemsResponse";
6
- import { ShopCategory } from "./ShopCategory";
7
- import { ShopCategoryPublicMeta } from "./ShopCategoryPublicMeta";
8
- import { ShopItem } from "./ShopItem";
9
- import { ShopItemPublicMeta } from "./ShopItemPublicMeta";
10
- import { ShopItemType } from "./ShopItemType";
11
- export { BuyShopItemErrorCode, BuyShopItemRequest, BuyShopItemResponse, GetCategoriesShopResponse, GetShopItemsResponse, ShopCategory, ShopCategoryPublicMeta, ShopItem, ShopItemPublicMeta, ShopItemType, };
1
+ import { BuyStoreItemErrorCode } from "./BuyStoreItemErrorCode";
2
+ import { BuyStoreItemRequest } from "./BuyStoreItemRequest";
3
+ import { BuyStoreItemResponse } from "./BuyStoreItemResponse";
4
+ import { GetCategoriesStoreResponse } from "./GetCategoriesStoreResponse";
5
+ import { GetStoreItemsResponse } from "./GetStoreItemsResponse";
6
+ import { StoreCategory } from "./StoreCategory";
7
+ import { StoreCategoryPublicMeta } from "./StoreCategoryPublicMeta";
8
+ import { StoreItem } from "./StoreItem";
9
+ import { StoreItemPublicMeta } from "./StoreItemPublicMeta";
10
+ import { StoreItemType } from "./StoreItemType";
11
+ export { BuyStoreItemErrorCode, BuyStoreItemRequest, BuyStoreItemResponse, GetCategoriesStoreResponse, GetStoreItemsResponse, StoreCategory, StoreCategoryPublicMeta, StoreItem, StoreItemPublicMeta, StoreItemType, };
@@ -0,0 +1,4 @@
1
+ import { ProtocolMessage } from "../Base/ProtocolMessage";
2
+ export interface GetTournamentInfoRequest extends ProtocolMessage {
3
+ tournamentInstanceId: number;
4
+ }
@@ -0,0 +1,20 @@
1
+ import { Tournament } from "./Tournament";
2
+ import { TournamentPlayer } from "./TournamentPlayer";
3
+ import { ProtocolResponse } from "../Base/ProtocolResponse";
4
+ import { TournamentPrize } from "./TournamentPrize";
5
+ export interface GetTournamentInfoResponse extends ProtocolResponse {
6
+ /** tournament info */
7
+ tournamentInfo: {
8
+ /** id of label, not in use */
9
+ labelId: number;
10
+ tournamentLobbyInfo: Tournament;
11
+ /** list of registered users */
12
+ players: TournamentPlayer[];
13
+ };
14
+ /** information about current user position */
15
+ userPosition: TournamentPlayer;
16
+ /** prizes structure */
17
+ prizeStructure?: {
18
+ prizes: TournamentPrize[];
19
+ };
20
+ }
@@ -0,0 +1,3 @@
1
+ import { ProtocolMessage } from "../Base/ProtocolMessage";
2
+ export interface GetTournamentsRequest extends ProtocolMessage {
3
+ }
@@ -0,0 +1,6 @@
1
+ import { ProtocolResponse } from "../Base/ProtocolResponse";
2
+ import { Tournament } from "./Tournament";
3
+ export interface GetTournamentsResponse extends ProtocolResponse {
4
+ /** array of the tournaments */
5
+ tournaments?: Tournament[];
6
+ }
@@ -0,0 +1,43 @@
1
+ import { TournamentRegistrationType } from "./TournamentRegistrationType";
2
+ import { TournamentInstanceStatus } from "./TournamentInstanceStatus";
3
+ import { TournamentRegistrationStatus } from "./TournamentRegistrationStatus";
4
+ import { TournamentType } from "./TournamentType";
5
+ import { TournamentPublicMeta } from "./TournamentPublicMeta";
6
+ export interface Tournament {
7
+ /** ID of tournament template */
8
+ tournamentId?: number;
9
+ /** ID of tournament instance. Generated every time when tournament based on specific template is scheduled for run */
10
+ tournamentInstanceId?: number;
11
+ /** Type of the tournament. For now only SCHEDULED is support */
12
+ tournamentType?: TournamentType;
13
+ /** Meta information about tournament that should be used to build UI */
14
+ publicMeta?: TournamentPublicMeta;
15
+ /** Cost of registration in the tournament in gamification points */
16
+ buyInAmount?: number;
17
+ /** Not in use */
18
+ prizePool?: number;
19
+ /** The time when tournament is going to start */
20
+ startTime?: string;
21
+ /** The time when tournament is going to finish */
22
+ endTime?: string;
23
+ /** Number of users registered in the tournament */
24
+ registrationCount?: number;
25
+ /** Not in use */
26
+ totalCount?: number;
27
+ /** Type of registration in the tournament */
28
+ registrationType?: TournamentRegistrationType;
29
+ /** Status of registration in the tournament for current user */
30
+ tournamentRegistrationStatus?: TournamentRegistrationStatus;
31
+ /** Status of tournament instance */
32
+ tournamentInstanceStatus?: TournamentInstanceStatus;
33
+ /** flag indicating if current user is registered in the tournament */
34
+ isUserRegistered?: boolean;
35
+ /** Indicator if tournament allows later registration, when tournament is already started */
36
+ allowLateRegistration?: boolean;
37
+ /** Minimum number of participant for this tournament. If tournament doesnt have enough registrations, it will not start */
38
+ playersMinCount?: number;
39
+ /** Maximum number of participant for this tournament. When reached, new users won't be able to register */
40
+ playersMaxCount?: number;
41
+ /** Tournament duration in millisecnnds */
42
+ durationMs?: number;
43
+ }
@@ -0,0 +1,10 @@
1
+ export declare enum TournamentInstanceStatus {
2
+ PUBLISHED = 1,
3
+ REGISTER = 2,
4
+ STARTED = 3,
5
+ FINISHED = 4,
6
+ CANCELLED = 5,
7
+ FAILED = 6,
8
+ FINALIZING = 7
9
+ }
10
+ export declare const TournamentInstanceStatusName: (s: TournamentInstanceStatus) => string;
@@ -0,0 +1,9 @@
1
+ export interface TournamentPlayer {
2
+ userAltName: string;
3
+ position: number;
4
+ scores: number;
5
+ isMe: boolean;
6
+ userId: number;
7
+ avatar_id: string;
8
+ avatar_url?: string;
9
+ }
@@ -0,0 +1,10 @@
1
+ import { ActivityTypeLimited } from "../Core/ActivityTypeLimited";
2
+ export interface TournamentPrize {
3
+ name: string;
4
+ description: string;
5
+ image_url: string;
6
+ place_from: number;
7
+ place_to: number;
8
+ type: ActivityTypeLimited;
9
+ points: number;
10
+ }
@@ -0,0 +1,22 @@
1
+ export interface TournamentPublicMeta {
2
+ /** Name of tournament */
3
+ name?: string;
4
+ /** 1st image */
5
+ image_url?: string;
6
+ /** 2nd image */
7
+ image_url2?: string;
8
+ /** Description, html capable */
9
+ description?: string;
10
+ /** Short explanation of prize pool */
11
+ prize_pool_short?: string;
12
+ /** Message to show when user is not matching to the segment allowed to register (error code 30005 in registration response) */
13
+ segment_dont_match_message?: string;
14
+ /** Short explanation of registration price */
15
+ custom_price_text?: string;
16
+ /** Indicator if the scores of other users should be shown in the leaderboard of tournament */
17
+ show_other_users_score?: boolean;
18
+ custom_section_id?: number;
19
+ only_in_custom_section?: boolean;
20
+ label_tag?: string;
21
+ featured?: boolean;
22
+ }
@@ -0,0 +1,4 @@
1
+ import { ProtocolMessage } from "../Base/ProtocolMessage";
2
+ export interface TournamentRegisterRequest extends ProtocolMessage {
3
+ tournamentInstanceId: number;
4
+ }
@@ -0,0 +1,5 @@
1
+ import { ProtocolResponse } from "../Base/ProtocolResponse";
2
+ import { TournamentRegistrationError } from "./TournamentRegistrationError";
3
+ export interface TournamentRegisterResponse extends ProtocolResponse {
4
+ errCode?: TournamentRegistrationError;
5
+ }
@@ -0,0 +1,11 @@
1
+ export declare enum TournamentRegistrationError {
2
+ NO_ERROR = 0,
3
+ TOURNAMENT_INSTANCE_NOT_FOUND = 30001,
4
+ TOURNAMENT_REGISTRATION_NOT_ENOUGH_POINTS = 30002,
5
+ TOURNAMENT_INSTANCE_NOT_IN_STATE = 30003,
6
+ TOURNAMENT_ALREADY_REGISTERED = 30004,
7
+ TOURNAMENT_USER_DONT_MATCH_CONDITIONS = 30005,
8
+ TOURNAMENT_USER_NOT_REGISTERED = 30006,
9
+ TOURNAMENT_CANT_CHANGE_REGISTRATION_STATUS = 30007,
10
+ TOURNAMENT_MAX_REGISTRATIONS_REACHED = 30008
11
+ }
@@ -0,0 +1,9 @@
1
+ export declare enum TournamentRegistrationStatus {
2
+ NOT_REGISTERED = 0,
3
+ REGISTERED = 1,
4
+ FINISHED = 2,
5
+ PENDING = 3,
6
+ CANCELLED = 4,
7
+ REGISTERED_PENDING_QUALIFICATION = 5,
8
+ QUALIFIED_PENDING_REGISTRATION = 6
9
+ }
@@ -0,0 +1,7 @@
1
+ export declare enum TournamentRegistrationType {
2
+ AUTO = 1,
3
+ OPT_IN = 2,
4
+ BUY_IN_POINTS = 3,
5
+ MANUAL_APPROVAL = 4,
6
+ REQUIRES_QUALIFICATION = 5
7
+ }
@@ -0,0 +1,5 @@
1
+ export declare enum TournamentType {
2
+ SCHEDULED = 1,
3
+ SNG = 2,
4
+ TEST = 3
5
+ }
@@ -0,0 +1,16 @@
1
+ import { GetTournamentInfoRequest } from "./GetTournamentInfoRequest";
2
+ import { GetTournamentInfoResponse } from "./GetTournamentInfoResponse";
3
+ import { GetTournamentsRequest } from "./GetTournamentsRequest";
4
+ import { GetTournamentsResponse } from "./GetTournamentsResponse";
5
+ import { Tournament } from "./Tournament";
6
+ import { TournamentInstanceStatus } from "./TournamentInstanceStatus";
7
+ import { TournamentPlayer } from "./TournamentPlayer";
8
+ import { TournamentPrize } from "./TournamentPrize";
9
+ import { TournamentPublicMeta } from "./TournamentPublicMeta";
10
+ import { TournamentRegisterRequest } from "./TournamentRegisterRequest";
11
+ import { TournamentRegisterResponse } from "./TournamentRegisterResponse";
12
+ import { TournamentRegistrationError } from "./TournamentRegistrationError";
13
+ import { TournamentRegistrationStatus } from "./TournamentRegistrationStatus";
14
+ import { TournamentRegistrationType } from "./TournamentRegistrationType";
15
+ import { TournamentType } from "./TournamentType";
16
+ export { GetTournamentInfoRequest, GetTournamentInfoResponse, GetTournamentsRequest, GetTournamentsResponse, Tournament, TournamentInstanceStatus, TournamentPlayer, TournamentPrize, TournamentPublicMeta, TournamentRegisterRequest, TournamentRegisterResponse, TournamentRegistrationError, TournamentRegistrationStatus, TournamentRegistrationType, TournamentType, };
package/dist/index.d.ts CHANGED
@@ -7,4 +7,5 @@ export * from './Leaderboard';
7
7
  export * from './MiniGames';
8
8
  export * from './Missions';
9
9
  export * from './Store';
10
+ export * from './Tournaments';
10
11
  export { SmarticoAPI, ClassId, ILogger };
package/dist/index.js CHANGED
@@ -1,25 +1,3 @@
1
- var superagent = require('superagent');
2
-
3
- function _interopNamespace(e) {
4
- if (e && e.__esModule) return e;
5
- var n = Object.create(null);
6
- if (e) {
7
- Object.keys(e).forEach(function (k) {
8
- if (k !== 'default') {
9
- var d = Object.getOwnPropertyDescriptor(e, k);
10
- Object.defineProperty(n, k, d.get ? d : {
11
- enumerable: true,
12
- get: function () { return e[k]; }
13
- });
14
- }
15
- });
16
- }
17
- n["default"] = e;
18
- return n;
19
- }
20
-
21
- var superagent__namespace = /*#__PURE__*/_interopNamespace(superagent);
22
-
23
1
  exports.ClassId = void 0;
24
2
  (function (ClassId) {
25
3
  ClassId[ClassId["INIT"] = 3] = "INIT";
@@ -450,13 +428,21 @@ var SmarticoAPI = /*#__PURE__*/function () {
450
428
  var result;
451
429
  var _temp = _catch(function () {
452
430
  var timeStart = new Date().getTime();
453
- return Promise.resolve(superagent__namespace.post(_this.publicUrl).send(message)).then(function (res) {
431
+ return Promise.resolve(fetch(_this.publicUrl, {
432
+ method: 'POST',
433
+ body: JSON.stringify(message),
434
+ headers: {
435
+ 'Content-Type': 'application/json'
436
+ }
437
+ })).then(function (res) {
454
438
  // const res = await superagent.post('http://channel01.int.smartico.ai:81/services/public').send(message);
455
439
  var timeEnd = new Date().getTime();
456
440
  if (_this.logHTTPTiming) {
457
441
  _this.logger.always('HTTP time, ms:' + (timeEnd - timeStart));
458
442
  }
459
- result = JSON.parse(res.text);
443
+ return Promise.resolve(res.json()).then(function (_res$json) {
444
+ result = _res$json;
445
+ });
460
446
  });
461
447
  }, function (e) {
462
448
  _this.logger.error("Failed to make request to smartico channel. " + e.message, {
@@ -612,29 +598,6 @@ var SmarticoAPI = /*#__PURE__*/function () {
612
598
  return Promise.reject(e);
613
599
  }
614
600
  };
615
- _proto.sawFormatTemplatesForWidget = function sawFormatTemplatesForWidget(templates, pointsBalance) {
616
- try {
617
- return Promise.resolve(templates.filter(function (r) {
618
- return r.saw_template_id >= 1;
619
- }).map(function (r) {
620
- var _r$saw_skin_ui_defini, _r$saw_skin_ui_defini2;
621
- return {
622
- id: r.saw_template_id,
623
- name: r.saw_template_ui_definition.name,
624
- // description: r.saw_template_ui_definition.description,
625
- game_type: SAWGameTypeName[r.saw_game_type_id] || 'unknown',
626
- buyin_type: SAWBuyInTypeName[r.saw_buyin_type_id] || 'unknown',
627
- jackpot: r.jackpot_current,
628
- spin_count: r.spin_count,
629
- buyin_cost_points: r.buyin_cost_points,
630
- can_play: SAWUtils.canPlay(r, pointsBalance),
631
- icon: (_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"
632
- };
633
- }));
634
- } catch (e) {
635
- return Promise.reject(e);
636
- }
637
- };
638
601
  _proto.sawSpinRequest = function sawSpinRequest(user_ext_id, saw_template_id, round_id) {
639
602
  try {
640
603
  var _this8 = this;
@@ -677,9 +640,56 @@ var SmarticoAPI = /*#__PURE__*/function () {
677
640
  return Promise.reject(e);
678
641
  }
679
642
  };
643
+ _proto.storeGetItems = function storeGetItems(user_ext_id) {
644
+ try {
645
+ var _this10 = this;
646
+ var message = _this10.buildMessage(user_ext_id, exports.ClassId.GET_SHOP_ITEMS_REQUEST);
647
+ return Promise.resolve(_this10.send(message));
648
+ } catch (e) {
649
+ return Promise.reject(e);
650
+ }
651
+ };
652
+ _proto.missionsGetItems = function missionsGetItems(user_ext_id) {
653
+ try {
654
+ var _this11 = this;
655
+ var message = _this11.buildMessage(user_ext_id, exports.ClassId.GET_ACHIEVEMENT_MAP_REQUEST);
656
+ return Promise.resolve(_this11.send(message));
657
+ } catch (e) {
658
+ return Promise.reject(e);
659
+ }
660
+ };
661
+ _proto.tournamentsGetLobby = function tournamentsGetLobby(user_ext_id) {
662
+ try {
663
+ var _this12 = this;
664
+ var message = _this12.buildMessage(user_ext_id, exports.ClassId.GET_TOURNAMENT_LOBBY_REQUEST);
665
+ return Promise.resolve(_this12.send(message));
666
+ } catch (e) {
667
+ return Promise.reject(e);
668
+ }
669
+ };
670
+ _proto.tournamentsGetInfo = function tournamentsGetInfo(user_ext_id, tournamentInstanceId) {
671
+ try {
672
+ var _this13 = this;
673
+ var message = _this13.buildMessage(user_ext_id, exports.ClassId.GET_TOURNAMENT_INFO_REQUEST, {
674
+ tournamentInstanceId: tournamentInstanceId
675
+ });
676
+ return Promise.resolve(_this13.send(message));
677
+ } catch (e) {
678
+ return Promise.reject(e);
679
+ }
680
+ };
680
681
  return SmarticoAPI;
681
682
  }();
682
683
 
684
+ exports.ActivityTypeLimited = void 0;
685
+ (function (ActivityTypeLimited) {
686
+ ActivityTypeLimited[ActivityTypeLimited["DoNothing"] = 8] = "DoNothing";
687
+ ActivityTypeLimited[ActivityTypeLimited["Points"] = 12] = "Points";
688
+ ActivityTypeLimited[ActivityTypeLimited["Popup"] = 30] = "Popup";
689
+ ActivityTypeLimited[ActivityTypeLimited["Inbox"] = 31] = "Inbox";
690
+ ActivityTypeLimited[ActivityTypeLimited["Bonus"] = 100] = "Bonus";
691
+ })(exports.ActivityTypeLimited || (exports.ActivityTypeLimited = {}));
692
+
683
693
  exports.PublicLabelSettings = void 0;
684
694
  (function (PublicLabelSettings) {
685
695
  PublicLabelSettings["FCM_SENDER_ID"] = "FCM_SENDER_ID";
@@ -763,23 +773,75 @@ exports.AchievementType = void 0;
763
773
  AchievementType[AchievementType["Badge"] = 2] = "Badge";
764
774
  })(exports.AchievementType || (exports.AchievementType = {}));
765
775
 
766
- exports.BuyShopItemErrorCode = void 0;
767
- (function (BuyShopItemErrorCode) {
768
- BuyShopItemErrorCode[BuyShopItemErrorCode["FAILED_TO_BUY_SHOP_ITEM"] = 121] = "FAILED_TO_BUY_SHOP_ITEM";
769
- BuyShopItemErrorCode[BuyShopItemErrorCode["SHOP_NO_BALANCE"] = 11000] = "SHOP_NO_BALANCE";
770
- BuyShopItemErrorCode[BuyShopItemErrorCode["SHOP_WRONG_LABEL"] = 11001] = "SHOP_WRONG_LABEL";
771
- BuyShopItemErrorCode[BuyShopItemErrorCode["SHOP_FAILED_TO_BUY_BONUS"] = 11002] = "SHOP_FAILED_TO_BUY_BONUS";
772
- BuyShopItemErrorCode[BuyShopItemErrorCode["SHOP_FAILED_TO_BUY_SHOP_ITEM_CONDITION"] = 11003] = "SHOP_FAILED_TO_BUY_SHOP_ITEM_CONDITION";
773
- BuyShopItemErrorCode[BuyShopItemErrorCode["SHOP_FAILED_TO_BUY_SHOP_ITEM_CONDITION_PURSHASE"] = 11004] = "SHOP_FAILED_TO_BUY_SHOP_ITEM_CONDITION_PURSHASE";
774
- BuyShopItemErrorCode[BuyShopItemErrorCode["SHOP_FAILED_TO_BUY_MATCHING_BONUS"] = 11005] = "SHOP_FAILED_TO_BUY_MATCHING_BONUS";
775
- BuyShopItemErrorCode[BuyShopItemErrorCode["SHOP_FAILED_MAX_BOUGHT_ITEMS_REACHED"] = 11006] = "SHOP_FAILED_MAX_BOUGHT_ITEMS_REACHED";
776
- })(exports.BuyShopItemErrorCode || (exports.BuyShopItemErrorCode = {}));
776
+ exports.BuyStoreItemErrorCode = void 0;
777
+ (function (BuyStoreItemErrorCode) {
778
+ BuyStoreItemErrorCode[BuyStoreItemErrorCode["FAILED_TO_BUY_SHOP_ITEM"] = 121] = "FAILED_TO_BUY_SHOP_ITEM";
779
+ BuyStoreItemErrorCode[BuyStoreItemErrorCode["SHOP_NO_BALANCE"] = 11000] = "SHOP_NO_BALANCE";
780
+ BuyStoreItemErrorCode[BuyStoreItemErrorCode["SHOP_WRONG_LABEL"] = 11001] = "SHOP_WRONG_LABEL";
781
+ BuyStoreItemErrorCode[BuyStoreItemErrorCode["SHOP_FAILED_TO_BUY_BONUS"] = 11002] = "SHOP_FAILED_TO_BUY_BONUS";
782
+ BuyStoreItemErrorCode[BuyStoreItemErrorCode["SHOP_FAILED_TO_BUY_SHOP_ITEM_CONDITION"] = 11003] = "SHOP_FAILED_TO_BUY_SHOP_ITEM_CONDITION";
783
+ BuyStoreItemErrorCode[BuyStoreItemErrorCode["SHOP_FAILED_TO_BUY_SHOP_ITEM_CONDITION_PURSHASE"] = 11004] = "SHOP_FAILED_TO_BUY_SHOP_ITEM_CONDITION_PURSHASE";
784
+ BuyStoreItemErrorCode[BuyStoreItemErrorCode["SHOP_FAILED_TO_BUY_MATCHING_BONUS"] = 11005] = "SHOP_FAILED_TO_BUY_MATCHING_BONUS";
785
+ BuyStoreItemErrorCode[BuyStoreItemErrorCode["SHOP_FAILED_MAX_BOUGHT_ITEMS_REACHED"] = 11006] = "SHOP_FAILED_MAX_BOUGHT_ITEMS_REACHED";
786
+ })(exports.BuyStoreItemErrorCode || (exports.BuyStoreItemErrorCode = {}));
787
+
788
+ exports.StoreItemType = void 0;
789
+ (function (StoreItemType) {
790
+ StoreItemType[StoreItemType["Bonus"] = 1] = "Bonus";
791
+ StoreItemType[StoreItemType["Manual"] = 2] = "Manual";
792
+ })(exports.StoreItemType || (exports.StoreItemType = {}));
793
+
794
+ exports.TournamentInstanceStatus = void 0;
795
+ (function (TournamentInstanceStatus) {
796
+ TournamentInstanceStatus[TournamentInstanceStatus["PUBLISHED"] = 1] = "PUBLISHED";
797
+ TournamentInstanceStatus[TournamentInstanceStatus["REGISTER"] = 2] = "REGISTER";
798
+ TournamentInstanceStatus[TournamentInstanceStatus["STARTED"] = 3] = "STARTED";
799
+ TournamentInstanceStatus[TournamentInstanceStatus["FINISHED"] = 4] = "FINISHED";
800
+ TournamentInstanceStatus[TournamentInstanceStatus["CANCELLED"] = 5] = "CANCELLED";
801
+ TournamentInstanceStatus[TournamentInstanceStatus["FAILED"] = 6] = "FAILED";
802
+ TournamentInstanceStatus[TournamentInstanceStatus["FINALIZING"] = 7] = "FINALIZING";
803
+ })(exports.TournamentInstanceStatus || (exports.TournamentInstanceStatus = {}));
804
+
805
+ exports.TournamentRegistrationError = void 0;
806
+ (function (TournamentRegistrationError) {
807
+ TournamentRegistrationError[TournamentRegistrationError["NO_ERROR"] = 0] = "NO_ERROR";
808
+ TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_INSTANCE_NOT_FOUND"] = 30001] = "TOURNAMENT_INSTANCE_NOT_FOUND";
809
+ TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_REGISTRATION_NOT_ENOUGH_POINTS"] = 30002] = "TOURNAMENT_REGISTRATION_NOT_ENOUGH_POINTS";
810
+ TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_INSTANCE_NOT_IN_STATE"] = 30003] = "TOURNAMENT_INSTANCE_NOT_IN_STATE";
811
+ TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_ALREADY_REGISTERED"] = 30004] = "TOURNAMENT_ALREADY_REGISTERED";
812
+ TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_USER_DONT_MATCH_CONDITIONS"] = 30005] = "TOURNAMENT_USER_DONT_MATCH_CONDITIONS";
813
+ TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_USER_NOT_REGISTERED"] = 30006] = "TOURNAMENT_USER_NOT_REGISTERED";
814
+ TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_CANT_CHANGE_REGISTRATION_STATUS"] = 30007] = "TOURNAMENT_CANT_CHANGE_REGISTRATION_STATUS";
815
+ TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_MAX_REGISTRATIONS_REACHED"] = 30008] = "TOURNAMENT_MAX_REGISTRATIONS_REACHED";
816
+ })(exports.TournamentRegistrationError || (exports.TournamentRegistrationError = {}));
817
+
818
+ exports.TournamentRegistrationStatus = void 0;
819
+ (function (TournamentRegistrationStatus) {
820
+ TournamentRegistrationStatus[TournamentRegistrationStatus["NOT_REGISTERED"] = 0] = "NOT_REGISTERED";
821
+ TournamentRegistrationStatus[TournamentRegistrationStatus["REGISTERED"] = 1] = "REGISTERED";
822
+ TournamentRegistrationStatus[TournamentRegistrationStatus["FINISHED"] = 2] = "FINISHED";
823
+ TournamentRegistrationStatus[TournamentRegistrationStatus["PENDING"] = 3] = "PENDING";
824
+ TournamentRegistrationStatus[TournamentRegistrationStatus["CANCELLED"] = 4] = "CANCELLED";
825
+ TournamentRegistrationStatus[TournamentRegistrationStatus["REGISTERED_PENDING_QUALIFICATION"] = 5] = "REGISTERED_PENDING_QUALIFICATION";
826
+ TournamentRegistrationStatus[TournamentRegistrationStatus["QUALIFIED_PENDING_REGISTRATION"] = 6] = "QUALIFIED_PENDING_REGISTRATION";
827
+ })(exports.TournamentRegistrationStatus || (exports.TournamentRegistrationStatus = {}));
828
+
829
+ exports.TournamentRegistrationType = void 0;
830
+ (function (TournamentRegistrationType) {
831
+ TournamentRegistrationType[TournamentRegistrationType["AUTO"] = 1] = "AUTO";
832
+ TournamentRegistrationType[TournamentRegistrationType["OPT_IN"] = 2] = "OPT_IN";
833
+ TournamentRegistrationType[TournamentRegistrationType["BUY_IN_POINTS"] = 3] = "BUY_IN_POINTS";
834
+ TournamentRegistrationType[TournamentRegistrationType["MANUAL_APPROVAL"] = 4] = "MANUAL_APPROVAL";
835
+ TournamentRegistrationType[TournamentRegistrationType["REQUIRES_QUALIFICATION"] = 5] = "REQUIRES_QUALIFICATION";
836
+ // BUY_IN_CASH = 5???,
837
+ })(exports.TournamentRegistrationType || (exports.TournamentRegistrationType = {}));
777
838
 
778
- exports.ShopItemType = void 0;
779
- (function (ShopItemType) {
780
- ShopItemType[ShopItemType["Bonus"] = 1] = "Bonus";
781
- ShopItemType[ShopItemType["Manual"] = 2] = "Manual";
782
- })(exports.ShopItemType || (exports.ShopItemType = {}));
839
+ exports.TournamentType = void 0;
840
+ (function (TournamentType) {
841
+ TournamentType[TournamentType["SCHEDULED"] = 1] = "SCHEDULED";
842
+ TournamentType[TournamentType["SNG"] = 2] = "SNG";
843
+ TournamentType[TournamentType["TEST"] = 3] = "TEST";
844
+ })(exports.TournamentType || (exports.TournamentType = {}));
783
845
 
784
846
  exports.SAWBuyInTypeName = SAWBuyInTypeName;
785
847
  exports.SAWGameTypeName = SAWGameTypeName;