@smartico/public-api 0.0.415 → 0.0.417

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.
@@ -2203,6 +2203,7 @@ var onUpdateContextKey;
2203
2203
  onUpdateContextKey["CurrentLevel"] = "currentLevel";
2204
2204
  onUpdateContextKey["InboxUnreadCount"] = "inboxUnreadCount";
2205
2205
  onUpdateContextKey["ActivityLog"] = "activityLog";
2206
+ onUpdateContextKey["ActivityLogV2"] = "activityLogV2";
2206
2207
  onUpdateContextKey["AvatarsList"] = "avatarsList";
2207
2208
  onUpdateContextKey["AvatarsCustomized"] = "avatarsCustomized";
2208
2209
  onUpdateContextKey["AvatarPrompts"] = "avatarPrompts";
@@ -3044,6 +3045,33 @@ class WSAPIUser extends WSAPIBase {
3044
3045
  onUpdate(payload);
3045
3046
  }
3046
3047
  }
3048
+ /**
3049
+ * Returns the full activity log (v2) — wallet changes **and** non-wallet
3050
+ * activities (missions, badges, levels, tournaments, avatars, …).
3051
+ *
3052
+ * **Backwards compatibility**: existing integrations should keep using
3053
+ * {@link getActivityLog}, which returns wallet-only {@link TActivityLog}
3054
+ * rows with the original field contract unchanged.
3055
+ *
3056
+ * **Pagination** — same `from` / `to` offset model as {@link getActivityLog}
3057
+ * (server caps a single response at 50 entries).
3058
+ *
3059
+ * **Filtering** — pass `types` with {@link ActivityLogActivities} values to
3060
+ * request a server-side subset (e.g. missions only). Omit for all activity types.
3061
+ *
3062
+ * @returns Array of {@link TActivityLogEntry} ordered newest-first.
3063
+ */
3064
+ async getActivityLogV2({
3065
+ startTimeSeconds,
3066
+ endTimeSeconds,
3067
+ from,
3068
+ to,
3069
+ types
3070
+ }) {
3071
+ var _types$join;
3072
+ const cacheKey = `${onUpdateContextKey.ActivityLogV2}:${startTimeSeconds}:${endTimeSeconds}:${from}:${to}:${(_types$join = types == null ? void 0 : types.join(',')) != null ? _types$join : ''}`;
3073
+ return await OCache.use(cacheKey, ECacheContext.WSAPI, () => this.api.getActivityLogV2T(this.userExtId, startTimeSeconds, endTimeSeconds, from, to, types), CACHE_DATA_SEC);
3074
+ }
3047
3075
  }
3048
3076
 
3049
3077
  /** @group General */
@@ -9574,32 +9602,408 @@ var UserBalanceType;
9574
9602
  UserBalanceType[UserBalanceType["Diamonds"] = 2] = "Diamonds";
9575
9603
  })(UserBalanceType || (UserBalanceType = {}));
9576
9604
 
