@smartico/public-api 0.0.3 → 0.0.5

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 (123) hide show
  1. package/.nvmrc +1 -1
  2. package/README.md +23 -44
  3. package/dist/Base/ClassId.d.ts +21 -0
  4. package/dist/Base/ProtocolMessage.d.ts +5 -0
  5. package/dist/Base/ProtocolRequest.d.ts +6 -0
  6. package/dist/Base/ProtocolResponse.d.ts +5 -0
  7. package/dist/Core/GetLabelInfoRequest.d.ts +3 -0
  8. package/dist/Core/GetLabelInfoResponse.d.ts +7 -0
  9. package/dist/Core/GetTranslationsRequest.d.ts +7 -0
  10. package/dist/Core/GetTranslationsResponse.d.ts +7 -0
  11. package/dist/Core/PublicLabelSettings.d.ts +28 -0
  12. package/dist/Core/PublicProperties.d.ts +11 -0
  13. package/dist/Core/ResponseIdentify.d.ts +12 -0
  14. package/dist/Core/TranslationArea.d.ts +9 -0
  15. package/dist/Core/index.d.ts +8 -0
  16. package/dist/ErrorCodes.d.ts +12 -0
  17. package/dist/GResponse.d.ts +9 -0
  18. package/dist/ILogger.d.ts +7 -0
  19. package/dist/IntUtils.d.ts +8 -0
  20. package/dist/MiniGames/SAWAcknowledgeType.d.ts +5 -0
  21. package/dist/MiniGames/SAWAskForUsername.d.ts +4 -0
  22. package/dist/MiniGames/SAWBuyInType.d.ts +10 -0
  23. package/dist/MiniGames/SAWDoSpinRequest.d.ts +5 -0
  24. package/dist/MiniGames/SAWDoSpinResponse.d.ts +9 -0
  25. package/dist/MiniGames/SAWGameType.d.ts +10 -0
  26. package/dist/MiniGames/SAWGetTemplatesRequest.d.ts +3 -0
  27. package/dist/MiniGames/SAWGetTemplatesResponse.d.ts +5 -0
  28. package/dist/MiniGames/SAWPrize.d.ts +11 -0
  29. package/dist/MiniGames/SAWPrizeType.d.ts +8 -0
  30. package/dist/MiniGames/SAWPrizeUI.d.ts +13 -0
  31. package/dist/MiniGames/SAWSpinErrorCode.d.ts +7 -0
  32. package/dist/MiniGames/SAWTemplate.d.ts +26 -0
  33. package/dist/MiniGames/SAWTemplateUI.d.ts +28 -0
  34. package/dist/MiniGames/SAWUtils.d.ts +5 -0
  35. package/dist/MiniGames/SAWWinSoundType.d.ts +12 -0
  36. package/dist/MiniGames/index.d.ts +17 -0
  37. package/dist/OCache.d.ts +11 -0
  38. package/dist/SmarticoAPI.d.ts +35 -0
  39. package/dist/SmarticoPublicAPI.d.ts +23 -0
  40. package/dist/index.d.ts +6 -2
  41. package/dist/index.js +576 -219
  42. package/dist/index.js.map +1 -1
  43. package/dist/index.modern.mjs +417 -218
  44. package/dist/index.modern.mjs.map +1 -1
  45. package/dist/service/index.d.ts +3 -2
  46. package/dist/service/types/ErrorCodes.d.ts +13 -0
  47. package/dist/service/types/GRequest.d.ts +16 -0
  48. package/dist/service/types/GResponse.d.ts +10 -0
  49. package/dist/service/types/Game/GameAttemptType.d.ts +6 -0
  50. package/{src/service/types/Game/GameCanPlayType.ts → dist/service/types/Game/GameCanPlayType.d.ts} +10 -11
  51. package/dist/service/types/Game/GameExternalStatus.d.ts +6 -0
  52. package/{src/service/types/Game/GameInfo.ts → dist/service/types/Game/GameInfo.d.ts} +9 -11
  53. package/{src/service/types/Game/GamePick.ts → dist/service/types/Game/GamePick.d.ts} +90 -104
  54. package/dist/service/types/Game/GameUtil.d.ts +7 -0
  55. package/{src/service/types/SmarticoProto/GetTranslationsRequest.ts → dist/service/types/SmarticoProto/GetTranslationsRequest.d.ts} +7 -9
  56. package/dist/service/types/SmarticoProto/GetTranslationsResponse.d.ts +7 -0
  57. package/dist/service/types/SmarticoProto/ProtocolMessage.d.ts +5 -0
  58. package/dist/service/types/SmarticoProto/ProtocolRequest.d.ts +6 -0
  59. package/dist/service/types/SmarticoProto/ProtocolResponse.d.ts +5 -0
  60. package/dist/service/types/SmarticoProto/PublicLabelInfo.d.ts +34 -0
  61. package/dist/service/types/SmarticoProto/PublicProperties.d.ts +11 -0
  62. package/{src/service/types/SmarticoProto/ResponseIdentify.ts → dist/service/types/SmarticoProto/ResponseIdentify.d.ts} +12 -16
  63. package/dist/service/types/SmarticoProto/SAW/SAWAcknowledgeType.d.ts +5 -0
  64. package/{src/service/types/SmarticoProto/SAW/SAWBuyInType.ts → dist/service/types/SmarticoProto/SAW/SAWBuyInType.d.ts} +5 -5
  65. package/{src/service/types/SmarticoProto/SAW/SAWDoSpinRequest.ts → dist/service/types/SmarticoProto/SAW/SAWDoSpinRequest.d.ts} +5 -8
  66. package/{src/service/types/SmarticoProto/SAW/SAWDoSpinResponse.ts → dist/service/types/SmarticoProto/SAW/SAWDoSpinResponse.d.ts} +15 -18
  67. package/dist/service/types/SmarticoProto/SAW/SAWGameType.d.ts +10 -0
  68. package/{src/service/types/SmarticoProto/SAW/SAWGetTemplatesRequest.ts → dist/service/types/SmarticoProto/SAW/SAWGetTemplatesRequest.d.ts} +3 -5
  69. package/{src/service/types/SmarticoProto/SAW/SAWGetTemplatesResponse.ts → dist/service/types/SmarticoProto/SAW/SAWGetTemplatesResponse.d.ts} +5 -8
  70. package/dist/service/types/SmarticoProto/SAW/SAWPrize.d.ts +11 -0
  71. package/dist/service/types/SmarticoProto/SAW/SAWPrizeType.d.ts +8 -0
  72. package/dist/service/types/SmarticoProto/SAW/SAWPrizeUI.d.ts +13 -0
  73. package/dist/service/types/SmarticoProto/SAW/SAWTemplate.d.ts +21 -0
  74. package/{src/service/types/SmarticoProto/SAW/SAWTemplateUI.ts → dist/service/types/SmarticoProto/SAW/SAWTemplateUI.d.ts} +31 -33
  75. package/dist/service/types/SmarticoProto/SAW/SAWWinSoundType.d.ts +12 -0
  76. package/dist/service/types/SmarticoProto/TranslationArea.d.ts +9 -0
  77. package/{src/service/types/User/UserInfo.ts → dist/service/types/User/UserInfo.d.ts} +10 -12
  78. package/package.json +10 -3
  79. package/src/Base/ClassId.ts +26 -0
  80. package/src/{service/types/SmarticoProto → Base}/ProtocolMessage.ts +0 -0
  81. package/src/{service/types/SmarticoProto → Base}/ProtocolRequest.ts +0 -0
  82. package/src/{service/types/SmarticoProto → Base}/ProtocolResponse.ts +0 -0
  83. package/src/Core/GetLabelInfoRequest.ts +5 -0
  84. package/src/Core/GetLabelInfoResponse.ts +6 -0
  85. package/src/Core/GetTranslationsRequest.ts +10 -0
  86. package/src/{service/types/SmarticoProto → Core}/GetTranslationsResponse.ts +1 -1
  87. package/src/{service/types/SmarticoProto/PublicLabelInfo.ts → Core/PublicLabelSettings.ts} +1 -6
  88. package/src/{service/types/SmarticoProto → Core}/PublicProperties.ts +0 -0
  89. package/src/Core/ResponseIdentify.ts +14 -0
  90. package/src/{service/types/SmarticoProto → Core}/TranslationArea.ts +1 -1
  91. package/src/Core/index.ts +18 -0
  92. package/src/{service/types/ErrorCodes.ts → ErrorCodes.ts} +1 -3
  93. package/src/{service/types/GResponse.ts → GResponse.ts} +0 -0
  94. package/src/ILogger.ts +11 -0
  95. package/src/IntUtils.ts +39 -0
  96. package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWAcknowledgeType.ts +0 -0
  97. package/src/MiniGames/SAWAskForUsername.ts +5 -0
  98. package/src/MiniGames/SAWBuyInType.ts +11 -0
  99. package/src/MiniGames/SAWDoSpinRequest.ts +8 -0
  100. package/src/MiniGames/SAWDoSpinResponse.ts +11 -0
  101. package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWGameType.ts +2 -2
  102. package/src/MiniGames/SAWGetTemplatesRequest.ts +5 -0
  103. package/src/MiniGames/SAWGetTemplatesResponse.ts +8 -0
  104. package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWPrize.ts +0 -0
  105. package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWPrizeType.ts +0 -0
  106. package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWPrizeUI.ts +0 -0
  107. package/src/MiniGames/SAWSpinErrorCode.ts +8 -0
  108. package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWTemplate.ts +5 -0
  109. package/src/MiniGames/SAWTemplateUI.ts +31 -0
  110. package/src/MiniGames/SAWUtils.ts +31 -0
  111. package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWWinSoundType.ts +0 -0
  112. package/src/MiniGames/index.ts +35 -0
  113. package/src/OCache.ts +54 -0
  114. package/src/SmarticoAPI.ts +296 -0
  115. package/src/index.ts +12 -2
  116. package/tsconfig.json +17 -0
  117. package/src/service/index.ts +0 -12
  118. package/src/service/types/GRequest.ts +0 -18
  119. package/src/service/types/Game/GameAttemptType.ts +0 -8
  120. package/src/service/types/Game/GameExternalStatus.ts +0 -7
  121. package/src/service/types/Game/GameUtil.ts +0 -30
  122. package/src/util/Util.ts +0 -306
  123. package/test/package.json +0 -11
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- v18.13.0
1
+ v13.13.0
package/README.md CHANGED
@@ -1,8 +1,7 @@
1
- # The library for communication with Smartico API
2
- - Allows to make requests and receive a response over https
3
- - Describes data types
1
+ # Smartico Public API
2
+ API allows you to build and manage Smartico Gamification context on behalf of the user. It can be used in the JS/TS based frontend or in NodeJS backend
4
3
 
