@smartico/public-api 0.0.2 → 0.0.4

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 (96) hide show
  1. package/.nvmrc +1 -1
  2. package/dist/Base/ClassId.d.ts +21 -0
  3. package/dist/Base/ProtocolMessage.d.ts +5 -0
  4. package/dist/Base/ProtocolRequest.d.ts +6 -0
  5. package/dist/Base/ProtocolResponse.d.ts +5 -0
  6. package/dist/ErrorCodes.d.ts +12 -0
  7. package/dist/GResponse.d.ts +9 -0
  8. package/dist/ILogger.d.ts +7 -0
  9. package/dist/IntUtils.d.ts +8 -0
  10. package/dist/MiniGames/SAWAcknowledgeType.d.ts +5 -0
  11. package/dist/MiniGames/SAWBuyInType.d.ts +10 -0
  12. package/dist/MiniGames/SAWDoSpinRequest.d.ts +5 -0
  13. package/dist/MiniGames/SAWDoSpinResponse.d.ts +15 -0
  14. package/dist/MiniGames/SAWGameType.d.ts +10 -0
  15. package/dist/MiniGames/SAWGetTemplatesRequest.d.ts +3 -0
  16. package/dist/MiniGames/SAWGetTemplatesResponse.d.ts +5 -0
  17. package/dist/MiniGames/SAWPrize.d.ts +11 -0
  18. package/dist/MiniGames/SAWPrizeType.d.ts +8 -0
  19. package/dist/MiniGames/SAWPrizeUI.d.ts +13 -0
  20. package/dist/MiniGames/SAWTemplate.d.ts +26 -0
  21. package/dist/MiniGames/SAWTemplateUI.d.ts +31 -0
  22. package/dist/MiniGames/SAWWinSoundType.d.ts +12 -0
  23. package/dist/MiniGames/index.d.ts +14 -0
  24. package/dist/SmarticoAPI.d.ts +23 -0
  25. package/dist/SmarticoPublicAPI.d.ts +23 -0
  26. package/dist/index.d.ts +5 -2
  27. package/dist/index.js +322 -241
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.modern.mjs +232 -231
  30. package/dist/index.modern.mjs.map +1 -1
  31. package/dist/service/index.d.ts +3 -2
  32. package/dist/service/types/ErrorCodes.d.ts +13 -0
  33. package/dist/service/types/GRequest.d.ts +16 -0
  34. package/dist/service/types/GResponse.d.ts +10 -0
  35. package/dist/service/types/Game/GameAttemptType.d.ts +6 -0
  36. package/{src/service/types/Game/GameCanPlayType.ts → dist/service/types/Game/GameCanPlayType.d.ts} +10 -11
  37. package/dist/service/types/Game/GameExternalStatus.d.ts +6 -0
  38. package/{src/service/types/Game/GameInfo.ts → dist/service/types/Game/GameInfo.d.ts} +9 -11
  39. package/{src/service/types/Game/GamePick.ts → dist/service/types/Game/GamePick.d.ts} +90 -104
  40. package/dist/service/types/Game/GameUtil.d.ts +7 -0
  41. package/{src/service/types/SmarticoProto/GetTranslationsRequest.ts → dist/service/types/SmarticoProto/GetTranslationsRequest.d.ts} +7 -9
  42. package/{src/service/types/SmarticoProto/GetTranslationsResponse.ts → dist/service/types/SmarticoProto/GetTranslationsResponse.d.ts} +7 -8
  43. package/dist/service/types/SmarticoProto/ProtocolMessage.d.ts +5 -0
  44. package/dist/service/types/SmarticoProto/ProtocolRequest.d.ts +6 -0
  45. package/dist/service/types/SmarticoProto/ProtocolResponse.d.ts +5 -0
  46. package/{src/service/types/SmarticoProto/PublicLabelInfo.ts → dist/service/types/SmarticoProto/PublicLabelInfo.d.ts} +34 -39
  47. package/{src/service/types/SmarticoProto/PublicProperties.ts → dist/service/types/SmarticoProto/PublicProperties.d.ts} +11 -11
  48. package/{src/service/types/SmarticoProto/ResponseIdentify.ts → dist/service/types/SmarticoProto/ResponseIdentify.d.ts} +12 -16
  49. package/dist/service/types/SmarticoProto/SAW/SAWAcknowledgeType.d.ts +5 -0
  50. package/{src/service/types/SmarticoProto/SAW/SAWBuyInType.ts → dist/service/types/SmarticoProto/SAW/SAWBuyInType.d.ts} +5 -5
  51. package/{src/service/types/SmarticoProto/SAW/SAWDoSpinRequest.ts → dist/service/types/SmarticoProto/SAW/SAWDoSpinRequest.d.ts} +5 -8
  52. package/dist/service/types/SmarticoProto/SAW/SAWDoSpinResponse.d.ts +15 -0
  53. package/dist/service/types/SmarticoProto/SAW/SAWGameType.d.ts +10 -0
  54. package/{src/service/types/SmarticoProto/SAW/SAWGetTemplatesRequest.ts → dist/service/types/SmarticoProto/SAW/SAWGetTemplatesRequest.d.ts} +3 -5
  55. package/{src/service/types/SmarticoProto/SAW/SAWGetTemplatesResponse.ts → dist/service/types/SmarticoProto/SAW/SAWGetTemplatesResponse.d.ts} +5 -8
  56. package/dist/service/types/SmarticoProto/SAW/SAWPrize.d.ts +11 -0
  57. package/dist/service/types/SmarticoProto/SAW/SAWPrizeType.d.ts +8 -0
  58. package/dist/service/types/SmarticoProto/SAW/SAWPrizeUI.d.ts +13 -0
  59. package/dist/service/types/SmarticoProto/SAW/SAWTemplate.d.ts +21 -0
  60. package/dist/service/types/SmarticoProto/SAW/SAWTemplateUI.d.ts +31 -0
  61. package/dist/service/types/SmarticoProto/SAW/SAWWinSoundType.d.ts +12 -0
  62. package/{src/service/types/SmarticoProto/TranslationArea.ts → dist/service/types/SmarticoProto/TranslationArea.d.ts} +9 -11
  63. package/{src/service/types/User/UserInfo.ts → dist/service/types/User/UserInfo.d.ts} +10 -12
  64. package/package.json +2 -1
  65. package/src/Base/ClassId.ts +26 -0
  66. package/src/{service/types/SmarticoProto → Base}/ProtocolMessage.ts +0 -0
  67. package/src/{service/types/SmarticoProto → Base}/ProtocolRequest.ts +0 -0
  68. package/src/{service/types/SmarticoProto → Base}/ProtocolResponse.ts +0 -0
  69. package/src/{service/types/ErrorCodes.ts → ErrorCodes.ts} +1 -3
  70. package/src/{service/types/GResponse.ts → GResponse.ts} +0 -0
  71. package/src/ILogger.ts +11 -0
  72. package/src/IntUtils.ts +39 -0
  73. package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWAcknowledgeType.ts +0 -0
  74. package/src/MiniGames/SAWBuyInType.ts +11 -0
  75. package/src/MiniGames/SAWDoSpinRequest.ts +8 -0
  76. package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWDoSpinResponse.ts +1 -1
  77. package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWGameType.ts +2 -2
  78. package/src/MiniGames/SAWGetTemplatesRequest.ts +5 -0
  79. package/src/MiniGames/SAWGetTemplatesResponse.ts +8 -0
  80. package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWPrize.ts +0 -0
  81. package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWPrizeType.ts +0 -0
  82. package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWPrizeUI.ts +0 -0
  83. package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWTemplate.ts +5 -0
  84. package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWTemplateUI.ts +0 -0
  85. package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWWinSoundType.ts +0 -0
  86. package/src/MiniGames/index.ts +30 -0
  87. package/src/SmarticoAPI.ts +177 -0
  88. package/src/index.ts +11 -2
  89. package/tsconfig.json +17 -0
  90. package/src/service/index.ts +0 -12
  91. package/src/service/types/GRequest.ts +0 -18
  92. package/src/service/types/Game/GameAttemptType.ts +0 -8
  93. package/src/service/types/Game/GameExternalStatus.ts +0 -7
  94. package/src/service/types/Game/GameUtil.ts +0 -30
  95. package/src/util/Util.ts +0 -306
  96. package/test/package.json +0 -11
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- v18.13.0
1
+ v13.13.0
@@ -0,0 +1,21 @@
1
+ export declare enum ClassId {
2
+ GET_LABEL_INFO = 3,
3
+ GET_LABEL_INFO_RESPONSE = 4,
4
+ IDENTIFY = 5,
5
+ IDENTIFY_RESPONSE = 6,
6
+ EVENT = 9,
7
+ EVENT_RESPONSE = 10,
8
+ GET_TRANSLATIONS_REQUEST = 13,
9
+ GET_TRANSLATIONS_RESPONSE = 14,
10
+ CHANGE_USERNAME = 159,
11
+ CHANGE_USERNAME_RESPONSE = 160,
12
+ SAW_GET_SPINS_REQUEST = 700,
13
+ SAW_GET_SPINS_RESPONSE = 701,
14
+ SAW_DO_SPIN_REQUEST = 702,
15
+ SAW_DO_SPIN_RESPONSE = 703,
16
+ SAW_AKNOWLEDGE_REQUEST = 704,
17
+ SAW_AKNOWLEDGE_RESPONSE = 705,
18
+ SAW_SPINS_COUNT_PUSH = 706,
19
+ SAW_SHOW_SPIN_PUSH = 707,
20
+ UNSUPPORTED_COMMAND = 99999
21
+ }
@@ -0,0 +1,5 @@
1
+ export interface ProtocolMessage {
2
+ cid: number;
3
+ ts?: number;
4
+ uuid?: string;
5
+ }
@@ -0,0 +1,6 @@
1
+ import { ProtocolMessage } from "./ProtocolMessage";
2
+ export interface ProtocolRequest extends ProtocolMessage {
3
+ api_key: string;
4
+ brand_key: string;
5
+ ext_user_id: string;
6
+ }
@@ -0,0 +1,5 @@
1
+ import { ProtocolMessage } from "./ProtocolMessage";
2
+ export interface ProtocolResponse extends ProtocolMessage {
3
+ errCode?: number;
4
+ errMsg?: string;
5
+ }
@@ -0,0 +1,12 @@
1
+ export declare const ErrorCodes_FatalStartingRange = 100000;
2
+ export declare enum ErrorCodesGame {
3
+ OK = 0,
4
+ NoBetsUpdatedOnSubmit = 3,
5
+ RepeatRequest_Unhandled = 4,
6
+ Fatal_NotValidHash,
7
+ Fatal_WrongCustomerID,
8
+ Fatal_TemplateNotFound,
9
+ Fatal_NoOpenRounds,
10
+ Fatal_Unhandled
11
+ }
12
+ export type ErrorCodes = ErrorCodesGame;
@@ -0,0 +1,9 @@
1
+ import { ErrorCodes } from "./ErrorCodes";
2
+ interface GResponseBase {
3
+ errCode: ErrorCodes;
4
+ errMessage?: string;
5
+ }
6
+ interface GResponse<T> extends GResponseBase {
7
+ data?: T;
8
+ }
9
+ export { GResponseBase, GResponse };
@@ -0,0 +1,7 @@
1
+ export interface ILogger {
2
+ debug(...any: any[]): void;
3
+ error(...any: any[]): void;
4
+ info(...any: any[]): void;
5
+ warn(...any: any[]): void;
6
+ always(...any: any[]): void;
7
+ }
@@ -0,0 +1,8 @@
1
+ declare class IntUtils {
2
+ static uuid(): string;
3
+ static isNotNull(val: any): boolean;
4
+ static isNotEmpty(val: string): boolean;
5
+ static replaceAll(value: string, regex: string, replacement: string | number): string;
6
+ static escapeRegExp(v: string): string;
7
+ }
8
+ export { IntUtils };
@@ -0,0 +1,5 @@
1
+ export declare enum SAWAcknowledgeType {
2
+ Silent = 1,
3
+ QuickMessage = 2,
4
+ FullMessage = 3
5
+ }
@@ -0,0 +1,10 @@
1
+ export declare enum SAWBuyInType {
2
+ Free = 1,
3
+ Points = 2,
4
+ Spins = 3
5
+ }
6
+ export declare const SAWBuyInTypeName: {
7
+ 1: string;
8
+ 2: string;
9
+ 3: string;
10
+ };
@@ -0,0 +1,5 @@
1
+ import { ProtocolRequest } from "./../Base/ProtocolRequest";
2
+ export interface SAWDoSpinRequest extends ProtocolRequest {
3
+ request_id: string;
4
+ saw_template_id: number;
5
+ }
@@ -0,0 +1,15 @@
1
+ import { ProtocolResponse } from "./../Base/ProtocolResponse";
2
+ export declare enum SAWSpinErrorCode {
3
+ SAW_OK = 0,
4
+ SAW_NO_SPINS = 40001,
5
+ SAW_PRIZE_POOL_EMPTY = 40002,
6
+ SAW_NOT_ENOUGH_POINTS = 40003,
7
+ SAW_FAILED_MAX_SPINS_REACHED = 40004
8
+ }
9
+ export interface SAWDoSpinResponse extends ProtocolResponse {
10
+ errCode: SAWSpinErrorCode;
11
+ errMsg?: string;
12
+ request_id: string;
13
+ saw_prize_id: number;
14
+ first_spin_in_period: number;
15
+ }
@@ -0,0 +1,10 @@
1
+ export declare enum SAWGameType {
2
+ SpinAWheel = 1,
3
+ ScratchCard = 2,
4
+ MatchX = 3
5
+ }
6
+ export declare const SAWGameTypeName: {
7
+ 1: string;
8
+ 2: string;
9
+ 3: string;
10
+ };
@@ -0,0 +1,3 @@
1
+ import { ProtocolRequest } from "./../Base/ProtocolRequest";
2
+ export interface SAWGetTemplatesRequest extends ProtocolRequest {
3
+ }
@@ -0,0 +1,5 @@
1
+ import { ProtocolResponse } from "./../Base/ProtocolResponse";
2
+ import { SAWTemplate } from "./SAWTemplate";
3
+ export interface SAWGetTemplatesResponse extends ProtocolResponse {
4
+ templates: SAWTemplate[];
5
+ }
@@ -0,0 +1,11 @@
1
+ import { SAWPrizeType } from "./SAWPrizeType";
2
+ import { SAWPrizeUI } from "./SAWPrizeUI";
3
+ export interface SAWPrize {
4
+ saw_prize_id: number;
5
+ saw_prize_ui_definition: SAWPrizeUI;
6
+ prize_value?: number;
7
+ prize_type_id: SAWPrizeType;
8
+ place_from?: number;
9
+ place_to?: number;
10
+ sawUniqueWinId?: string;
11
+ }
@@ -0,0 +1,8 @@
1
+ export declare enum SAWPrizeType {
2
+ NO_PRIZE = 1,
3
+ POINTS = 2,
4
+ BONUS = 3,
5
+ MANUAL = 4,
6
+ SPIN = 5,
7
+ JACKPOT = 6
8
+ }
@@ -0,0 +1,13 @@
1
+ import { SAWAcknowledgeType } from "./SAWAcknowledgeType";
2
+ import { SAWWinSoundType } from "./SAWWinSoundType";
3
+ export interface SAWPrizeUI {
4
+ position?: number;
5
+ name: string;
6
+ aknowledge_message: string;
7
+ sectors: number[];
8
+ acknowledge_type: SAWAcknowledgeType;
9
+ acknowledge_dp?: string;
10
+ font_size?: number;
11
+ sound_type: SAWWinSoundType;
12
+ icon?: string;
13
+ }
@@ -0,0 +1,26 @@
1
+ import { SAWBuyInType } from "./SAWBuyInType";
2
+ import { SAWGameType } from "./SAWGameType";
3
+ import { SAWPrize } from "./SAWPrize";
4
+ import { SAWTemplateUI } from "./SAWTemplateUI";
5
+ export interface SAWTemplate {
6
+ saw_template_id: number;
7
+ saw_game_type_id: SAWGameType;
8
+ saw_template_ui_definition: SAWTemplateUI;
9
+ saw_buyin_type_id: SAWBuyInType;
10
+ buyin_cost_points?: number;
11
+ visibile_when_can_spin: boolean;
12
+ spin_count?: number;
13
+ prizes: SAWPrize[];
14
+ is_visible: boolean;
15
+ jackpot_add_on_attempt: number;
16
+ jackpot_current: number;
17
+ jackpot_guaranteed: number;
18
+ maxActiveSpinsAllowed: number;
19
+ maxSpinsCount: number;
20
+ maxSpinsPediodMs: number;
21
+ saw_skin_key: string;
22
+ saw_skin_ui_definition: {
23
+ skin_folder: string;
24
+ skin_css: string;
25
+ };
26
+ }
@@ -0,0 +1,31 @@
1
+ export declare enum AskForUsername {
2
+ NOASK = "no-ask",
3
+ ONSUMBIT = "on-submit"
4
+ }
5
+ export interface SAWTemplateUI {
6
+ skin: string;
7
+ name: string;
8
+ description?: string;
9
+ over_limit_message?: string;
10
+ no_attempts_message?: string;
11
+ thumbnail?: string;
12
+ sectors_count: number;
13
+ priority: number;
14
+ flow_builder_only: boolean;
15
+ background_image?: string;
16
+ background_image_mobile?: string;
17
+ background_sound?: string;
18
+ scratch_logo?: string;
19
+ scratch_cover?: string;
20
+ scratch_bg_desktop?: string;
21
+ scratch_bg_mobile?: string;
22
+ scratch_cursor?: string;
23
+ custom_css?: string;
24
+ custom_skin_folder?: string;
25
+ jackpot_symbol?: string;
26
+ promo_image?: string;
27
+ promo_text?: string;
28
+ ask_for_username?: AskForUsername;
29
+ show_prize_board?: boolean;
30
+ max_spins_period_ms?: number;
31
+ }
@@ -0,0 +1,12 @@
1
+ export declare enum SAWWinSoundType {
2
+ Disappointing = 1,
3
+ Positive = 2,
4
+ HighlyPositive = 3,
5
+ NoSound = 4
6
+ }
7
+ export declare const SAWWinSoundFiles: {
8
+ 4: any;
9
+ 1: string;
10
+ 2: string;
11
+ 3: string;
12
+ };
@@ -0,0 +1,14 @@
1
+ import { SAWAcknowledgeType } from "./SAWAcknowledgeType";
2
+ import { SAWBuyInType, SAWBuyInTypeName } from "./SAWBuyInType";
3
+ import { SAWDoSpinRequest } from "./SAWDoSpinRequest";
4
+ import { SAWDoSpinResponse, SAWSpinErrorCode } from "./SAWDoSpinResponse";
5
+ import { SAWGameType, SAWGameTypeName } from "./SAWGameType";
6
+ import { SAWGetTemplatesRequest } from "./SAWGetTemplatesRequest";
7
+ import { SAWGetTemplatesResponse } from "./SAWGetTemplatesResponse";
8
+ import { SAWPrize } from "./SAWPrize";
9
+ import { SAWPrizeType } from "./SAWPrizeType";
10
+ import { SAWPrizeUI } from "./SAWPrizeUI";
11
+ import { SAWTemplate } from "./SAWTemplate";
12
+ import { SAWTemplateUI } from "./SAWTemplateUI";
13
+ import { SAWWinSoundType, SAWWinSoundFiles } from "./SAWWinSoundType";
14
+ export { SAWAcknowledgeType, SAWBuyInType, SAWBuyInTypeName, SAWDoSpinRequest, SAWDoSpinResponse, SAWSpinErrorCode, SAWGameType, SAWGameTypeName, SAWGetTemplatesRequest, SAWGetTemplatesResponse, SAWPrize, SAWPrizeType, SAWPrizeUI, SAWTemplate, SAWTemplateUI, SAWWinSoundType, SAWWinSoundFiles };
@@ -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 SmarticoAPI {
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 { SmarticoAPI };
@@ -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 };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,5 @@
1
- export { Util } from './util/Util';
2
- export * from './service';
1
+ import { ClassId } from './Base/ClassId';
2
+ import { ILogger } from './ILogger';
3
+ import { SmarticoAPI } from './SmarticoAPI';
4
+ export * from './MiniGames';
5
+ export { SmarticoAPI, ClassId, ILogger };