9605
+ /** Activity-log entry type as returned on the v2 wire (`type_id`). */
9606
+ var ActivityLogActivities;
9607
+ (function (ActivityLogActivities) {
9608
+ ActivityLogActivities[ActivityLogActivities["Gems"] = 1] = "Gems";
9609
+ ActivityLogActivities[ActivityLogActivities["Diamonds"] = 2] = "Diamonds";
9610
+ ActivityLogActivities[ActivityLogActivities["Points"] = 3] = "Points";
9611
+ ActivityLogActivities[ActivityLogActivities["LevelChanged"] = 4] = "LevelChanged";
9612
+ ActivityLogActivities[ActivityLogActivities["Bonus"] = 5] = "Bonus";
9613
+ ActivityLogActivities[ActivityLogActivities["PrizeDrop"] = 6] = "PrizeDrop";
9614
+ ActivityLogActivities[ActivityLogActivities["Minigame"] = 7] = "Minigame";
9615
+ ActivityLogActivities[ActivityLogActivities["RaffleTicket"] = 8] = "RaffleTicket";
9616
+ ActivityLogActivities[ActivityLogActivities["Avatar"] = 9] = "Avatar";
9617
+ ActivityLogActivities[ActivityLogActivities["Task"] = 10] = "Task";
9618
+ ActivityLogActivities[ActivityLogActivities["Mission"] = 11] = "Mission";
9619
+ ActivityLogActivities[ActivityLogActivities["Badge"] = 12] = "Badge";
9620
+ ActivityLogActivities[ActivityLogActivities["TangiblePrize"] = 13] = "TangiblePrize";
9621
+ ActivityLogActivities[ActivityLogActivities["Jackpot"] = 14] = "Jackpot";
9622
+ ActivityLogActivities[ActivityLogActivities["Spin"] = 15] = "Spin";
9623
+ ActivityLogActivities[ActivityLogActivities["NoPrize"] = 16] = "NoPrize";
9624
+ ActivityLogActivities[ActivityLogActivities["Leaderboard"] = 17] = "Leaderboard";
9625
+ ActivityLogActivities[ActivityLogActivities["Tournament"] = 18] = "Tournament";
9626
+ ActivityLogActivities[ActivityLogActivities["ClanTournament"] = 19] = "ClanTournament";
9627
+ })(ActivityLogActivities || (ActivityLogActivities = {}));
9628
+ var WalletChangeType;
9629
+ (function (WalletChangeType) {
9630
+ WalletChangeType[WalletChangeType["Add"] = 1] = "Add";
9631
+ WalletChangeType[WalletChangeType["Deduct"] = 2] = "Deduct";
9632
+ WalletChangeType[WalletChangeType["Set"] = 3] = "Set";
9633
+ })(WalletChangeType || (WalletChangeType = {}));
9634
+ var LevelChangeType;
9635
+ (function (LevelChangeType) {
9636
+ LevelChangeType[LevelChangeType["Increase"] = 1] = "Increase";
9637
+ LevelChangeType[LevelChangeType["Decrease"] = 2] = "Decrease";
9638
+ })(LevelChangeType || (LevelChangeType = {}));
9639
+ /** Wire ctx_1 for Mission / Badge / Task — see SMR-44986. */
9640
+ var AchievementChangeType;
9641
+ (function (AchievementChangeType) {
9642
+ AchievementChangeType[AchievementChangeType["Complete"] = 1] = "Complete";
9643
+ AchievementChangeType[AchievementChangeType["Unlock"] = 2] = "Unlock";
9644
+ })(AchievementChangeType || (AchievementChangeType = {}));
9645
+ /** Wire ctx_1 for Jackpot rows — SMR-44986. */
9646
+ var JackpotContextValue;
9647
+ (function (JackpotContextValue) {
9648
+ JackpotContextValue[JackpotContextValue["Registration"] = 1] = "Registration";
9649
+ JackpotContextValue[JackpotContextValue["Win"] = 3] = "Win";
9650
+ })(JackpotContextValue || (JackpotContextValue = {}));
9651
+ const WALLET_TYPE_IDS = new Set([ActivityLogActivities.Gems, ActivityLogActivities.Diamonds, ActivityLogActivities.Points]);
9652
+ const isWalletActivityTypeId = typeId => WALLET_TYPE_IDS.has(typeId);
9653
+ const activityTypeIdToBalanceType = typeId => {
9654
+ switch (typeId) {
9655
+ case ActivityLogActivities.Gems:
9656
+ return UserBalanceType.Gems;
9657
+ case ActivityLogActivities.Diamonds:
9658
+ return UserBalanceType.Diamonds;
9659
+ default:
9660
+ return UserBalanceType.Points;
9661
+ }
9662
+ };
9663
+
9664
+ const POINTS_COLLECTED_SENTINEL = -1;
9665
+ const parseCreateDate = raw => {
9666
+ if (raw === undefined || raw === null) {
9667
+ return 0;
9668
+ }
9669
+ if (typeof raw === 'number') {
9670
+ return raw;
9671
+ }
9672
+ if (typeof raw === 'object' && raw !== null) {
9673
+ if ('seconds' in raw) {
9674
+ return Number(raw.seconds);
9675
+ }
9676
+ if ('epochSecond' in raw) {
9677
+ return Number(raw.epochSecond);
9678
+ }
9679
+ }
9680
+ if (typeof raw === 'string') {
9681
+ const ms = Date.parse(raw);
9682
+ if (!Number.isNaN(ms)) {
9683
+ return Math.floor(ms / 1000);
9684
+ }
9685
+ }
9686
+ return 0;
9687
+ };
9688
+ const readWireNumber = (log, ...keys) => {
9689
+ for (const key of keys) {
9690
+ const value = log[key];
9691
+ if (value !== undefined && value !== null && value !== '') {
9692
+ return Number(value);
9693
+ }
9694
+ }
9695
+ return undefined;
9696
+ };
9697
+ const normalizeWireLog = raw => {
9698
+ const log = _extends({}, raw);
9699
+ const explicitTypeId = readWireNumber(log, 'type_id');
9700
+ if (explicitTypeId !== undefined) {
9701
+ log.type_id = explicitTypeId;
9702
+ } else {
9703
+ const wireType = readWireNumber(log, 'type');
9704
+ if (wireType !== undefined && wireType > UserBalanceType.Diamonds) {
9705
+ log.type_id = wireType;
9706
+ }
9707
+ }
9708
+ if (log.context_value_1 === undefined && log.ctx_1 !== undefined) {
9709
+ log.context_value_1 = log.ctx_1;
9710
+ }
9711
+ if (log.context_value_meta === undefined && log.ctx_meta !== undefined) {
9712
+ log.context_value_meta = log.ctx_meta;
9713
+ }
9714
+ if (log.source_reference_id === undefined && log.source_ref_id !== undefined) {
9715
+ log.source_reference_id = log.source_ref_id;
9716
+ }
9717
+ if (log.source_entity_id === undefined && log.source_root_id !== undefined) {
9718
+ log.source_entity_id = log.source_root_id;
9719
+ }
9720
+ return log;
9721
+ };
9722
+ const isActivityLogWireEntry = log => {
9723
+ if (log.is_activity_log === true) {
9724
+ return true;
9725
+ }
9726
+ if (log.label_id !== undefined && log.label_id !== null) {
9727
+ return true;
9728
+ }
9729
+ if (log.ctx_meta !== undefined || log.context_value_meta !== undefined) {
9730
+ return true;
9731
+ }
9732
+ if (log.ctx_1 !== undefined || log.context_value_1 !== undefined) {
9733
+ return true;
9734
+ }
9735
+ if (log.user_id !== undefined && log.user_id !== null) {
9736
+ return true;
9737
+ }
9738
+ const wireTypeId = readWireNumber(log, 'type_id');
9739
+ return wireTypeId !== undefined && wireTypeId > UserBalanceType.Diamonds;
9740
+ };
9741
+ const readWireBalanceType = log => {
9742
+ const balanceType = readWireNumber(log, 'type');
9743
+ if (balanceType === UserBalanceType.Gems || balanceType === UserBalanceType.Diamonds) {
9744
+ return balanceType;
9745
+ }
9746
+ return undefined;
9747
+ };
9748
+ const hasGemsOrDiamondsWalletFields = log => log.amount !== undefined || log.balance !== undefined || readWireNumber(log, 'amount', 'collected_amount') !== undefined || readWireNumber(log, 'balance', 'user_balance') !== undefined;
9749
+ const isGemsOrDiamondsWalletWireEntry = log => {
9750
+ const balanceType = readWireBalanceType(log);
9751
+ return balanceType !== undefined && hasGemsOrDiamondsWalletFields(log);
9752
+ };
9753
+ const resolveWalletAmount = (log, isPoints) => {
9754
+ const pointsCollected = readWireNumber(log, 'points_collected');
9755
+ if (isPoints && pointsCollected !== undefined && pointsCollected !== POINTS_COLLECTED_SENTINEL) {
9756
+ return pointsCollected;
9757
+ }
9758
+ if (isPoints) {
9759
+ const _amount = readWireNumber(log, 'amount', 'collected_amount');
9760
+ return _amount === undefined ? 0 : _amount;
9761
+ }
9762
+ const amount = readWireNumber(log, 'amount', 'collected_amount');
9763
+ return amount === undefined ? 0 : amount;
9764
+ };
9765
+ const resolveWalletBalance = (log, isPoints) => {
9766
+ if (isPoints) {
9767
+ const _balance = readWireNumber(log, 'balance', 'user_points_balance', 'user_balance');
9768
+ return _balance === undefined ? 0 : _balance;
9769
+ }
9770
+ const balance = readWireNumber(log, 'balance', 'user_balance');
9771
+ return balance === undefined ? 0 : balance;
9772
+ };
9773
+ const resolveSourceTypeId = log => {
9774
+ const sourceTypeId = readWireNumber(log, 'source_type_id', 'entity_type_id');
9775
+ return sourceTypeId === undefined ? 0 : sourceTypeId;
9776
+ };
9777
+ const parseMeta = contextValueMeta => {
9778
+ var _meta$public_meta;
9779
+ if (!contextValueMeta) {
9780
+ return undefined;
9781
+ }
9782
+ let meta;
9783
+ if (typeof contextValueMeta === 'object') {
9784
+ meta = contextValueMeta;
9785
+ } else if (typeof contextValueMeta === 'string') {
9786
+ try {
9787
+ meta = JSON.parse(contextValueMeta);
9788
+ } catch (_unused) {
9789
+ return undefined;
9790
+ }
9791
+ }
9792
+ if (!meta) {
9793
+ return undefined;
9794
+ }
9795
+ const nested = (_meta$public_meta = meta.public_meta) != null ? _meta$public_meta : meta.public_map;
9796
+ const pickImage = src => {
9797
+ var _ref, _ref2, _ref3, _ref4, _src$image_url;
9798
+ 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;
9799
+ };
9800
+ if (nested) {
9801
+ var _meta$name, _pickImage, _ref5, _meta$position;
9802
+ return _extends({}, meta, {
9803
+ name: (_meta$name = meta.name) != null ? _meta$name : nested.name,
9804
+ image_url: (_pickImage = pickImage(meta)) != null ? _pickImage : pickImage(nested),
9805
+ position: (_ref5 = (_meta$position = meta.position) != null ? _meta$position : nested.position) != null ? _ref5 : meta.score
9806
+ });
9807
+ }
9808
+ const topImage = pickImage(meta);
9809
+ if (topImage && meta.image_url === undefined) {
9810
+ var _meta$position2;
9811
+ return _extends({}, meta, {
9812
+ image_url: topImage,
9813
+ position: (_meta$position2 = meta.position) != null ? _meta$position2 : meta.score
9814
+ });
9815
+ }
9816
+ if (meta.score !== undefined && meta.position === undefined) {
9817
+ return _extends({}, meta, {
9818
+ position: meta.score
9819
+ });
9820
+ }
9821
+ return meta;
9822
+ };
9823
+ const isLegacyPointsEntry = log => {
9824
+ if (isActivityLogWireEntry(log)) {
9825
+ return false;
9826
+ }
9827
+ const pointsCollected = readWireNumber(log, 'points_collected');
9828
+ return pointsCollected !== undefined && pointsCollected !== POINTS_COLLECTED_SENTINEL;
9829
+ };
9830
+ const isLegacyGemsDiamondsEntry = log => {
9831
+ if (isActivityLogWireEntry(log)) {
9832
+ return false;
9833
+ }
9834
+ const balanceType = readWireNumber(log, 'type');
9835
+ return (balanceType === UserBalanceType.Gems || balanceType === UserBalanceType.Diamonds) && log.amount !== undefined;
9836
+ };
9837
+ const isV2Entry = log => isActivityLogWireEntry(log) || log.type_id !== undefined && log.type_id !== null;
9838
+ const resolveSourceEntityName = (log, meta) => {
9839
+ var _log$source_entity_na;
9840
+ const fromWire = (_log$source_entity_na = log.source_entity_name) != null ? _log$source_entity_na : log.source_public_name;
9841
+ if (typeof fromWire === 'string' && fromWire.length > 0) {
9842
+ return fromWire;
9843
+ }
9844
+ if (meta != null && meta.name) {
9845
+ return meta.name;
9846
+ }
9847
+ return undefined;
9848
+ };
9849
+ const buildEntryKey = (log, index) => {
9850
+ var _ref6, _log$type_id, _log$source_type_id, _ref7, _log$source_entity_id, _ref8, _log$context_value_;
9851
+ 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('-');
9852
+ };
9853
+ const mapLegacyPointsEntry = (log, index) => {
9854
+ var _log$user_ext_id, _log$crm_brand_id;
9855
+ return {
9856
+ entry_key: buildEntryKey(log, index),
9857
+ create_date: parseCreateDate(log.create_date),
9858
+ user_ext_id: String((_log$user_ext_id = log.user_ext_id) != null ? _log$user_ext_id : ''),
9859
+ crm_brand_id: Number((_log$crm_brand_id = log.crm_brand_id) != null ? _log$crm_brand_id : 0),
9860
+ type: UserBalanceType.Points,
9861
+ amount: resolveWalletAmount(log, true),
9862
+ balance: resolveWalletBalance(log, true),
9863
+ total_ever: readWireNumber(log, 'user_points_ever', 'collected_ever'),
9864
+ context_value_1: readWireNumber(log, 'context_value_1', 'ctx_1'),
9865
+ source_type_id: resolveSourceTypeId(log),
9866
+ activity_type_id: ActivityLogActivities.Points,
9867
+ is_wallet_entry: true
9868
+ };
9869
+ };
9870
+ const mapLegacyGemsDiamondsEntry = (log, index) => {
9871
+ var _log$user_ext_id2, _log$crm_brand_id2;
9872
+ const wireType = readWireNumber(log, 'type');
9873
+ const activityTypeId = wireType === UserBalanceType.Gems ? ActivityLogActivities.Gems : ActivityLogActivities.Diamonds;
9874
+ return {
9875
+ entry_key: buildEntryKey(log, index),
9876
+ create_date: parseCreateDate(log.create_date),
9877
+ user_ext_id: String((_log$user_ext_id2 = log.user_ext_id) != null ? _log$user_ext_id2 : ''),
9878
+ crm_brand_id: Number((_log$crm_brand_id2 = log.crm_brand_id) != null ? _log$crm_brand_id2 : 0),
9879
+ type: activityTypeIdToBalanceType(activityTypeId),
9880
+ amount: resolveWalletAmount(log, false),
9881
+ balance: resolveWalletBalance(log, false),
9882
+ context_value_1: readWireNumber(log, 'context_value_1', 'ctx_1'),
9883
+ source_type_id: resolveSourceTypeId(log),
9884
+ activity_type_id: activityTypeId,
9885
+ is_wallet_entry: true
9886
+ };
9887
+ };
9888
+ const mapV2Entry = (log, index) => {
9889
+ var _log$user_ext_id3, _log$crm_brand_id3;
9890
+ const typeId = readWireNumber(log, 'type_id');
9891
+ const contextValue1 = readWireNumber(log, 'context_value_1', 'ctx_1');
9892
+ const meta = parseMeta(log.context_value_meta);
9893
+ const sourceEntityName = resolveSourceEntityName(log, meta);
9894
+ const sourceEntityId = readWireNumber(log, 'source_entity_id', 'source_root_id');
9895
+ const sourceReferenceId = readWireNumber(log, 'source_reference_id', 'source_ref_id');
9896
+ const sourceRootId = readWireNumber(log, 'source_root_id');
9897
+ const gemsOrDiamondsWallet = isGemsOrDiamondsWalletWireEntry(log);
9898
+ const isWalletEntry = typeId !== undefined && isWalletActivityTypeId(typeId) || gemsOrDiamondsWallet;
9899
+ const base = {
9900
+ entry_key: buildEntryKey(log, index),
9901
+ create_date: parseCreateDate(log.create_date),
9902
+ user_ext_id: String((_log$user_ext_id3 = log.user_ext_id) != null ? _log$user_ext_id3 : ''),
9903
+ crm_brand_id: Number((_log$crm_brand_id3 = log.crm_brand_id) != null ? _log$crm_brand_id3 : 0),
9904
+ source_type_id: resolveSourceTypeId(log),
9905
+ activity_type_id: typeId,
9906
+ context_value_1: contextValue1,
9907
+ meta,
9908
+ source_entity_name: sourceEntityName,
9909
+ source_entity_id: sourceEntityId && sourceEntityId > 0 ? sourceEntityId : undefined,
9910
+ source_reference_id: sourceReferenceId && sourceReferenceId > 0 ? sourceReferenceId : undefined,
9911
+ source_root_id: sourceRootId && sourceRootId > 0 ? sourceRootId : undefined
9912
+ };
9913
+ if (isWalletEntry) {
9914
+ var _readWireNumber;
9915
+ const wireBalanceType = readWireBalanceType(log);
9916
+ const balanceType = wireBalanceType != null ? wireBalanceType : typeId !== undefined ? activityTypeIdToBalanceType(typeId) : UserBalanceType.Points;
9917
+ const walletActivityTypeId = typeId !== undefined && isWalletActivityTypeId(typeId) ? typeId : balanceType === UserBalanceType.Gems ? ActivityLogActivities.Gems : balanceType === UserBalanceType.Diamonds ? ActivityLogActivities.Diamonds : ActivityLogActivities.Points;
9918
+ const isPoints = balanceType === UserBalanceType.Points;
9919
+ const 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;
9920
+ return _extends({}, base, {
9921
+ activity_type_id: walletActivityTypeId,
9922
+ type: balanceType,
9923
+ amount: resolveWalletAmount(log, isPoints),
9924
+ balance: resolveWalletBalance(log, isPoints),
9925
+ total_ever: totalEver === POINTS_COLLECTED_SENTINEL ? undefined : totalEver,
9926
+ is_wallet_entry: true
9927
+ });
9928
+ }
9929
+ return _extends({}, base, {
9930
+ type: UserBalanceType.Points,
9931
+ amount: 0,
9932
+ balance: 0,
9933
+ is_wallet_entry: false,
9934
+ is_level_entry: typeId === ActivityLogActivities.LevelChanged
9935
+ });
9936
+ };
9937
+ const mapWireEntry = (log, index) => {
9938
+ const normalized = normalizeWireLog(log);
9939
+ if (isLegacyPointsEntry(normalized)) {
9940
+ return mapLegacyPointsEntry(normalized, index);
9941
+ }
9942
+ if (isLegacyGemsDiamondsEntry(normalized)) {
9943
+ return mapLegacyGemsDiamondsEntry(normalized, index);
9944
+ }
9945
+ if (isV2Entry(normalized)) {
9946
+ return mapV2Entry(normalized, index);
9947
+ }
9948
+ return null;
9949
+ };
9950
+ const mapActivityLogHistory = logHistory => {
9951
+ const entries = [];
9952
+ (logHistory || []).forEach((raw, index) => {
9953
+ const mapped = mapWireEntry(raw, index);
9954
+ if (mapped) {
9955
+ entries.push(mapped);
9956
+ }
9957
+ });
9958
+ return entries;
9959
+ };
9960
+ const resolveWalletDisplayType = entry => {
9961
+ switch (entry.activity_type_id) {
9962
+ case ActivityLogActivities.Gems:
9963
+ return UserBalanceType.Gems;
9964
+ case ActivityLogActivities.Diamonds:
9965
+ return UserBalanceType.Diamonds;
9966
+ case ActivityLogActivities.Points:
9967
+ return UserBalanceType.Points;
9968
+ }
9969
+ switch (Number(entry.type)) {
9970
+ case UserBalanceType.Gems:
9971
+ return UserBalanceType.Gems;
9972
+ case UserBalanceType.Diamonds:
9973
+ return UserBalanceType.Diamonds;
9974
+ default:
9975
+ return UserBalanceType.Points;
9976
+ }
9977
+ };
9978
+
9979
+ const toTActivityLog = entry => {
9980
+ const row = {
9981
+ create_date: entry.create_date,
9982
+ user_ext_id: entry.user_ext_id,
9983
+ crm_brand_id: entry.crm_brand_id,
9984
+ type: resolveWalletDisplayType(entry),
9985
+ amount: entry.amount,
9986
+ balance: entry.balance,
9987
+ source_type_id: entry.source_type_id
9988
+ };
9989
+ if (entry.total_ever !== undefined) {
9990
+ row.total_ever = entry.total_ever;
9991
+ }
9992
+ return row;
9993
+ };
9994
+ /** Maps wire rows to wallet-only {@link TActivityLog} — legacy consumer contract. */
9577
9995
  const ActivityLogTransform = items => {
9578
9996
  if (!items) {
9579
9997
  return [];
9580
9998
  }
9581
- return items.map(item => {
9582
- var _item$type;
9583
- const itemTransformed = {
9584
- create_date: item.create_date,
9585
- user_ext_id: item.user_ext_id,
9586
- crm_brand_id: item.crm_brand_id,
9587
- source_type_id: item.source_type_id
9588
- };
9589
- item.type = (_item$type = item.type) != null ? _item$type : UserBalanceType.Points;
9590
- if (item.type === UserBalanceType.Diamonds || item.type === UserBalanceType.Gems) {
9591
- itemTransformed.type = item.type;
9592
- itemTransformed.amount = item.amount;
9593
- itemTransformed.balance = item.balance;
9594
- }
9595
- if (item.type === UserBalanceType.Points) {
9596
- itemTransformed.type = UserBalanceType.Points;
9597
- itemTransformed.amount = item.points_collected;
9598
- itemTransformed.balance = item.user_points_balance;
9599
- itemTransformed.total_ever = item.user_points_ever;
9600
- }
9601
- return itemTransformed;
9602
- });
9999
+ return mapActivityLogHistory(items).filter(entry => entry.is_wallet_entry).map(toTActivityLog);
10000
+ };
10001
+ /** Maps wire rows to the full v2 {@link TActivityLogEntry} shape. */
10002
+ const ActivityLogV2Transform = items => {
10003
+ if (!items) {
10004
+ return [];
10005
+ }
10006
+ return mapActivityLogHistory(items);
9603
10007
  };