5
- # Install in your application
4
+ # Installation
6
5
 
7
6
  ```bash
8
7
  npm install --save @smartico/public-api
@@ -11,65 +10,45 @@ npm install --save @smartico/public-api
11
10
  ## Usage
12
11
 
13
12
  ```typescript
14
- import { ProtocolRequest, GBaseRequest } from '@smartico/public-api';
13
+ import { SmarticoAPI } from '@smartico/public-api';
15
14
 
16
- class Example {
17
-
18
- private static buildMessage<TRequest,TResponse>(rq: GBaseRequest): TResponse {
19
-
20
- const message: ProtocolRequest = {
21
- api_key: rq.label_api_key,
22
- brand_key: rq.brand_key,
23
- ext_user_id: rq.smartico_ext_user_id,
24
- uuid: Util.uuid(),
25
- ts: new Date().getTime(),
26
- };
27
-
28
- return message as any
29
- }
15
+ const SAPI = new SmarticoAPI( 'your-label-api-key', 'your-brand-key', { logger: console });
16
+
17
+ const response = await SAPI.miniGamesGetTemplates(rsUser.user_ext_id);
30
18
 
19
+ response.templates.forEach( t => {
20
+ console.log(t.saw_template_ui_definition.name)
31
21
  }
32
- ```
33
22
 
34
- ## Pre-requisite for publish new version of package
23
+ ```
35
24
 
36
- ### Set new package version
37
25
 
38
- ```sh
39
- npm run build
40
- npm version [<newversion> | major | minor | patch ]
41
- ```
26
+ ## Development and publishing process
42
27
 
43
- ### Manual publish new version
28
+ ### Publishing process
44
29
 
45
30
  ```sh
31
+ git commit
32
+ npm run build
33
+ npm version patch
46
34
  npm run pub
47
35
  ```
48
36
 
49
- # Developing & debugging locally
50
-
51
- ### Enable Debug changes locally
52
-
53
- (reference article: https://terodox.tech/using-npm-link-for-package-development/)
37
+ ### Debug locally
54
38
 
55
39
  In the public-api project console:
56
40
 
57
- 1. Assure you are in the project folder (`cd <your-local-git-folder-for-this-project>/public-api `)
58
- 2. Run:
59
- ```sh
60
- npm link
61
- ```
62
- This will create a symlink from the global `node_modules/@smartico/public-api` to your current folder - `<your-local-git-folder-for-this-project>/public-api`
41
+ ```sh
42
+ npm link
43
+ # when you are done
44
+ npm unlink
45
+ ```
63
46
 
64
47
  Consumer project console:
65
48
  ```bash
66
49
  npm link @smartico/public-api
67
- ```
68
-
69
- Now you are ready to debug locally the library!
70
50
 
71
- ### Before you deploy !!! Cleanup if you enabled the debug changes locally steps above
72
- ```bash
51
+ # when you are done
73
52
  npm unlink npm link @smartico/public-api
74
53
  npm install npm link @smartico/public-api
75
- ```
54
+ ```
@@ -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,3 @@
1
+ import { ProtocolRequest } from "../Base/ProtocolRequest";
2
+ export interface GetLabelInfoRequest extends ProtocolRequest {
3
+ }
@@ -0,0 +1,7 @@
1
+ import { ProtocolResponse } from "../Base/ProtocolResponse";
2
+ export interface GetLabelInfoResponse extends ProtocolResponse {
3
+ settings: {
4
+ [key: string]: string;
5
+ };
6
+ label_id: string;
7
+ }
@@ -0,0 +1,7 @@
1
+ import { ProtocolRequest } from "../Base/ProtocolRequest";
2
+ import { TranslationArea } from "./TranslationArea";
3
+ export interface GetTranslationsRequest extends ProtocolRequest {
4
+ hash_code: number;
5
+ areas: TranslationArea[];
6
+ lang_code: string;
7
+ }
@@ -0,0 +1,7 @@
1
+ import { ProtocolResponse } from "../Base/ProtocolResponse";
2
+ export interface GetTranslationsResponse extends ProtocolResponse {
3
+ hash_code: number;
4
+ translations: {
5
+ [key: string]: string;
6
+ };
7
+ }
@@ -0,0 +1,28 @@
1
+ export declare enum PublicLabelSettings {
2
+ FCM_SENDER_ID = "FCM_SENDER_ID",
3
+ PUBLIC_API_URL = "PUBLIC_API_URL",
4
+ FCM_SW_URL = "FCM_SW_URL",
5
+ RECORDING_ENABLED_FOR_ALL_USERS = "RECORDING_ENABLED_FOR_ALL_USERS",
6
+ JS_INJECTION = "JS_INJECTION",
7
+ GAMIFICATION_UI_MAIN = "GAMIFICATION_UI_MAIN",
8
+ GAMIFICATION_UI_WIDGET = "GAMIFICATION_UI_WIDGET",
9
+ GAMIFICATION_UI_MINI_GAME = "GAMIFICATION_UI_MINI_GAME",
10
+ GAMIFICATION_UI_SETTINGS = "GAMIFICATION_UI_SETTINGS",
11
+ GAMIFICATION_UI_MAIN_TEST = "GAMIFICATION_UI_MAIN_TEST",
12
+ GAMIFICATION_UI_WIDGET_TEST = "GAMIFICATION_UI_WIDGET_TEST",
13
+ GAMIFICATION_UI_SETTINGS_TEST = "GAMIFICATION_UI_SETTINGS_TEST",
14
+ FRONT_END_ALLOWED_LANGUAGES = "FRONT_END_ALLOWED_LANGUAGES",
15
+ FRONT_END_ALLOW_DOMAINS = "FRONT_END_ALLOW_DOMAINS",
16
+ DELAY_ENGAGEMENT_EXECUTION_ON_LOGIN_MS = "DELAY_ENGAGEMENT_EXECUTION_ON_LOGIN_MS",
17
+ SHADOW_LABEL_PUBLIC_KEY = "SHADOW_LABEL_PUBLIC_KEY",
18
+ DYNAMIC_IMAGE_DOMAIN = "DYNAMIC_IMAGE_DOMAIN",
19
+ GAMIFICATION_UI_LEVEL_ENABLED = "GAMIFICATION_UI_LEVEL_ENABLED",
20
+ GAMIFICATION_UI_LEVEL_IMAGE_MOB = "GAMIFICATION_UI_LEVEL_IMAGE_MOB",
21
+ GAMIFICATION_UI_LEVEL_IMAGE_DESK = "GAMIFICATION_UI_LEVEL_IMAGE_DESK",
22
+ GAMIFICATION_LEVELS_LOGIC2 = "GAMIFICATION_LEVELS_LOGIC2",
23
+ AVATAR_CUSTOM_IMAGE_MAX_ID = "AVATAR_CUSTOM_IMAGE_MAX_ID",
24
+ AVATAR_CUSTOM_IMAGE_FOLDER = "AVATAR_CUSTOM_IMAGE_FOLDER",
25
+ RETENTION_GAMES_CUSTOMER_ID = "RETENTION_GAMES_CUSTOMER_ID",
26
+ GAMIFICATION_SHOW_POWERED_BY = "GAMIFICATION_SHOW_POWERED_BY",
27
+ _system_leader_board_mask_username = "_system_leader_board_mask_username"
28
+ }
@@ -0,0 +1,11 @@
1
+ export interface PublicProperties {
2
+ core_user_language?: string;
3
+ ach_points_balance?: number;
4
+ ach_points_ever?: number;
5
+ ach_points_board_period_type_1?: number;
6
+ ach_points_board_period_type_2?: number;
7
+ ach_level_current_id?: number;
8
+ ach_level_current?: string;
9
+ core_is_test_account?: boolean;
10
+ ach_gamification_in_control_group?: boolean;
11
+ }
@@ -0,0 +1,12 @@
1
+ import { ProtocolResponse } from "../Base/ProtocolResponse";
2
+ import { PublicProperties } from "./PublicProperties";
3
+ interface ResponseIdentify extends ProtocolResponse {
4
+ user_id: number;
5
+ ext_user_id: string;
6
+ public_username: string;
7
+ avatar_id: string;
8
+ job: boolean;
9
+ props?: PublicProperties;
10
+ pubic_username_set: boolean;
11
+ }
12
+ export { ResponseIdentify };
@@ -0,0 +1,9 @@
1
+ declare enum TranslationArea {
2
+ Casino = 1,
3
+ Gamification = 2,
4
+ Trading = 3,
5
+ Archived = 4,
6
+ Affiliation = 5,
7
+ RetentionGames = 6
8
+ }
9
+ export { TranslationArea };
@@ -0,0 +1,8 @@
1
+ import { GetLabelInfoRequest } from './GetLabelInfoRequest';
2
+ import { GetLabelInfoResponse } from './GetLabelInfoResponse';
3
+ import { GetTranslationsRequest } from './GetTranslationsRequest';
4
+ import { GetTranslationsResponse } from './GetTranslationsResponse';
5
+ import { PublicLabelSettings } from './PublicLabelSettings';
6
+ import { ResponseIdentify } from './ResponseIdentify';
7
+ import { TranslationArea } from './TranslationArea';
8
+ export { GetTranslationsRequest, GetTranslationsResponse, GetLabelInfoRequest, GetLabelInfoResponse, TranslationArea, PublicLabelSettings, ResponseIdentify };
@@ -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,4 @@
1
+ export declare enum SAWAskForUsername {
2
+ NOASK = "no-ask",
3
+ ONSUMBIT = "on-submit"
4
+ }
@@ -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,9 @@
1
+ import { ProtocolResponse } from "./../Base/ProtocolResponse";
2
+ import { SAWSpinErrorCode } from "./SAWSpinErrorCode";
3
+ export interface SAWDoSpinResponse extends ProtocolResponse {
4
+ errCode: SAWSpinErrorCode;
5
+ errMsg?: string;
6
+ request_id: string;
7
+ saw_prize_id: number;
8
+ first_spin_in_period: number;
9
+ }
@@ -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,7 @@
1
+ export declare enum SAWSpinErrorCode {
2
+ SAW_OK = 0,
3
+ SAW_NO_SPINS = 40001,
4
+ SAW_PRIZE_POOL_EMPTY = 40002,
5
+ SAW_NOT_ENOUGH_POINTS = 40003,
6
+ SAW_FAILED_MAX_SPINS_REACHED = 40004
7
+ }
@@ -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,28 @@
1
+ import { SAWAskForUsername } from "./SAWAskForUsername";
2
+ export interface SAWTemplateUI {
3
+ skin: string;
4
+ name: string;
5
+ description?: string;
6
+ over_limit_message?: string;
7
+ no_attempts_message?: string;
8
+ thumbnail?: string;
9
+ sectors_count: number;
10
+ priority: number;
11
+ flow_builder_only: boolean;
12
+ background_image?: string;
13
+ background_image_mobile?: string;
14
+ background_sound?: string;
15
+ scratch_logo?: string;
16
+ scratch_cover?: string;
17
+ scratch_bg_desktop?: string;
18
+ scratch_bg_mobile?: string;
19
+ scratch_cursor?: string;
20
+ custom_css?: string;
21
+ custom_skin_folder?: string;
22
+ jackpot_symbol?: string;
23
+ promo_image?: string;
24
+ promo_text?: string;
25
+ ask_for_username?: SAWAskForUsername;
26
+ show_prize_board?: boolean;
27
+ max_spins_period_ms?: number;
28
+ }
@@ -0,0 +1,5 @@
1
+ import { SAWTemplate } from "./SAWTemplate";
2
+ declare class SAWUtils {
3
+ static canPlay: (t: SAWTemplate, pointsBalance: number) => boolean;
4
+ }
5
+ export { SAWUtils };
@@ -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,17 @@
1
+ import { SAWUtils } from "./SAWUtils";
2
+ import { SAWAcknowledgeType } from "./SAWAcknowledgeType";
3
+ import { SAWAskForUsername } from "./SAWAskForUsername";
4
+ import { SAWBuyInType, SAWBuyInTypeName } from "./SAWBuyInType";
5
+ import { SAWDoSpinRequest } from "./SAWDoSpinRequest";
6
+ import { SAWDoSpinResponse } from "./SAWDoSpinResponse";
7
+ import { SAWGameType, SAWGameTypeName } from "./SAWGameType";
8
+ import { SAWGetTemplatesRequest } from "./SAWGetTemplatesRequest";
9
+ import { SAWGetTemplatesResponse } from "./SAWGetTemplatesResponse";
10
+ import { SAWPrize } from "./SAWPrize";
11
+ import { SAWPrizeType } from "./SAWPrizeType";
12
+ import { SAWPrizeUI } from "./SAWPrizeUI";
13
+ import { SAWSpinErrorCode } from "./SAWSpinErrorCode";
14
+ import { SAWTemplate } from "./SAWTemplate";
15
+ import { SAWTemplateUI } from "./SAWTemplateUI";
16
+ import { SAWWinSoundType, SAWWinSoundFiles } from "./SAWWinSoundType";
17
+ export { SAWUtils, SAWAcknowledgeType, SAWBuyInType, SAWBuyInTypeName, SAWDoSpinRequest, SAWDoSpinResponse, SAWGameType, SAWGameTypeName, SAWGetTemplatesRequest, SAWGetTemplatesResponse, SAWPrize, SAWPrizeType, SAWPrizeUI, SAWTemplate, SAWTemplateUI, SAWWinSoundType, SAWWinSoundFiles, SAWAskForUsername, SAWSpinErrorCode };
@@ -0,0 +1,11 @@
1
+ export declare enum ECacheContext {
2
+ Translations = 0,
3
+ LabelInfo = 1
4
+ }
5
+ export declare class OCache {
6
+ private static cache;
7
+ static get<T>(oKey: any, cacheContext: ECacheContext): T | undefined;
8
+ static set(oKey: any, o: any, cacheContext: ECacheContext, ttlSeconds?: number): void;
9
+ static use<T>(oKey: any, cacheContext: ECacheContext, f: () => Promise<T>, ttlSeconds?: number): Promise<T>;
10
+ static clear(cacheContext: ECacheContext): Promise<void>;
11
+ }
@@ -0,0 +1,35 @@
1
+ import { ClassId } from "./Base/ClassId";
2
+ import { SAWGetTemplatesResponse } from './MiniGames/SAWGetTemplatesResponse';
3
+ import { SAWTemplate } from './MiniGames/SAWTemplate';
4
+ import { ILogger } from './ILogger';
5
+ import { SAWDoSpinResponse } from './MiniGames';
6
+ import { GetTranslationsResponse, ResponseIdentify, TranslationArea } from './Core';
7
+ import { GetLabelInfoResponse } from './Core/GetLabelInfoResponse';
8
+ interface IOptions {
9
+ logger?: ILogger;
10
+ logCIDs?: ClassId[];
11
+ logHTTPTiming?: boolean;
12
+ }
13
+ declare class SmarticoAPI {
14
+ private label_api_key;
15
+ private brand_api_key;
16
+ private publicUrl;
17
+ private avatarDomain;
18
+ private logger;
19
+ private logCIDs;
20
+ private logHTTPTiming;
21
+ constructor(label_api_key: string, brand_api_key: string, options?: IOptions);
22
+ private send;
23
+ private buildMessage;
24
+ coreReportCustomEvent(user_ext_id: string, eventType: string, payload?: any): Promise<any>;
25
+ coreGetTranslations(user_ext_id: string, lang_code: string, areas: TranslationArea[], cacheSec?: number): Promise<GetTranslationsResponse>;
26
+ coreIdentifyLabel(user_ext_id: string, cacheSec?: number): Promise<GetLabelInfoResponse>;
27
+ coreIdentifyUser(user_ext_id: string): Promise<ResponseIdentify>;
28
+ coreChangeUsername(user_ext_id: string, public_username_custom: string): Promise<{
29
+ public_username_custom: string;
30
+ }>;
31
+ sawGetTemplates(user_ext_id: string): Promise<SAWGetTemplatesResponse>;
32
+ sawFormatTemplatesForWidget(templates: SAWTemplate[], pointsBalance: number): Promise<any[]>;
33
+ sawSpinRequest(user_ext_id: string, saw_template_id: number, round_id: number): Promise<SAWDoSpinResponse>;
34
+ }
35
+ 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,6 @@
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 * from './Core';
6
+ export { SmarticoAPI, ClassId, ILogger };