@smartico/public-api 0.0.339 → 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.
@@ -2925,6 +2925,8 @@ class WSAPI {
2925
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)
2940
+ * @param params.from - Start index of records to return
2941
+ * @param params.to - End index of records to return
2938
2942
  * @param params.onUpdate - Optional callback function that will be called when the activity log is updated
2939
2943
  */
2940
2944
  async getActivityLog({
2941
2945
  startTimeSeconds,
2942
2946
  endTimeSeconds,
2947
+ from,
2948
+ to,
2943
2949
  onUpdate
2944
2950
  }) {
2945
2951
  if (onUpdate) {
2946
2952
  this.onUpdateCallback.set(onUpdateContextKey.ActivityLog, onUpdate);
2947
2953
  }
2948
- return await OCache.use(onUpdateContextKey.ActivityLog, ECacheContext.WSAPI, () => this.api.getActivityLogT(null, startTimeSeconds, endTimeSeconds), CACHE_DATA_SEC);
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);
@@ -2991,7 +2997,7 @@ class WSAPI {
2991
2997
  async notifyActivityLogUpdate() {
2992
2998
  const startSeconds = Date.now() / 1000 - 600;
2993
2999
  const endSeconds = Date.now() / 1000;
2994
- const payload = await this.api.getActivityLogT(null, startSeconds, endSeconds);
3000
+ const payload = await this.api.getActivityLogT(null, startSeconds, endSeconds, 0, 50);
2995
3001
  this.updateEntity(onUpdateContextKey.ActivityLog, payload);
2996
3002
  }
2997
3003
  async updateEntity(contextKey, payload) {
@@ -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 getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds) {
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 getActivityLogT(user_ext_id, startTimeSeconds, endTimeSeconds) {
4272
- return ActivityLogTransform((await this.getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds)).logHistory);
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