9604
10008
 
9605
10009
  var PointChangeSourceType;
@@ -10806,11 +11210,27 @@ class SmarticoAPI {
10806
11210
  });
10807
11211
  return await this.send(message, ClassId.GET_POINT_HISTORY_RESPONSE);
10808
11212
  }
11213
+ async getActivityLogV2(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset, types) {
11214
+ const message = this.buildMessage(user_ext_id, ClassId.GET_POINT_HISTORY_REQUEST, _extends({
11215
+ startTimeSeconds: Math.floor(startTimeSeconds),
11216
+ endTimeSeconds: Math.floor(endTimeSeconds),
11217
+ limit,
11218
+ offset
11219
+ }, types ? {
11220
+ types
11221
+ } : {}));
11222
+ return await this.send(message, ClassId.GET_POINT_HISTORY_RESPONSE);
11223
+ }
10809
11224
  async getActivityLogT(user_ext_id, startTimeSeconds, endTimeSeconds, from = 0, to = 50) {
10810
11225
  const limit = to - from > 50 ? 50 : to - from;
10811
11226
  const offset = from;
10812
11227
  return ActivityLogTransform((await this.getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset)).logHistory);
10813
11228
  }
11229
+ async getActivityLogV2T(user_ext_id, startTimeSeconds, endTimeSeconds, from = 0, to = 50, types) {
11230
+ const limit = to - from > 50 ? 50 : to - from;
11231
+ const offset = from;
11232
+ return ActivityLogV2Transform((await this.getActivityLogV2(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset, types)).logHistory);
11233
+ }
10814
11234
  }
