@smartico/public-api 0.0.338 → 0.0.340
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/{PointsHistory/PointsHistoryLog.d.ts → ActivityLog/ActivityLogEntry.d.ts} +1 -1
- package/dist/{PointsHistory/GetPointsHistoryRequest.d.ts → ActivityLog/GetActivityLogRequest.d.ts} +3 -1
- package/dist/ActivityLog/GetActivityLogResponse.d.ts +7 -0
- package/dist/ActivityLog/index.d.ts +5 -0
- package/dist/Analytics/AnalyticStoreData.d.ts +1 -1
- package/dist/SmarticoAPI.d.ts +4 -4
- package/dist/WSAPI/WSAPI.d.ts +15 -9
- package/dist/WSAPI/WSAPITypes.d.ts +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +37 -21
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +29 -19
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +3 -3
- package/docs/classes/WSAPI.md +11 -7
- package/docs/interfaces/{TPointsHistoryLog.md → TActivityLog.md} +2 -2
- package/package.json +1 -1
- package/src/{PointsHistory/PointsHistoryLog.ts → ActivityLog/ActivityLogEntry.ts} +2 -1
- package/src/{PointsHistory/GetPointsHistoryRequest.ts → ActivityLog/GetActivityLogRequest.ts} +4 -1
- package/src/{PointsHistory/GetPointsHistoryResponse.ts → ActivityLog/GetActivityLogResponse.ts} +9 -8
- package/src/{PointsHistory → ActivityLog}/PointChangeSourceType.ts +1 -0
- package/src/{PointsHistory → ActivityLog}/UserBalanceType.ts +1 -0
- package/src/ActivityLog/index.ts +7 -0
- package/src/Analytics/AnalyticStoreData.ts +1 -1
- package/src/SmarticoAPI.ts +19 -10
- package/src/WSAPI/WSAPI.ts +24 -16
- package/src/WSAPI/WSAPITypes.ts +5 -4
- package/src/index.ts +1 -1
- package/dist/PointsHistory/GetPointsHistoryResponse.d.ts +0 -7
- package/dist/PointsHistory/index.d.ts +0 -5
- package/src/PointsHistory/index.ts +0 -6
- /package/dist/{PointsHistory → ActivityLog}/PointChangeSourceType.d.ts +0 -0
- /package/dist/{PointsHistory → ActivityLog}/UserBalanceType.d.ts +0 -0
package/dist/index.modern.mjs
CHANGED
|
@@ -2132,7 +2132,7 @@ var onUpdateContextKey;
|
|
|
2132
2132
|
onUpdateContextKey["JackpotEligibleGames"] = "jackpotEligibleGames";
|
|
2133
2133
|
onUpdateContextKey["CurrentLevel"] = "currentLevel";
|
|
2134
2134
|
onUpdateContextKey["InboxUnreadCount"] = "inboxUnreadCount";
|
|
2135
|
-
onUpdateContextKey["
|
|
2135
|
+
onUpdateContextKey["ActivityLog"] = "activityLog";
|
|
2136
2136
|
})(onUpdateContextKey || (onUpdateContextKey = {}));
|
|
2137
2137
|
/** @group General API */
|
|
2138
2138
|
class WSAPI {
|
|
@@ -2186,7 +2186,7 @@ class WSAPI {
|
|
|
2186
2186
|
this.updateInboxUnreadCount(data.props.core_inbox_unread_count);
|
|
2187
2187
|
}
|
|
2188
2188
|
if ((data == null || (_data$props3 = data.props) == null ? void 0 : _data$props3.ach_points_balance) !== undefined || (data == null || (_data$props4 = data.props) == null ? void 0 : _data$props4.ach_gems_balance) !== undefined || (data == null || (_data$props5 = data.props) == null ? void 0 : _data$props5.ach_diamonds_balance) !== undefined) {
|
|
2189
|
-
this.
|
|
2189
|
+
this.notifyActivityLogUpdate();
|
|
2190
2190
|
}
|
|
2191
2191
|
});
|
|
2192
2192
|
on(ClassId.RAF_OPTIN_RESPONSE, () => this.updateRaffles());
|
|
@@ -2911,20 +2911,22 @@ class WSAPI {
|
|
|
2911
2911
|
this.api.reportEngagementAction(null, engagement_uid, activityType, action);
|
|
2912
2912
|
}
|
|
2913
2913
|
/**
|
|
2914
|
-
* Returns the
|
|
2914
|
+
* Returns the activity log for a user within a specified time range.
|
|
2915
2915
|
* The response includes both points changes and gems/diamonds changes.
|
|
2916
2916
|
* Each log entry contains information about the change amount, balance, and source.
|
|
2917
2917
|
* The returned list is cached for 30 seconds.
|
|
2918
|
-
* You can pass the onUpdate callback as a parameter, it will be called every time the
|
|
2918
|
+
* You can pass the onUpdate callback as a parameter, it will be called every time the activity log is updated and will provide the updated list of activity logs for the last 10 minutes.
|
|
2919
2919
|
*
|
|
2920
2920
|
* **Example**:
|
|
2921
2921
|
* ```
|
|
2922
2922
|
* const startTime = Math.floor(Date.now() / 1000) - 86400 * 30; // 30 days ago
|
|
2923
2923
|
* const endTime = Math.floor(Date.now() / 1000); // now
|
|
2924
2924
|
*
|
|
2925
|
-
* _smartico.api.
|
|
2925
|
+
* _smartico.api.getActivityLog({
|
|
2926
2926
|
* startTimeSeconds: startTime,
|
|
2927
2927
|
* endTimeSeconds: endTime,
|
|
2928
|
+
* from: 0,
|
|
2929
|
+
* to: 50,
|
|
2928
2930
|
* onUpdate: (data) => console.log('Updated:', data)
|
|
2929
2931
|
* }).then((result) => {
|
|
2930
2932
|
* console.log(result);
|
|
@@ -2935,17 +2937,21 @@ class WSAPI {
|
|
|
2935
2937
|
*
|
|
2936
2938
|
* @param params.startTimeSeconds - Start time in seconds (epoch timestamp)
|
|
2937
2939
|
* @param params.endTimeSeconds - End time in seconds (epoch timestamp)
|
|
2938
|
-
* @param params.
|
|
2940
|
+
* @param params.from - Start index of records to return
|
|
2941
|
+
* @param params.to - End index of records to return
|
|
2942
|
+
* @param params.onUpdate - Optional callback function that will be called when the activity log is updated
|
|
2939
2943
|
*/
|
|
2940
|
-
async
|
|
2944
|
+
async getActivityLog({
|
|
2941
2945
|
startTimeSeconds,
|
|
2942
2946
|
endTimeSeconds,
|
|
2947
|
+
from,
|
|
2948
|
+
to,
|
|
2943
2949
|
onUpdate
|
|
2944
2950
|
}) {
|
|
2945
2951
|
if (onUpdate) {
|
|
2946
|
-
this.onUpdateCallback.set(onUpdateContextKey.
|
|
2952
|
+
this.onUpdateCallback.set(onUpdateContextKey.ActivityLog, onUpdate);
|
|
2947
2953
|
}
|
|
2948
|
-
return await OCache.use(onUpdateContextKey.
|
|
2954
|
+
return await OCache.use(onUpdateContextKey.ActivityLog, ECacheContext.WSAPI, () => this.api.getActivityLogT(null, startTimeSeconds, endTimeSeconds, from, to), CACHE_DATA_SEC);
|
|
2949
2955
|
}
|
|
2950
2956
|
async updateOnSpin(data) {
|
|
2951
2957
|
const templates = await OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, () => this.api.sawGetTemplatesT(null), CACHE_DATA_SEC);
|
|
@@ -2988,11 +2994,11 @@ class WSAPI {
|
|
|
2988
2994
|
const payload = await this.api.getRafflesT(null);
|
|
2989
2995
|
this.updateEntity(onUpdateContextKey.Raffles, payload);
|
|
2990
2996
|
}
|
|
2991
|
-
async
|
|
2997
|
+
async notifyActivityLogUpdate() {
|
|
2992
2998
|
const startSeconds = Date.now() / 1000 - 600;
|
|
2993
2999
|
const endSeconds = Date.now() / 1000;
|
|
2994
|
-
const payload = await this.api.
|
|
2995
|
-
this.updateEntity(onUpdateContextKey.
|
|
3000
|
+
const payload = await this.api.getActivityLogT(null, startSeconds, endSeconds, 0, 50);
|
|
3001
|
+
this.updateEntity(onUpdateContextKey.ActivityLog, payload);
|
|
2996
3002
|
}
|
|
2997
3003
|
async updateEntity(contextKey, payload) {
|
|
2998
3004
|
OCache.set(contextKey, payload, ECacheContext.WSAPI);
|
|
@@ -3426,7 +3432,7 @@ var UserBalanceType;
|
|
|
3426
3432
|
UserBalanceType[UserBalanceType["Diamonds"] = 2] = "Diamonds";
|
|
3427
3433
|
})(UserBalanceType || (UserBalanceType = {}));
|
|
3428
3434
|
|
|
3429
|
-
const
|
|
3435
|
+
const ActivityLogTransform = items => {
|
|
3430
3436
|
if (!items) {
|
|
3431
3437
|
return [];
|
|
3432
3438
|
}
|
|
@@ -4261,15 +4267,19 @@ class SmarticoAPI {
|
|
|
4261
4267
|
const message = this.buildMessage(user_ext_id, ClassId.RAF_OPTIN_REQUEST, props);
|
|
4262
4268
|
return await this.send(message, ClassId.RAF_OPTIN_RESPONSE);
|
|
4263
4269
|
}
|
|
4264
|
-
async
|
|
4270
|
+
async getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset) {
|
|
4265
4271
|
const message = this.buildMessage(user_ext_id, ClassId.GET_POINT_HISTORY_REQUEST, {
|
|
4266
4272
|
startTimeSeconds: Math.floor(startTimeSeconds),
|
|
4267
|
-
endTimeSeconds: Math.floor(endTimeSeconds)
|
|
4273
|
+
endTimeSeconds: Math.floor(endTimeSeconds),
|
|
4274
|
+
limit,
|
|
4275
|
+
offset
|
|
4268
4276
|
});
|
|
4269
4277
|
return await this.send(message, ClassId.GET_POINT_HISTORY_RESPONSE);
|
|
4270
4278
|
}
|
|
4271
|
-
async
|
|
4272
|
-
|
|
4279
|
+
async getActivityLogT(user_ext_id, startTimeSeconds, endTimeSeconds, from = 0, to = 50) {
|
|
4280
|
+
const limit = to - from > 50 ? 50 : to - from;
|
|
4281
|
+
const offset = from;
|
|
4282
|
+
return ActivityLogTransform((await this.getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset)).logHistory);
|
|
4273
4283
|
}
|
|
4274
4284
|
}
|
|
4275
4285
|
|
|
@@ -4314,7 +4324,7 @@ var AnalyticsScreenNameId;
|
|
|
4314
4324
|
AnalyticsScreenNameId[AnalyticsScreenNameId["LootboxCalendarDays"] = 21] = "LootboxCalendarDays";
|
|
4315
4325
|
AnalyticsScreenNameId[AnalyticsScreenNameId["TreasureHunt"] = 22] = "TreasureHunt";
|
|
4316
4326
|
AnalyticsScreenNameId[AnalyticsScreenNameId["LiquidSection"] = 23] = "LiquidSection";
|
|
4317
|
-
AnalyticsScreenNameId[AnalyticsScreenNameId["
|
|
4327
|
+
AnalyticsScreenNameId[AnalyticsScreenNameId["ActivityLog"] = 24] = "ActivityLog";
|
|
4318
4328
|
AnalyticsScreenNameId[AnalyticsScreenNameId["ModalMission"] = 31] = "ModalMission";
|
|
4319
4329
|
AnalyticsScreenNameId[AnalyticsScreenNameId["ModalLevel"] = 32] = "ModalLevel";
|
|
4320
4330
|
AnalyticsScreenNameId[AnalyticsScreenNameId["ModalBadge"] = 33] = "ModalBadge";
|
|
@@ -4737,5 +4747,5 @@ var JackpotType;
|
|
|
4737
4747
|
JackpotType[JackpotType["Personal"] = 2] = "Personal";
|
|
4738
4748
|
})(JackpotType || (JackpotType = {}));
|
|
4739
4749
|
|
|
4740
|
-
export { AchCategoryTransform, AchCustomLayoutTheme, AchCustomSectionType, AchMissionsTabsOptions, AchOverviewMissionsFilter, AchievementAvailabilityStatus, AchievementStatus, AchievementTaskType, AchievementType, ActivityTypeLimited, AnalyticsInboxSubScreenNameId, AnalyticsInterfaceType, AnalyticsScreenNameId, AnalyticsTournamentsLobbySubScreenNameId, AttemptPeriodType, BadgesTimeLimitStates, BonusItemsTransform, BonusStatus, BuyStoreItemErrorCode, ClassId, CookieStore, CoreUtils, ECacheContext, GetJackpotEligibleGamesResponseTransform, GetJackpotWinnersResponseTransform, GetLevelMapResponseTransform, InboxCategories, InboxMessageBodyTransform, InboxMessageType, InboxMessagesTransform, InboxReadStatus, JackPotTemparature, JackpotContributionType, JackpotType, LeaderBoardPeriodType, LiquidEntityData, MiniGamePrizeTypeName, MiniGamePrizeTypeNamed, MissionCategory, MissionUtils, OCache, OpenLinksType, PointChangeSourceType,
|
|
4750
|
+
export { AchCategoryTransform, AchCustomLayoutTheme, AchCustomSectionType, AchMissionsTabsOptions, AchOverviewMissionsFilter, AchievementAvailabilityStatus, AchievementStatus, AchievementTaskType, AchievementType, ActivityLogTransform, ActivityTypeLimited, AnalyticsInboxSubScreenNameId, AnalyticsInterfaceType, AnalyticsScreenNameId, AnalyticsTournamentsLobbySubScreenNameId, AttemptPeriodType, BadgesTimeLimitStates, BonusItemsTransform, BonusStatus, BuyStoreItemErrorCode, ClassId, CookieStore, CoreUtils, ECacheContext, GetJackpotEligibleGamesResponseTransform, GetJackpotWinnersResponseTransform, GetLevelMapResponseTransform, InboxCategories, InboxMessageBodyTransform, InboxMessageType, InboxMessagesTransform, InboxReadStatus, JackPotTemparature, JackpotContributionType, JackpotType, LeaderBoardPeriodType, LiquidEntityData, MiniGamePrizeTypeName, MiniGamePrizeTypeNamed, MissionCategory, MissionUtils, OCache, OpenLinksType, PointChangeSourceType, PrizeModifiers, PrizeModifiersKeysNames, PublicLabelSettings, QuizAnswersValueType, QuizMarketPerSport, QuizSportType, RaffleDrawInstanceState, RaffleDrawTypeExecution, SAWAcknowledgeType, SAWAcknowledgeTypeName, SAWAcknowledgeTypeNamed, SAWAskForUsername, SAWBuyInType, SAWBuyInTypeName, SAWBuyInTypeNamed, SAWExposeUserSpinId, SAWGPMarketType, SAWGameDifficultyType, SAWGameDifficultyTypeName, SAWGameLayout, 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, drawRunHistoryTransform, drawRunTransform, drawTransform, enrichUserAchievementsWithBadgeState, getLeaderBoardTransform, marketsInfo, prizeTransform, quizAnswerAwayTeamReplacementText, quizAnswerHomeTeamReplacementText, quizAnswersTrKeys, quizDrawReplacementText, quizEvenReplacementText, quizNoGoalsReplacementText, quizNoReplacementText, quizOddReplacementText, quizOrReplacementText, quizSupportedSports, quizYesReplacementText, raffleClaimPrizeResponseTransform, raffleTransform, ticketsTransform, tournamentInfoItemTransform, winnersTransform };
|
|
4741
4751
|
//# sourceMappingURL=index.modern.mjs.map
|