@smartico/public-api 0.0.420 → 0.0.422
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/README.md +14 -0
- package/dist/ActivityLog/ActivityLogActivities.d.ts +1 -1
- package/dist/ActivityLog/ActivityLogEntry.d.ts +35 -17
- package/dist/ActivityLog/ActivityLogMeta.d.ts +31 -0
- package/dist/ActivityLog/GetActivityLogRequest.d.ts +2 -0
- package/dist/ActivityLog/GetActivityLogResponse.d.ts +1 -2
- package/dist/Jackpots/JackPotWinPushWinner.d.ts +34 -0
- package/dist/Jackpots/JackPotWinner.d.ts +3 -1
- package/dist/Jackpots/JackpotContributionRule.d.ts +23 -0
- package/dist/Jackpots/JackpotDetails.d.ts +8 -0
- package/dist/Jackpots/JackpotPot.d.ts +4 -2
- package/dist/Jackpots/JackpotPublicMeta.d.ts +6 -2
- package/dist/Jackpots/JackpotWinPush.d.ts +14 -2
- package/dist/Jackpots/index.d.ts +2 -0
- package/dist/SmarticoAPI.d.ts +1 -3
- package/dist/WSAPI/WSAPIBase.d.ts +0 -1
- package/dist/WSAPI/WSAPIJackpots.d.ts +2 -0
- package/dist/WSAPI/WSAPITypes.d.ts +19 -17
- package/dist/WSAPI/WSAPIUser.d.ts +11 -36
- package/dist/index.js +36 -128
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +34 -100
- package/dist/index.modern.mjs.map +1 -1
- package/docs/Callbacks.md +1 -1
- package/docs/api/README.md +4 -4
- package/docs/api/classes/WSAPIJackpots.md +2 -0
- package/docs/api/classes/WSAPIUser.md +30 -59
- package/docs/api/documents/Callbacks.md +1 -1
- package/docs/api/enumerations/ActivityLogActivities.md +1 -1
- package/docs/api/enumerations/PointChangeSourceType.md +6 -0
- package/docs/api/interfaces/ActivityLogEntry.md +124 -0
- package/docs/api/interfaces/ActivityLogMeta.md +100 -0
- package/docs/api/interfaces/JackPotWinPushWinner.md +103 -0
- package/docs/api/interfaces/JackPotWinner.md +9 -1
- package/docs/api/interfaces/JackpotContributionRule.md +49 -0
- package/docs/api/interfaces/JackpotDetails.md +24 -0
- package/docs/api/interfaces/JackpotPot.md +9 -1
- package/docs/api/interfaces/JackpotPublicMeta.md +12 -2
- package/docs/api/interfaces/JackpotWinPush.md +14 -1
- package/docs/api/interfaces/TActivityLog.md +70 -2
- package/docs/api/type-aliases/TActivityLogEntry.md +7 -0
- package/docs/capabilities/_responses/gamePickGetActiveRound.json +37 -37
- package/docs/capabilities/_responses/gamePickGetActiveRounds.json +37 -131
- package/docs/capabilities/_responses/gamePickGetBoard.json +25 -14
- package/docs/capabilities/_responses/gamePickGetGameInfo.json +93 -79
- package/docs/capabilities/_responses/gamePickGetHistory.json +37 -131
- package/docs/capabilities/_responses/gamePickGetUserInfo.json +5 -5
- package/docs/capabilities/_responses/getActivityLog.json +106 -1
- package/docs/capabilities/_responses/getAvatarsCustomized.json +4 -4
- package/docs/capabilities/_responses/getAvatarsList.json +2 -2
- package/docs/capabilities/_responses/getBadges.json +27 -29
- package/docs/capabilities/_responses/getBonuses.json +1 -18
- package/docs/capabilities/_responses/getClanInfo.json +13 -13
- package/docs/capabilities/_responses/getClans.json +6 -6
- package/docs/capabilities/_responses/getCurrentLevel.json +12 -12
- package/docs/capabilities/_responses/getInboxMessageBody.json +2 -2
- package/docs/capabilities/_responses/getInboxMessages.json +6 -6
- package/docs/capabilities/_responses/getInboxUnreadCount.json +1 -1
- package/docs/capabilities/_responses/getJackpotWinners.json +14 -14
- package/docs/capabilities/_responses/getLeaderBoard.json +8 -8
- package/docs/capabilities/_responses/getMiniGames.json +92 -90
- package/docs/capabilities/_responses/getMiniGamesHistory.json +874 -1
- package/docs/capabilities/_responses/getMissions.json +2 -2
- package/docs/capabilities/_responses/getRaffleDrawRun.json +7 -7
- package/docs/capabilities/_responses/getRaffleDrawRunsHistory.json +6 -6
- package/docs/capabilities/_responses/getRaffles.json +14 -14
- package/docs/capabilities/_responses/getStorePurchasedItems.json +5 -5
- package/docs/capabilities/_responses/getTournamentInstanceInfo.json +100 -53
- package/docs/capabilities/_responses/getTournamentsList.json +12 -12
- package/docs/capabilities/_responses/getTranslations.json +1 -1
- package/docs/capabilities/_responses/getUserProfile.json +10 -10
- package/docs/capabilities/_responses/jackpotGet.json +33 -34
- package/docs/capabilities/gamePickGetActiveRound.md +22 -23
- package/docs/capabilities/gamePickGetActiveRounds.md +22 -23
- package/docs/capabilities/gamePickGetBoard.md +14 -14
- package/docs/capabilities/gamePickGetGameInfo.md +24 -44
- package/docs/capabilities/gamePickGetHistory.md +22 -23
- package/docs/capabilities/gamePickGetUserInfo.md +5 -5
- package/docs/capabilities/getActivityLog.md +69 -9
- package/docs/capabilities/getAvatarsCustomized.md +3 -3
- package/docs/capabilities/getBadges.md +13 -14
- package/docs/capabilities/getBonuses.md +2 -17
- package/docs/capabilities/getClanInfo.md +8 -8
- package/docs/capabilities/getClans.md +4 -4
- package/docs/capabilities/getCurrentLevel.md +12 -12
- package/docs/capabilities/getInboxMessageBody.md +2 -2
- package/docs/capabilities/getInboxMessages.md +3 -3
- package/docs/capabilities/getInboxUnreadCount.md +6 -0
- package/docs/capabilities/getJackpotWinners.md +9 -8
- package/docs/capabilities/getLeaderBoard.md +5 -5
- package/docs/capabilities/getMiniGames.md +35 -37
- package/docs/capabilities/getMiniGamesHistory.md +83 -2
- package/docs/capabilities/getMissions.md +1 -1
- package/docs/capabilities/getRaffleDrawRun.md +7 -7
- package/docs/capabilities/getRaffleDrawRunsHistory.md +3 -3
- package/docs/capabilities/getRaffles.md +8 -8
- package/docs/capabilities/getStorePurchasedItems.md +2 -2
- package/docs/capabilities/getTournamentInstanceInfo.md +45 -37
- package/docs/capabilities/getTournamentsList.md +6 -6
- package/docs/capabilities/getTranslations.md +1 -1
- package/docs/capabilities/getUserProfile.md +10 -10
- package/docs/capabilities/jackpotGet.md +56 -28
- package/docs/capabilities/jackpotOptIn.md +2 -0
- package/docs/capabilities/smarticoCallbacks.md +1 -1
- package/docs/native/PROTOCOL.md +141 -18
- package/docs/ui/jackpots/UIGuide_jackpotGet.md +1 -1
- package/docs/ui/user/UIGuide_getActivityLog.md +4 -2
- package/package.json +4 -3
- package/scripts/capture-responses-browser.mjs +8 -1
- package/src/ActivityLog/ActivityLogActivities.ts +1 -1
- package/src/ActivityLog/ActivityLogEntry.ts +33 -21
- package/src/ActivityLog/ActivityLogMeta.ts +31 -0
- package/src/ActivityLog/GetActivityLogRequest.ts +2 -0
- package/src/ActivityLog/GetActivityLogResponse.ts +23 -49
- package/src/Jackpots/JackPotWinPushWinner.ts +35 -0
- package/src/Jackpots/JackPotWinner.ts +3 -1
- package/src/Jackpots/JackpotContributionRule.ts +25 -0
- package/src/Jackpots/JackpotDetails.ts +8 -0
- package/src/Jackpots/JackpotPot.ts +4 -2
- package/src/Jackpots/JackpotPublicMeta.ts +6 -2
- package/src/Jackpots/JackpotWinPush.ts +14 -2
- package/src/Jackpots/index.ts +2 -0
- package/src/MiniGames/SAWGetTemplatesResponse.ts +1 -0
- package/src/SmarticoAPI.ts +1 -44
- package/src/WSAPI/WSAPIBase.ts +0 -1
- package/src/WSAPI/WSAPIJackpots.ts +2 -0
- package/src/WSAPI/WSAPITypes.ts +20 -18
- package/src/WSAPI/WSAPIUser.ts +10 -53
- package/docs/api/interfaces/GemsDiamondsLog.md +0 -45
- package/docs/api/interfaces/PointsLog.md +0 -45
- package/docs/api/interfaces/TActivityLogEntry.md +0 -100
- package/docs/api/type-aliases/ActivityLogEntry.md +0 -3
- package/docs/capabilities/getActivityLogV2.md +0 -62
|
@@ -1,27 +1,39 @@
|
|
|
1
|
+
import { ActivityLogActivities } from './ActivityLogActivities';
|
|
2
|
+
import { ActivityLogMeta } from './ActivityLogMeta';
|
|
1
3
|
import { PointChangeSourceType } from './PointChangeSourceType';
|
|
2
|
-
import { UserBalanceType } from './UserBalanceType';
|
|
3
|
-
|
|
4
|
-
export interface PointsLog {
|
|
5
|
-
/** Epoch timestamp in SECONDS (not ms — unlike most SDK timestamps). */
|
|
6
|
-
create_date: number;
|
|
7
|
-
user_ext_id: string;
|
|
8
|
-
crm_brand_id: number;
|
|
9
|
-
points_collected: number;
|
|
10
|
-
user_points_ever: number;
|
|
11
|
-
user_points_balance: number;
|
|
12
|
-
source_type_id: PointChangeSourceType;
|
|
13
|
-
}
|
|
14
4
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
/**
|
|
6
|
+
* One raw activity-log row as it arrives on the wire.
|
|
7
|
+
*
|
|
8
|
+
* JS consumers receive the friendlier {@link TActivityLog} instead — this is the
|
|
9
|
+
* pre-transform shape, documented for native clients that read the protocol directly.
|
|
10
|
+
*/
|
|
11
|
+
export interface ActivityLogEntry {
|
|
12
|
+
/** Creation time; `seconds` is the epoch value in SECONDS (not ms). */
|
|
13
|
+
create_date: { seconds: number; nanos?: number };
|
|
18
14
|
user_ext_id: string;
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
/** Sent as a string on the wire. */
|
|
16
|
+
crm_brand_id: string;
|
|
17
|
+
/** Kind of activity this row records. */
|
|
18
|
+
type: ActivityLogActivities;
|
|
19
|
+
/** Sub-action within `type` (e.g. unlock vs complete, add vs deduct). */
|
|
20
|
+
ctx_1: number;
|
|
21
|
+
/** Extra display payload for the row; contents vary by `type`. */
|
|
22
|
+
ctx_meta?: ActivityLogMeta;
|
|
23
|
+
/** What triggered the change. */
|
|
24
|
+
source_type_id: PointChangeSourceType;
|
|
25
|
+
/** More specific id within the source (e.g. level id, draw id, win id). */
|
|
26
|
+
source_ref_id: number;
|
|
27
|
+
/** Root / parent entity id when the source is nested. */
|
|
28
|
+
source_root_id: number;
|
|
29
|
+
/** Delta applied by this row, in the balance named by `type`. */
|
|
21
30
|
amount: number;
|
|
31
|
+
/** Balance after this row, in the balance named by `type`. */
|
|
22
32
|
balance: number;
|
|
23
|
-
|
|
33
|
+
/** Points balance after this row; points rows only. */
|
|
34
|
+
user_points_balance?: number;
|
|
35
|
+
/** Total points ever collected after this row; points rows only. */
|
|
36
|
+
user_points_ever?: number;
|
|
37
|
+
/** Placeholder on points rows (`-1`) — read `amount` for the real delta. */
|
|
38
|
+
points_collected?: number;
|
|
24
39
|
}
|
|
25
|
-
|
|
26
|
-
export type ActivityLogEntry = PointsLog | GemsDiamondsLog;
|
|
27
|
-
|
|
@@ -1,8 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extra display payload attached to an activity-log row (`ctx_meta` on the wire).
|
|
3
|
+
* Which keys are present depends on the row's activity type — treat every field
|
|
4
|
+
* as optional and render only what is there.
|
|
5
|
+
*/
|
|
1
6
|
export interface ActivityLogMeta {
|
|
7
|
+
/** Display name of the source entity (mission, tournament, raffle, …). */
|
|
2
8
|
name?: string;
|
|
3
9
|
image_url?: string;
|
|
4
10
|
position?: number;
|
|
11
|
+
/** Points balance before this row; points rows. */
|
|
5
12
|
user_points_balance_before?: number;
|
|
13
|
+
/** Points the awarding rule asked for; points rows. */
|
|
6
14
|
points_requested?: number;
|
|
15
|
+
/** Total points ever collected after this row; points rows. */
|
|
7
16
|
user_points_ever?: number;
|
|
17
|
+
/** Gems / diamonds the awarding rule asked for; gems / diamonds rows. */
|
|
18
|
+
amount_requested?: number;
|
|
19
|
+
/** Gems / diamonds balance before this row. */
|
|
20
|
+
balance_before?: number;
|
|
21
|
+
/** Whether this row counts toward level progress. */
|
|
22
|
+
affects_level?: boolean;
|
|
23
|
+
/** Whether this row counts toward leaderboards. */
|
|
24
|
+
affects_leaderboard?: boolean;
|
|
25
|
+
/** Whether this row moved the spendable balance. */
|
|
26
|
+
affects_current_balance?: boolean;
|
|
27
|
+
/** Set on the row that seeds a brand-new user's wallet. */
|
|
28
|
+
user_initialization?: boolean;
|
|
29
|
+
/** Set on mission rows for repeatable missions. */
|
|
30
|
+
is_recurring?: boolean;
|
|
31
|
+
/** Level moved from; level-change rows. */
|
|
32
|
+
from_level_id?: number;
|
|
33
|
+
/** Level moved to; level-change rows. */
|
|
34
|
+
to_level_id?: number;
|
|
35
|
+
/** Public meta of the level moved from; level-change rows. */
|
|
36
|
+
from_level_public_meta?: any;
|
|
37
|
+
/** Public meta of the level moved to; level-change rows. */
|
|
38
|
+
to_level_public_meta?: any;
|
|
8
39
|
}
|
|
@@ -6,6 +6,8 @@ export interface GetActivityLogRequest extends ProtocolMessage {
|
|
|
6
6
|
endTimeSeconds: number;
|
|
7
7
|
limit: number;
|
|
8
8
|
offset: number;
|
|
9
|
+
/** Optional filter — {@link ActivityLogActivities} values to include. */
|
|
9
10
|
types?: number[];
|
|
11
|
+
/** Optional filter — {@link PointChangeSourceType} values to include. */
|
|
10
12
|
src_types?: number[];
|
|
11
13
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ProtocolResponse } from '../Base/ProtocolResponse';
|
|
2
2
|
import { ActivityLogEntry } from './ActivityLogEntry';
|
|
3
3
|
import { ActivityLogActivities } from './ActivityLogActivities';
|
|
4
|
-
import { TActivityLog
|
|
4
|
+
import { TActivityLog } from '../WSAPI/WSAPITypes';
|
|
5
5
|
import { UserBalanceType } from './UserBalanceType';
|
|
6
6
|
|
|
7
7
|
export interface GetActivityLogResponse extends ProtocolResponse {
|
|
@@ -13,64 +13,38 @@ export const ActivityLogTransform = (items: ActivityLogEntry[]): TActivityLog[]
|
|
|
13
13
|
return [];
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
return items.map((
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
item.type = item.type ?? UserBalanceType.Points;
|
|
25
|
-
|
|
26
|
-
if (item.type === UserBalanceType.Diamonds || item.type === UserBalanceType.Gems) {
|
|
27
|
-
itemTransformed.type = item.type;
|
|
28
|
-
itemTransformed.amount = item.amount;
|
|
29
|
-
itemTransformed.balance = item.balance;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (item.type === UserBalanceType.Points) {
|
|
33
|
-
itemTransformed.type = UserBalanceType.Points;
|
|
34
|
-
itemTransformed.amount = item.points_collected;
|
|
35
|
-
itemTransformed.balance = item.user_points_balance;
|
|
36
|
-
itemTransformed.total_ever = item.user_points_ever;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return itemTransformed as TActivityLog;
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const ActivityLogV2Transform = (items: any[]): TActivityLogEntry[] => {
|
|
44
|
-
if (!items) {
|
|
45
|
-
return [];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return items.map((r) => {
|
|
49
|
-
const isGems = r.type_id === ActivityLogActivities.Gems || r.type === UserBalanceType.Gems;
|
|
50
|
-
const isDiamonds = r.type_id === ActivityLogActivities.Diamonds || r.type === UserBalanceType.Diamonds;
|
|
16
|
+
return items.map((r: any): TActivityLog => {
|
|
17
|
+
// The wire sends the activity kind as `type` (an ActivityLogActivities value).
|
|
18
|
+
// `type_id` is accepted as an alias so an older/newer server spelling still maps.
|
|
19
|
+
const activityTypeId: ActivityLogActivities = r.type_id ?? r.type;
|
|
20
|
+
const isGems = activityTypeId === ActivityLogActivities.Gems;
|
|
21
|
+
const isDiamonds = activityTypeId === ActivityLogActivities.Diamonds;
|
|
22
|
+
const meta = r.ctx_meta ?? r.context_value_meta;
|
|
51
23
|
|
|
52
|
-
|
|
24
|
+
return {
|
|
53
25
|
create_date: r.create_date?.seconds ?? r.create_date,
|
|
54
26
|
user_ext_id: r.user_ext_id,
|
|
55
|
-
|
|
27
|
+
// Sent as a string on the wire.
|
|
28
|
+
crm_brand_id: Number(r.crm_brand_id),
|
|
56
29
|
type: isGems ? UserBalanceType.Gems : isDiamonds ? UserBalanceType.Diamonds : UserBalanceType.Points,
|
|
57
|
-
amount
|
|
30
|
+
// `amount` carries the real delta; `points_collected` is a `-1` placeholder on points rows.
|
|
31
|
+
amount: r.amount ?? r.points_collected,
|
|
58
32
|
balance: r.user_points_balance ?? r.balance,
|
|
59
33
|
total_ever: r.user_points_ever,
|
|
60
34
|
source_type_id: r.source_type_id,
|
|
61
|
-
activity_type_id:
|
|
62
|
-
context_value_1: r.context_value_1,
|
|
63
|
-
meta
|
|
64
|
-
|
|
35
|
+
activity_type_id: activityTypeId,
|
|
36
|
+
context_value_1: r.ctx_1 ?? r.context_value_1,
|
|
37
|
+
meta,
|
|
38
|
+
// Entity name travels inside the context meta, not as a top-level field.
|
|
39
|
+
source_entity_name: r.source_entity_name ?? meta?.name,
|
|
65
40
|
source_entity_id: r.source_entity_id,
|
|
66
|
-
source_reference_id: r.source_reference_id,
|
|
41
|
+
source_reference_id: r.source_ref_id ?? r.source_reference_id,
|
|
67
42
|
source_root_id: r.source_root_id,
|
|
68
43
|
is_wallet_entry:
|
|
69
|
-
|
|
70
|
-
||
|
|
71
|
-
||
|
|
72
|
-
||
|
|
44
|
+
activityTypeId == null
|
|
45
|
+
|| activityTypeId === ActivityLogActivities.Gems
|
|
46
|
+
|| activityTypeId === ActivityLogActivities.Diamonds
|
|
47
|
+
|| activityTypeId === ActivityLogActivities.Points,
|
|
73
48
|
};
|
|
74
|
-
return x;
|
|
75
49
|
});
|
|
76
50
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One winner entry inside a {@link JackpotWinPush}.
|
|
3
|
+
*
|
|
4
|
+
* Distinct from {@link JackPotWinner}, which is the winner shape returned by the
|
|
5
|
+
* `getJackpotWinners()` history — the live win push carries bet / trigger context
|
|
6
|
+
* and no avatar.
|
|
7
|
+
*/
|
|
8
|
+
interface JackPotWinPushWinner {
|
|
9
|
+
/** Smartico user ID of the winner */
|
|
10
|
+
user_id: number;
|
|
11
|
+
/** Operator's external user ID of the winner */
|
|
12
|
+
ext_user_id: string;
|
|
13
|
+
/** Flag indicating that this copy of the push was delivered to the winner themselves */
|
|
14
|
+
is_me: boolean;
|
|
15
|
+
/** Name of the winner, masked for everyone except `is_me` unless masking is disabled by request to Smartico AM team */
|
|
16
|
+
public_username: string;
|
|
17
|
+
/** Custom display name; falls back to `public_username` when not set */
|
|
18
|
+
public_username_custom: string;
|
|
19
|
+
/** Won amount in the Jackpot currency; real and bonus parts are combined */
|
|
20
|
+
winning_amount_jp_currency: number;
|
|
21
|
+
/** Won amount in the user Wallet currency; real and bonus parts are combined */
|
|
22
|
+
winning_amount_wallet_currency: number;
|
|
23
|
+
/** Position of the winner. Relevant for jackpots where there could be multiple winners */
|
|
24
|
+
winning_position: number;
|
|
25
|
+
/** External game ID of the game whose bet triggered the win; `null` when the triggering bet context is unavailable */
|
|
26
|
+
winning_game_id: string | null;
|
|
27
|
+
/** External provider ID of the triggering game's provider; `null` when the triggering bet context is unavailable */
|
|
28
|
+
winning_provider_id: string | null;
|
|
29
|
+
/** Placement time of the triggering bet as reported by the operator (epoch milliseconds) — not the time Smartico processed it; `null` when unavailable */
|
|
30
|
+
bet_original_date: number | null;
|
|
31
|
+
/** Present only on the `is_me` copy; `true` while the win awaits manual approval before payout */
|
|
32
|
+
pending_approve?: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { JackPotWinPushWinner };
|
|
@@ -9,8 +9,10 @@ interface JackPotWinner {
|
|
|
9
9
|
winning_amount_wallet_currency: number;
|
|
10
10
|
/** Position of the winner. Relevant for jackpots where there could be multiple winners */
|
|
11
11
|
winning_position: number;
|
|
12
|
-
/** Avatar of the winner */
|
|
12
|
+
/** Avatar image URL of the winner */
|
|
13
13
|
avatar_id: string;
|
|
14
|
+
/** Numeric ID of the winner's avatar; `null` when the winner has not picked one */
|
|
15
|
+
avatar_real_id: number | null;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export { JackPotWinner };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { JackpotContributionType } from './JackpotContributionType';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* One per-game / per-provider override of a jackpot's default contribution.
|
|
5
|
+
*
|
|
6
|
+
* When a qualifying bet matches a rule's `extEntityIds`, that rule's
|
|
7
|
+
* `contributionValue` and `type` are used instead of the template-level
|
|
8
|
+
* `contribution_value` / `contribution_type`. Rules are informational for
|
|
9
|
+
* consumers — the server applies them. Note the camelCase field names; the rest
|
|
10
|
+
* of the jackpot payload is snake_case.
|
|
11
|
+
*/
|
|
12
|
+
interface JackpotContributionRule {
|
|
13
|
+
/** Stable ID of the rule within its template */
|
|
14
|
+
ruleId: number;
|
|
15
|
+
/** Template this rule belongs to */
|
|
16
|
+
jpTemplateId: number;
|
|
17
|
+
/** Whether `contributionValue` is a fixed amount or a percentage; see {@link JackpotContributionType} */
|
|
18
|
+
type: JackpotContributionType;
|
|
19
|
+
/** Operator-side game or provider IDs this rule applies to */
|
|
20
|
+
extEntityIds: string[];
|
|
21
|
+
/** Contribution to apply for matching bets — fixed amount or percentage depending on `type` */
|
|
22
|
+
contributionValue: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { JackpotContributionRule };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { AchRelatedGame } from '../Base/AchRelatedGame';
|
|
2
|
+
import { JackpotContributionRule } from './JackpotContributionRule';
|
|
1
3
|
import { JackpotContributionType } from './JackpotContributionType';
|
|
2
4
|
import { JackpotPot } from './JackpotPot';
|
|
3
5
|
import { JackpotPublicMeta } from './JackpotPublicMeta';
|
|
@@ -22,10 +24,16 @@ interface JackpotDetails {
|
|
|
22
24
|
contribution_type: JackpotContributionType;
|
|
23
25
|
/** Amount of contribution per qualifying bet — fixed value or percentage depending on `contribution_type`. */
|
|
24
26
|
contribution_value: number;
|
|
27
|
+
/** Per-game / per-provider overrides of `contribution_type` + `contribution_value`; see {@link JackpotContributionRule}. Empty when the template contributes at a flat rate. */
|
|
28
|
+
contribution_rules: JackpotContributionRule[];
|
|
29
|
+
/** Reserved — the server currently always sends an empty array. Use `getJackpotEligibleGames()` for the eligible-games list. */
|
|
30
|
+
related_games: AchRelatedGame[];
|
|
25
31
|
/** Live pot snapshot (amount, temperature, last explosion timestamp). */
|
|
26
32
|
pot: JackpotPot;
|
|
27
33
|
/** `true` when the current user is currently opted in. */
|
|
28
34
|
is_opted_in: boolean;
|
|
35
|
+
/** `true` when eligible users are opted in automatically, so no opt-in CTA is needed; `false` means `jackpotOptIn()` must be called explicitly. */
|
|
36
|
+
is_auto_opt_in: boolean;
|
|
29
37
|
/** `true` when every game in the operator catalog contributes; if `true`, skip `getJackpotEligibleGames`. */
|
|
30
38
|
ach_related_game_allow_all: boolean;
|
|
31
39
|
/** Number of users currently opted in; always `1` for `JackpotType.Personal`. */
|
|
@@ -22,8 +22,10 @@ interface JackpotPot {
|
|
|
22
22
|
current_pot_amount: number;
|
|
23
23
|
/** Current pot amount converted to the user's wallet currency (`user_currency`). */
|
|
24
24
|
current_pot_amount_user_currency: number;
|
|
25
|
-
/** Unix ms timestamp of when this pot last exploded; `
|
|
26
|
-
explode_date_ts: number;
|
|
25
|
+
/** Unix ms timestamp of when this pot last exploded; `null` while the pot is still running. */
|
|
26
|
+
explode_date_ts: number | null;
|
|
27
|
+
/** Owning user for `JackpotType.Personal` pots; `null` for shared `MultiUser` pots. */
|
|
28
|
+
user_id: number | null;
|
|
27
29
|
/** Heat band of the pot relative to its explosion range; see {@link JackPotTemparature}. */
|
|
28
30
|
current_pot_temperature: JackPotTemparature;
|
|
29
31
|
}
|
|
@@ -14,12 +14,16 @@ interface JackpotPublicMeta {
|
|
|
14
14
|
placeholder1: string;
|
|
15
15
|
/** custom value of placeholder2 defined by operator and can be used in the HTML templates */
|
|
16
16
|
placeholder2: string;
|
|
17
|
+
/** operator-defined display order, ascending; sent as a string */
|
|
18
|
+
priority: string;
|
|
17
19
|
/**
|
|
18
|
-
* Custom data
|
|
20
|
+
* Custom data that can be used in API to build custom UI.
|
|
21
|
+
* `jackpotGet()` returns this already parsed — an object when the operator stored JSON,
|
|
22
|
+
* otherwise the raw string. Elsewhere (e.g. the jackpot-win push) it arrives unparsed.
|
|
19
23
|
* You can request from Smartico to define fields for your specific case that will be managed from Smartico BackOffice
|
|
20
24
|
* Read more here - <https://help.smartico.ai/welcome/products/tools-and-guides/custom-fields-attributes>
|
|
21
25
|
*/
|
|
22
|
-
custom_data:
|
|
26
|
+
custom_data: any;
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
export { JackpotPublicMeta };
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import { ProtocolMessage } from '../Base/ProtocolMessage';
|
|
2
|
-
import {
|
|
2
|
+
import { JackPotWinPushWinner } from './JackPotWinPushWinner';
|
|
3
3
|
import { JackpotDetails } from './JackpotDetails';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Live jackpot-win notification. Delivered both to the winner and to other players
|
|
7
|
+
* taking part in the same jackpot — use `winners[].is_me` to tell the two apart;
|
|
8
|
+
* the copy sent to other players has its `public_username` masked.
|
|
9
|
+
*
|
|
10
|
+
* Surfaced to consumers through the `jackpot_win` callback
|
|
11
|
+
* (`_smartico.on('jackpot_win', …)`).
|
|
12
|
+
*
|
|
13
|
+
* The explosion time is `jackpot.pot.explode_date_ts` (epoch milliseconds).
|
|
14
|
+
*/
|
|
5
15
|
export interface JackpotWinPush extends ProtocolMessage {
|
|
16
|
+
/** The jackpot that exploded, including its live `pot` snapshot */
|
|
6
17
|
jackpot: JackpotDetails;
|
|
7
|
-
|
|
18
|
+
/** Winner entries; currently always a single entry */
|
|
19
|
+
winners: JackPotWinPushWinner[];
|
|
8
20
|
}
|
package/src/Jackpots/index.ts
CHANGED
|
@@ -3,6 +3,8 @@ export * from './GetJackpotsPotsResponse';
|
|
|
3
3
|
export * from './GetJackpotsRequest';
|
|
4
4
|
export * from './GetJackpotsResponse';
|
|
5
5
|
export * from './JackPotWinner';
|
|
6
|
+
export * from './JackPotWinPushWinner';
|
|
7
|
+
export * from './JackpotContributionRule';
|
|
6
8
|
export * from './JackpotContributionType';
|
|
7
9
|
export * from './JackpotDetails';
|
|
8
10
|
export * from './JackpotPot';
|
|
@@ -47,6 +47,7 @@ export const SAWTemplatesTransform = (items: SAWTemplate[]): TMiniGameTemplate[]
|
|
|
47
47
|
earliest_expiration_dt: r.earliest_expiration_dt,
|
|
48
48
|
latest_expiration_dt: r.latest_expiration_dt,
|
|
49
49
|
steps_to_finish_game: r.saw_template_ui_definition.steps_to_finish_game,
|
|
50
|
+
min_steps_to_finish_game: r.saw_template_ui_definition.min_steps_to_finish_game,
|
|
50
51
|
custom_section_id: r.saw_template_ui_definition.custom_section_id,
|
|
51
52
|
saw_template_ui_definition: r.saw_template_ui_definition,
|
|
52
53
|
...(r.saw_game_type_id === SAWGameType.LootboxCalendarDays || r.saw_game_type_id === SAWGameType.LootboxWeekdays
|
package/src/SmarticoAPI.ts
CHANGED
|
@@ -102,7 +102,6 @@ import {
|
|
|
102
102
|
TRaffle,
|
|
103
103
|
TLevelCurrent,
|
|
104
104
|
TActivityLog,
|
|
105
|
-
TActivityLogEntry,
|
|
106
105
|
TRaffleDraw,
|
|
107
106
|
TAvatarDefinition,
|
|
108
107
|
TAvatarCustomized,
|
|
@@ -137,7 +136,7 @@ import { GetRelatedAchTourRequest } from './Missions/GetRelatedAchTourRequest';
|
|
|
137
136
|
import { GetRelatedAchTourResponse } from './Missions/GetRelatedAchTourResponse';
|
|
138
137
|
import { GetRafflesResponse, raffleTransform } from './Raffle/GetRafflesResponse';
|
|
139
138
|
import { GetRafflesRequest } from './Raffle/GetRafflesRequest';
|
|
140
|
-
import { GetActivityLogRequest, GetActivityLogResponse, ActivityLogTransform
|
|
139
|
+
import { GetActivityLogRequest, GetActivityLogResponse, ActivityLogTransform } from './ActivityLog';
|
|
141
140
|
import { GetClanListRequest, GetClanListResponse, GetClanInfoRequest, GetClanInfoResponse, JoinClanRequest, JoinClanResponse } from './Clans';
|
|
142
141
|
import { InboxCategories } from './Inbox/InboxCategories';
|
|
143
142
|
import { GetDrawRunRequest, GetDrawRunResponse, GetRaffleDrawRunsHistoryRequest, GetRaffleDrawRunsHistoryResponse, RaffleClaimPrizeRequest, RaffleClaimPrizeResponse, RaffleOptinRequest, RaffleOptinResponse, drawRunTransform, GetRaffleWonPrizesRequest, GetRaffleWonPrizesResponse } from './Raffle';
|
|
@@ -1783,31 +1782,6 @@ class SmarticoAPI {
|
|
|
1783
1782
|
return await this.send<GetActivityLogResponse>(message, ClassId.GET_POINT_HISTORY_RESPONSE);
|
|
1784
1783
|
}
|
|
1785
1784
|
|
|
1786
|
-
public async getActivityLogV2(
|
|
1787
|
-
user_ext_id: string,
|
|
1788
|
-
startTimeSeconds: number,
|
|
1789
|
-
endTimeSeconds: number,
|
|
1790
|
-
limit: number,
|
|
1791
|
-
offset: number,
|
|
1792
|
-
types?: number[],
|
|
1793
|
-
src_types?: number[],
|
|
1794
|
-
): Promise<GetActivityLogResponse> {
|
|
1795
|
-
const message = this.buildMessage<GetActivityLogRequest, GetActivityLogResponse>(
|
|
1796
|
-
user_ext_id,
|
|
1797
|
-
ClassId.GET_POINT_HISTORY_REQUEST,
|
|
1798
|
-
{
|
|
1799
|
-
startTimeSeconds: Math.floor(startTimeSeconds),
|
|
1800
|
-
endTimeSeconds: Math.floor(endTimeSeconds),
|
|
1801
|
-
limit,
|
|
1802
|
-
offset,
|
|
1803
|
-
...(types ? { types } : {}),
|
|
1804
|
-
...(src_types ? { src_types } : {}),
|
|
1805
|
-
},
|
|
1806
|
-
);
|
|
1807
|
-
|
|
1808
|
-
return await this.send<GetActivityLogResponse>(message, ClassId.GET_POINT_HISTORY_RESPONSE);
|
|
1809
|
-
}
|
|
1810
|
-
|
|
1811
1785
|
public async getActivityLogT(
|
|
1812
1786
|
user_ext_id: string,
|
|
1813
1787
|
startTimeSeconds: number,
|
|
@@ -1824,23 +1798,6 @@ class SmarticoAPI {
|
|
|
1824
1798
|
(await this.getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset, types, src_types)).logHistory,
|
|
1825
1799
|
);
|
|
1826
1800
|
}
|
|
1827
|
-
|
|
1828
|
-
public async getActivityLogV2T(
|
|
1829
|
-
user_ext_id: string,
|
|
1830
|
-
startTimeSeconds: number,
|
|
1831
|
-
endTimeSeconds: number,
|
|
1832
|
-
from: number = 0,
|
|
1833
|
-
to: number = 50,
|
|
1834
|
-
types?: number[],
|
|
1835
|
-
src_types?: number[],
|
|
1836
|
-
): Promise<TActivityLogEntry[]> {
|
|
1837
|
-
const limit = to - from > 50 ? 50 : to - from;
|
|
1838
|
-
const offset = from;
|
|
1839
|
-
|
|
1840
|
-
return ActivityLogV2Transform(
|
|
1841
|
-
(await this.getActivityLogV2(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset, types, src_types)).logHistory,
|
|
1842
|
-
);
|
|
1843
|
-
}
|
|
1844
1801
|
}
|
|
1845
1802
|
|
|
1846
1803
|
export { SmarticoAPI, MessageSender };
|
package/src/WSAPI/WSAPIBase.ts
CHANGED
|
@@ -40,7 +40,6 @@ export enum onUpdateContextKey {
|
|
|
40
40
|
CurrentLevel = 'currentLevel',
|
|
41
41
|
InboxUnreadCount = 'inboxUnreadCount',
|
|
42
42
|
ActivityLog = 'activityLog',
|
|
43
|
-
ActivityLogV2 = 'activityLogV2',
|
|
44
43
|
AvatarsList = 'avatarsList',
|
|
45
44
|
AvatarsCustomized = 'avatarsCustomized',
|
|
46
45
|
AvatarPrompts = 'avatarPrompts',
|
|
@@ -176,6 +176,8 @@ export class WSAPIJackpots extends WSAPIClans {
|
|
|
176
176
|
* - The jackpot must currently be active and the user must be in its
|
|
177
177
|
* eligibility segment. Ineligible jackpots are filtered out of
|
|
178
178
|
* {@link jackpotGet} entirely, so a card the user sees is opt-in-able.
|
|
179
|
+
* - Skip the opt-in CTA when the template reports `is_auto_opt_in: true` —
|
|
180
|
+
* eligible users are enrolled automatically and there is nothing to join.
|
|
179
181
|
*
|
|
180
182
|
* **Error handling**
|
|
181
183
|
* The server returns a non-zero `errCode` with a human-readable `errMsg`
|
package/src/WSAPI/WSAPITypes.ts
CHANGED
|
@@ -222,6 +222,8 @@ export interface TMiniGameTemplate {
|
|
|
222
222
|
activeTillDate?: number;
|
|
223
223
|
/** Number of steps to complete the game and collect the prize (step games — Voyager / Treasure Hunt) */
|
|
224
224
|
steps_to_finish_game?: number;
|
|
225
|
+
/** Minimum number of path steps / collectible prizes a session must include before the game can finish (step games — Voyager / Treasure Hunt). `>= 1` and `<= steps_to_finish_game`; when omitted, no minimum is enforced */
|
|
226
|
+
min_steps_to_finish_game?: number;
|
|
225
227
|
/** ID of the operator-defined custom section (widget menu grouping) the mini-game is assigned to */
|
|
226
228
|
custom_section_id?: number;
|
|
227
229
|
|
|
@@ -1784,8 +1786,12 @@ export interface TransformedRaffleClaimPrizeResponse {
|
|
|
1784
1786
|
errorMessage?: string
|
|
1785
1787
|
}
|
|
1786
1788
|
/**
|
|
1787
|
-
*
|
|
1788
|
-
*
|
|
1789
|
+
* One activity-log row from {@link WSAPIUser.getActivityLog}.
|
|
1790
|
+
*
|
|
1791
|
+
* Always includes the wallet fields (`type` / `amount` / `balance` / …). When the
|
|
1792
|
+
* server returns richer activity rows (missions, badges, levels, …), the optional
|
|
1793
|
+
* fields below are populated — same method, same CID; clients that ignore unknown
|
|
1794
|
+
* fields keep working.
|
|
1789
1795
|
*/
|
|
1790
1796
|
export interface TActivityLog {
|
|
1791
1797
|
/** Date when the change was created (epoch timestamp in seconds) */
|
|
@@ -1804,31 +1810,27 @@ export interface TActivityLog {
|
|
|
1804
1810
|
total_ever?: number;
|
|
1805
1811
|
/** Source type ID indicating what triggered this change */
|
|
1806
1812
|
source_type_id: PointChangeSourceType;
|
|
1807
|
-
}
|
|
1808
|
-
|
|
1809
|
-
/**
|
|
1810
|
-
* Full activity-log row returned by {@link WSAPIUser.getActivityLogV2}.
|
|
1811
|
-
* Includes wallet changes and non-wallet activities (missions, badges, levels, …).
|
|
1812
|
-
*/
|
|
1813
|
-
export interface TActivityLogEntry {
|
|
1814
|
-
create_date: number;
|
|
1815
|
-
user_ext_id: string;
|
|
1816
|
-
crm_brand_id: number;
|
|
1817
|
-
type: UserBalanceType;
|
|
1818
|
-
amount: number;
|
|
1819
|
-
balance: number;
|
|
1820
|
-
total_ever?: number;
|
|
1821
|
-
source_type_id: PointChangeSourceType;
|
|
1813
|
+
/** Activity kind — see {@link ActivityLogActivities} (`type` on the wire). */
|
|
1822
1814
|
activity_type_id?: ActivityLogActivities;
|
|
1815
|
+
/** Sub-action for `activity_type_id` (e.g. unlock vs complete, add vs deduct, raffle win vs register). */
|
|
1823
1816
|
context_value_1?: number;
|
|
1817
|
+
/** Extra display payload for the row (name, image, position, …) — see {@link ActivityLogMeta}. */
|
|
1824
1818
|
meta?: ActivityLogMeta;
|
|
1819
|
+
/** Human-readable name of the source entity (mission, tournament, raffle, …). */
|
|
1825
1820
|
source_entity_name?: string;
|
|
1821
|
+
/** Primary id of the source entity (mission / badge / tournament / …). */
|
|
1826
1822
|
source_entity_id?: number;
|
|
1823
|
+
/** More specific id within the source (e.g. level id, draw id, win id). */
|
|
1827
1824
|
source_reference_id?: number;
|
|
1825
|
+
/** Root / parent entity id when the source is nested (e.g. raffle id owning a draw). */
|
|
1828
1826
|
source_root_id?: number;
|
|
1829
|
-
|
|
1827
|
+
/** True when the row is a points/gems/diamonds wallet change. */
|
|
1828
|
+
is_wallet_entry?: boolean;
|
|
1830
1829
|
}
|
|
1831
1830
|
|
|
1831
|
+
/** @deprecated Use {@link TActivityLog} — same shape; kept as an alias for early adopters. */
|
|
1832
|
+
export type TActivityLogEntry = TActivityLog;
|
|
1833
|
+
|
|
1832
1834
|
|
|
1833
1835
|
/**
|
|
1834
1836
|
* Result of `_smartico.api.requestRaffleOptin({raffle_id, draw_id, raffle_run_id})`.
|
package/src/WSAPI/WSAPIUser.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { CoreUtils } from '../Core';
|
|
|
2
2
|
import { ECacheContext, OCache } from '../OCache';
|
|
3
3
|
import {
|
|
4
4
|
TActivityLog,
|
|
5
|
-
TActivityLogEntry,
|
|
6
5
|
TLevel,
|
|
7
6
|
TLevelCurrent,
|
|
8
7
|
TSegmentCheckResult,
|
|
@@ -514,15 +513,16 @@ export class WSAPIUser extends WSAPIBase {
|
|
|
514
513
|
}
|
|
515
514
|
|
|
516
515
|
/**
|
|
517
|
-
* Returns the user's
|
|
518
|
-
*
|
|
519
|
-
*
|
|
520
|
-
*
|
|
516
|
+
* Returns the user's activity history within the requested time window,
|
|
517
|
+
* ordered newest-first. Today that is primarily wallet changes (points /
|
|
518
|
+
* gems / diamonds); when the server starts returning richer activity rows
|
|
519
|
+
* (missions, badges, levels, …), the same method surfaces them via optional
|
|
520
|
+
* fields on {@link TActivityLog} — no separate call, same wire CID.
|
|
521
521
|
*
|
|
522
|
-
*
|
|
523
|
-
*
|
|
524
|
-
*
|
|
525
|
-
*
|
|
522
|
+
* Existing wallet fields (`type`, `amount`, `balance`, `source_type_id`, …)
|
|
523
|
+
* stay stable. Clients that only read those keep working; clients that want
|
|
524
|
+
* the fuller feed can also read `activity_type_id`, `meta`,
|
|
525
|
+
* `source_entity_*`, and `is_wallet_entry` when present.
|
|
526
526
|
*
|
|
527
527
|
* @remarks
|
|
528
528
|
* **Preconditions**
|
|
@@ -535,7 +535,7 @@ export class WSAPIUser extends WSAPIBase {
|
|
|
535
535
|
* `from` by 50 between calls. Both `startTimeSeconds` and `endTimeSeconds`
|
|
536
536
|
* are epoch seconds bounding the window the server scans.
|
|
537
537
|
*
|
|
538
|
-
* **Filtering** — optional server-side filters
|
|
538
|
+
* **Filtering** — optional server-side filters:
|
|
539
539
|
* - `types` — {@link ActivityLogActivities} / `type_id` values (e.g. Points=3, Gems=1)
|
|
540
540
|
* - `src_types` — {@link PointChangeSourceType} / `source_type_id` values
|
|
541
541
|
* Omit both for an unfiltered window.
|
|
@@ -662,47 +662,4 @@ export class WSAPIUser extends WSAPIBase {
|
|
|
662
662
|
onUpdate(payload);
|
|
663
663
|
}
|
|
664
664
|
}
|
|
665
|
-
|
|
666
|
-
/**
|
|
667
|
-
* Returns the full activity log (v2) — wallet changes **and** non-wallet
|
|
668
|
-
* activities (missions, badges, levels, tournaments, avatars, …).
|
|
669
|
-
*
|
|
670
|
-
* **Backwards compatibility**: existing integrations should keep using
|
|
671
|
-
* {@link getActivityLog}, which returns wallet-only {@link TActivityLog}
|
|
672
|
-
* rows with the original field contract unchanged.
|
|
673
|
-
*
|
|
674
|
-
* **Pagination** — same `from` / `to` offset model as {@link getActivityLog}
|
|
675
|
-
* (server caps a single response at 50 entries).
|
|
676
|
-
*
|
|
677
|
-
* **Filtering** — optional server-side filters:
|
|
678
|
-
* - `types` — {@link ActivityLogActivities} values (`type_id`)
|
|
679
|
-
* - `src_types` — {@link PointChangeSourceType} values (`source_type_id`)
|
|
680
|
-
* Omit both for all activity types / sources.
|
|
681
|
-
*
|
|
682
|
-
* @returns Array of {@link TActivityLogEntry} ordered newest-first.
|
|
683
|
-
*/
|
|
684
|
-
public async getActivityLogV2({
|
|
685
|
-
startTimeSeconds,
|
|
686
|
-
endTimeSeconds,
|
|
687
|
-
from,
|
|
688
|
-
to,
|
|
689
|
-
types,
|
|
690
|
-
src_types,
|
|
691
|
-
}: {
|
|
692
|
-
startTimeSeconds: number;
|
|
693
|
-
endTimeSeconds: number;
|
|
694
|
-
from: number;
|
|
695
|
-
to: number;
|
|
696
|
-
types?: number[];
|
|
697
|
-
src_types?: number[];
|
|
698
|
-
}): Promise<TActivityLogEntry[]> {
|
|
699
|
-
const cacheKey = `${onUpdateContextKey.ActivityLogV2}:${startTimeSeconds}:${endTimeSeconds}:${from}:${to}:${types?.join(',') ?? ''}:${src_types?.join(',') ?? ''}`;
|
|
700
|
-
|
|
701
|
-
return await OCache.use(
|
|
702
|
-
cacheKey,
|
|
703
|
-
ECacheContext.WSAPI,
|
|
704
|
-
() => this.api.getActivityLogV2T(this.userExtId, startTimeSeconds, endTimeSeconds, from, to, types, src_types),
|
|
705
|
-
CACHE_DATA_SEC,
|
|
706
|
-
);
|
|
707
|
-
}
|
|
708
665
|
}
|