@smartico/public-api 0.0.417 → 0.0.419
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/dist/ActivityLog/ActivityLogActivities.d.ts +2 -23
- package/dist/ActivityLog/ActivityLogMeta.d.ts +1 -19
- package/dist/ActivityLog/GetActivityLogResponse.d.ts +2 -4
- package/dist/ActivityLog/PointChangeSourceType.d.ts +2 -1
- package/dist/ActivityLog/index.d.ts +0 -1
- package/dist/Base/ClassId.d.ts +1 -0
- package/dist/WSAPI/WSAPIMiniGames.d.ts +4 -4
- package/dist/WSAPI/WSAPITypes.d.ts +0 -2
- package/dist/index.js +59 -392
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +60 -380
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/README.md +5 -0
- package/docs/api/classes/WSAPIJackpots.md +3 -1
- package/docs/api/classes/WSAPIMiniGames.md +7 -2
- package/docs/api/classes/WSAPIUser.md +49 -0
- package/docs/api/enumerations/ActivityLogActivities.md +123 -0
- package/docs/api/enumerations/PointChangeSourceType.md +6 -0
- package/docs/api/interfaces/ActivityLogMeta.md +37 -0
- package/docs/api/interfaces/SAWPrizeDropAknowledgeCancelRequest.md +47 -0
- package/docs/api/interfaces/SAWPrizeDropAknowledgeCancelResponse.md +41 -0
- package/docs/api/interfaces/SAWTemplateUI.md +1 -1
- package/docs/api/interfaces/TActivityLogEntry.md +100 -0
- package/docs/capabilities/getActivityLogV2.md +62 -0
- package/docs/capabilities/getJackpotWinners.md +3 -1
- package/docs/capabilities/miniGameWinAcknowledgeRequest.md +1 -1
- package/docs/native/PROTOCOL.md +33 -1
- package/package.json +1 -1
- package/src/ActivityLog/ActivityLogActivities.ts +1 -44
- package/src/ActivityLog/ActivityLogMeta.ts +1 -20
- package/src/ActivityLog/GetActivityLogResponse.ts +59 -25
- package/src/ActivityLog/PointChangeSourceType.ts +1 -0
- package/src/ActivityLog/index.ts +0 -1
- package/src/Base/ClassId.ts +2 -0
- package/src/WSAPI/WSAPIMiniGames.ts +4 -4
- package/src/WSAPI/WSAPITypes.ts +0 -2
- package/tsconfig.json +4 -1
- package/src/ActivityLog/ActivityLogMapper.ts +0 -358
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { UserBalanceType } from './UserBalanceType';
|
|
2
1
|
/** Activity-log entry type as returned on the v2 wire (`type_id`). */
|
|
3
2
|
export declare enum ActivityLogActivities {
|
|
4
3
|
Gems = 1,
|
|
@@ -19,26 +18,6 @@ export declare enum ActivityLogActivities {
|
|
|
19
18
|
NoPrize = 16,
|
|
20
19
|
Leaderboard = 17,
|
|
21
20
|
Tournament = 18,
|
|
22
|
-
ClanTournament = 19
|
|
21
|
+
ClanTournament = 19,
|
|
22
|
+
Clan = 20
|
|
23
23
|
}
|
|
24
|
-
export declare enum WalletChangeType {
|
|
25
|
-
Add = 1,
|
|
26
|
-
Deduct = 2,
|
|
27
|
-
Set = 3
|
|
28
|
-
}
|
|
29
|
-
export declare enum LevelChangeType {
|
|
30
|
-
Increase = 1,
|
|
31
|
-
Decrease = 2
|
|
32
|
-
}
|
|
33
|
-
/** Wire ctx_1 for Mission / Badge / Task — see SMR-44986. */
|
|
34
|
-
export declare enum AchievementChangeType {
|
|
35
|
-
Complete = 1,
|
|
36
|
-
Unlock = 2
|
|
37
|
-
}
|
|
38
|
-
/** Wire ctx_1 for Jackpot rows — SMR-44986. */
|
|
39
|
-
export declare enum JackpotContextValue {
|
|
40
|
-
Registration = 1,
|
|
41
|
-
Win = 3
|
|
42
|
-
}
|
|
43
|
-
export declare const isWalletActivityTypeId: (typeId: number) => boolean;
|
|
44
|
-
export declare const activityTypeIdToBalanceType: (typeId: ActivityLogActivities) => UserBalanceType;
|
|
@@ -1,26 +1,8 @@
|
|
|
1
|
-
export interface ActivityLogPublicMeta {
|
|
2
|
-
name?: string;
|
|
3
|
-
image_url?: string;
|
|
4
|
-
image?: string;
|
|
5
|
-
url?: string;
|
|
6
|
-
avatar_url?: string;
|
|
7
|
-
avatar_id?: string;
|
|
8
|
-
icon_url?: string;
|
|
9
|
-
position?: number;
|
|
10
|
-
}
|
|
11
1
|
export interface ActivityLogMeta {
|
|
12
|
-
image_url?: string;
|
|
13
|
-
image?: string;
|
|
14
|
-
url?: string;
|
|
15
|
-
avatar_url?: string;
|
|
16
|
-
avatar_id?: string;
|
|
17
|
-
icon_url?: string;
|
|
18
2
|
name?: string;
|
|
3
|
+
image_url?: string;
|
|
19
4
|
position?: number;
|
|
20
|
-
score?: number;
|
|
21
5
|
user_points_balance_before?: number;
|
|
22
6
|
points_requested?: number;
|
|
23
7
|
user_points_ever?: number;
|
|
24
|
-
public_meta?: ActivityLogPublicMeta;
|
|
25
|
-
public_map?: ActivityLogPublicMeta;
|
|
26
8
|
}
|
|
@@ -4,7 +4,5 @@ import { TActivityLog, TActivityLogEntry } from '../WSAPI/WSAPITypes';
|
|
|
4
4
|
export interface GetActivityLogResponse extends ProtocolResponse {
|
|
5
5
|
logHistory: ActivityLogEntry[];
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
export declare const
|
|
9
|
-
/** Maps wire rows to the full v2 {@link TActivityLogEntry} shape. */
|
|
10
|
-
export declare const ActivityLogV2Transform: (items: ActivityLogEntry[] | unknown[]) => TActivityLogEntry[];
|
|
7
|
+
export declare const ActivityLogTransform: (items: ActivityLogEntry[]) => TActivityLog[];
|
|
8
|
+
export declare const ActivityLogV2Transform: (items: any[]) => TActivityLogEntry[];
|
|
@@ -3,6 +3,5 @@ export * from './GetActivityLogResponse';
|
|
|
3
3
|
export * from './ActivityLogEntry';
|
|
4
4
|
export * from './ActivityLogActivities';
|
|
5
5
|
export * from './ActivityLogMeta';
|
|
6
|
-
export * from './ActivityLogMapper';
|
|
7
6
|
export * from './PointChangeSourceType';
|
|
8
7
|
export * from './UserBalanceType';
|
package/dist/Base/ClassId.d.ts
CHANGED
|
@@ -139,6 +139,7 @@ export declare enum ClassId {
|
|
|
139
139
|
BNR_GET_BANNER_CONTENT_RESPONSE = 953,
|
|
140
140
|
REGISTER_PUSH_NOTIFICATIONS_TOKEN_REQ = 1003,
|
|
141
141
|
REGISTER_PUSH_NOTIFICATIONS_TOKEN_RESP = 2003,
|
|
142
|
+
FORM_SHOW_PUSH = 1050,
|
|
142
143
|
CLIENT_DEBUG_REQUEST = 77777,
|
|
143
144
|
UNSUPPORTED_COMMAND = 99999
|
|
144
145
|
}
|
|
@@ -496,10 +496,10 @@ export declare class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
496
496
|
* (played with `acknowledge: false`), or the
|
|
497
497
|
* `client_request_id` of a
|
|
498
498
|
* {@link getMiniGamesHistory} row.
|
|
499
|
-
* @param
|
|
500
|
-
*
|
|
501
|
-
*
|
|
502
|
-
*
|
|
499
|
+
* @param lose Optional. When `true`, finalises the spin as
|
|
500
|
+
* lost — the prize is not credited and returns
|
|
501
|
+
* to the prize pool (see "Finalising as lost").
|
|
502
|
+
* Omit (or pass `false`) to deliver the win.
|
|
503
503
|
*
|
|
504
504
|
* @example
|
|
505
505
|
* ```ts
|
|
@@ -1705,7 +1705,6 @@ export interface TActivityLog {
|
|
|
1705
1705
|
* Includes wallet changes and non-wallet activities (missions, badges, levels, …).
|
|
1706
1706
|
*/
|
|
1707
1707
|
export interface TActivityLogEntry {
|
|
1708
|
-
entry_key: string;
|
|
1709
1708
|
create_date: number;
|
|
1710
1709
|
user_ext_id: string;
|
|
1711
1710
|
crm_brand_id: number;
|
|
@@ -1722,7 +1721,6 @@ export interface TActivityLogEntry {
|
|
|
1722
1721
|
source_reference_id?: number;
|
|
1723
1722
|
source_root_id?: number;
|
|
1724
1723
|
is_wallet_entry: boolean;
|
|
1725
|
-
is_level_entry?: boolean;
|
|
1726
1724
|
}
|
|
1727
1725
|
/**
|
|
1728
1726
|
* Result of `_smartico.api.requestRaffleOptin({raffle_id, draw_id, raffle_run_id})`.
|
package/dist/index.js
CHANGED
|
@@ -172,6 +172,7 @@ exports.ClassId = void 0;
|
|
|
172
172
|
*/
|
|
173
173
|
ClassId[ClassId["REGISTER_PUSH_NOTIFICATIONS_TOKEN_REQ"] = 1003] = "REGISTER_PUSH_NOTIFICATIONS_TOKEN_REQ";
|
|
174
174
|
ClassId[ClassId["REGISTER_PUSH_NOTIFICATIONS_TOKEN_RESP"] = 2003] = "REGISTER_PUSH_NOTIFICATIONS_TOKEN_RESP";
|
|
175
|
+
ClassId[ClassId["FORM_SHOW_PUSH"] = 1050] = "FORM_SHOW_PUSH";
|
|
175
176
|
ClassId[ClassId["CLIENT_DEBUG_REQUEST"] = 77777] = "CLIENT_DEBUG_REQUEST";
|
|
176
177
|
/*
|
|
177
178
|
!Important, if adding new messages that are 'acting' on behalf of the client,
|
|
@@ -7783,10 +7784,10 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7783
7784
|
* (played with `acknowledge: false`), or the
|
|
7784
7785
|
* `client_request_id` of a
|
|
7785
7786
|
* {@link getMiniGamesHistory} row.
|
|
7786
|
-
* @param
|
|
7787
|
-
*
|
|
7788
|
-
*
|
|
7789
|
-
*
|
|
7787
|
+
* @param lose Optional. When `true`, finalises the spin as
|
|
7788
|
+
* lost — the prize is not credited and returns
|
|
7789
|
+
* to the prize pool (see "Finalising as lost").
|
|
7790
|
+
* Omit (or pass `false`) to deliver the win.
|
|
7790
7791
|
*
|
|
7791
7792
|
* @example
|
|
7792
7793
|
* ```ts
|
|
@@ -10339,13 +10340,6 @@ exports.BonusStatus = void 0;
|
|
|
10339
10340
|
BonusStatus[BonusStatus["EXPIRED"] = 6] = "EXPIRED";
|
|
10340
10341
|
})(exports.BonusStatus || (exports.BonusStatus = {}));
|
|
10341
10342
|
|
|
10342
|
-
exports.UserBalanceType = void 0;
|
|
10343
|
-
(function (UserBalanceType) {
|
|
10344
|
-
UserBalanceType[UserBalanceType["Points"] = 0] = "Points";
|
|
10345
|
-
UserBalanceType[UserBalanceType["Gems"] = 1] = "Gems";
|
|
10346
|
-
UserBalanceType[UserBalanceType["Diamonds"] = 2] = "Diamonds";
|
|
10347
|
-
})(exports.UserBalanceType || (exports.UserBalanceType = {}));
|
|
10348
|
-
|
|
10349
10343
|
/** Activity-log entry type as returned on the v2 wire (`type_id`). */
|
|
10350
10344
|
exports.ActivityLogActivities = void 0;
|
|
10351
10345
|
(function (ActivityLogActivities) {
|
|
@@ -10368,395 +10362,71 @@ exports.ActivityLogActivities = void 0;
|
|
|
10368
10362
|
ActivityLogActivities[ActivityLogActivities["Leaderboard"] = 17] = "Leaderboard";
|
|
10369
10363
|
ActivityLogActivities[ActivityLogActivities["Tournament"] = 18] = "Tournament";
|
|
10370
10364
|
ActivityLogActivities[ActivityLogActivities["ClanTournament"] = 19] = "ClanTournament";
|
|
10365
|
+
ActivityLogActivities[ActivityLogActivities["Clan"] = 20] = "Clan";
|
|
10371
10366
|
})(exports.ActivityLogActivities || (exports.ActivityLogActivities = {}));
|
|
10372
|
-
exports.WalletChangeType = void 0;
|
|
10373
|
-
(function (WalletChangeType) {
|
|
10374
|
-
WalletChangeType[WalletChangeType["Add"] = 1] = "Add";
|
|
10375
|
-
WalletChangeType[WalletChangeType["Deduct"] = 2] = "Deduct";
|
|
10376
|
-
WalletChangeType[WalletChangeType["Set"] = 3] = "Set";
|
|
10377
|
-
})(exports.WalletChangeType || (exports.WalletChangeType = {}));
|
|
10378
|
-
exports.LevelChangeType = void 0;
|
|
10379
|
-
(function (LevelChangeType) {
|
|
10380
|
-
LevelChangeType[LevelChangeType["Increase"] = 1] = "Increase";
|
|
10381
|
-
LevelChangeType[LevelChangeType["Decrease"] = 2] = "Decrease";
|
|
10382
|
-
})(exports.LevelChangeType || (exports.LevelChangeType = {}));
|
|
10383
|
-
/** Wire ctx_1 for Mission / Badge / Task — see SMR-44986. */
|
|
10384
|
-
exports.AchievementChangeType = void 0;
|
|
10385
|
-
(function (AchievementChangeType) {
|
|
10386
|
-
AchievementChangeType[AchievementChangeType["Complete"] = 1] = "Complete";
|
|
10387
|
-
AchievementChangeType[AchievementChangeType["Unlock"] = 2] = "Unlock";
|
|
10388
|
-
})(exports.AchievementChangeType || (exports.AchievementChangeType = {}));
|
|
10389
|
-
/** Wire ctx_1 for Jackpot rows — SMR-44986. */
|
|
10390
|
-
exports.JackpotContextValue = void 0;
|
|
10391
|
-
(function (JackpotContextValue) {
|
|
10392
|
-
JackpotContextValue[JackpotContextValue["Registration"] = 1] = "Registration";
|
|
10393
|
-
JackpotContextValue[JackpotContextValue["Win"] = 3] = "Win";
|
|
10394
|
-
})(exports.JackpotContextValue || (exports.JackpotContextValue = {}));
|
|
10395
|
-
var WALLET_TYPE_IDS = new Set([exports.ActivityLogActivities.Gems, exports.ActivityLogActivities.Diamonds, exports.ActivityLogActivities.Points]);
|
|
10396
|
-
var isWalletActivityTypeId = function isWalletActivityTypeId(typeId) {
|
|
10397
|
-
return WALLET_TYPE_IDS.has(typeId);
|
|
10398
|
-
};
|
|
10399
|
-
var activityTypeIdToBalanceType = function activityTypeIdToBalanceType(typeId) {
|
|
10400
|
-
switch (typeId) {
|
|
10401
|
-
case exports.ActivityLogActivities.Gems:
|
|
10402
|
-
return exports.UserBalanceType.Gems;
|
|
10403
|
-
case exports.ActivityLogActivities.Diamonds:
|
|
10404
|
-
return exports.UserBalanceType.Diamonds;
|
|
10405
|
-
default:
|
|
10406
|
-
return exports.UserBalanceType.Points;
|
|
10407
|
-
}
|
|
10408
|
-
};
|
|
10409
10367
|
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
return raw;
|
|
10417
|
-
}
|
|
10418
|
-
if (typeof raw === 'object' && raw !== null) {
|
|
10419
|
-
if ('seconds' in raw) {
|
|
10420
|
-
return Number(raw.seconds);
|
|
10421
|
-
}
|
|
10422
|
-
if ('epochSecond' in raw) {
|
|
10423
|
-
return Number(raw.epochSecond);
|
|
10424
|
-
}
|
|
10425
|
-
}
|
|
10426
|
-
if (typeof raw === 'string') {
|
|
10427
|
-
var ms = Date.parse(raw);
|
|
10428
|
-
if (!Number.isNaN(ms)) {
|
|
10429
|
-
return Math.floor(ms / 1000);
|
|
10430
|
-
}
|
|
10431
|
-
}
|
|
10432
|
-
return 0;
|
|
10433
|
-
};
|
|
10434
|
-
var readWireNumber = function readWireNumber(log) {
|
|
10435
|
-
for (var _iterator = _createForOfIteratorHelperLoose([].slice.call(arguments, 1)), _step; !(_step = _iterator()).done;) {
|
|
10436
|
-
var key = _step.value;
|
|
10437
|
-
var value = log[key];
|
|
10438
|
-
if (value !== undefined && value !== null && value !== '') {
|
|
10439
|
-
return Number(value);
|
|
10440
|
-
}
|
|
10441
|
-
}
|
|
10442
|
-
return undefined;
|
|
10443
|
-
};
|
|
10444
|
-
var normalizeWireLog = function normalizeWireLog(raw) {
|
|
10445
|
-
var log = _extends({}, raw);
|
|
10446
|
-
var explicitTypeId = readWireNumber(log, 'type_id');
|
|
10447
|
-
if (explicitTypeId !== undefined) {
|
|
10448
|
-
log.type_id = explicitTypeId;
|
|
10449
|
-
} else {
|
|
10450
|
-
var wireType = readWireNumber(log, 'type');
|
|
10451
|
-
if (wireType !== undefined && wireType > exports.UserBalanceType.Diamonds) {
|
|
10452
|
-
log.type_id = wireType;
|
|
10453
|
-
}
|
|
10454
|
-
}
|
|
10455
|
-
if (log.context_value_1 === undefined && log.ctx_1 !== undefined) {
|
|
10456
|
-
log.context_value_1 = log.ctx_1;
|
|
10457
|
-
}
|
|
10458
|
-
if (log.context_value_meta === undefined && log.ctx_meta !== undefined) {
|
|
10459
|
-
log.context_value_meta = log.ctx_meta;
|
|
10460
|
-
}
|
|
10461
|
-
if (log.source_reference_id === undefined && log.source_ref_id !== undefined) {
|
|
10462
|
-
log.source_reference_id = log.source_ref_id;
|
|
10463
|
-
}
|
|
10464
|
-
if (log.source_entity_id === undefined && log.source_root_id !== undefined) {
|
|
10465
|
-
log.source_entity_id = log.source_root_id;
|
|
10466
|
-
}
|
|
10467
|
-
return log;
|
|
10468
|
-
};
|
|
10469
|
-
var isActivityLogWireEntry = function isActivityLogWireEntry(log) {
|
|
10470
|
-
if (log.is_activity_log === true) {
|
|
10471
|
-
return true;
|
|
10472
|
-
}
|
|
10473
|
-
if (log.label_id !== undefined && log.label_id !== null) {
|
|
10474
|
-
return true;
|
|
10475
|
-
}
|
|
10476
|
-
if (log.ctx_meta !== undefined || log.context_value_meta !== undefined) {
|
|
10477
|
-
return true;
|
|
10478
|
-
}
|
|
10479
|
-
if (log.ctx_1 !== undefined || log.context_value_1 !== undefined) {
|
|
10480
|
-
return true;
|
|
10481
|
-
}
|
|
10482
|
-
if (log.user_id !== undefined && log.user_id !== null) {
|
|
10483
|
-
return true;
|
|
10484
|
-
}
|
|
10485
|
-
var wireTypeId = readWireNumber(log, 'type_id');
|
|
10486
|
-
return wireTypeId !== undefined && wireTypeId > exports.UserBalanceType.Diamonds;
|
|
10487
|
-
};
|
|
10488
|
-
var readWireBalanceType = function readWireBalanceType(log) {
|
|
10489
|
-
var balanceType = readWireNumber(log, 'type');
|
|
10490
|
-
if (balanceType === exports.UserBalanceType.Gems || balanceType === exports.UserBalanceType.Diamonds) {
|
|
10491
|
-
return balanceType;
|
|
10492
|
-
}
|
|
10493
|
-
return undefined;
|
|
10494
|
-
};
|
|
10495
|
-
var hasGemsOrDiamondsWalletFields = function hasGemsOrDiamondsWalletFields(log) {
|
|
10496
|
-
return log.amount !== undefined || log.balance !== undefined || readWireNumber(log, 'amount', 'collected_amount') !== undefined || readWireNumber(log, 'balance', 'user_balance') !== undefined;
|
|
10497
|
-
};
|
|
10498
|
-
var isGemsOrDiamondsWalletWireEntry = function isGemsOrDiamondsWalletWireEntry(log) {
|
|
10499
|
-
var balanceType = readWireBalanceType(log);
|
|
10500
|
-
return balanceType !== undefined && hasGemsOrDiamondsWalletFields(log);
|
|
10501
|
-
};
|
|
10502
|
-
var resolveWalletAmount = function resolveWalletAmount(log, isPoints) {
|
|
10503
|
-
var pointsCollected = readWireNumber(log, 'points_collected');
|
|
10504
|
-
if (isPoints && pointsCollected !== undefined && pointsCollected !== POINTS_COLLECTED_SENTINEL) {
|
|
10505
|
-
return pointsCollected;
|
|
10506
|
-
}
|
|
10507
|
-
if (isPoints) {
|
|
10508
|
-
var _amount = readWireNumber(log, 'amount', 'collected_amount');
|
|
10509
|
-
return _amount === undefined ? 0 : _amount;
|
|
10510
|
-
}
|
|
10511
|
-
var amount = readWireNumber(log, 'amount', 'collected_amount');
|
|
10512
|
-
return amount === undefined ? 0 : amount;
|
|
10513
|
-
};
|
|
10514
|
-
var resolveWalletBalance = function resolveWalletBalance(log, isPoints) {
|
|
10515
|
-
if (isPoints) {
|
|
10516
|
-
var _balance = readWireNumber(log, 'balance', 'user_points_balance', 'user_balance');
|
|
10517
|
-
return _balance === undefined ? 0 : _balance;
|
|
10518
|
-
}
|
|
10519
|
-
var balance = readWireNumber(log, 'balance', 'user_balance');
|
|
10520
|
-
return balance === undefined ? 0 : balance;
|
|
10521
|
-
};
|
|
10522
|
-
var resolveSourceTypeId = function resolveSourceTypeId(log) {
|
|
10523
|
-
var sourceTypeId = readWireNumber(log, 'source_type_id', 'entity_type_id');
|
|
10524
|
-
return sourceTypeId === undefined ? 0 : sourceTypeId;
|
|
10525
|
-
};
|
|
10526
|
-
var parseMeta = function parseMeta(contextValueMeta) {
|
|
10527
|
-
var _meta$public_meta;
|
|
10528
|
-
if (!contextValueMeta) {
|
|
10529
|
-
return undefined;
|
|
10530
|
-
}
|
|
10531
|
-
var meta;
|
|
10532
|
-
if (typeof contextValueMeta === 'object') {
|
|
10533
|
-
meta = contextValueMeta;
|
|
10534
|
-
} else if (typeof contextValueMeta === 'string') {
|
|
10535
|
-
try {
|
|
10536
|
-
meta = JSON.parse(contextValueMeta);
|
|
10537
|
-
} catch (_unused) {
|
|
10538
|
-
return undefined;
|
|
10539
|
-
}
|
|
10540
|
-
}
|
|
10541
|
-
if (!meta) {
|
|
10542
|
-
return undefined;
|
|
10543
|
-
}
|
|
10544
|
-
var nested = (_meta$public_meta = meta.public_meta) != null ? _meta$public_meta : meta.public_map;
|
|
10545
|
-
var pickImage = function pickImage(src) {
|
|
10546
|
-
var _ref, _ref2, _ref3, _ref4, _src$image_url;
|
|
10547
|
-
return (_ref = (_ref2 = (_ref3 = (_ref4 = (_src$image_url = src == null ? void 0 : src.image_url) != null ? _src$image_url : src == null ? void 0 : src.image) != null ? _ref4 : src == null ? void 0 : src.url) != null ? _ref3 : src == null ? void 0 : src.avatar_url) != null ? _ref2 : src == null ? void 0 : src.icon_url) != null ? _ref : src == null ? void 0 : src.avatar_id;
|
|
10548
|
-
};
|
|
10549
|
-
if (nested) {
|
|
10550
|
-
var _meta$name, _pickImage, _ref5, _meta$position;
|
|
10551
|
-
return _extends({}, meta, {
|
|
10552
|
-
name: (_meta$name = meta.name) != null ? _meta$name : nested.name,
|
|
10553
|
-
image_url: (_pickImage = pickImage(meta)) != null ? _pickImage : pickImage(nested),
|
|
10554
|
-
position: (_ref5 = (_meta$position = meta.position) != null ? _meta$position : nested.position) != null ? _ref5 : meta.score
|
|
10555
|
-
});
|
|
10556
|
-
}
|
|
10557
|
-
var topImage = pickImage(meta);
|
|
10558
|
-
if (topImage && meta.image_url === undefined) {
|
|
10559
|
-
var _meta$position2;
|
|
10560
|
-
return _extends({}, meta, {
|
|
10561
|
-
image_url: topImage,
|
|
10562
|
-
position: (_meta$position2 = meta.position) != null ? _meta$position2 : meta.score
|
|
10563
|
-
});
|
|
10564
|
-
}
|
|
10565
|
-
if (meta.score !== undefined && meta.position === undefined) {
|
|
10566
|
-
return _extends({}, meta, {
|
|
10567
|
-
position: meta.score
|
|
10568
|
-
});
|
|
10569
|
-
}
|
|
10570
|
-
return meta;
|
|
10571
|
-
};
|
|
10572
|
-
var isLegacyPointsEntry = function isLegacyPointsEntry(log) {
|
|
10573
|
-
if (isActivityLogWireEntry(log)) {
|
|
10574
|
-
return false;
|
|
10575
|
-
}
|
|
10576
|
-
var pointsCollected = readWireNumber(log, 'points_collected');
|
|
10577
|
-
return pointsCollected !== undefined && pointsCollected !== POINTS_COLLECTED_SENTINEL;
|
|
10578
|
-
};
|
|
10579
|
-
var isLegacyGemsDiamondsEntry = function isLegacyGemsDiamondsEntry(log) {
|
|
10580
|
-
if (isActivityLogWireEntry(log)) {
|
|
10581
|
-
return false;
|
|
10582
|
-
}
|
|
10583
|
-
var balanceType = readWireNumber(log, 'type');
|
|
10584
|
-
return (balanceType === exports.UserBalanceType.Gems || balanceType === exports.UserBalanceType.Diamonds) && log.amount !== undefined;
|
|
10585
|
-
};
|
|
10586
|
-
var isV2Entry = function isV2Entry(log) {
|
|
10587
|
-
return isActivityLogWireEntry(log) || log.type_id !== undefined && log.type_id !== null;
|
|
10588
|
-
};
|
|
10589
|
-
var resolveSourceEntityName = function resolveSourceEntityName(log, meta) {
|
|
10590
|
-
var _log$source_entity_na;
|
|
10591
|
-
var fromWire = (_log$source_entity_na = log.source_entity_name) != null ? _log$source_entity_na : log.source_public_name;
|
|
10592
|
-
if (typeof fromWire === 'string' && fromWire.length > 0) {
|
|
10593
|
-
return fromWire;
|
|
10594
|
-
}
|
|
10595
|
-
if (meta != null && meta.name) {
|
|
10596
|
-
return meta.name;
|
|
10597
|
-
}
|
|
10598
|
-
return undefined;
|
|
10599
|
-
};
|
|
10600
|
-
var buildEntryKey = function buildEntryKey(log, index) {
|
|
10601
|
-
var _ref6, _log$type_id, _log$source_type_id, _ref7, _log$source_entity_id, _ref8, _log$context_value_;
|
|
10602
|
-
return [parseCreateDate(log.create_date), (_ref6 = (_log$type_id = log.type_id) != null ? _log$type_id : log.type) != null ? _ref6 : 'legacy', (_log$source_type_id = log.source_type_id) != null ? _log$source_type_id : '', (_ref7 = (_log$source_entity_id = log.source_entity_id) != null ? _log$source_entity_id : log.source_root_id) != null ? _ref7 : '', (_ref8 = (_log$context_value_ = log.context_value_1) != null ? _log$context_value_ : log.ctx_1) != null ? _ref8 : '', index].join('-');
|
|
10603
|
-
};
|
|
10604
|
-
var mapLegacyPointsEntry = function mapLegacyPointsEntry(log, index) {
|
|
10605
|
-
var _log$user_ext_id, _log$crm_brand_id;
|
|
10606
|
-
return {
|
|
10607
|
-
entry_key: buildEntryKey(log, index),
|
|
10608
|
-
create_date: parseCreateDate(log.create_date),
|
|
10609
|
-
user_ext_id: String((_log$user_ext_id = log.user_ext_id) != null ? _log$user_ext_id : ''),
|
|
10610
|
-
crm_brand_id: Number((_log$crm_brand_id = log.crm_brand_id) != null ? _log$crm_brand_id : 0),
|
|
10611
|
-
type: exports.UserBalanceType.Points,
|
|
10612
|
-
amount: resolveWalletAmount(log, true),
|
|
10613
|
-
balance: resolveWalletBalance(log, true),
|
|
10614
|
-
total_ever: readWireNumber(log, 'user_points_ever', 'collected_ever'),
|
|
10615
|
-
context_value_1: readWireNumber(log, 'context_value_1', 'ctx_1'),
|
|
10616
|
-
source_type_id: resolveSourceTypeId(log),
|
|
10617
|
-
activity_type_id: exports.ActivityLogActivities.Points,
|
|
10618
|
-
is_wallet_entry: true
|
|
10619
|
-
};
|
|
10620
|
-
};
|
|
10621
|
-
var mapLegacyGemsDiamondsEntry = function mapLegacyGemsDiamondsEntry(log, index) {
|
|
10622
|
-
var _log$user_ext_id2, _log$crm_brand_id2;
|
|
10623
|
-
var wireType = readWireNumber(log, 'type');
|
|
10624
|
-
var activityTypeId = wireType === exports.UserBalanceType.Gems ? exports.ActivityLogActivities.Gems : exports.ActivityLogActivities.Diamonds;
|
|
10625
|
-
return {
|
|
10626
|
-
entry_key: buildEntryKey(log, index),
|
|
10627
|
-
create_date: parseCreateDate(log.create_date),
|
|
10628
|
-
user_ext_id: String((_log$user_ext_id2 = log.user_ext_id) != null ? _log$user_ext_id2 : ''),
|
|
10629
|
-
crm_brand_id: Number((_log$crm_brand_id2 = log.crm_brand_id) != null ? _log$crm_brand_id2 : 0),
|
|
10630
|
-
type: activityTypeIdToBalanceType(activityTypeId),
|
|
10631
|
-
amount: resolveWalletAmount(log, false),
|
|
10632
|
-
balance: resolveWalletBalance(log, false),
|
|
10633
|
-
context_value_1: readWireNumber(log, 'context_value_1', 'ctx_1'),
|
|
10634
|
-
source_type_id: resolveSourceTypeId(log),
|
|
10635
|
-
activity_type_id: activityTypeId,
|
|
10636
|
-
is_wallet_entry: true
|
|
10637
|
-
};
|
|
10638
|
-
};
|
|
10639
|
-
var mapV2Entry = function mapV2Entry(log, index) {
|
|
10640
|
-
var _log$user_ext_id3, _log$crm_brand_id3;
|
|
10641
|
-
var typeId = readWireNumber(log, 'type_id');
|
|
10642
|
-
var contextValue1 = readWireNumber(log, 'context_value_1', 'ctx_1');
|
|
10643
|
-
var meta = parseMeta(log.context_value_meta);
|
|
10644
|
-
var sourceEntityName = resolveSourceEntityName(log, meta);
|
|
10645
|
-
var sourceEntityId = readWireNumber(log, 'source_entity_id', 'source_root_id');
|
|
10646
|
-
var sourceReferenceId = readWireNumber(log, 'source_reference_id', 'source_ref_id');
|
|
10647
|
-
var sourceRootId = readWireNumber(log, 'source_root_id');
|
|
10648
|
-
var gemsOrDiamondsWallet = isGemsOrDiamondsWalletWireEntry(log);
|
|
10649
|
-
var isWalletEntry = typeId !== undefined && isWalletActivityTypeId(typeId) || gemsOrDiamondsWallet;
|
|
10650
|
-
var base = {
|
|
10651
|
-
entry_key: buildEntryKey(log, index),
|
|
10652
|
-
create_date: parseCreateDate(log.create_date),
|
|
10653
|
-
user_ext_id: String((_log$user_ext_id3 = log.user_ext_id) != null ? _log$user_ext_id3 : ''),
|
|
10654
|
-
crm_brand_id: Number((_log$crm_brand_id3 = log.crm_brand_id) != null ? _log$crm_brand_id3 : 0),
|
|
10655
|
-
source_type_id: resolveSourceTypeId(log),
|
|
10656
|
-
activity_type_id: typeId,
|
|
10657
|
-
context_value_1: contextValue1,
|
|
10658
|
-
meta: meta,
|
|
10659
|
-
source_entity_name: sourceEntityName,
|
|
10660
|
-
source_entity_id: sourceEntityId && sourceEntityId > 0 ? sourceEntityId : undefined,
|
|
10661
|
-
source_reference_id: sourceReferenceId && sourceReferenceId > 0 ? sourceReferenceId : undefined,
|
|
10662
|
-
source_root_id: sourceRootId && sourceRootId > 0 ? sourceRootId : undefined
|
|
10663
|
-
};
|
|
10664
|
-
if (isWalletEntry) {
|
|
10665
|
-
var _readWireNumber;
|
|
10666
|
-
var wireBalanceType = readWireBalanceType(log);
|
|
10667
|
-
var balanceType = wireBalanceType != null ? wireBalanceType : typeId !== undefined ? activityTypeIdToBalanceType(typeId) : exports.UserBalanceType.Points;
|
|
10668
|
-
var walletActivityTypeId = typeId !== undefined && isWalletActivityTypeId(typeId) ? typeId : balanceType === exports.UserBalanceType.Gems ? exports.ActivityLogActivities.Gems : balanceType === exports.UserBalanceType.Diamonds ? exports.ActivityLogActivities.Diamonds : exports.ActivityLogActivities.Points;
|
|
10669
|
-
var isPoints = balanceType === exports.UserBalanceType.Points;
|
|
10670
|
-
var totalEver = isPoints ? (_readWireNumber = readWireNumber(log, 'user_points_ever', 'collected_ever')) != null ? _readWireNumber : (meta == null ? void 0 : meta.user_points_ever) !== undefined ? Number(meta.user_points_ever) : undefined : undefined;
|
|
10671
|
-
return _extends({}, base, {
|
|
10672
|
-
activity_type_id: walletActivityTypeId,
|
|
10673
|
-
type: balanceType,
|
|
10674
|
-
amount: resolveWalletAmount(log, isPoints),
|
|
10675
|
-
balance: resolveWalletBalance(log, isPoints),
|
|
10676
|
-
total_ever: totalEver === POINTS_COLLECTED_SENTINEL ? undefined : totalEver,
|
|
10677
|
-
is_wallet_entry: true
|
|
10678
|
-
});
|
|
10679
|
-
}
|
|
10680
|
-
return _extends({}, base, {
|
|
10681
|
-
type: exports.UserBalanceType.Points,
|
|
10682
|
-
amount: 0,
|
|
10683
|
-
balance: 0,
|
|
10684
|
-
is_wallet_entry: false,
|
|
10685
|
-
is_level_entry: typeId === exports.ActivityLogActivities.LevelChanged
|
|
10686
|
-
});
|
|
10687
|
-
};
|
|
10688
|
-
var mapWireEntry = function mapWireEntry(log, index) {
|
|
10689
|
-
var normalized = normalizeWireLog(log);
|
|
10690
|
-
if (isLegacyPointsEntry(normalized)) {
|
|
10691
|
-
return mapLegacyPointsEntry(normalized, index);
|
|
10692
|
-
}
|
|
10693
|
-
if (isLegacyGemsDiamondsEntry(normalized)) {
|
|
10694
|
-
return mapLegacyGemsDiamondsEntry(normalized, index);
|
|
10695
|
-
}
|
|
10696
|
-
if (isV2Entry(normalized)) {
|
|
10697
|
-
return mapV2Entry(normalized, index);
|
|
10698
|
-
}
|
|
10699
|
-
return null;
|
|
10700
|
-
};
|
|
10701
|
-
var mapActivityLogHistory = function mapActivityLogHistory(logHistory) {
|
|
10702
|
-
var entries = [];
|
|
10703
|
-
(logHistory || []).forEach(function (raw, index) {
|
|
10704
|
-
var mapped = mapWireEntry(raw, index);
|
|
10705
|
-
if (mapped) {
|
|
10706
|
-
entries.push(mapped);
|
|
10707
|
-
}
|
|
10708
|
-
});
|
|
10709
|
-
return entries;
|
|
10710
|
-
};
|
|
10711
|
-
var resolveWalletDisplayType = function resolveWalletDisplayType(entry) {
|
|
10712
|
-
switch (entry.activity_type_id) {
|
|
10713
|
-
case exports.ActivityLogActivities.Gems:
|
|
10714
|
-
return exports.UserBalanceType.Gems;
|
|
10715
|
-
case exports.ActivityLogActivities.Diamonds:
|
|
10716
|
-
return exports.UserBalanceType.Diamonds;
|
|
10717
|
-
case exports.ActivityLogActivities.Points:
|
|
10718
|
-
return exports.UserBalanceType.Points;
|
|
10719
|
-
}
|
|
10720
|
-
switch (Number(entry.type)) {
|
|
10721
|
-
case exports.UserBalanceType.Gems:
|
|
10722
|
-
return exports.UserBalanceType.Gems;
|
|
10723
|
-
case exports.UserBalanceType.Diamonds:
|
|
10724
|
-
return exports.UserBalanceType.Diamonds;
|
|
10725
|
-
default:
|
|
10726
|
-
return exports.UserBalanceType.Points;
|
|
10727
|
-
}
|
|
10728
|
-
};
|
|
10368
|
+
exports.UserBalanceType = void 0;
|
|
10369
|
+
(function (UserBalanceType) {
|
|
10370
|
+
UserBalanceType[UserBalanceType["Points"] = 0] = "Points";
|
|
10371
|
+
UserBalanceType[UserBalanceType["Gems"] = 1] = "Gems";
|
|
10372
|
+
UserBalanceType[UserBalanceType["Diamonds"] = 2] = "Diamonds";
|
|
10373
|
+
})(exports.UserBalanceType || (exports.UserBalanceType = {}));
|
|
10729
10374
|
|
|
10730
|
-
var toTActivityLog = function toTActivityLog(entry) {
|
|
10731
|
-
var row = {
|
|
10732
|
-
create_date: entry.create_date,
|
|
10733
|
-
user_ext_id: entry.user_ext_id,
|
|
10734
|
-
crm_brand_id: entry.crm_brand_id,
|
|
10735
|
-
type: resolveWalletDisplayType(entry),
|
|
10736
|
-
amount: entry.amount,
|
|
10737
|
-
balance: entry.balance,
|
|
10738
|
-
source_type_id: entry.source_type_id
|
|
10739
|
-
};
|
|
10740
|
-
if (entry.total_ever !== undefined) {
|
|
10741
|
-
row.total_ever = entry.total_ever;
|
|
10742
|
-
}
|
|
10743
|
-
return row;
|
|
10744
|
-
};
|
|
10745
|
-
/** Maps wire rows to wallet-only {@link TActivityLog} — legacy consumer contract. */
|
|
10746
10375
|
var ActivityLogTransform = function ActivityLogTransform(items) {
|
|
10747
10376
|
if (!items) {
|
|
10748
10377
|
return [];
|
|
10749
10378
|
}
|
|
10750
|
-
return
|
|
10751
|
-
|
|
10752
|
-
|
|
10379
|
+
return items.map(function (item) {
|
|
10380
|
+
var _item$create_date$sec, _item$create_date, _item$type;
|
|
10381
|
+
var itemTransformed = {
|
|
10382
|
+
create_date: (_item$create_date$sec = (_item$create_date = item.create_date) == null ? void 0 : _item$create_date.seconds) != null ? _item$create_date$sec : item.create_date,
|
|
10383
|
+
user_ext_id: item.user_ext_id,
|
|
10384
|
+
crm_brand_id: item.crm_brand_id,
|
|
10385
|
+
source_type_id: item.source_type_id
|
|
10386
|
+
};
|
|
10387
|
+
item.type = (_item$type = item.type) != null ? _item$type : exports.UserBalanceType.Points;
|
|
10388
|
+
if (item.type === exports.UserBalanceType.Diamonds || item.type === exports.UserBalanceType.Gems) {
|
|
10389
|
+
itemTransformed.type = item.type;
|
|
10390
|
+
itemTransformed.amount = item.amount;
|
|
10391
|
+
itemTransformed.balance = item.balance;
|
|
10392
|
+
}
|
|
10393
|
+
if (item.type === exports.UserBalanceType.Points) {
|
|
10394
|
+
itemTransformed.type = exports.UserBalanceType.Points;
|
|
10395
|
+
itemTransformed.amount = item.points_collected;
|
|
10396
|
+
itemTransformed.balance = item.user_points_balance;
|
|
10397
|
+
itemTransformed.total_ever = item.user_points_ever;
|
|
10398
|
+
}
|
|
10399
|
+
return itemTransformed;
|
|
10400
|
+
});
|
|
10753
10401
|
};
|
|
10754
|
-
/** Maps wire rows to the full v2 {@link TActivityLogEntry} shape. */
|
|
10755
10402
|
var ActivityLogV2Transform = function ActivityLogV2Transform(items) {
|
|
10756
10403
|
if (!items) {
|
|
10757
10404
|
return [];
|
|
10758
10405
|
}
|
|
10759
|
-
return
|
|
10406
|
+
return items.map(function (r) {
|
|
10407
|
+
var _r$create_date$second, _r$create_date, _r$points_collected, _r$user_points_balanc;
|
|
10408
|
+
var isGems = r.type_id === exports.ActivityLogActivities.Gems || r.type === exports.UserBalanceType.Gems;
|
|
10409
|
+
var isDiamonds = r.type_id === exports.ActivityLogActivities.Diamonds || r.type === exports.UserBalanceType.Diamonds;
|
|
10410
|
+
var x = {
|
|
10411
|
+
create_date: (_r$create_date$second = (_r$create_date = r.create_date) == null ? void 0 : _r$create_date.seconds) != null ? _r$create_date$second : r.create_date,
|
|
10412
|
+
user_ext_id: r.user_ext_id,
|
|
10413
|
+
crm_brand_id: r.crm_brand_id,
|
|
10414
|
+
type: isGems ? exports.UserBalanceType.Gems : isDiamonds ? exports.UserBalanceType.Diamonds : exports.UserBalanceType.Points,
|
|
10415
|
+
amount: (_r$points_collected = r.points_collected) != null ? _r$points_collected : r.amount,
|
|
10416
|
+
balance: (_r$user_points_balanc = r.user_points_balance) != null ? _r$user_points_balanc : r.balance,
|
|
10417
|
+
total_ever: r.user_points_ever,
|
|
10418
|
+
source_type_id: r.source_type_id,
|
|
10419
|
+
activity_type_id: r.type_id,
|
|
10420
|
+
context_value_1: r.context_value_1,
|
|
10421
|
+
meta: r.context_value_meta,
|
|
10422
|
+
source_entity_name: r.source_entity_name,
|
|
10423
|
+
source_entity_id: r.source_entity_id,
|
|
10424
|
+
source_reference_id: r.source_reference_id,
|
|
10425
|
+
source_root_id: r.source_root_id,
|
|
10426
|
+
is_wallet_entry: r.type_id == null || r.type_id === exports.ActivityLogActivities.Gems || r.type_id === exports.ActivityLogActivities.Diamonds || r.type_id === exports.ActivityLogActivities.Points
|
|
10427
|
+
};
|
|
10428
|
+
return x;
|
|
10429
|
+
});
|
|
10760
10430
|
};
|
|
10761
10431
|
|
|
10762
10432
|
exports.PointChangeSourceType = void 0;
|
|
@@ -10779,6 +10449,7 @@ exports.PointChangeSourceType = void 0;
|
|
|
10779
10449
|
PointChangeSourceType[PointChangeSourceType["DynamicFormula"] = 19] = "DynamicFormula";
|
|
10780
10450
|
PointChangeSourceType[PointChangeSourceType["Raffle"] = 21] = "Raffle";
|
|
10781
10451
|
PointChangeSourceType[PointChangeSourceType["Avatars"] = 22] = "Avatars";
|
|
10452
|
+
PointChangeSourceType[PointChangeSourceType["Clan"] = 23] = "Clan";
|
|
10782
10453
|
})(exports.PointChangeSourceType || (exports.PointChangeSourceType = {}));
|
|
10783
10454
|
|
|
10784
10455
|
var avatarDefinitionTransform = function avatarDefinitionTransform(items, avatarDomain) {
|
|
@@ -13409,7 +13080,6 @@ exports.TournamentUtils = TournamentUtils;
|
|
|
13409
13080
|
exports.UICustomSectionTransform = UICustomSectionTransform;
|
|
13410
13081
|
exports.UserAchievementTransform = UserAchievementTransform;
|
|
13411
13082
|
exports.WSAPI = WSAPI;
|
|
13412
|
-
exports.activityTypeIdToBalanceType = activityTypeIdToBalanceType;
|
|
13413
13083
|
exports.avatarCustomizedTransform = avatarCustomizedTransform;
|
|
13414
13084
|
exports.avatarDefinitionTransform = avatarDefinitionTransform;
|
|
13415
13085
|
exports.avatarPromptTransform = avatarPromptTransform;
|
|
@@ -13419,8 +13089,6 @@ exports.drawRunTransform = drawRunTransform;
|
|
|
13419
13089
|
exports.drawTransform = drawTransform;
|
|
13420
13090
|
exports.enrichUserAchievementsWithBadgeState = enrichUserAchievementsWithBadgeState;
|
|
13421
13091
|
exports.getLeaderBoardTransform = getLeaderBoardTransform;
|
|
13422
|
-
exports.isWalletActivityTypeId = isWalletActivityTypeId;
|
|
13423
|
-
exports.mapActivityLogHistory = mapActivityLogHistory;
|
|
13424
13092
|
exports.marketsInfo = marketsInfo;
|
|
13425
13093
|
exports.prizeTransform = prizeTransform;
|
|
13426
13094
|
exports.quizAnswerAwayTeamReplacementText = quizAnswerAwayTeamReplacementText;
|
|
@@ -13436,7 +13104,6 @@ exports.quizSupportedSports = quizSupportedSports;
|
|
|
13436
13104
|
exports.quizYesReplacementText = quizYesReplacementText;
|
|
13437
13105
|
exports.raffleClaimPrizeResponseTransform = raffleClaimPrizeResponseTransform;
|
|
13438
13106
|
exports.raffleTransform = raffleTransform;
|
|
13439
|
-
exports.resolveWalletDisplayType = resolveWalletDisplayType;
|
|
13440
13107
|
exports.ticketsTransform = ticketsTransform;
|
|
13441
13108
|
exports.tournamentInfoItemTransform = tournamentInfoItemTransform;
|
|
13442
13109
|
exports.winnersTransform = winnersTransform;
|