@smartico/public-api 0.0.158 → 0.0.160
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/.prettierrc +10 -10
- package/dist/Bonuses/Bonus.d.ts +20 -0
- package/dist/Bonuses/BonusMetaMap.d.ts +3 -0
- package/dist/Bonuses/BonusStatus.d.ts +8 -0
- package/dist/Bonuses/BonusTemplateMetaMap.d.ts +5 -0
- package/dist/Bonuses/ClaimBonusRequest.d.ts +4 -0
- package/dist/Bonuses/ClaimBonusResponse.d.ts +4 -0
- package/dist/Bonuses/GetBonusesRequest.d.ts +3 -0
- package/dist/Bonuses/GetBonusesResponse.d.ts +5 -0
- package/dist/Bonuses/index.d.ts +7 -0
- package/dist/SmarticoAPI.d.ts +5 -1
- package/dist/SmarticoLib/index.d.ts +58 -2
- package/dist/WSAPI/WSAPI.d.ts +18 -3
- package/dist/WSAPI/WSAPITypes.d.ts +32 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +254 -147
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +72 -2
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +2 -0
- package/docs/classes/WSAPI.md +109 -72
- package/docs/interfaces/TBonus.md +65 -0
- package/docs/interfaces/TClaimBonusResult.md +27 -0
- package/docs/interfaces/TInboxMessageBody.md +2 -2
- package/docs/interfaces/TLevel.md +2 -2
- package/docs/interfaces/TMissionOrBadgeTask.md +1 -10
- package/docs/interfaces/TTournament.md +1 -1
- package/docs/interfaces/TTournamentDetailed.md +2 -2
- package/docs/interfaces/TUserProfile.md +2 -2
- package/package.json +41 -41
- package/src/Base/AchRelatedGame.ts +10 -10
- package/src/Base/ProtocolMessage.ts +4 -4
- package/src/Base/ProtocolRequest.ts +4 -4
- package/src/Base/ProtocolResponse.ts +3 -3
- package/src/Bonuses/Bonus.ts +40 -0
- package/src/Bonuses/BonusMetaMap.ts +3 -0
- package/src/Bonuses/BonusStatus.ts +8 -0
- package/src/Bonuses/BonusTemplateMetaMap.ts +6 -0
- package/src/Bonuses/ClaimBonusRequest.ts +5 -0
- package/src/Bonuses/ClaimBonusResponse.ts +5 -0
- package/src/Bonuses/GetBonusesRequest.ts +3 -0
- package/src/Bonuses/GetBonusesResponse.ts +6 -0
- package/src/Bonuses/index.ts +7 -0
- package/src/CookieStore.ts +6 -6
- package/src/Core/CheckSegmentMatchRequest.ts +2 -2
- package/src/Core/CheckSegmentMatchResponse.ts +4 -4
- package/src/Core/CoreUtils.ts +12 -7
- package/src/Core/GetAchievementsUserInfoRequest.ts +1 -1
- package/src/Core/GetAchievementsUserInfoResponse.ts +3 -3
- package/src/Core/GetLabelInfoRequest.ts +1 -1
- package/src/Core/GetLabelInfoResponse.ts +3 -3
- package/src/Core/GetTranslationsRequest.ts +5 -5
- package/src/Core/GetTranslationsResponse.ts +3 -3
- package/src/Core/PublicProperties.ts +7 -7
- package/src/Core/ResponseIdentify.ts +10 -10
- package/src/Core/TranslationArea.ts +1 -1
- package/src/Core/index.ts +9 -9
- package/src/CustomSections/GetCustomSectionsRequest.ts +1 -1
- package/src/CustomSections/GetCustomSectionsResponse.ts +3 -3
- package/src/CustomSections/UICustomSection.ts +21 -16
- package/src/CustomSections/index.ts +4 -4
- package/src/ErrorCodes.ts +2 -2
- package/src/GResponse.ts +5 -5
- package/src/ILogger.ts +5 -5
- package/src/Inbox/GetInboxMessagesRequest.ts +4 -4
- package/src/Inbox/GetInboxMessagesResponse.ts +8 -8
- package/src/Inbox/InboxMessage.ts +20 -20
- package/src/Inbox/MarkInboxMessageDeletedRequest.ts +3 -3
- package/src/Inbox/MarkInboxMessageDeletedResponse.ts +3 -3
- package/src/Inbox/MarkInboxMessageReadRequest.ts +3 -3
- package/src/Inbox/MarkInboxMessageReadResponse.ts +3 -3
- package/src/Inbox/MarkInboxMessageStarredRequest.ts +3 -3
- package/src/Inbox/MarkInboxMessageStarredResponse.ts +3 -3
- package/src/Inbox/index.ts +10 -10
- package/src/IntUtils.ts +36 -28
- package/src/Jackpots/GetJackpotsPotsRequest.ts +2 -2
- package/src/Jackpots/GetJackpotsPotsResponse.ts +3 -3
- package/src/Jackpots/GetJackpotsRequest.ts +3 -3
- package/src/Jackpots/GetJackpotsResponse.ts +4 -4
- package/src/Jackpots/JackPotWinner.ts +6 -6
- package/src/Jackpots/JackpotContributionType.ts +1 -1
- package/src/Jackpots/JackpotDetails.ts +18 -18
- package/src/Jackpots/JackpotHtmlTemplate.ts +3 -3
- package/src/Jackpots/JackpotPot.ts +6 -6
- package/src/Jackpots/JackpotPublicMeta.ts +9 -9
- package/src/Jackpots/JackpotType.ts +1 -1
- package/src/Jackpots/JackpotWinPush.ts +5 -5
- package/src/Jackpots/JackpotsOptinRequest.ts +2 -2
- package/src/Jackpots/JackpotsOptinResponse.ts +1 -1
- package/src/Jackpots/JackpotsOptoutRequest.ts +2 -2
- package/src/Jackpots/JackpotsOptoutResponse.ts +1 -1
- package/src/Jackpots/index.ts +16 -16
- package/src/Leaderboard/GetLeaderBoardsRequest.ts +5 -5
- package/src/Leaderboard/GetLeaderBoardsResponse.ts +3 -3
- package/src/Leaderboard/LeaderBoardDetails.ts +11 -11
- package/src/Leaderboard/LeaderBoardPosition.ts +8 -8
- package/src/Leaderboard/LeaderBoardPublicMeta.ts +3 -3
- package/src/Leaderboard/LeaderBoards.ts +16 -16
- package/src/Leaderboard/index.ts +6 -6
- package/src/Level/GetLevelMapResponse.ts +7 -7
- package/src/Level/Level.ts +9 -9
- package/src/Level/LevelPublicMeta.ts +10 -10
- package/src/Level/index.ts +3 -3
- package/src/MiniGames/SAWAcknowledgeSpinPushRequest.ts +3 -3
- package/src/MiniGames/SAWBuyInType.ts +2 -2
- package/src/MiniGames/SAWDoAknowledgeRequest.ts +2 -2
- package/src/MiniGames/SAWDoAknowledgeResponse.ts +2 -2
- package/src/MiniGames/SAWDoSpinRequest.ts +3 -3
- package/src/MiniGames/SAWDoSpinResponse.ts +9 -9
- package/src/MiniGames/SAWEventSawPush.ts +3 -3
- package/src/MiniGames/SAWGameType.ts +2 -2
- package/src/MiniGames/SAWGetTemplatesRequest.ts +3 -3
- package/src/MiniGames/SAWGetTemplatesResponse.ts +18 -16
- package/src/MiniGames/SAWPrize.ts +11 -11
- package/src/MiniGames/SAWPrizeDropAknowledgeRequest.ts +4 -4
- package/src/MiniGames/SAWPrizeDropAknowledgeResponse.ts +2 -2
- package/src/MiniGames/SAWPrizeDropWinPush.ts +8 -8
- package/src/MiniGames/SAWPrizeType.ts +2 -2
- package/src/MiniGames/SAWPrizeUI.ts +16 -16
- package/src/MiniGames/SAWSpinsCountPush.ts +3 -3
- package/src/MiniGames/SAWTemplate.ts +26 -26
- package/src/MiniGames/SAWTemplateUI.ts +42 -42
- package/src/MiniGames/SAWUtils.ts +10 -10
- package/src/MiniGames/SAWWinSoundType.ts +1 -1
- package/src/MiniGames/index.ts +24 -24
- package/src/Missions/AchCategoryPublicMeta.ts +2 -2
- package/src/Missions/AchClaimPrizeRequest.ts +3 -3
- package/src/Missions/AchClaimPrizeResponse.ts +1 -1
- package/src/Missions/AchievementCategory.ts +8 -8
- package/src/Missions/AchievementOptinRequest.ts +2 -2
- package/src/Missions/AchievementOptinResponse.ts +1 -1
- package/src/Missions/AchievementPublicMeta.ts +19 -19
- package/src/Missions/AchievementTaskPublicMeta.ts +2 -2
- package/src/Missions/GetAchCategoriesRequest.ts +1 -1
- package/src/Missions/GetAchCategoriesResponse.ts +3 -3
- package/src/Missions/GetAchievementMapRequest.ts +1 -1
- package/src/Missions/GetAchievementMapResponse.ts +3 -3
- package/src/Missions/GetRelatedAchTourRequest.ts +2 -2
- package/src/Missions/GetRelatedAchTourResponse.ts +5 -5
- package/src/Missions/ReloadAchievementsEvent.ts +3 -3
- package/src/Missions/UserAchievement.ts +48 -46
- package/src/Missions/UserAchievementTask.ts +13 -13
- package/src/Missions/index.ts +19 -19
- package/src/NodeCache.ts +12 -12
- package/src/OCache.ts +22 -22
- package/src/Quiz/MarketsAnswers.ts +9 -9
- package/src/Quiz/MarketsInfo.ts +62 -23
- package/src/Quiz/MarketsPerSport.ts +11 -4
- package/src/Quiz/ScoreResultTypes.ts +22 -22
- package/src/Quiz/SportTypes.ts +1 -1
- package/src/Quiz/index.ts +6 -6
- package/src/SmarticoAPI.ts +556 -303
- package/src/SmarticoLib/index.ts +956 -840
- package/src/Store/BuyStoreItemRequest.ts +2 -2
- package/src/Store/BuyStoreItemResponse.ts +2 -2
- package/src/Store/GetCategoriesStoreResponse.ts +3 -3
- package/src/Store/GetStoreHistoryRequest.ts +3 -3
- package/src/Store/GetStoreHistoryResponse.ts +4 -4
- package/src/Store/GetStoreItemsResponse.ts +3 -3
- package/src/Store/StoreCategory.ts +8 -8
- package/src/Store/StoreCategoryPublicMeta.ts +2 -2
- package/src/Store/StoreItem.ts +13 -13
- package/src/Store/StoreItemPublicMeta.ts +10 -10
- package/src/Store/StoreItemPurchased.ts +17 -17
- package/src/Store/StoreItemType.ts +2 -2
- package/src/Store/index.ts +13 -13
- package/src/Tournaments/GetTournamentInfoRequest.ts +2 -2
- package/src/Tournaments/GetTournamentInfoResponse.ts +18 -18
- package/src/Tournaments/GetTournamentsRequest.ts +1 -1
- package/src/Tournaments/GetTournamentsResponse.ts +6 -6
- package/src/Tournaments/Tournament.ts +43 -39
- package/src/Tournaments/TournamentInstanceStatus.ts +2 -2
- package/src/Tournaments/TournamentPlayer.ts +7 -7
- package/src/Tournaments/TournamentPrize.ts +8 -8
- package/src/Tournaments/TournamentPublicMeta.ts +16 -16
- package/src/Tournaments/TournamentRegisterRequest.ts +2 -2
- package/src/Tournaments/TournamentRegisterResponse.ts +3 -3
- package/src/Tournaments/TournamentRegistrationStatus.ts +6 -4
- package/src/Tournaments/TournamentRegistrationType.ts +9 -3
- package/src/Tournaments/TournamentUtils.ts +44 -38
- package/src/Tournaments/index.ts +16 -16
- package/src/WSAPI/WSAPI.ts +244 -132
- package/src/WSAPI/WSAPITypes.ts +287 -250
- package/src/index.ts +16 -15
- package/tsconfig.json +41 -43
package/src/GResponse.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ErrorCodes } from './ErrorCodes'
|
|
1
|
+
import { ErrorCodes } from './ErrorCodes';
|
|
2
2
|
|
|
3
3
|
interface GResponseBase {
|
|
4
|
-
errCode: ErrorCodes
|
|
5
|
-
errMessage?: string
|
|
4
|
+
errCode: ErrorCodes;
|
|
5
|
+
errMessage?: string;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
interface GResponse<T> extends GResponseBase {
|
|
9
|
-
data?: T
|
|
9
|
+
data?: T;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export { GResponseBase, GResponse }
|
|
12
|
+
export { GResponseBase, GResponse };
|
package/src/ILogger.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
|
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
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ProtocolMessage } from '../Base/ProtocolMessage'
|
|
1
|
+
import { ProtocolMessage } from '../Base/ProtocolMessage';
|
|
2
2
|
|
|
3
3
|
export interface GetInboxMessagesRequest extends ProtocolMessage {
|
|
4
|
-
limit?: number
|
|
5
|
-
offset?: number
|
|
6
|
-
starred_only?: boolean
|
|
4
|
+
limit?: number;
|
|
5
|
+
offset?: number;
|
|
6
|
+
starred_only?: boolean;
|
|
7
7
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { TInboxMessage } from '../WSAPI/WSAPITypes'
|
|
2
|
-
import { ProtocolResponse } from '../Base/ProtocolResponse'
|
|
3
|
-
import { InboxMessage } from './InboxMessage'
|
|
1
|
+
import { TInboxMessage } from '../WSAPI/WSAPITypes';
|
|
2
|
+
import { ProtocolResponse } from '../Base/ProtocolResponse';
|
|
3
|
+
import { InboxMessage } from './InboxMessage';
|
|
4
4
|
|
|
5
5
|
export interface GetInboxMessagesResponse extends ProtocolResponse {
|
|
6
|
-
log: InboxMessage[]
|
|
6
|
+
log: InboxMessage[];
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export const InboxMessagesTransform = (items: InboxMessage[]): TInboxMessage[] => {
|
|
@@ -13,7 +13,7 @@ export const InboxMessagesTransform = (items: InboxMessage[]): TInboxMessage[] =
|
|
|
13
13
|
message_guid: item.engagement_uid,
|
|
14
14
|
read: item.is_read,
|
|
15
15
|
favorite: item.is_starred,
|
|
16
|
-
}
|
|
17
|
-
return x
|
|
18
|
-
})
|
|
19
|
-
}
|
|
16
|
+
};
|
|
17
|
+
return x;
|
|
18
|
+
});
|
|
19
|
+
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { TInboxMessageBody } from '../WSAPI/WSAPITypes'
|
|
2
|
-
import { InboxMessageType } from './InboxMessageType'
|
|
1
|
+
import { TInboxMessageBody } from '../WSAPI/WSAPITypes';
|
|
2
|
+
import { InboxMessageType } from './InboxMessageType';
|
|
3
3
|
|
|
4
4
|
export interface InboxMessageBody {
|
|
5
|
-
action: string
|
|
6
|
-
body: string
|
|
7
|
-
type: InboxMessageType
|
|
8
|
-
image: string
|
|
9
|
-
title: string
|
|
10
|
-
html_body: string
|
|
11
|
-
additional_buttons?: { inbox_cta_text: string; action: string }[]
|
|
5
|
+
action: string;
|
|
6
|
+
body: string;
|
|
7
|
+
type: InboxMessageType;
|
|
8
|
+
image: string;
|
|
9
|
+
title: string;
|
|
10
|
+
html_body: string;
|
|
11
|
+
additional_buttons?: { inbox_cta_text: string; action: string }[];
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export interface InboxMessage {
|
|
15
|
-
createDate: string
|
|
16
|
-
body: InboxMessageBody
|
|
17
|
-
engagement_uid: string
|
|
18
|
-
is_read: boolean
|
|
19
|
-
is_starred: boolean
|
|
20
|
-
is_deleted?: boolean
|
|
15
|
+
createDate: string;
|
|
16
|
+
body: InboxMessageBody;
|
|
17
|
+
engagement_uid: string;
|
|
18
|
+
is_read: boolean;
|
|
19
|
+
is_starred: boolean;
|
|
20
|
+
is_deleted?: boolean;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export const InboxMessageBodyTransform = (item: InboxMessageBody): TInboxMessageBody => {
|
|
@@ -26,18 +26,18 @@ export const InboxMessageBodyTransform = (item: InboxMessageBody): TInboxMessage
|
|
|
26
26
|
icon: item.image,
|
|
27
27
|
title: item.title,
|
|
28
28
|
preview_body: item.body,
|
|
29
|
-
}
|
|
29
|
+
};
|
|
30
30
|
|
|
31
31
|
if (item.action === 'dp:inbox') {
|
|
32
32
|
if (item.additional_buttons && item.additional_buttons.length) {
|
|
33
33
|
x.buttons = item.additional_buttons.map((b) => ({
|
|
34
34
|
action: b.action,
|
|
35
35
|
text: b.inbox_cta_text,
|
|
36
|
-
}))
|
|
36
|
+
}));
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
x.html_body = item?.html_body || null
|
|
39
|
+
x.html_body = item?.html_body || null;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
return x
|
|
43
|
-
}
|
|
42
|
+
return x;
|
|
43
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ProtocolMessage } from '../Base/ProtocolMessage'
|
|
1
|
+
import { ProtocolMessage } from '../Base/ProtocolMessage';
|
|
2
2
|
|
|
3
3
|
export interface MarkInboxMessageDeletedRequest extends ProtocolMessage {
|
|
4
|
-
engagement_uid?: string
|
|
5
|
-
all_deleted?: boolean
|
|
4
|
+
engagement_uid?: string;
|
|
5
|
+
all_deleted?: boolean;
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ProtocolMessage } from '../Base/ProtocolMessage'
|
|
1
|
+
import { ProtocolMessage } from '../Base/ProtocolMessage';
|
|
2
2
|
|
|
3
3
|
export interface MarkInboxMessageDeletedResponse extends ProtocolMessage {
|
|
4
|
-
errCode: number
|
|
5
|
-
errMsg?: string
|
|
4
|
+
errCode: number;
|
|
5
|
+
errMsg?: string;
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ProtocolMessage } from '../Base/ProtocolMessage'
|
|
1
|
+
import { ProtocolMessage } from '../Base/ProtocolMessage';
|
|
2
2
|
|
|
3
3
|
export interface MarkInboxMessageReadRequest extends ProtocolMessage {
|
|
4
|
-
engagement_uid?: string
|
|
5
|
-
all_read?: boolean
|
|
4
|
+
engagement_uid?: string;
|
|
5
|
+
all_read?: boolean;
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ProtocolMessage } from '../Base/ProtocolMessage'
|
|
1
|
+
import { ProtocolMessage } from '../Base/ProtocolMessage';
|
|
2
2
|
|
|
3
3
|
export interface MarkInboxMessageReadResponse extends ProtocolMessage {
|
|
4
|
-
errCode: number
|
|
5
|
-
errMsg?: string
|
|
4
|
+
errCode: number;
|
|
5
|
+
errMsg?: string;
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ProtocolMessage } from '../Base/ProtocolMessage'
|
|
1
|
+
import { ProtocolMessage } from '../Base/ProtocolMessage';
|
|
2
2
|
|
|
3
3
|
export interface MarkInboxMessageStarredRequest extends ProtocolMessage {
|
|
4
|
-
engagement_uid: string
|
|
5
|
-
is_starred?: boolean
|
|
4
|
+
engagement_uid: string;
|
|
5
|
+
is_starred?: boolean;
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ProtocolMessage } from '../Base/ProtocolMessage'
|
|
1
|
+
import { ProtocolMessage } from '../Base/ProtocolMessage';
|
|
2
2
|
|
|
3
3
|
export interface MarkInboxMessageStarredResponse extends ProtocolMessage {
|
|
4
|
-
errCode: number
|
|
5
|
-
errMsg?: string
|
|
4
|
+
errCode: number;
|
|
5
|
+
errMsg?: string;
|
|
6
6
|
}
|
package/src/Inbox/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from './GetInboxMessagesRequest'
|
|
2
|
-
export * from './GetInboxMessagesResponse'
|
|
3
|
-
export * from './InboxMessage'
|
|
4
|
-
export * from './InboxMessageType'
|
|
5
|
-
export * from './MarkInboxMessageReadRequest'
|
|
6
|
-
export * from './MarkInboxMessageReadResponse'
|
|
7
|
-
export * from './MarkInboxMessageStarredRequest'
|
|
8
|
-
export * from './MarkInboxMessageStarredResponse'
|
|
9
|
-
export * from './MarkInboxMessageDeletedRequest'
|
|
10
|
-
export * from './MarkInboxMessageDeletedResponse'
|
|
1
|
+
export * from './GetInboxMessagesRequest';
|
|
2
|
+
export * from './GetInboxMessagesResponse';
|
|
3
|
+
export * from './InboxMessage';
|
|
4
|
+
export * from './InboxMessageType';
|
|
5
|
+
export * from './MarkInboxMessageReadRequest';
|
|
6
|
+
export * from './MarkInboxMessageReadResponse';
|
|
7
|
+
export * from './MarkInboxMessageStarredRequest';
|
|
8
|
+
export * from './MarkInboxMessageStarredResponse';
|
|
9
|
+
export * from './MarkInboxMessageDeletedRequest';
|
|
10
|
+
export * from './MarkInboxMessageDeletedResponse';
|
package/src/IntUtils.ts
CHANGED
|
@@ -1,43 +1,47 @@
|
|
|
1
1
|
class IntUtils {
|
|
2
2
|
public static uuid(): string {
|
|
3
|
-
let a: any
|
|
4
|
-
let b: any
|
|
5
|
-
for (
|
|
6
|
-
|
|
3
|
+
let a: any;
|
|
4
|
+
let b: any;
|
|
5
|
+
for (
|
|
6
|
+
b = a = '';
|
|
7
|
+
a++ < 36;
|
|
8
|
+
b += (a * 51) & 52 ? (a ^ 15 ? 8 ^ (Math.random() * (a ^ 20 ? 16 : 4)) : 4).toString(16) : '-'
|
|
9
|
+
) {}
|
|
10
|
+
return b;
|
|
7
11
|
}
|
|
8
12
|
|
|
9
13
|
public static isNotNull(val: any): boolean {
|
|
10
|
-
return typeof val !== 'undefined' && val !== null
|
|
14
|
+
return typeof val !== 'undefined' && val !== null;
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
public static isNotEmpty(val: string): boolean {
|
|
14
|
-
return typeof val !== 'undefined' && val !== null && val.length > 0
|
|
18
|
+
return typeof val !== 'undefined' && val !== null && val.length > 0;
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
public static replaceAll(value: string, regex: string, replacement: string | number): string {
|
|
18
22
|
if (IntUtils.isNotNull(value)) {
|
|
19
|
-
return value.replace(new RegExp(IntUtils.escapeRegExp(regex), 'g'), replacement?.toString())
|
|
23
|
+
return value.replace(new RegExp(IntUtils.escapeRegExp(regex), 'g'), replacement?.toString());
|
|
20
24
|
}
|
|
21
|
-
return value
|
|
25
|
+
return value;
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
public static escapeRegExp(v: string): string {
|
|
25
29
|
if (IntUtils.isNotEmpty(v)) {
|
|
26
|
-
return v.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
30
|
+
return v.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
27
31
|
}
|
|
28
|
-
return v
|
|
32
|
+
return v;
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
public static JsonOrText = (str: string): any => {
|
|
32
36
|
if (str && str.includes && (str.includes('{') || str.includes('['))) {
|
|
33
37
|
try {
|
|
34
|
-
return JSON.parse(str)
|
|
38
|
+
return JSON.parse(str);
|
|
35
39
|
} catch (e) {
|
|
36
|
-
return str
|
|
40
|
+
return str;
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
|
-
return str
|
|
40
|
-
}
|
|
43
|
+
return str;
|
|
44
|
+
};
|
|
41
45
|
|
|
42
46
|
// public static wsTimeToEpoch = (time: string): number => {
|
|
43
47
|
// if (time) {
|
|
@@ -48,28 +52,32 @@ class IntUtils {
|
|
|
48
52
|
// }
|
|
49
53
|
|
|
50
54
|
public static isWithinPeriod = (timestamp: number, period: 'today' | 'thisWeek' | 'thisMonth'): boolean => {
|
|
51
|
-
const now = new Date()
|
|
52
|
-
const completedDate = new Date(timestamp)
|
|
55
|
+
const now = new Date();
|
|
56
|
+
const completedDate = new Date(timestamp);
|
|
53
57
|
|
|
54
58
|
switch (period) {
|
|
55
59
|
case 'today':
|
|
56
|
-
return
|
|
60
|
+
return (
|
|
61
|
+
now.getFullYear() === completedDate.getFullYear() &&
|
|
62
|
+
now.getMonth() === completedDate.getMonth() &&
|
|
63
|
+
now.getDate() === completedDate.getDate()
|
|
64
|
+
);
|
|
57
65
|
case 'thisWeek':
|
|
58
|
-
const startOfWeek = new Date(now)
|
|
59
|
-
startOfWeek.setDate(now.getDate() - now.getDay())
|
|
60
|
-
startOfWeek.setHours(0, 0, 0, 0)
|
|
66
|
+
const startOfWeek = new Date(now);
|
|
67
|
+
startOfWeek.setDate(now.getDate() - now.getDay());
|
|
68
|
+
startOfWeek.setHours(0, 0, 0, 0);
|
|
61
69
|
|
|
62
|
-
const endOfWeek = new Date(startOfWeek)
|
|
63
|
-
endOfWeek.setDate(startOfWeek.getDate() + 6)
|
|
64
|
-
endOfWeek.setHours(23, 59, 59, 999)
|
|
70
|
+
const endOfWeek = new Date(startOfWeek);
|
|
71
|
+
endOfWeek.setDate(startOfWeek.getDate() + 6);
|
|
72
|
+
endOfWeek.setHours(23, 59, 59, 999);
|
|
65
73
|
|
|
66
|
-
return completedDate >= startOfWeek && completedDate <= endOfWeek
|
|
74
|
+
return completedDate >= startOfWeek && completedDate <= endOfWeek;
|
|
67
75
|
case 'thisMonth':
|
|
68
|
-
return now.getFullYear() === completedDate.getFullYear() && now.getMonth() === completedDate.getMonth()
|
|
76
|
+
return now.getFullYear() === completedDate.getFullYear() && now.getMonth() === completedDate.getMonth();
|
|
69
77
|
default:
|
|
70
|
-
return false
|
|
78
|
+
return false;
|
|
71
79
|
}
|
|
72
|
-
}
|
|
80
|
+
};
|
|
73
81
|
}
|
|
74
82
|
|
|
75
|
-
export { IntUtils }
|
|
83
|
+
export { IntUtils };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ProtocolResponse } from '../Base/ProtocolResponse'
|
|
2
|
-
import { JackpotPot } from './JackpotPot'
|
|
1
|
+
import { ProtocolResponse } from '../Base/ProtocolResponse';
|
|
2
|
+
import { JackpotPot } from './JackpotPot';
|
|
3
3
|
|
|
4
4
|
export interface GetJackpotsPotsResponse extends ProtocolResponse {
|
|
5
|
-
items: JackpotPot[]
|
|
5
|
+
items: JackpotPot[];
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ProtocolMessage } from '../Base/ProtocolMessage'
|
|
1
|
+
import { ProtocolMessage } from '../Base/ProtocolMessage';
|
|
2
2
|
|
|
3
3
|
export interface GetJackpotsRequest extends ProtocolMessage {
|
|
4
|
-
related_game_id?: string
|
|
5
|
-
jp_template_id?: number
|
|
4
|
+
related_game_id?: string;
|
|
5
|
+
jp_template_id?: number;
|
|
6
6
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AchRelatedGame } from '../Base/AchRelatedGame'
|
|
2
|
-
import { ProtocolResponse } from '../Base/ProtocolResponse'
|
|
3
|
-
import { JackpotDetails } from './JackpotDetails'
|
|
1
|
+
import { AchRelatedGame } from '../Base/AchRelatedGame';
|
|
2
|
+
import { ProtocolResponse } from '../Base/ProtocolResponse';
|
|
3
|
+
import { JackpotDetails } from './JackpotDetails';
|
|
4
4
|
|
|
5
5
|
export interface GetJackpotsResponse extends ProtocolResponse {
|
|
6
|
-
items: JackpotDetails[]
|
|
6
|
+
items: JackpotDetails[];
|
|
7
7
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
interface JackPotWinner {
|
|
2
2
|
/** Flag indicating that this winner is the currently logged in user */
|
|
3
|
-
is_me: boolean
|
|
3
|
+
is_me: boolean;
|
|
4
4
|
/** Name of the winner, note that for all users except is_me, the name is masked by default, but masking can be disabled by request to Smartico AM team */
|
|
5
|
-
public_username: string // masked for all except "is_me"
|
|
5
|
+
public_username: string; // masked for all except "is_me"
|
|
6
6
|
/** Won amount in the Jackpot currency */
|
|
7
|
-
winning_amount_jp_currency: number
|
|
7
|
+
winning_amount_jp_currency: number;
|
|
8
8
|
/** Won amount in the user Wallet currency */
|
|
9
|
-
winning_amount_wallet_currency: number
|
|
9
|
+
winning_amount_wallet_currency: number;
|
|
10
10
|
/** Position of the winner. Relevant for jackpots where there could be multiple winners */
|
|
11
|
-
winning_position: number
|
|
11
|
+
winning_position: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export { JackPotWinner }
|
|
14
|
+
export { JackPotWinner };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AchRelatedGame } from '../Base/AchRelatedGame'
|
|
2
|
-
import { JackpotContributionType } from './JackpotContributionType'
|
|
3
|
-
import { JackpotPot } from './JackpotPot'
|
|
4
|
-
import { JackpotPublicMeta } from './JackpotPublicMeta'
|
|
5
|
-
import { JackpotType } from './JackpotType'
|
|
1
|
+
import { AchRelatedGame } from '../Base/AchRelatedGame';
|
|
2
|
+
import { JackpotContributionType } from './JackpotContributionType';
|
|
3
|
+
import { JackpotPot } from './JackpotPot';
|
|
4
|
+
import { JackpotPublicMeta } from './JackpotPublicMeta';
|
|
5
|
+
import { JackpotType } from './JackpotType';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* JackpotDetails the information about Jackpot template
|
|
@@ -11,29 +11,29 @@ import { JackpotType } from './JackpotType'
|
|
|
11
11
|
*/
|
|
12
12
|
interface JackpotDetails {
|
|
13
13
|
/** ID of the jackpot template */
|
|
14
|
-
jp_template_id: number
|
|
14
|
+
jp_template_id: number;
|
|
15
15
|
/** type of jackpot logic */
|
|
16
|
-
jp_type_id: JackpotType
|
|
16
|
+
jp_type_id: JackpotType;
|
|
17
17
|
/** UI information of jackpot, like name, description, etc. */
|
|
18
|
-
jp_public_meta: JackpotPublicMeta
|
|
18
|
+
jp_public_meta: JackpotPublicMeta;
|
|
19
19
|
/** base currency of the jackpot */
|
|
20
|
-
jp_currency: string
|
|
20
|
+
jp_currency: string;
|
|
21
21
|
/** wallet currency of currently logged in user */
|
|
22
|
-
user_currency: string
|
|
22
|
+
user_currency: string;
|
|
23
23
|
/** list of related games that are eligible for the jackpot */
|
|
24
|
-
related_games?: AchRelatedGame[]
|
|
24
|
+
related_games?: AchRelatedGame[];
|
|
25
25
|
/** type of the user contribution to the jackpot */
|
|
26
|
-
contribution_type: JackpotContributionType
|
|
26
|
+
contribution_type: JackpotContributionType;
|
|
27
27
|
/** value of the user contribution. Fixed amount or percentage of bet depending on the contribution type */
|
|
28
|
-
contribution_value: number
|
|
28
|
+
contribution_value: number;
|
|
29
29
|
/** information of current value of the jackpot */
|
|
30
|
-
pot: JackpotPot
|
|
30
|
+
pot: JackpotPot;
|
|
31
31
|
/** indication if the current user is opted in to the jackpot */
|
|
32
|
-
is_opted_in: boolean
|
|
32
|
+
is_opted_in: boolean;
|
|
33
33
|
/** indicates whether all games are eligible for the jackpot */
|
|
34
|
-
ach_related_game_allow_all: boolean
|
|
34
|
+
ach_related_game_allow_all: boolean;
|
|
35
35
|
/** The number of users who have opted in to participate in the jackpot */
|
|
36
|
-
registration_count: number
|
|
36
|
+
registration_count: number;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
export { JackpotDetails }
|
|
39
|
+
export { JackpotDetails };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
interface JackpotPot {
|
|
2
2
|
/** ID of the jackpot template */
|
|
3
|
-
jp_template_id: number
|
|
3
|
+
jp_template_id: number;
|
|
4
4
|
/** ID of the jackpot pot */
|
|
5
|
-
jp_pot_id: number
|
|
5
|
+
jp_pot_id: number;
|
|
6
6
|
/** currency of the jackpot pot in the Jackput base currency */
|
|
7
|
-
current_pot_amount: number
|
|
7
|
+
current_pot_amount: number;
|
|
8
8
|
/** currency of the jackpot pot in the user wallet currency */
|
|
9
|
-
current_pot_amount_user_currency: number
|
|
9
|
+
current_pot_amount_user_currency: number;
|
|
10
10
|
/** the date/time when this pot exploded */
|
|
11
|
-
explode_date_ts: number
|
|
11
|
+
explode_date_ts: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export { JackpotPot }
|
|
14
|
+
export { JackpotPot };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { JackpotHtmlTemplate } from './JackpotHtmlTemplate'
|
|
1
|
+
import { JackpotHtmlTemplate } from './JackpotHtmlTemplate';
|
|
2
2
|
interface JackpotPublicMeta {
|
|
3
3
|
/** name of the jackpot */
|
|
4
|
-
name: string
|
|
4
|
+
name: string;
|
|
5
5
|
/** description/rules of the jackpot */
|
|
6
|
-
description: string
|
|
6
|
+
description: string;
|
|
7
7
|
/** image url of the jackpot */
|
|
8
|
-
image_url: string
|
|
8
|
+
image_url: string;
|
|
9
9
|
/** HTML template for the winner of the jackpt */
|
|
10
|
-
winner_template: JackpotHtmlTemplate
|
|
10
|
+
winner_template: JackpotHtmlTemplate;
|
|
11
11
|
/** HTML template for the not winner of the jackpot */
|
|
12
|
-
not_winner_template: JackpotHtmlTemplate
|
|
12
|
+
not_winner_template: JackpotHtmlTemplate;
|
|
13
13
|
/** custom value of placeholder1 defined by operator and can be used in the HTML templates */
|
|
14
|
-
placeholder1: string
|
|
14
|
+
placeholder1: string;
|
|
15
15
|
/** custom value of placeholder2 defined by operator and can be used in the HTML templates */
|
|
16
|
-
placeholder2: string
|
|
16
|
+
placeholder2: string;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export { JackpotPublicMeta }
|
|
19
|
+
export { JackpotPublicMeta };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ProtocolMessage } from '../Base/ProtocolMessage'
|
|
2
|
-
import { JackPotWinner } from './JackPotWinner'
|
|
3
|
-
import { JackpotDetails } from './JackpotDetails'
|
|
1
|
+
import { ProtocolMessage } from '../Base/ProtocolMessage';
|
|
2
|
+
import { JackPotWinner } from './JackPotWinner';
|
|
3
|
+
import { JackpotDetails } from './JackpotDetails';
|
|
4
4
|
|
|
5
5
|
export interface JackpotWinPush extends ProtocolMessage {
|
|
6
|
-
jackpot: JackpotDetails
|
|
7
|
-
winners: JackPotWinner[]
|
|
6
|
+
jackpot: JackpotDetails;
|
|
7
|
+
winners: JackPotWinner[];
|
|
8
8
|
}
|
package/src/Jackpots/index.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export * from './GetJackpotsPotsRequest'
|
|
2
|
-
export * from './GetJackpotsPotsResponse'
|
|
3
|
-
export * from './GetJackpotsRequest'
|
|
4
|
-
export * from './GetJackpotsResponse'
|
|
5
|
-
export * from './JackPotWinner'
|
|
6
|
-
export * from './JackpotContributionType'
|
|
7
|
-
export * from './JackpotDetails'
|
|
8
|
-
export * from './JackpotPot'
|
|
9
|
-
export * from './JackpotPublicMeta'
|
|
10
|
-
export * from './JackpotType'
|
|
11
|
-
export * from './JackpotWinPush'
|
|
12
|
-
export * from './JackpotsOptinRequest'
|
|
13
|
-
export * from './JackpotsOptinResponse'
|
|
14
|
-
export * from './JackpotsOptoutRequest'
|
|
15
|
-
export * from './JackpotsOptoutResponse'
|
|
16
|
-
export * from './JackpotHtmlTemplate'
|
|
1
|
+
export * from './GetJackpotsPotsRequest';
|
|
2
|
+
export * from './GetJackpotsPotsResponse';
|
|
3
|
+
export * from './GetJackpotsRequest';
|
|
4
|
+
export * from './GetJackpotsResponse';
|
|
5
|
+
export * from './JackPotWinner';
|
|
6
|
+
export * from './JackpotContributionType';
|
|
7
|
+
export * from './JackpotDetails';
|
|
8
|
+
export * from './JackpotPot';
|
|
9
|
+
export * from './JackpotPublicMeta';
|
|
10
|
+
export * from './JackpotType';
|
|
11
|
+
export * from './JackpotWinPush';
|
|
12
|
+
export * from './JackpotsOptinRequest';
|
|
13
|
+
export * from './JackpotsOptinResponse';
|
|
14
|
+
export * from './JackpotsOptoutRequest';
|
|
15
|
+
export * from './JackpotsOptoutResponse';
|
|
16
|
+
export * from './JackpotHtmlTemplate';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ProtocolMessage } from '../Base/ProtocolMessage'
|
|
2
|
-
import { LeaderBoardPeriodType } from './LeaderBoardPeriodType'
|
|
1
|
+
import { ProtocolMessage } from '../Base/ProtocolMessage';
|
|
2
|
+
import { LeaderBoardPeriodType } from './LeaderBoardPeriodType';
|
|
3
3
|
|
|
4
4
|
export interface GetLeaderBoardsRequest extends ProtocolMessage {
|
|
5
5
|
// if not set will return all boards
|
|
6
|
-
period_type_id?: LeaderBoardPeriodType
|
|
6
|
+
period_type_id?: LeaderBoardPeriodType;
|
|
7
7
|
// can be >=1, if set will return snapshot for the previous period (1), or period before previous (2) etc
|
|
8
|
-
snapshot_offset?: number
|
|
9
|
-
include_users?: boolean
|
|
8
|
+
snapshot_offset?: number;
|
|
9
|
+
include_users?: boolean;
|
|
10
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ProtocolResponse } from '../Base/ProtocolResponse'
|
|
2
|
-
import { LeaderBoardDetails } from './LeaderBoardDetails'
|
|
1
|
+
import { ProtocolResponse } from '../Base/ProtocolResponse';
|
|
2
|
+
import { LeaderBoardDetails } from './LeaderBoardDetails';
|
|
3
3
|
|
|
4
4
|
export interface GetLeaderBoardsResponse extends ProtocolResponse {
|
|
5
|
-
map: { [key: string]: LeaderBoardDetails }
|
|
5
|
+
map: { [key: string]: LeaderBoardDetails };
|
|
6
6
|
}
|