@smartico/public-api 0.0.314 → 0.0.316

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.
@@ -4,5 +4,6 @@ import { UserAchievementTask } from "./UserAchievementTask";
4
4
  export declare class MissionUtils {
5
5
  static getAvailabilityStatus: (mission: UserAchievement) => AchievementAvailabilityStatus;
6
6
  static getMs: (ts: number) => number;
7
+ static replaceTagsFavMissionTask: (task: UserAchievementTask, valueToReplace: string) => string;
7
8
  static replaceFavGameNameTag: (task: UserAchievementTask) => UserAchievementTask;
8
9
  }
package/dist/index.js CHANGED
@@ -844,7 +844,8 @@ var InboxMessageBodyTransform = function InboxMessageBodyTransform(item) {
844
844
  action: item.action,
845
845
  icon: item.image,
846
846
  title: item.title,
847
- preview_body: item.body
847
+ preview_body: item.body,
848
+ custom_data: IntUtils.JsonOrText(item == null ? void 0 : item.custom_data)
848
849
  };
849
850
  if (item.action === 'dp:inbox') {
850
851
  if (item.additional_buttons && item.additional_buttons.length) {
@@ -856,7 +857,6 @@ var InboxMessageBodyTransform = function InboxMessageBodyTransform(item) {
856
857
  });
857
858
  }
858
859
  x.html_body = (item == null ? void 0 : item.html_body) || null;
859
- x.custom_data = IntUtils.JsonOrText(item == null ? void 0 : item.custom_data);
860
860
  }
861
861
  return x;
862
862
  };
@@ -1279,16 +1279,17 @@ MissionUtils.getAvailabilityStatus = function (mission) {
1279
1279
  MissionUtils.getMs = function (ts) {
1280
1280
  return new Date(ts).getTime();
1281
1281
  };
1282
- MissionUtils.replaceFavGameNameTag = function (task) {
1282
+ MissionUtils.replaceTagsFavMissionTask = function (task, valueToReplace) {
1283
1283
  var _task$task_public_met;
1284
+ var result = valueToReplace || '';
1284
1285
  if (!task) {
1285
- return task;
1286
+ return result;
1286
1287
  }
1287
1288
  var userStateParams = task.user_state_params || {};
1288
1289
  var userStateOperator = (_task$task_public_met = task.task_public_meta) == null ? void 0 : _task$task_public_met.user_state_operations;
1289
1290
  var userStateParamsKeys = Object.keys(userStateParams);
1290
1291
  if (userStateParamsKeys.length === 0 || !userStateOperator) {
1291
- return task;
1292
+ return result;
1292
1293
  }
1293
1294
  var operatorsMulti = ['has', '!has'];
1294
1295
  var operatorsPos = ['pos1', 'pos2', 'pos3'];
@@ -1320,8 +1321,14 @@ MissionUtils.replaceFavGameNameTag = function (task) {
1320
1321
  }
1321
1322
  }
1322
1323
  });
1323
- if (replacementValue) {
1324
- task.task_public_meta.name = task.task_public_meta.name.replace('{{suggested_games}}', replacementValue);
1324
+ if (replacementValue && result) {
1325
+ result = result.replace('{{suggested_games}}', replacementValue);
1326
+ }
1327
+ return result;
1328
+ };
1329
+ MissionUtils.replaceFavGameNameTag = function (task) {
1330
+ if (task && task.task_public_meta && task.task_public_meta.name) {
1331
+ task.task_public_meta.name = _class.replaceTagsFavMissionTask(task, task.task_public_meta.name);
1325
1332
  }
1326
1333
  return task;
1327
1334
  };