@smartico/public-api 0.0.245 → 0.0.247

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 (71) hide show
  1. package/dist/Leaderboard/index.d.ts +1 -0
  2. package/dist/MiniGames/SAWPrizeUI.d.ts +1 -0
  3. package/dist/MiniGames/SAWSpinErrorCode.d.ts +3 -1
  4. package/dist/Quiz/MarketsAnswersType.d.ts +22 -0
  5. package/dist/Raffle/GetDrawResponse.d.ts +5 -0
  6. package/dist/Raffle/RafflePrizeWinner.d.ts +1 -1
  7. package/dist/SmarticoAPI.d.ts +2 -1
  8. package/dist/SmarticoPublicAPI.d.ts +23 -0
  9. package/dist/Store/BuyShopItemErrorCode.d.ts +10 -0
  10. package/dist/Store/BuyShopItemRequest.d.ts +4 -0
  11. package/dist/Store/BuyShopItemResponse.d.ts +4 -0
  12. package/dist/Store/GetCategoriesShopResponse.d.ts +5 -0
  13. package/dist/Store/GetShopItemsResponse.d.ts +5 -0
  14. package/dist/Store/ShopCategory.d.ts +5 -0
  15. package/dist/Store/ShopCategoryPublicMeta.d.ts +4 -0
  16. package/dist/Store/ShopItem.d.ts +9 -0
  17. package/dist/Store/ShopItemPublicMeta.d.ts +10 -0
  18. package/dist/Store/ShopItemType.d.ts +4 -0
  19. package/dist/Store/StorItemPruchased.d.ts +6 -0
  20. package/dist/WSAPI/WSAPI.d.ts +2 -1
  21. package/dist/WSAPI/WSAPITypes.d.ts +2 -0
  22. package/dist/index.js +68 -47
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.modern.mjs +54 -44
  25. package/dist/index.modern.mjs.map +1 -1
  26. package/dist/service/index.d.ts +5 -0
  27. package/dist/service/types/ErrorCodes.d.ts +13 -0
  28. package/dist/service/types/GRequest.d.ts +16 -0
  29. package/dist/service/types/GResponse.d.ts +10 -0
  30. package/dist/service/types/Game/GameAttemptType.d.ts +6 -0
  31. package/dist/service/types/Game/GameCanPlayType.d.ts +10 -0
  32. package/dist/service/types/Game/GameExternalStatus.d.ts +6 -0
  33. package/dist/service/types/Game/GameInfo.d.ts +9 -0
  34. package/dist/service/types/Game/GamePick.d.ts +90 -0
  35. package/dist/service/types/Game/GameUtil.d.ts +7 -0
  36. package/dist/service/types/SmarticoProto/GetTranslationsRequest.d.ts +7 -0
  37. package/dist/service/types/SmarticoProto/GetTranslationsResponse.d.ts +7 -0
  38. package/dist/service/types/SmarticoProto/ProtocolMessage.d.ts +5 -0
  39. package/dist/service/types/SmarticoProto/ProtocolRequest.d.ts +6 -0
  40. package/dist/service/types/SmarticoProto/ProtocolResponse.d.ts +5 -0
  41. package/dist/service/types/SmarticoProto/PublicLabelInfo.d.ts +34 -0
  42. package/dist/service/types/SmarticoProto/PublicProperties.d.ts +11 -0
  43. package/dist/service/types/SmarticoProto/ResponseIdentify.d.ts +12 -0
  44. package/dist/service/types/SmarticoProto/SAW/SAWAcknowledgeType.d.ts +5 -0
  45. package/dist/service/types/SmarticoProto/SAW/SAWBuyInType.d.ts +5 -0
  46. package/dist/service/types/SmarticoProto/SAW/SAWDoSpinRequest.d.ts +5 -0
  47. package/dist/service/types/SmarticoProto/SAW/SAWDoSpinResponse.d.ts +15 -0
  48. package/dist/service/types/SmarticoProto/SAW/SAWGameType.d.ts +10 -0
  49. package/dist/service/types/SmarticoProto/SAW/SAWGetTemplatesRequest.d.ts +3 -0
  50. package/dist/service/types/SmarticoProto/SAW/SAWGetTemplatesResponse.d.ts +5 -0
  51. package/dist/service/types/SmarticoProto/SAW/SAWPrize.d.ts +11 -0
  52. package/dist/service/types/SmarticoProto/SAW/SAWPrizeType.d.ts +8 -0
  53. package/dist/service/types/SmarticoProto/SAW/SAWPrizeUI.d.ts +13 -0
  54. package/dist/service/types/SmarticoProto/SAW/SAWTemplate.d.ts +21 -0
  55. package/dist/service/types/SmarticoProto/SAW/SAWTemplateUI.d.ts +31 -0
  56. package/dist/service/types/SmarticoProto/SAW/SAWWinSoundType.d.ts +12 -0
  57. package/dist/service/types/SmarticoProto/TranslationArea.d.ts +9 -0
  58. package/dist/service/types/User/UserInfo.d.ts +10 -0
  59. package/dist/util/Util.d.ts +51 -0
  60. package/docs/classes/WSAPI.md +17 -1
  61. package/docs/interfaces/RafflePrizeWinner.md +2 -2
  62. package/docs/interfaces/TStoreItem.md +8 -0
  63. package/package.json +1 -1
  64. package/src/Leaderboard/index.ts +1 -0
  65. package/src/MiniGames/SAWGetTemplatesResponse.ts +1 -0
  66. package/src/MiniGames/SAWPrizeUI.ts +1 -0
  67. package/src/MiniGames/SAWSpinErrorCode.ts +2 -0
  68. package/src/Raffle/RafflePrizeWinner.ts +1 -1
  69. package/src/SmarticoAPI.ts +11 -1
  70. package/src/WSAPI/WSAPI.ts +24 -11
  71. package/src/WSAPI/WSAPITypes.ts +2 -0