10815
11235
 
10816
11236
  class CookieStore {
@@ -10855,6 +11275,7 @@ var AnalyticsScreenNameId;
10855
11275
  AnalyticsScreenNameId[AnalyticsScreenNameId["TreasureHunt"] = 22] = "TreasureHunt";
10856
11276
  AnalyticsScreenNameId[AnalyticsScreenNameId["LiquidSection"] = 23] = "LiquidSection";
10857
11277
  AnalyticsScreenNameId[AnalyticsScreenNameId["ActivityLog"] = 24] = "ActivityLog";
11278
+ AnalyticsScreenNameId[AnalyticsScreenNameId["MiniGamesHistory"] = 25] = "MiniGamesHistory";
10858
11279
  AnalyticsScreenNameId[AnalyticsScreenNameId["ModalMission"] = 31] = "ModalMission";
10859
11280
  AnalyticsScreenNameId[AnalyticsScreenNameId["ModalLevel"] = 32] = "ModalLevel";
10860
11281
  AnalyticsScreenNameId[AnalyticsScreenNameId["ModalBadge"] = 33] = "ModalBadge";
@@ -11459,5 +11880,5 @@ var JoinClanErrorCode;
11459
11880
  JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_JOINED_AFTER_TOURNAMENT_START"] = 1011] = "JOIN_CLAN_JOINED_AFTER_TOURNAMENT_START";
11460
11881
  })(JoinClanErrorCode || (JoinClanErrorCode = {}));
