@smartico/public-api 0.0.208 → 0.0.210

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 (70) hide show
  1. package/dist/Missions/AchievementAvailabilityStatus.d.ts +61 -0
  2. package/dist/Missions/MissionsUtils.d.ts +6 -0
  3. package/dist/Missions/index.d.ts +1 -0
  4. package/dist/SmarticoLib/index.d.ts +9 -0
  5. package/dist/WSAPI/WSAPITypes.d.ts +10 -2
  6. package/dist/index.js +218 -2
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.modern.mjs +219 -3
  9. package/dist/index.modern.mjs.map +1 -1
  10. package/docs/README.md +1 -0
  11. package/docs/classes/WSAPI.md +3 -3
  12. package/docs/enums/AchievementAvailabilityStatus.md +139 -0
  13. package/docs/interfaces/TMissionOrBadge.md +18 -1
  14. package/docs/interfaces/TTournamentDetailed.md +20 -0
  15. package/package.json +1 -1
  16. package/src/MiniGames/SAWGetTemplatesResponse.ts +1 -0
  17. package/src/Missions/AchievementAvailabilityStatus.ts +76 -0
  18. package/src/Missions/MissionsUtils.ts +166 -0
  19. package/src/Missions/UserAchievement.ts +7 -1
  20. package/src/Missions/index.ts +1 -0
  21. package/src/SmarticoLib/index.ts +16 -5
  22. package/src/WSAPI/WSAPITypes.ts +13 -3
  23. package/tsconfig.json +2 -1
  24. package/dist/Quiz/MarketsAnswersType.d.ts +0 -22
  25. package/dist/SmarticoPublicAPI.d.ts +0 -23
  26. package/dist/Store/BuyShopItemErrorCode.d.ts +0 -10
  27. package/dist/Store/BuyShopItemRequest.d.ts +0 -4
  28. package/dist/Store/BuyShopItemResponse.d.ts +0 -4
  29. package/dist/Store/GetCategoriesShopResponse.d.ts +0 -5
  30. package/dist/Store/GetShopItemsResponse.d.ts +0 -5
  31. package/dist/Store/ShopCategory.d.ts +0 -5
  32. package/dist/Store/ShopCategoryPublicMeta.d.ts +0 -4
  33. package/dist/Store/ShopItem.d.ts +0 -9
  34. package/dist/Store/ShopItemPublicMeta.d.ts +0 -10
  35. package/dist/Store/ShopItemType.d.ts +0 -4
  36. package/dist/Store/StorItemPruchased.d.ts +0 -6
  37. package/dist/service/index.d.ts +0 -5
  38. package/dist/service/types/ErrorCodes.d.ts +0 -13
  39. package/dist/service/types/GRequest.d.ts +0 -16
  40. package/dist/service/types/GResponse.d.ts +0 -10
  41. package/dist/service/types/Game/GameAttemptType.d.ts +0 -6
  42. package/dist/service/types/Game/GameCanPlayType.d.ts +0 -10
  43. package/dist/service/types/Game/GameExternalStatus.d.ts +0 -6
  44. package/dist/service/types/Game/GameInfo.d.ts +0 -9
  45. package/dist/service/types/Game/GamePick.d.ts +0 -90
  46. package/dist/service/types/Game/GameUtil.d.ts +0 -7
  47. package/dist/service/types/SmarticoProto/GetTranslationsRequest.d.ts +0 -7
  48. package/dist/service/types/SmarticoProto/GetTranslationsResponse.d.ts +0 -7
  49. package/dist/service/types/SmarticoProto/ProtocolMessage.d.ts +0 -5
  50. package/dist/service/types/SmarticoProto/ProtocolRequest.d.ts +0 -6
  51. package/dist/service/types/SmarticoProto/ProtocolResponse.d.ts +0 -5
  52. package/dist/service/types/SmarticoProto/PublicLabelInfo.d.ts +0 -34
  53. package/dist/service/types/SmarticoProto/PublicProperties.d.ts +0 -11
  54. package/dist/service/types/SmarticoProto/ResponseIdentify.d.ts +0 -12
  55. package/dist/service/types/SmarticoProto/SAW/SAWAcknowledgeType.d.ts +0 -5
  56. package/dist/service/types/SmarticoProto/SAW/SAWBuyInType.d.ts +0 -5
  57. package/dist/service/types/SmarticoProto/SAW/SAWDoSpinRequest.d.ts +0 -5
  58. package/dist/service/types/SmarticoProto/SAW/SAWDoSpinResponse.d.ts +0 -15
  59. package/dist/service/types/SmarticoProto/SAW/SAWGameType.d.ts +0 -10
  60. package/dist/service/types/SmarticoProto/SAW/SAWGetTemplatesRequest.d.ts +0 -3
  61. package/dist/service/types/SmarticoProto/SAW/SAWGetTemplatesResponse.d.ts +0 -5
  62. package/dist/service/types/SmarticoProto/SAW/SAWPrize.d.ts +0 -11
  63. package/dist/service/types/SmarticoProto/SAW/SAWPrizeType.d.ts +0 -8
  64. package/dist/service/types/SmarticoProto/SAW/SAWPrizeUI.d.ts +0 -13
  65. package/dist/service/types/SmarticoProto/SAW/SAWTemplate.d.ts +0 -21
  66. package/dist/service/types/SmarticoProto/SAW/SAWTemplateUI.d.ts +0 -31
  67. package/dist/service/types/SmarticoProto/SAW/SAWWinSoundType.d.ts +0 -12
  68. package/dist/service/types/SmarticoProto/TranslationArea.d.ts +0 -9
  69. package/dist/service/types/User/UserInfo.d.ts +0 -10
  70. package/dist/util/Util.d.ts +0 -51