@@ -4,3 +4,4 @@ export * from './LeaderBoardDetails';
4
4
  export * from './LeaderBoardPeriodType';
5
5
  export * from './LeaderBoardPosition';
6
6
  export * from './LeaderBoardPublicMeta';
7
+ export * from './LeaderBoards';
@@ -25,4 +25,5 @@ export interface SAWPrizeUI {
25
25
  allow_split_decimal?: boolean;
26
26
  hide_prize_from_history?: boolean;
27
27
  hide_prize_till_won?: boolean;
28
+ requirements_to_get_prize?: string;
28
29
  }
@@ -12,5 +12,7 @@ export declare enum SAWSpinErrorCode {
12
12
  /** User tries to play a template that is restricted by date */
13
13
  SAW_TEMPLATE_NOT_ACTIVE = 40007,
14
14
  /** Special code for the 'visitor' mode */
15
- SAW_VISITOR_STOP_SPIN_REQUEST = -40001
15
+ SAW_VISITOR_STOP_SPIN_REQUEST = -40001,
16
+ /** User is not in the segment */
17
+ SAW_NOT_IN_SEGMENT = 40009
16
18
  }
@@ -0,0 +1,22 @@
1
+ export declare enum MarketsValueType {
2
+ HomeTeam = "1",
3
+ AwayTeam = "2",
4
+ Draw = "x",
5
+ HomeTeamHomeTeam = "1/1",
6
+ HomeTeamDraw = "1/x",
7
+ HomeTeamAwayTeam = "1/2",
8
+ DrawHomeTeam = "x/1",
9
+ DrawDraw = "x/x",
10
+ DrawAwayTeam = "x/2",
11
+ AwayTeamHomeTeam = "2/1",
12
+ AwayTeamDraw = "2/x",
13
+ AwayTeamAwayTeam = "2/2",
14
+ Yes = "yes",
15
+ No = "no",
16
+ Odd = "odd",
17
+ Even = "even",
18
+ HomeOdd = "1/odd",
19
+ HomeEven = "1/even",
20
+ AwayOdd = "2/odd",
21
+ AwayEven = "2/even"
22
+ }
@@ -0,0 +1,5 @@
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
2
+ import { RaffleDraw } from './RaffleDraw';
3
+ export interface GetDrawResponse extends ProtocolResponse {
4
+ draw: RaffleDraw;
5
+ }
@@ -5,6 +5,6 @@ interface RafflePrizeWinner {
5
5
  avatar_id: string;
6
6
  avatar_url?: string;
7
7
  ticket: RaffleTicket;
8
- won_id: number;
8
+ raf_won_id: number;
9
9
  }
