@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.
Files changed (38) hide show
  1. package/dist/ActivityLog/ActivityLogActivities.d.ts +2 -23
  2. package/dist/ActivityLog/ActivityLogMeta.d.ts +1 -19
  3. package/dist/ActivityLog/GetActivityLogResponse.d.ts +2 -4
  4. package/dist/ActivityLog/PointChangeSourceType.d.ts +2 -1
  5. package/dist/ActivityLog/index.d.ts +0 -1
  6. package/dist/Base/ClassId.d.ts +1 -0
  7. package/dist/WSAPI/WSAPIMiniGames.d.ts +4 -4
  8. package/dist/WSAPI/WSAPITypes.d.ts +0 -2
  9. package/dist/index.js +59 -392
  10. package/dist/index.js.map +1 -1
  11. package/dist/index.modern.mjs +60 -380
  12. package/dist/index.modern.mjs.map +1 -1
  13. package/docs/api/README.md +5 -0
  14. package/docs/api/classes/WSAPIJackpots.md +3 -1
  15. package/docs/api/classes/WSAPIMiniGames.md +7 -2
  16. package/docs/api/classes/WSAPIUser.md +49 -0
  17. package/docs/api/enumerations/ActivityLogActivities.md +123 -0
  18. package/docs/api/enumerations/PointChangeSourceType.md +6 -0
  19. package/docs/api/interfaces/ActivityLogMeta.md +37 -0
  20. package/docs/api/interfaces/SAWPrizeDropAknowledgeCancelRequest.md +47 -0
  21. package/docs/api/interfaces/SAWPrizeDropAknowledgeCancelResponse.md +41 -0
  22. package/docs/api/interfaces/SAWTemplateUI.md +1 -1
  23. package/docs/api/interfaces/TActivityLogEntry.md +100 -0
  24. package/docs/capabilities/getActivityLogV2.md +62 -0
  25. package/docs/capabilities/getJackpotWinners.md +3 -1
  26. package/docs/capabilities/miniGameWinAcknowledgeRequest.md +1 -1
  27. package/docs/native/PROTOCOL.md +33 -1
  28. package/package.json +1 -1
  29. package/src/ActivityLog/ActivityLogActivities.ts +1 -44
  30. package/src/ActivityLog/ActivityLogMeta.ts +1 -20
  31. package/src/ActivityLog/GetActivityLogResponse.ts +59 -25
  32. package/src/ActivityLog/PointChangeSourceType.ts +1 -0
  33. package/src/ActivityLog/index.ts +0 -1
  34. package/src/Base/ClassId.ts +2 -0
  35. package/src/WSAPI/WSAPIMiniGames.ts +4 -4
  36. package/src/WSAPI/WSAPITypes.ts +0 -2
  37. package/tsconfig.json +4 -1
  38. package/src/ActivityLog/ActivityLogMapper.ts +0 -358
