@smartico/public-api 0.0.3 → 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.
- package/.nvmrc +1 -1
- package/dist/Base/ClassId.d.ts +21 -0
- package/dist/Base/ProtocolMessage.d.ts +5 -0
- package/dist/Base/ProtocolRequest.d.ts +6 -0
- package/dist/Base/ProtocolResponse.d.ts +5 -0
- package/dist/ErrorCodes.d.ts +12 -0
- package/dist/GResponse.d.ts +9 -0
- package/dist/ILogger.d.ts +7 -0
- package/dist/IntUtils.d.ts +8 -0
- package/dist/MiniGames/SAWAcknowledgeType.d.ts +5 -0
- package/dist/MiniGames/SAWBuyInType.d.ts +10 -0
- package/dist/MiniGames/SAWDoSpinRequest.d.ts +5 -0
- package/dist/MiniGames/SAWDoSpinResponse.d.ts +15 -0
- package/dist/MiniGames/SAWGameType.d.ts +10 -0
- package/dist/MiniGames/SAWGetTemplatesRequest.d.ts +3 -0
- package/dist/MiniGames/SAWGetTemplatesResponse.d.ts +5 -0
- package/dist/MiniGames/SAWPrize.d.ts +11 -0
- package/dist/MiniGames/SAWPrizeType.d.ts +8 -0
- package/dist/MiniGames/SAWPrizeUI.d.ts +13 -0
- package/dist/MiniGames/SAWTemplate.d.ts +26 -0
- package/dist/MiniGames/SAWTemplateUI.d.ts +31 -0
- package/dist/MiniGames/SAWWinSoundType.d.ts +12 -0
- package/dist/MiniGames/index.d.ts +14 -0
- package/dist/SmarticoAPI.d.ts +23 -0
- package/dist/SmarticoPublicAPI.d.ts +23 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +322 -241
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +232 -231
- package/dist/index.modern.mjs.map +1 -1
- package/dist/service/index.d.ts +3 -2
- package/dist/service/types/ErrorCodes.d.ts +13 -0
- package/dist/service/types/GRequest.d.ts +16 -0
- package/dist/service/types/GResponse.d.ts +10 -0
- package/dist/service/types/Game/GameAttemptType.d.ts +6 -0
- package/{src/service/types/Game/GameCanPlayType.ts → dist/service/types/Game/GameCanPlayType.d.ts} +10 -11
- package/dist/service/types/Game/GameExternalStatus.d.ts +6 -0
- package/{src/service/types/Game/GameInfo.ts → dist/service/types/Game/GameInfo.d.ts} +9 -11
- package/{src/service/types/Game/GamePick.ts → dist/service/types/Game/GamePick.d.ts} +90 -104
- package/dist/service/types/Game/GameUtil.d.ts +7 -0
- package/{src/service/types/SmarticoProto/GetTranslationsRequest.ts → dist/service/types/SmarticoProto/GetTranslationsRequest.d.ts} +7 -9
- package/{src/service/types/SmarticoProto/GetTranslationsResponse.ts → dist/service/types/SmarticoProto/GetTranslationsResponse.d.ts} +7 -8
- package/dist/service/types/SmarticoProto/ProtocolMessage.d.ts +5 -0
- package/dist/service/types/SmarticoProto/ProtocolRequest.d.ts +6 -0
- package/dist/service/types/SmarticoProto/ProtocolResponse.d.ts +5 -0
- package/{src/service/types/SmarticoProto/PublicLabelInfo.ts → dist/service/types/SmarticoProto/PublicLabelInfo.d.ts} +34 -39
- package/{src/service/types/SmarticoProto/PublicProperties.ts → dist/service/types/SmarticoProto/PublicProperties.d.ts} +11 -11
- package/{src/service/types/SmarticoProto/ResponseIdentify.ts → dist/service/types/SmarticoProto/ResponseIdentify.d.ts} +12 -16
- package/dist/service/types/SmarticoProto/SAW/SAWAcknowledgeType.d.ts +5 -0
- package/{src/service/types/SmarticoProto/SAW/SAWBuyInType.ts → dist/service/types/SmarticoProto/SAW/SAWBuyInType.d.ts} +5 -5
- package/{src/service/types/SmarticoProto/SAW/SAWDoSpinRequest.ts → dist/service/types/SmarticoProto/SAW/SAWDoSpinRequest.d.ts} +5 -8
- package/dist/service/types/SmarticoProto/SAW/SAWDoSpinResponse.d.ts +15 -0
- package/dist/service/types/SmarticoProto/SAW/SAWGameType.d.ts +10 -0
- package/{src/service/types/SmarticoProto/SAW/SAWGetTemplatesRequest.ts → dist/service/types/SmarticoProto/SAW/SAWGetTemplatesRequest.d.ts} +3 -5
- package/{src/service/types/SmarticoProto/SAW/SAWGetTemplatesResponse.ts → dist/service/types/SmarticoProto/SAW/SAWGetTemplatesResponse.d.ts} +5 -8
- package/dist/service/types/SmarticoProto/SAW/SAWPrize.d.ts +11 -0
- package/dist/service/types/SmarticoProto/SAW/SAWPrizeType.d.ts +8 -0
- package/dist/service/types/SmarticoProto/SAW/SAWPrizeUI.d.ts +13 -0
- package/dist/service/types/SmarticoProto/SAW/SAWTemplate.d.ts +21 -0
- package/dist/service/types/SmarticoProto/SAW/SAWTemplateUI.d.ts +31 -0
- package/dist/service/types/SmarticoProto/SAW/SAWWinSoundType.d.ts +12 -0
- package/{src/service/types/SmarticoProto/TranslationArea.ts → dist/service/types/SmarticoProto/TranslationArea.d.ts} +9 -11
- package/{src/service/types/User/UserInfo.ts → dist/service/types/User/UserInfo.d.ts} +10 -12
- package/package.json +2 -1
- package/src/Base/ClassId.ts +26 -0
- package/src/{service/types/SmarticoProto → Base}/ProtocolMessage.ts +0 -0
- package/src/{service/types/SmarticoProto → Base}/ProtocolRequest.ts +0 -0
- package/src/{service/types/SmarticoProto → Base}/ProtocolResponse.ts +0 -0
- package/src/{service/types/ErrorCodes.ts → ErrorCodes.ts} +1 -3
- package/src/{service/types/GResponse.ts → GResponse.ts} +0 -0
- package/src/ILogger.ts +11 -0
- package/src/IntUtils.ts +39 -0
- package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWAcknowledgeType.ts +0 -0
- package/src/MiniGames/SAWBuyInType.ts +11 -0
- package/src/MiniGames/SAWDoSpinRequest.ts +8 -0
- package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWDoSpinResponse.ts +1 -1
- package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWGameType.ts +2 -2
- package/src/MiniGames/SAWGetTemplatesRequest.ts +5 -0
- package/src/MiniGames/SAWGetTemplatesResponse.ts +8 -0
- package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWPrize.ts +0 -0
- package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWPrizeType.ts +0 -0
- package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWPrizeUI.ts +0 -0
- package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWTemplate.ts +5 -0
- package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWTemplateUI.ts +0 -0
- package/src/{service/types/SmarticoProto/SAW → MiniGames}/SAWWinSoundType.ts +0 -0
- package/src/MiniGames/index.ts +30 -0
- package/src/SmarticoAPI.ts +177 -0
- package/src/index.ts +11 -2
- package/tsconfig.json +17 -0
- package/src/service/index.ts +0 -12
- package/src/service/types/GRequest.ts +0 -18
- package/src/service/types/Game/GameAttemptType.ts +0 -8
- package/src/service/types/Game/GameExternalStatus.ts +0 -7
- package/src/service/types/Game/GameUtil.ts +0 -30
- package/src/util/Util.ts +0 -306
- package/test/package.json +0 -11
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
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,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,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,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,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,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,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
|
-
|
|
2
|
-
|
|
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 };
|