10
10
  export { RafflePrizeWinner };
@@ -21,7 +21,7 @@ import { SAWDoAcknowledgeBatchResponse } from './MiniGames/SAWDoAcknowledgeBatch
21
21
  import { GetRelatedAchTourResponse } from './Missions/GetRelatedAchTourResponse';
22
22
  import { GetRafflesResponse } from './Raffle/GetRafflesResponse';
23
23
  import { InboxCategories } from './Inbox/InboxCategories';
24
- import { GetDrawRunRequest, GetDrawRunResponse, GetRaffleDrawRunsHistoryRequest, GetRaffleDrawRunsHistoryResponse } from './Raffle';
24
+ import { GetDrawRunRequest, GetDrawRunResponse, GetRaffleDrawRunsHistoryRequest, GetRaffleDrawRunsHistoryResponse, RaffleClaimPrizeRequest, RaffleClaimPrizeResponse } from './Raffle';
25
25
  interface Tracker {
26
26
  label_api_key: string;
27
27
  userPublicProps: any;
@@ -136,5 +136,6 @@ declare class SmarticoAPI {
136
136
  getRaffles(user_ext_id: string): Promise<GetRafflesResponse>;
137
137
  getDrawRun(user_ext_id: string, payload: GetDrawRunRequest): Promise<GetDrawRunResponse>;
138
138
  getRaffleDrawRunsHistory(user_ext_id: string, payload: GetRaffleDrawRunsHistoryRequest): Promise<GetRaffleDrawRunsHistoryResponse>;
139
+ claimRafflePrize(user_ext_id: string, payload: RaffleClaimPrizeRequest): Promise<RaffleClaimPrizeResponse>;
139
140
  }
140
141
  export { SmarticoAPI, MessageSender };
@@ -0,0 +1,23 @@
1
+ import { ClassId } from "./Base/ClassId";
2
+ import { SAWGetTemplatesResponse } from './MiniGames/SAWGetTemplatesResponse';
3
+ import { SAWTemplate } from './MiniGames/SAWTemplate';
4
+ import { ILogger } from './ILogger';
5
+ interface IOptions {
6
+ logger?: ILogger;
7
+ logCIDs?: ClassId[];
8
+ logHTTPTiming?: boolean;
9
+ }
10
+ declare class SmarticoPublicApi {
11
+ private label_api_key;
12
+ private brand_api_key;
13
+ private publicUrl;
14
+ private logger;
15
+ private logCIDs;
16
+ private logHTTPTiming;
17
+ constructor(label_api_key: string, brand_api_key: string, options?: IOptions);
18
+ private send;
19
+ private buildMessage;
20
+ miniGamesGetTemplates(user_ext_id: string): Promise<SAWGetTemplatesResponse>;
21
+ miniGamesFormatTemplatesForWidget(templates: SAWTemplate[], pointsBalance: number): any[];
22
+ }
23
+ export { SmarticoPublicApi };
@@ -0,0 +1,10 @@
1
+ export declare enum BuyShopItemErrorCode {
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 BuyShopItemRequest extends ProtocolMessage {
3
+ itemId: number;
4
+ }
@@ -0,0 +1,4 @@
1
+ import { ProtocolResponse } from "../Base/ProtocolResponse";
2
+ export interface BuyShopItemResponse extends ProtocolResponse {
3
+ success?: boolean;
4
+ }
@@ -0,0 +1,5 @@
1
+ import { ProtocolResponse } from "../Base/ProtocolResponse";
2
+ import { ShopCategory } from "./ShopCategory";
3
+ export interface GetCategoriesShopResponse extends ProtocolResponse {
4
+ categories: ShopCategory[];
5
+ }
@@ -0,0 +1,5 @@
1
+ import { ProtocolResponse } from "../Base/ProtocolResponse";
2
+ import { ShopItem } from "./ShopItem";
3
+ export interface GetShopItemsResponse extends ProtocolResponse {
4
+ items: ShopItem[];
5
+ }
@@ -0,0 +1,5 @@
1
+ import { ShopCategoryPublicMeta } from "./ShopCategoryPublicMeta";
2
+ export interface ShopCategory {
3
+ id?: number;
4
+ publicMeta?: ShopCategoryPublicMeta;
5
+ }
@@ -0,0 +1,4 @@
1
+ export interface ShopCategoryPublicMeta {
2
+ name?: string;
3
+ order?: number;
4
+ }
@@ -0,0 +1,9 @@
1
+ import { ShopItemPublicMeta } from "./ShopItemPublicMeta";
2
+ import { ShopItemType } from "./ShopItemType";
3
+ export interface ShopItem {
4
+ id: number;
5
+ itemTypeId: ShopItemType;
6
+ itemPublicMeta: ShopItemPublicMeta;
7
+ categoryIds?: number[];
8
+ canBuy?: boolean;
9
+ }
@@ -0,0 +1,10 @@
1
+ export interface ShopItemPublicMeta {
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 ShopItemType {
2
+ Bonus = 1,
3
+ Manual = 2
4
+ }
@@ -0,0 +1,6 @@
1
+ import { StoreItem } from "./StoreItem";
2
+ interface StorItemPruchased extends StoreItem {
3
+ purchase_ts: number;
4
+ purchase_points_amount: number;
5
+ }
6
+ export { StorItemPruchased };
@@ -5,7 +5,7 @@ import { JackpotDetails, JackpotsOptinResponse, JackpotsOptoutResponse } from '.
5
5
  import { GetRelatedAchTourResponse } from '../Missions/GetRelatedAchTourResponse';
6
6
  import { GetRafflesResponse } from '../Raffle/GetRafflesResponse';
7
7
  import { InboxCategories } from '../Inbox/InboxCategories';
8
- import { GetDrawRunRequest, GetDrawRunResponse, GetRaffleDrawRunsHistoryRequest, GetRaffleDrawRunsHistoryResponse } from '../Raffle';
8
+ import { GetDrawRunRequest, GetDrawRunResponse, GetRaffleDrawRunsHistoryRequest, GetRaffleDrawRunsHistoryResponse, RaffleClaimPrizeRequest, RaffleClaimPrizeResponse } from '../Raffle';
9
9
  /** @group General API */
10
10
  export declare class WSAPI {
11
11
  private api;
@@ -548,4 +548,5 @@ export declare class WSAPI {
548
548
  getRaffles(): Promise<GetRafflesResponse>;
549
549
  getDrawRun(payload: GetDrawRunRequest): Promise<GetDrawRunResponse>;
550
550
  getRaffleDrawRunsHistory(payload: GetRaffleDrawRunsHistoryRequest): Promise<GetRaffleDrawRunsHistoryResponse>;
551
+ claimRafflePrize(payload: RaffleClaimPrizeRequest): Promise<RaffleClaimPrizeResponse>;
551
552
  }
@@ -72,6 +72,8 @@ export interface TMiniGamePrize {
72
72
  allow_split_decimal?: boolean;
73
73
  /** When enabled, you can hide prize from prize history */
74
74
  hide_prize_from_history?: boolean;
75
+ /** Requirements to claim the prize (lootbox specific)*/
76
+ requirements_to_get_prize?: string;
75
77
  }
76
78
  /**
77
79
  * TMiniGamePlayResult describes the response of call to _smartico.api.playMiniGame(template_id) method
package/dist/index.js CHANGED
@@ -458,7 +458,8 @@ var SAWTemplatesTransform = function SAWTemplatesTransform(items) {
458
458
  custom_data: IntUtils.JsonOrText((_p$saw_prize_ui_defin = p.saw_prize_ui_definition) == null ? void 0 : _p$saw_prize_ui_defin.custom_data),
459
459
  prize_modifiers: p.saw_prize_ui_definition.prize_modifiers,
460
460
  allow_split_decimal: p.saw_prize_ui_definition.allow_split_decimal,
461
- hide_prize_from_history: p.saw_prize_ui_definition.hide_prize_from_history
461
+ hide_prize_from_history: p.saw_prize_ui_definition.hide_prize_from_history,
462
+ requirements_to_get_prize: p.saw_prize_ui_definition.requirements_to_get_prize
462
463
  };
463
464
  return y;
464
465
  })
@@ -486,6 +487,8 @@ exports.SAWSpinErrorCode = void 0;
486
487
  SAWSpinErrorCode[SAWSpinErrorCode["SAW_TEMPLATE_NOT_ACTIVE"] = 40007] = "SAW_TEMPLATE_NOT_ACTIVE";
487
488
  /** Special code for the 'visitor' mode */
488
489
  SAWSpinErrorCode[SAWSpinErrorCode["SAW_VISITOR_STOP_SPIN_REQUEST"] = -40001] = "SAW_VISITOR_STOP_SPIN_REQUEST";
490
+ /** User is not in the segment */
491
+ SAWSpinErrorCode[SAWSpinErrorCode["SAW_NOT_IN_SEGMENT"] = 40009] = "SAW_NOT_IN_SEGMENT";
489
492
  })(exports.SAWSpinErrorCode || (exports.SAWSpinErrorCode = {}));
490
493
 
491
494
  var _SAWWinSoundFiles;
@@ -1553,6 +1556,52 @@ exports.LeaderBoardPeriodType = void 0;
1553
1556
  LeaderBoardPeriodType[LeaderBoardPeriodType["MONTHLY"] = 3] = "MONTHLY";
1554
1557
  })(exports.LeaderBoardPeriodType || (exports.LeaderBoardPeriodType = {}));