@@ -0,0 +1,61 @@
1
+ /** Possible statuses of the mission availability.
2
+ * Notes:
3
+ * - Recurring missions have a special field next_recurrence_date_ts, but it's only relevant if the mission has no active till date or the next recurrence date is before the active till date.
4
+ * - For a locked mission or mission that requires opt-in, the time limit should be calculated as dt_start + time_limit_ms. For a mission that does not require opt-in or type is not Locked, it should be the highest value of dt_start and active_from_ts (if defined) + time_limit_ms.
5
+ * */
6
+ export declare enum AchievementAvailabilityStatus {
7
+ /** Mission without date/time restrictions or with passed active from date and no opt-in required and mission is unlocked */
8
+ Available = 0,
9
+ /** Mission without date/time restrictions or with passed active from date, opt-in is required, user is not opted-in or mission is locked */
10
+ AvailableInactive = 1,
11
+ /** Mission without date/time restrictions or with passed active from date, opt-in is required, user is opted-in or mission is unlocked*/
12
+ AvailableActive = 2,
13
+ /** Mission with active from date defined, date is in future.
14
+ * Field: active_from_ts
15
+ */
16
+ UnavailableWithActiveFrom = 3,
17
+ /** Mission with active till date defined, date is in future, and no opt-in required and mission is unlocked.
18
+ * Field: active_till_ts
19
+ */
20
+ AvailableWithActiveTill = 4,
21
+ /** Mission with active till date defined, date is in future, and opt-in is required, user is not opted in or mission is locked.
22
+ * Fields: active_till_ts, is_requires_optin, is_opted_in, is_locked.
23
+ */
24
+ AvailableWithActiveTillInactive = 5,
25
+ /** Mission with active till date defined, date is in future, and opt-in is required, user is opted in or mission is unlocked.
26
+ * Fields: active_till_ts, is_requires_optin, is_opted_in, is_locked.
27
+ */
28
+ AvailableWithActiveTillActive = 6,
29
+ /** Available mission with time limit, and opt-in is required or mission is unlocked.
30
+ * The time limit is calculated as the sum of two properties: (highest value from dt_start and active_from_ts) + time_limit_ms.
31
+ *
32
+ */
33
+ AvailableLimited = 7,
34
+ /** Available mission with time limit, opt-in is required, user is not opted-in or mission is locked.
35
+ * Time limit at this stage is not relevant, user should be opted-in or mission should be unlocked.
36
+ */
37
+ AvailableLimitedInactive = 8,
38
+ /** Available mission with time limit, opt-in is required, user is opted-in or mission unlocked.
39
+ * The time limit is calculated as the sum of two properties: dt_start + time_limit_ms.
40
+ */
41
+ AvailableLimitedActive = 9,
42
+ /** Available mission with time limit and active till date, opt-in is not required and mission is unlocked.
43
+ * Fields: active_till_ts, time_limit_ms, dt_start, active_from_ts;
44
+ * The time limit is calculated as the sum of two properties: (highest value from dt_start and active_from_ts) + time_limit_ms.
45
+ */
46
+ AvailableFullyLimited = 10,
47
+ /** Available mission with time limit and active till date, opt-in is required, user is not opted in or mission is locked.
48
+ * Fields: active_till_ts, time_limit_ms, dt_start, active_from_ts, is_requires_optin, is_opted_in, is_locked.
49
+ * On this stage only active_till_ts is relevant. time_limit_ms is ignored because user should be opted in.
50
+ */
51
+ AvailableFullyLimitedInactive = 11,
52
+ /** Available mission with time limit and active till date, opt-in is required, user is opted in or mission is unlocked.
53
+ * Fields: active_till_ts, time_limit_ms, dt_start, is_requires_optin, is_opted_in, is_locked.
54
+ * The time limit is calculated as the sum of two properties: dt_start + time_limit_ms.
55
+ */
56
+ AvailableFullyLimitedActive = 12,
57
+ /** Missed mission when active till date is already passed. is_completed field indicating if mission is completed or just missed */
58
+ MissedByActiveTill = 13,
59
+ /** Missed mission when start_date + time_limit_ms is already passed. is_completed field indicating if mission is completed or just missed */
60
+ MissedByLimitInTime = 14
61
+ }
@@ -0,0 +1,6 @@
1
+ import { AchievementAvailabilityStatus } from "./AchievementAvailabilityStatus";
2
+ import { UserAchievement } from "./UserAchievement";
3
+ export declare class MissionUtils {
4
+ static getAvailabilityStatus: (mission: UserAchievement) => AchievementAvailabilityStatus;
5
+ static getMs: (ts: number) => number;
6
+ }
@@ -17,3 +17,4 @@ export * from './GetAchCategoriesResponse';
17
17
  export * from './GetAchCategoriesRequest';