@@ -172,6 +172,7 @@ var ClassId;
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,
@@ -7306,10 +7307,10 @@ class WSAPIMiniGames extends WSAPIRaffles {
7306
7307
  * (played with `acknowledge: false`), or the
7307
7308
  * `client_request_id` of a
7308
7309
  * {@link getMiniGamesHistory} row.
7309
- * @param options.lose Optional. When `true`, finalises the spin as
7310
- * lost — the prize is not credited and returns
7311
- * to the prize pool (see "Finalising as lost").
7312
- * Omit (or pass `false`) to deliver the win.
7310
+ * @param lose Optional. When `true`, finalises the spin as
7311
+ * lost — the prize is not credited and returns
7312
+ * to the prize pool (see "Finalising as lost").
7313
+ * Omit (or pass `false`) to deliver the win.
7313
7314
  *
7314
7315
  * @example
7315
7316
  * ```ts
@@ -9595,13 +9596,6 @@ var BonusStatus;
9595
9596
  BonusStatus[BonusStatus["EXPIRED"] = 6] = "EXPIRED";
9596
9597
  })(BonusStatus || (BonusStatus = {}));
9597
9598
 
9598
- var UserBalanceType;
9599
- (function (UserBalanceType) {
9600
- UserBalanceType[UserBalanceType["Points"] = 0] = "Points";
9601
- UserBalanceType[UserBalanceType["Gems"] = 1] = "Gems";
9602
- UserBalanceType[UserBalanceType["Diamonds"] = 2] = "Diamonds";
9603
- })(UserBalanceType || (UserBalanceType = {}));
9604
-
9605
9599
  /** Activity-log entry type as returned on the v2 wire (`type_id`). */
9606
9600
  var ActivityLogActivities;
9607
9601
  (function (ActivityLogActivities) {
@@ -9624,386 +9618,71 @@ var ActivityLogActivities;
9624
9618
  ActivityLogActivities[ActivityLogActivities["Leaderboard"] = 17] = "Leaderboard";
9625
9619
  ActivityLogActivities[ActivityLogActivities["Tournament"] = 18] = "Tournament";
9626
9620
  ActivityLogActivities[ActivityLogActivities["ClanTournament"] = 19] = "ClanTournament";
9621
+ ActivityLogActivities[ActivityLogActivities["Clan"] = 20] = "Clan";
9627
9622
  })(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
9623
 
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
- };
9624
+ var UserBalanceType;
9625
+ (function (UserBalanceType) {
9626
+ UserBalanceType[UserBalanceType["Points"] = 0] = "Points";
9627
+ UserBalanceType[UserBalanceType["Gems"] = 1] = "Gems";
9628
+ UserBalanceType[UserBalanceType["Diamonds"] = 2] = "Diamonds";
9629
+ })(UserBalanceType || (UserBalanceType = {}));
9978
9630
 
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. */
9995
9631
  const ActivityLogTransform = items => {
9996
9632
  if (!items) {
9997
9633
  return [];
9998
9634
  }
9999
- return mapActivityLogHistory(items).filter(entry => entry.is_wallet_entry).map(toTActivityLog);
9635
+ return items.map(item => {
9636
+ var _item$create_date$sec, _item$create_date, _item$type;
9637
+ const itemTransformed = {
9638
+ 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,
9639
+ user_ext_id: item.user_ext_id,
9640
+ crm_brand_id: item.crm_brand_id,
9641
+ source_type_id: item.source_type_id
9642
+ };
9643
+ item.type = (_item$type = item.type) != null ? _item$type : UserBalanceType.Points;
9644
+ if (item.type === UserBalanceType.Diamonds || item.type === UserBalanceType.Gems) {
9645
+ itemTransformed.type = item.type;
9646
+ itemTransformed.amount = item.amount;
9647
+ itemTransformed.balance = item.balance;
9648
+ }
9649
+ if (item.type === UserBalanceType.Points) {
9650
+ itemTransformed.type = UserBalanceType.Points;
9651
+ itemTransformed.amount = item.points_collected;
9652
+ itemTransformed.balance = item.user_points_balance;
9653
+ itemTransformed.total_ever = item.user_points_ever;
9654
+ }
9655
+ return itemTransformed;
9656
+ });
10000
9657
  };
10001
- /** Maps wire rows to the full v2 {@link TActivityLogEntry} shape. */
10002
9658
  const ActivityLogV2Transform = items => {
10003
9659
  if (!items) {
10004
9660
  return [];
10005
9661
  }
10006
- return mapActivityLogHistory(items);
9662
+ return items.map(r => {
9663
+ var _r$create_date$second, _r$create_date, _r$points_collected, _r$user_points_balanc;
9664
+ const isGems = r.type_id === ActivityLogActivities.Gems || r.type === UserBalanceType.Gems;
9665
+ const isDiamonds = r.type_id === ActivityLogActivities.Diamonds || r.type === UserBalanceType.Diamonds;
9666
+ const x = {
9667
+ 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,
9668
+ user_ext_id: r.user_ext_id,
9669
+ crm_brand_id: r.crm_brand_id,
9670
+ type: isGems ? UserBalanceType.Gems : isDiamonds ? UserBalanceType.Diamonds : UserBalanceType.Points,
9671
+ amount: (_r$points_collected = r.points_collected) != null ? _r$points_collected : r.amount,
9672
+ balance: (_r$user_points_balanc = r.user_points_balance) != null ? _r$user_points_balanc : r.balance,
9673
+ total_ever: r.user_points_ever,
9674
+ source_type_id: r.source_type_id,
9675
+ activity_type_id: r.type_id,
9676
+ context_value_1: r.context_value_1,
9677
+ meta: r.context_value_meta,
9678
+ source_entity_name: r.source_entity_name,
9679
+ source_entity_id: r.source_entity_id,
9680
+ source_reference_id: r.source_reference_id,
9681
+ source_root_id: r.source_root_id,
9682
+ is_wallet_entry: r.type_id == null || r.type_id === ActivityLogActivities.Gems || r.type_id === ActivityLogActivities.Diamonds || r.type_id === ActivityLogActivities.Points
9683
+ };
9684
+ return x;
9685
+ });
10007
9686
  };
10008
9687
 
10009
9688
  var PointChangeSourceType;
@@ -10026,6 +9705,7 @@ var PointChangeSourceType;
10026
9705
  PointChangeSourceType[PointChangeSourceType["DynamicFormula"] = 19] = "DynamicFormula";
10027
9706
  PointChangeSourceType[PointChangeSourceType["Raffle"] = 21] = "Raffle";
10028
9707
  PointChangeSourceType[PointChangeSourceType["Avatars"] = 22] = "Avatars";
9708
+ PointChangeSourceType[PointChangeSourceType["Clan"] = 23] = "Clan";
10029
9709
  })(PointChangeSourceType || (PointChangeSourceType = {}));
10030
9710
 
10031
9711
  const avatarDefinitionTransform = (items, avatarDomain) => {
@@ -11880,5 +11560,5 @@ var JoinClanErrorCode;
11880
11560
  JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_JOINED_AFTER_TOURNAMENT_START"] = 1011] = "JOIN_CLAN_JOINED_AFTER_TOURNAMENT_START";
11881
11561
  })(JoinClanErrorCode || (JoinClanErrorCode = {}));
11882
11562
 
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 };
11563
+ export { AchCategoryTransform, AchCustomLayoutTheme, AchCustomSectionType, AchMissionsTabsOptions, AchOverviewMissionsFilter, AchievementAvailabilityStatus, 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, 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 };
11884
11564
  //# sourceMappingURL=index.modern.mjs.map