1555
1558
 
1559
+ var pointsRewardTransform = function pointsRewardTransform(reward_points) {
1560
+ if (reward_points && reward_points.length) {
1561
+ return reward_points.map(function (r, i) {
1562
+ return {
1563
+ place: i + 1,
1564
+ points: r
1565
+ };
1566
+ });
1567
+ }
1568
+ return null;
1569
+ };
1570
+ var getLeaderBoardPlayerTransformed = function getLeaderBoardPlayerTransformed(user, isMe) {
1571
+ if (user) {
1572
+ var x = {
1573
+ public_username: (user == null ? void 0 : user.public_username) || user.user_alt_name,
1574
+ avatar_url: user.avatar_url,
1575
+ position: user.position_in_board,
1576
+ points: user.points_accumulated,
1577
+ is_me: user.is_me
1578
+ };
1579
+ if (isMe) {
1580
+ delete x.is_me;
1581
+ }
1582
+ return x;
1583
+ }
1584
+ return null;
1585
+ };
1586
+ var getLeaderBoardTransform = function getLeaderBoardTransform(board) {
1587
+ if (board) {
1588
+ var x = {
1589
+ board_id: board.board_id,
1590
+ name: board.board_public_meta.name,
1591
+ description: board.board_public_meta.description,
1592
+ rules: board.board_public_meta.rules,
1593
+ period_type_id: board.period_type_id,
1594
+ rewards: pointsRewardTransform(board.reward_points),
1595
+ users: board.positions.map(function (p) {
1596
+ return getLeaderBoardPlayerTransformed(p);
1597
+ }),
1598
+ me: getLeaderBoardPlayerTransformed(board.userPosition, true)
1599
+ };
1600
+ return x;
1601
+ }
1602
+ return null;
1603
+ };
1604
+
1556
1605
  var GetLevelMapResponseTransform = function GetLevelMapResponseTransform(levels) {
1557
1606
  return levels == null ? void 0 : levels.levels.map(function (l) {
1558
1607
  var _l$level_public_meta;
@@ -2801,55 +2850,17 @@ var WSAPI = /*#__PURE__*/function () {
2801
2850
  return Promise.reject(e);
2802
2851
  }
2803
2852
  };
2853
+ _proto.claimRafflePrize = function claimRafflePrize(payload) {
2854
+ try {
2855
+ var _this49 = this;
2856
+ return Promise.resolve(_this49.api.claimRafflePrize(null, payload));
2857
+ } catch (e) {
2858
+ return Promise.reject(e);
2859
+ }
2860
+ };
2804
2861
  return WSAPI;
2805
2862
  }();
2806
2863
 
2807
- var pointsRewardTransform = function pointsRewardTransform(reward_points) {
2808
- if (reward_points && reward_points.length) {
2809
- return reward_points.map(function (r, i) {
2810
- return {
2811
- place: i + 1,
2812
- points: r
2813
- };
2814
- });
2815
- }
2816
- return null;
2817
- };
2818
- var getLeaderBoardPlayerTransformed = function getLeaderBoardPlayerTransformed(user, isMe) {
2819
- if (user) {
2820
- var x = {
2821
- public_username: (user == null ? void 0 : user.public_username) || user.user_alt_name,
2822
- avatar_url: user.avatar_url,
2823
- position: user.position_in_board,
2824
- points: user.points_accumulated,
2825
- is_me: user.is_me
2826
- };
2827
- if (isMe) {
2828
- delete x.is_me;
2829
- }
2830
- return x;
2831
- }
2832
- return null;
2833
- };
2834
- var getLeaderBoardTransform = function getLeaderBoardTransform(board) {
2835
- if (board) {
2836
- var x = {
2837
- board_id: board.board_id,
2838
- name: board.board_public_meta.name,
2839
- description: board.board_public_meta.description,
2840
- rules: board.board_public_meta.rules,
2841
- period_type_id: board.period_type_id,
2842
- rewards: pointsRewardTransform(board.reward_points),
2843
- users: board.positions.map(function (p) {
2844
- return getLeaderBoardPlayerTransformed(p);
2845
- }),
2846
- me: getLeaderBoardPlayerTransformed(board.userPosition, true)
2847
- };
2848
- return x;
2849
- }
2850
- return null;
2851
- };
2852
-
2853
2864
  var AchCustomSectionType;
2854
2865
  (function (AchCustomSectionType) {
2855
2866
  AchCustomSectionType[AchCustomSectionType["HTML_PAGE"] = 1] = "HTML_PAGE";
@@ -4048,6 +4059,15 @@ var SmarticoAPI = /*#__PURE__*/function () {
4048
4059
  return Promise.reject(e);
4049
4060
  }
4050
4061
  };
4062
+ _proto.claimRafflePrize = function claimRafflePrize(user_ext_id, payload) {
4063
+ try {
4064
+ var _this66 = this;
4065
+ var message = _this66.buildMessage(user_ext_id, exports.ClassId.RAF_CLAIM_PRIZE_REQUEST, payload);
4066
+ return Promise.resolve(_this66.send(message, exports.ClassId.RAF_CLAIM_PRIZE_RESPONSE));
4067
+ } catch (e) {
4068
+ return Promise.reject(e);
4069
+ }
4070
+ };
4051
4071
  return SmarticoAPI;
4052
4072
  }();
4053
4073
 
@@ -4482,6 +4502,7 @@ exports.TournamentRegistrationStatusNamed = TournamentRegistrationStatusNamed;
4482
4502
  exports.TournamentRegistrationTypeGetName = TournamentRegistrationTypeGetName;
4483
4503
  exports.TournamentUtils = TournamentUtils;
4484
4504
  exports.UserAchievementTransform = UserAchievementTransform;
4505
+ exports.getLeaderBoardTransform = getLeaderBoardTransform;
4485
4506
  exports.marketsInfo = marketsInfo;
4486
4507
  exports.quizAnswerAwayTeamReplacementText = quizAnswerAwayTeamReplacementText;
4487
4508
  exports.quizAnswerHomeTeamReplacementText = quizAnswerHomeTeamReplacementText;