18
18
  export * from './AchClaimPrizeRequest';
19
19
  export * from './AchClaimPrizeResponse';
20
+ export * from './AchievementAvailabilityStatus';
@@ -1494,18 +1494,27 @@ export interface UserAchievement {
1494
1494
  time_limit_ms?: number;
1495
1495
  progress?: number;
1496
1496
  complete_date?: string;
1497
+ complete_date_ts?: number;
1497
1498
  unlock_date?: string;
1498
1499
  milliseconds_till_available?: number;
1499
1500
  completed_tasks?: number;
1500
1501
  achievementTasks?: UserAchievementTask[];
1502
+ next_recurrence_date_ts?: number;
1501
1503
  ach_status_id?: AchievementStatus;
1502
1504
  scheduledMissionType?: ScheduledMissionType;
1503
1505
  related_games?: AchRelatedGame[];
1504
1506
  active_from_ts?: number;
1507
+ active_till_ts?: number;
1505
1508
  ach_categories?: number[];
1509
+ recurring_quantity?: number;
1510
+ completed_count?: number;
1506
1511
  ach_completed_id?: number;
1507
1512
  requires_prize_claim?: boolean;
1508
1513
  prize_claimed_date_ts?: number;
1514
+ completed_today?: boolean;
1515
+ completed_this_week?: boolean;
1516
+ completed_this_month?: boolean;
1517
+ custom_section_type_id?: number;
1509
1518
  }