11461
11882
 
11462
- export { AchCategoryTransform, AchCustomLayoutTheme, AchCustomSectionType, AchMissionsTabsOptions, AchOverviewMissionsFilter, AchievementAvailabilityStatus, AchievementClaimPeriodTypeId, AchievementStatus, AchievementTaskType, AchievementType, ActivityLogTransform, ActivityTypeLimited, AllRoundsGameBoardID, AnalyticsInboxSubScreenNameId, AnalyticsInterfaceType, AnalyticsScreenNameId, AnalyticsTournamentsLobbySubScreenNameId, AttemptPeriodType, AvatarCustomizeErrorCode, BadgesTimeLimitStates, BonusItemsTransform, BonusStatus, BuyStoreItemErrorCode, ClassId, CookieStore, CoreUtils, ECacheContext, GPRoundStatus, GamePickMarketType, GamePickResolutionType, GamePickScoreType, GamePickSportType, GameRoundOrderType, GetJackpotEligibleGamesResponseTransform, GetJackpotWinnersResponseTransform, GetLevelMapResponseTransform, InboxCategories, InboxMessageBodyTransform, InboxMessageType, InboxMessagesTransform, InboxReadStatus, JackPotTemparature, JackpotContributionType, JackpotType, JoinClanErrorCode, LeaderBoardPeriodType, LiquidEntityData, MiniGamePrizeTypeName, MiniGamePrizeTypeNamed, MissionCategory, MissionUtils, OCache, OpenLinksType, PointChangeSourceType, PrizeModifiers, PrizeModifiersKeysNames, PublicLabelSettings, QuizAnswersValueType, QuizMarketPerSport, QuizSportType, RaffleDrawInstanceState, RaffleDrawTypeExecution, RaffleTicketCapVisualization, SAWAcknowledgeType, SAWAcknowledgeTypeName, SAWAcknowledgeTypeNamed, SAWAskForUsername, SAWBuyInType, SAWBuyInTypeName, SAWBuyInTypeNamed, SAWExposeUserSpinId, SAWExposeUserSpinIdName, SAWExposeUserSpinIdNamed, SAWGPMarketType, SAWGameDifficultyType, SAWGameDifficultyTypeName, SAWGameLayout, SAWGameLayoutName, SAWGameLayoutNamed, SAWGameType, SAWGameTypeName, SAWGameTypeNamed, SAWHistoryTransform, SAWPrizeType, SAWSpinErrorCode, SAWTemplatesTransform, SAWUtils, SAWWheelLayout, SAWWinSoundFiles, SAWWinSoundType, SawGameDifficultyTypeNamed, ScheduledMissionType, SmarticoAPI, StoreCategoryTransform, StoreItemPurchaseType, StoreItemPurchasedTransform, StoreItemTransform, StoreItemType, StoreItemTypeName, StoreItemTypeNamed, TournamentInstanceStatus, TournamentInstanceStatusName, TournamentItemsTransform, TournamentRegistrationError, TournamentRegistrationStatus, TournamentRegistrationStatusName, TournamentRegistrationStatusNamed, TournamentRegistrationType, TournamentRegistrationTypeGetName, TournamentType, TournamentUtils, TranslationArea, UICustomSectionTransform, UserAchievementTransform, UserBalanceType, WSAPI, avatarCustomizedTransform, avatarDefinitionTransform, avatarPromptTransform, clanTournamentPlayersTransform, drawRunHistoryTransform, drawRunTransform, drawTransform, enrichUserAchievementsWithBadgeState, getLeaderBoardTransform, marketsInfo, prizeTransform, quizAnswerAwayTeamReplacementText, quizAnswerHomeTeamReplacementText, quizAnswersTrKeys, quizDrawReplacementText, quizEvenReplacementText, quizNoGoalsReplacementText, quizNoReplacementText, quizOddReplacementText, quizOrReplacementText, quizSupportedSports, quizYesReplacementText, raffleClaimPrizeResponseTransform, raffleTransform, ticketsTransform, tournamentInfoItemTransform, winnersTransform };
11883
+ export { AchCategoryTransform, AchCustomLayoutTheme, AchCustomSectionType, AchMissionsTabsOptions, AchOverviewMissionsFilter, AchievementAvailabilityStatus, AchievementChangeType, AchievementClaimPeriodTypeId, AchievementStatus, AchievementTaskType, AchievementType, ActivityLogActivities, ActivityLogTransform, ActivityLogV2Transform, ActivityTypeLimited, AllRoundsGameBoardID, AnalyticsInboxSubScreenNameId, AnalyticsInterfaceType, AnalyticsScreenNameId, AnalyticsTournamentsLobbySubScreenNameId, AttemptPeriodType, AvatarCustomizeErrorCode, BadgesTimeLimitStates, BonusItemsTransform, BonusStatus, BuyStoreItemErrorCode, ClassId, CookieStore, CoreUtils, ECacheContext, GPRoundStatus, GamePickMarketType, GamePickResolutionType, GamePickScoreType, GamePickSportType, GameRoundOrderType, GetJackpotEligibleGamesResponseTransform, GetJackpotWinnersResponseTransform, GetLevelMapResponseTransform, InboxCategories, InboxMessageBodyTransform, InboxMessageType, InboxMessagesTransform, InboxReadStatus, JackPotTemparature, JackpotContextValue, JackpotContributionType, JackpotType, JoinClanErrorCode, LeaderBoardPeriodType, LevelChangeType, LiquidEntityData, MiniGamePrizeTypeName, MiniGamePrizeTypeNamed, MissionCategory, MissionUtils, OCache, OpenLinksType, PointChangeSourceType, PrizeModifiers, PrizeModifiersKeysNames, PublicLabelSettings, QuizAnswersValueType, QuizMarketPerSport, QuizSportType, RaffleDrawInstanceState, RaffleDrawTypeExecution, RaffleTicketCapVisualization, SAWAcknowledgeType, SAWAcknowledgeTypeName, SAWAcknowledgeTypeNamed, SAWAskForUsername, SAWBuyInType, SAWBuyInTypeName, SAWBuyInTypeNamed, SAWExposeUserSpinId, SAWExposeUserSpinIdName, SAWExposeUserSpinIdNamed, SAWGPMarketType, SAWGameDifficultyType, SAWGameDifficultyTypeName, SAWGameLayout, SAWGameLayoutName, SAWGameLayoutNamed, SAWGameType, SAWGameTypeName, SAWGameTypeNamed, SAWHistoryTransform, SAWPrizeType, SAWSpinErrorCode, SAWTemplatesTransform, SAWUtils, SAWWheelLayout, SAWWinSoundFiles, SAWWinSoundType, SawGameDifficultyTypeNamed, ScheduledMissionType, SmarticoAPI, StoreCategoryTransform, StoreItemPurchaseType, StoreItemPurchasedTransform, StoreItemTransform, StoreItemType, StoreItemTypeName, StoreItemTypeNamed, TournamentInstanceStatus, TournamentInstanceStatusName, TournamentItemsTransform, TournamentRegistrationError, TournamentRegistrationStatus, TournamentRegistrationStatusName, TournamentRegistrationStatusNamed, TournamentRegistrationType, TournamentRegistrationTypeGetName, TournamentType, TournamentUtils, TranslationArea, UICustomSectionTransform, UserAchievementTransform, UserBalanceType, WSAPI, WalletChangeType, activityTypeIdToBalanceType, avatarCustomizedTransform, avatarDefinitionTransform, avatarPromptTransform, clanTournamentPlayersTransform, drawRunHistoryTransform, drawRunTransform, drawTransform, enrichUserAchievementsWithBadgeState, getLeaderBoardTransform, isWalletActivityTypeId, mapActivityLogHistory, marketsInfo, prizeTransform, quizAnswerAwayTeamReplacementText, quizAnswerHomeTeamReplacementText, quizAnswersTrKeys, quizDrawReplacementText, quizEvenReplacementText, quizNoGoalsReplacementText, quizNoReplacementText, quizOddReplacementText, quizOrReplacementText, quizSupportedSports, quizYesReplacementText, raffleClaimPrizeResponseTransform, raffleTransform, resolveWalletDisplayType, ticketsTransform, tournamentInfoItemTransform, winnersTransform };
11463
11884
  //# sourceMappingURL=index.modern.mjs.map