1510
1519
  export interface GetAchievementMapResponse extends ProtocolResponse {
1511
1520
  achievements?: UserAchievement[];
@@ -1,6 +1,7 @@
1
1
  import { BuyStoreItemErrorCode } from '../Store';
2
2
  import { MiniGamePrizeTypeName, SAWAcknowledgeTypeName, SAWBuyInTypeName, SAWGameTypeName, SAWSpinErrorCode, SAWTemplate } from '../MiniGames';
3
3
  import { TournamentRegistrationError, TournamentRegistrationStatusName, TournamentRegistrationTypeName } from '../Tournaments';
4
+ import { AchievementAvailabilityStatus } from '../Missions';
4
5
  import { LeaderBoardPeriodType } from '../Leaderboard';
5
6
  import { AchCustomLayoutTheme, AchCustomSectionType, AchMissionsTabsOptions, AchOverviewMissionsFilter } from '../CustomSections';
6
7
  import { BonusStatus, BonusTemplateMetaMap, BonusMetaMap } from '../Bonuses';
@@ -44,7 +45,7 @@ export interface TMiniGamePrize {
44
45
  /** The custom data of the mini-game defined by operator in the BackOffice. Can be a JSON object, string or number */
45
46
  custom_data?: any;
46
47
  /** Prize modifiers that will multiply by 2x, 5x or 10x the current total. This will not affect the final Prize Amount that will be awarded. */
47
- prize_modifiers?: PrizeModifiers;
48
+ prize_modifiers?: PrizeModifiers[];
48
49
  /** When enabled, you can split prize value by decimal values */
49
50
  allow_split_decimal?: boolean;
50
51
  }
@@ -120,6 +121,7 @@ export interface TMiniGameTemplate {
120
121
  activeFromDate?: number;
121
122
  activeTillDate?: number;
122
123
  steps_to_finish_game?: number;
124
+ custom_section_id?: number;
123
125
  }
124
126
  /**
125
127
  * TUser describes the information of the user
@@ -435,7 +437,7 @@ export interface TMissionOrBadge {
435
437
  active_from_ts: number;
436
438
  /** Holds time till mission will become unavailable, for the missions that are targeted to be available from specific date/time */
437
439
  active_till_ts: number;
438
- /** The date when the mission was started, relevant for the time limited missions */
440
+ /** The date when the mission was started, relevant for the time limited missions, also indicating opt-it date for mission that requires opt-in and unlock date for Locked mission. */
439
441
  dt_start: number;
440
442
  /** The progress of the mission in percents calculated as the aggregated relative percentage of all tasks */
441
443
  progress: number;
@@ -490,6 +492,12 @@ export interface TMissionOrBadge {
490
492
  max_completion_count?: number;
491
493
  /** Current completion count for Recurring upon completion missions */
492
494
  completion_count?: number;
495
+ /** The date/timestamp for recurring missions, which indicating the time remaining until the next recurrence of the mission.
496
+ * Note that if a mission has an "Active till" date defined, this field is not relevant after that date.
497
+ */
498
+ next_recurrence_date_ts?: number;
499
+ /** Availability status of the mission depends on the defined time limits */
500
+ availability_status?: AchievementAvailabilityStatus;
493
501
  }
494
502
  export interface AchRelatedGame {
495
503
  /** The ID of the related game */
package/dist/index.js CHANGED
@@ -409,6 +409,7 @@ var SAWTemplatesTransform = function SAWTemplatesTransform(items) {
409
409
  activeTillDate: r.activeTillDate,
410
410
  next_available_spin_ts: r.next_available_spin_ts,
411
411
  steps_to_finish_game: r.saw_template_ui_definition.steps_to_finish_game,
412
+ custom_section_id: r.saw_template_ui_definition.custom_section_id,
412
413
  prizes: r.prizes.map(function (p) {
413
414
  var y = {
414
415
  id: p.saw_prize_id,
@@ -926,6 +927,217 @@ exports.AchievementType = void 0;
926
927
  AchievementType[AchievementType["Badge"] = 2] = "Badge";
927
928
  })(exports.AchievementType || (exports.AchievementType = {}));
928
929
 
930
+ /** Possible statuses of the mission availability.
931
+ * Notes:
932
+ * - Recurring missions have a special field next_recurrence_date_ts, but it's only relevant if the mission has no active till date or the next recurrence date is before the active till date.
933
+ * - For a locked mission or mission that requires opt-in, the time limit should be calculated as dt_start + time_limit_ms. For a mission that does not require opt-in or type is not Locked, it should be the highest value of dt_start and active_from_ts (if defined) + time_limit_ms.
934
+ * */
935
+ exports.AchievementAvailabilityStatus = void 0;
936
+ (function (AchievementAvailabilityStatus) {
937
+ /** Mission without date/time restrictions or with passed active from date and no opt-in required and mission is unlocked */
938
+ AchievementAvailabilityStatus[AchievementAvailabilityStatus["Available"] = 0] = "Available";
939
+ /** Mission without date/time restrictions or with passed active from date, opt-in is required, user is not opted-in or mission is locked */
940
+ AchievementAvailabilityStatus[AchievementAvailabilityStatus["AvailableInactive"] = 1] = "AvailableInactive";
941
+ /** Mission without date/time restrictions or with passed active from date, opt-in is required, user is opted-in or mission is unlocked*/
942
+ AchievementAvailabilityStatus[AchievementAvailabilityStatus["AvailableActive"] = 2] = "AvailableActive";
943
+ /** Mission with active from date defined, date is in future.
944
+ * Field: active_from_ts
945
+ */
946
+ AchievementAvailabilityStatus[AchievementAvailabilityStatus["UnavailableWithActiveFrom"] = 3] = "UnavailableWithActiveFrom";
947
+ /** Mission with active till date defined, date is in future, and no opt-in required and mission is unlocked.
948
+ * Field: active_till_ts
949
+ */
950
+ AchievementAvailabilityStatus[AchievementAvailabilityStatus["AvailableWithActiveTill"] = 4] = "AvailableWithActiveTill";
951
+ /** Mission with active till date defined, date is in future, and opt-in is required, user is not opted in or mission is locked.
952
+ * Fields: active_till_ts, is_requires_optin, is_opted_in, is_locked.
953
+ */
954
+ AchievementAvailabilityStatus[AchievementAvailabilityStatus["AvailableWithActiveTillInactive"] = 5] = "AvailableWithActiveTillInactive";
955
+ /** Mission with active till date defined, date is in future, and opt-in is required, user is opted in or mission is unlocked.
956
+ * Fields: active_till_ts, is_requires_optin, is_opted_in, is_locked.
957
+ */
958
+ AchievementAvailabilityStatus[AchievementAvailabilityStatus["AvailableWithActiveTillActive"] = 6] = "AvailableWithActiveTillActive";
959
+ /** Available mission with time limit, and opt-in is required or mission is unlocked.
960
+ * The time limit is calculated as the sum of two properties: (highest value from dt_start and active_from_ts) + time_limit_ms.
961
+ *
962
+ */
963
+ AchievementAvailabilityStatus[AchievementAvailabilityStatus["AvailableLimited"] = 7] = "AvailableLimited";
964
+ /** Available mission with time limit, opt-in is required, user is not opted-in or mission is locked.
965
+ * Time limit at this stage is not relevant, user should be opted-in or mission should be unlocked.
966
+ */
967
+ AchievementAvailabilityStatus[AchievementAvailabilityStatus["AvailableLimitedInactive"] = 8] = "AvailableLimitedInactive";
968
+ /** Available mission with time limit, opt-in is required, user is opted-in or mission unlocked.
969
+ * The time limit is calculated as the sum of two properties: dt_start + time_limit_ms.
970
+ */
971
+ AchievementAvailabilityStatus[AchievementAvailabilityStatus["AvailableLimitedActive"] = 9] = "AvailableLimitedActive";
972
+ /** Available mission with time limit and active till date, opt-in is not required and mission is unlocked.
973
+ * Fields: active_till_ts, time_limit_ms, dt_start, active_from_ts;
974
+ * The time limit is calculated as the sum of two properties: (highest value from dt_start and active_from_ts) + time_limit_ms.
975
+ */
976
+ AchievementAvailabilityStatus[AchievementAvailabilityStatus["AvailableFullyLimited"] = 10] = "AvailableFullyLimited";
977
+ /** Available mission with time limit and active till date, opt-in is required, user is not opted in or mission is locked.
978
+ * Fields: active_till_ts, time_limit_ms, dt_start, active_from_ts, is_requires_optin, is_opted_in, is_locked.
979
+ * On this stage only active_till_ts is relevant. time_limit_ms is ignored because user should be opted in.
980
+ */
981
+ AchievementAvailabilityStatus[AchievementAvailabilityStatus["AvailableFullyLimitedInactive"] = 11] = "AvailableFullyLimitedInactive";
982
+ /** Available mission with time limit and active till date, opt-in is required, user is opted in or mission is unlocked.
983
+ * Fields: active_till_ts, time_limit_ms, dt_start, is_requires_optin, is_opted_in, is_locked.
984
+ * The time limit is calculated as the sum of two properties: dt_start + time_limit_ms.
985
+ */
986
+ AchievementAvailabilityStatus[AchievementAvailabilityStatus["AvailableFullyLimitedActive"] = 12] = "AvailableFullyLimitedActive";
987
+ /** Missed mission when active till date is already passed. is_completed field indicating if mission is completed or just missed */
988
+ AchievementAvailabilityStatus[AchievementAvailabilityStatus["MissedByActiveTill"] = 13] = "MissedByActiveTill";
989
+ /** Missed mission when start_date + time_limit_ms is already passed. is_completed field indicating if mission is completed or just missed */
990
+ AchievementAvailabilityStatus[AchievementAvailabilityStatus["MissedByLimitInTime"] = 14] = "MissedByLimitInTime";
991
+ })(exports.AchievementAvailabilityStatus || (exports.AchievementAvailabilityStatus = {}));
992
+
993
+ var _class;
994
+ var MissionUtils = function MissionUtils() {};
995
+ _class = MissionUtils;
996
+ MissionUtils.getAvailabilityStatus = function (mission) {
997
+ if (!mission) {
998
+ return null;
999
+ }
1000
+ var activeFrom = mission.active_from_ts ? _class.getMs(mission.active_from_ts) : null;
1001
+ var activeTill = mission.active_till_ts ? _class.getMs(mission.active_till_ts) : null;
1002
+ var startDate = mission.start_date_ts ? _class.getMs(mission.start_date_ts) : null;
1003
+ var timeLimit = mission.time_limit_ms;
1004
+ var requiresOptIn = mission.requiresOptin;
1005
+ var optedIn = mission.isOptedIn;
1006
+ var isLockedMission = mission.ach_status_id === exports.AchievementStatus.AvailableLocked;
1007
+ var isLocked = mission.isLocked;
1008
+ if (!activeFrom && !activeTill && !timeLimit) {
1009
+ if (requiresOptIn) {
1010
+ if (optedIn) {
1011
+ return exports.AchievementAvailabilityStatus.AvailableActive;
1012
+ } else {
1013
+ return exports.AchievementAvailabilityStatus.AvailableInactive;
1014
+ }
1015
+ } else if (isLockedMission) {
1016
+ if (!isLocked) {
1017
+ return exports.AchievementAvailabilityStatus.AvailableActive;
1018
+ } else {
1019
+ return exports.AchievementAvailabilityStatus.AvailableInactive;
1020
+ }
1021
+ } else {
1022
+ return exports.AchievementAvailabilityStatus.Available;
1023
+ }
1024
+ }
1025
+ if (activeFrom && activeFrom > Date.now()) {
1026
+ return exports.AchievementAvailabilityStatus.UnavailableWithActiveFrom;
1027
+ }
1028
+ if (activeFrom && activeFrom < Date.now() || !activeFrom) {
1029
+ if (!activeTill && !timeLimit) {
1030
+ if (requiresOptIn) {
1031
+ if (optedIn) {
1032
+ return exports.AchievementAvailabilityStatus.AvailableActive;
1033
+ } else {
1034
+ return exports.AchievementAvailabilityStatus.AvailableInactive;
1035
+ }
1036
+ } else if (isLockedMission) {
1037
+ if (!isLocked) {
1038
+ return exports.AchievementAvailabilityStatus.AvailableActive;
1039
+ } else {
1040
+ return exports.AchievementAvailabilityStatus.AvailableInactive;
1041
+ }
1042
+ } else {
1043
+ return exports.AchievementAvailabilityStatus.Available;
1044
+ }
1045
+ }
1046
+ if (activeTill && !timeLimit) {
1047
+ if (activeTill > Date.now()) {
1048
+ if (requiresOptIn) {
1049
+ if (optedIn) {
1050
+ return exports.AchievementAvailabilityStatus.AvailableWithActiveTillActive;
1051
+ } else {
1052
+ return exports.AchievementAvailabilityStatus.AvailableWithActiveTillInactive;
1053
+ }
1054
+ } else if (isLockedMission) {
1055
+ if (!isLocked) {
1056
+ return exports.AchievementAvailabilityStatus.AvailableWithActiveTillActive;
1057
+ } else {
1058
+ return exports.AchievementAvailabilityStatus.AvailableWithActiveTillInactive;
1059
+ }
1060
+ } else {
1061
+ return exports.AchievementAvailabilityStatus.AvailableWithActiveTill;
1062
+ }
1063
+ } else {
1064
+ return exports.AchievementAvailabilityStatus.MissedByActiveTill;
1065
+ }
1066
+ }
1067
+ if (timeLimit && !activeTill) {
1068
+ if (requiresOptIn) {
1069
+ var endDate = startDate + timeLimit;
1070
+ if (optedIn) {
1071
+ if (endDate > Date.now()) {
1072
+ return exports.AchievementAvailabilityStatus.AvailableLimitedActive;
1073
+ } else {
1074
+ return exports.AchievementAvailabilityStatus.MissedByLimitInTime;
1075
+ }
1076
+ } else {
1077
+ return exports.AchievementAvailabilityStatus.AvailableLimitedInactive;
1078
+ }
1079
+ } else if (isLockedMission) {
1080
+ var _endDate = startDate + timeLimit;
1081
+ if (!isLocked) {
1082
+ if (_endDate > Date.now()) {
1083
+ return exports.AchievementAvailabilityStatus.AvailableLimitedActive;
1084
+ } else {
1085
+ return exports.AchievementAvailabilityStatus.MissedByLimitInTime;
1086
+ }
1087
+ } else {
1088
+ return exports.AchievementAvailabilityStatus.AvailableLimitedInactive;
1089
+ }
1090
+ } else {
1091
+ var _endDate2 = activeFrom && activeFrom > startDate ? activeFrom + timeLimit : startDate + timeLimit;
1092
+ if (_endDate2 > Date.now()) {
1093
+ return exports.AchievementAvailabilityStatus.AvailableLimited;
1094
+ } else {
1095
+ return exports.AchievementAvailabilityStatus.MissedByLimitInTime;
1096
+ }
1097
+ }
1098
+ }
1099
+ if (timeLimit && activeTill) {
1100
+ if (activeTill > Date.now()) {
1101
+ if (requiresOptIn) {
1102
+ if (optedIn) {
1103
+ var _endDate3 = startDate + timeLimit;
1104
+ if (_endDate3 > Date.now()) {
1105
+ return exports.AchievementAvailabilityStatus.AvailableFullyLimitedActive;
1106
+ } else {
1107
+ return exports.AchievementAvailabilityStatus.MissedByLimitInTime;
1108
+ }
1109
+ } else {
1110
+ return exports.AchievementAvailabilityStatus.AvailableFullyLimitedInactive;
1111
+ }
1112
+ } else if (isLockedMission) {
1113
+ if (!isLocked) {
1114
+ var _endDate4 = startDate + timeLimit;
1115
+ if (_endDate4 > Date.now()) {
1116
+ return exports.AchievementAvailabilityStatus.AvailableFullyLimitedActive;
1117
+ } else {
1118
+ return exports.AchievementAvailabilityStatus.MissedByLimitInTime;
1119
+ }
1120
+ } else {
1121
+ return exports.AchievementAvailabilityStatus.AvailableFullyLimitedInactive;
1122
+ }
1123
+ } else {
1124
+ var _endDate5 = activeFrom && activeFrom > startDate ? activeFrom + timeLimit : startDate + timeLimit;
1125
+ if (_endDate5 > Date.now()) {
1126
+ return exports.AchievementAvailabilityStatus.AvailableFullyLimited;
1127
+ } else {
1128
+ return exports.AchievementAvailabilityStatus.MissedByLimitInTime;
1129
+ }
1130
+ }
1131
+ } else {
1132
+ return exports.AchievementAvailabilityStatus.MissedByActiveTill;
1133
+ }
1134
+ }
1135
+ }
1136
+ };
1137
+ MissionUtils.getMs = function (ts) {
1138
+ return new Date(ts).getTime();
1139
+ };
1140
+
929
1141
  var UserAchievementTransform = function UserAchievementTransform(items) {
930
1142
  return items.filter(function (r) {
931
1143
  return r.ach_id >= 1;
@@ -947,7 +1159,7 @@ var UserAchievementTransform = function UserAchievementTransform(items) {
947
1159
  is_opted_in: r.isOptedIn,
948
1160
  time_limit_ms: r.time_limit_ms,
949
1161
  active_from_ts: r.active_from_ts,
950
- active_till_ts: r.active_from_ts,
1162
+ active_till_ts: r.active_till_ts,
951
1163
  dt_start: r.start_date_ts,
952
1164
  reward: r.ach_public_meta.reward,
953
1165
  progress: r.progress,
@@ -997,8 +1209,12 @@ var UserAchievementTransform = function UserAchievementTransform(items) {
997
1209
  completed_today: completedToday,
998
1210
  completed_this_week: completedThisWeek,
999
1211
  completed_this_month: completedThisMonth,
1000
- custom_section_type_id: r.ach_public_meta.custom_section_type_id
1212
+ custom_section_type_id: r.ach_public_meta.custom_section_type_id,
1213
+ availability_status: MissionUtils.getAvailabilityStatus(r)
1001
1214
  };
1215
+ if (r.ach_status_id === exports.AchievementStatus.Recurring) {
1216
+ x.next_recurrence_date_ts = r.next_recurrence_date_ts;
1217
+ }
1002
1218
  if (r.ach_status_id === exports.AchievementStatus.RecurringUponCompletion) {
1003
1219
  x.completion_count = r.completed_count;
1004
1220
  x.max_completion_count = r.recurring_quantity;