@smartico/public-api 0.0.209 → 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.
- package/dist/Missions/AchievementAvailabilityStatus.d.ts +61 -0
- package/dist/Missions/MissionsUtils.d.ts +6 -0
- package/dist/Missions/index.d.ts +1 -0
- package/dist/SmarticoLib/index.d.ts +9 -0
- package/dist/WSAPI/WSAPITypes.d.ts +8 -1
- package/dist/index.js +217 -2
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +218 -3
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +1 -0
- package/docs/classes/WSAPI.md +3 -3
- package/docs/enums/AchievementAvailabilityStatus.md +139 -0
- package/docs/interfaces/TMissionOrBadge.md +18 -1
- package/docs/interfaces/TTournamentDetailed.md +20 -0
- package/package.json +1 -1
- package/src/Missions/AchievementAvailabilityStatus.ts +76 -0
- package/src/Missions/MissionsUtils.ts +166 -0
- package/src/Missions/UserAchievement.ts +7 -1
- package/src/Missions/index.ts +1 -0
- package/src/SmarticoLib/index.ts +16 -5
- package/src/WSAPI/WSAPITypes.ts +10 -2
- package/tsconfig.json +2 -1
- package/dist/Quiz/MarketsAnswersType.d.ts +0 -22
- package/dist/SmarticoPublicAPI.d.ts +0 -23
- package/dist/Store/BuyShopItemErrorCode.d.ts +0 -10
- package/dist/Store/BuyShopItemRequest.d.ts +0 -4
- package/dist/Store/BuyShopItemResponse.d.ts +0 -4
- package/dist/Store/GetCategoriesShopResponse.d.ts +0 -5
- package/dist/Store/GetShopItemsResponse.d.ts +0 -5
- package/dist/Store/ShopCategory.d.ts +0 -5
- package/dist/Store/ShopCategoryPublicMeta.d.ts +0 -4
- package/dist/Store/ShopItem.d.ts +0 -9
- package/dist/Store/ShopItemPublicMeta.d.ts +0 -10
- package/dist/Store/ShopItemType.d.ts +0 -4
- package/dist/Store/StorItemPruchased.d.ts +0 -6
- package/dist/service/index.d.ts +0 -5
- package/dist/service/types/ErrorCodes.d.ts +0 -13
- package/dist/service/types/GRequest.d.ts +0 -16
- package/dist/service/types/GResponse.d.ts +0 -10
- package/dist/service/types/Game/GameAttemptType.d.ts +0 -6
- package/dist/service/types/Game/GameCanPlayType.d.ts +0 -10
- package/dist/service/types/Game/GameExternalStatus.d.ts +0 -6
- package/dist/service/types/Game/GameInfo.d.ts +0 -9
- package/dist/service/types/Game/GamePick.d.ts +0 -90
- package/dist/service/types/Game/GameUtil.d.ts +0 -7
- package/dist/service/types/SmarticoProto/GetTranslationsRequest.d.ts +0 -7
- package/dist/service/types/SmarticoProto/GetTranslationsResponse.d.ts +0 -7
- package/dist/service/types/SmarticoProto/ProtocolMessage.d.ts +0 -5
- package/dist/service/types/SmarticoProto/ProtocolRequest.d.ts +0 -6
- package/dist/service/types/SmarticoProto/ProtocolResponse.d.ts +0 -5
- package/dist/service/types/SmarticoProto/PublicLabelInfo.d.ts +0 -34
- package/dist/service/types/SmarticoProto/PublicProperties.d.ts +0 -11
- package/dist/service/types/SmarticoProto/ResponseIdentify.d.ts +0 -12
- package/dist/service/types/SmarticoProto/SAW/SAWAcknowledgeType.d.ts +0 -5
- package/dist/service/types/SmarticoProto/SAW/SAWBuyInType.d.ts +0 -5
- package/dist/service/types/SmarticoProto/SAW/SAWDoSpinRequest.d.ts +0 -5
- package/dist/service/types/SmarticoProto/SAW/SAWDoSpinResponse.d.ts +0 -15
- package/dist/service/types/SmarticoProto/SAW/SAWGameType.d.ts +0 -10
- package/dist/service/types/SmarticoProto/SAW/SAWGetTemplatesRequest.d.ts +0 -3
- package/dist/service/types/SmarticoProto/SAW/SAWGetTemplatesResponse.d.ts +0 -5
- package/dist/service/types/SmarticoProto/SAW/SAWPrize.d.ts +0 -11
- package/dist/service/types/SmarticoProto/SAW/SAWPrizeType.d.ts +0 -8
- package/dist/service/types/SmarticoProto/SAW/SAWPrizeUI.d.ts +0 -13
- package/dist/service/types/SmarticoProto/SAW/SAWTemplate.d.ts +0 -21
- package/dist/service/types/SmarticoProto/SAW/SAWTemplateUI.d.ts +0 -31
- package/dist/service/types/SmarticoProto/SAW/SAWWinSoundType.d.ts +0 -12
- package/dist/service/types/SmarticoProto/TranslationArea.d.ts +0 -9
- package/dist/service/types/User/UserInfo.d.ts +0 -10
- 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
|
+
}
|
package/dist/Missions/index.d.ts
CHANGED
|
@@ -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';
|
|
@@ -436,7 +437,7 @@ export interface TMissionOrBadge {
|
|
|
436
437
|
active_from_ts: number;
|
|
437
438
|
/** Holds time till mission will become unavailable, for the missions that are targeted to be available from specific date/time */
|
|
438
439
|
active_till_ts: number;
|
|
439
|
-
/** 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. */
|
|
440
441
|
dt_start: number;
|
|
441
442
|
/** The progress of the mission in percents calculated as the aggregated relative percentage of all tasks */
|
|
442
443
|
progress: number;
|
|
@@ -491,6 +492,12 @@ export interface TMissionOrBadge {
|
|
|
491
492
|
max_completion_count?: number;
|
|
492
493
|
/** Current completion count for Recurring upon completion missions */
|
|
493
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;
|
|
494
501
|
}
|
|
495
502
|
export interface AchRelatedGame {
|
|
496
503
|
/** The ID of the related game */
|
package/dist/index.js
CHANGED
|
@@ -927,6 +927,217 @@ exports.AchievementType = void 0;
|
|
|
927
927
|
AchievementType[AchievementType["Badge"] = 2] = "Badge";
|
|
928
928
|
})(exports.AchievementType || (exports.AchievementType = {}));
|
|
929
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
|
+
|
|
930
1141
|
var UserAchievementTransform = function UserAchievementTransform(items) {
|
|
931
1142
|
return items.filter(function (r) {
|
|
932
1143
|
return r.ach_id >= 1;
|
|
@@ -948,7 +1159,7 @@ var UserAchievementTransform = function UserAchievementTransform(items) {
|
|
|
948
1159
|
is_opted_in: r.isOptedIn,
|
|
949
1160
|
time_limit_ms: r.time_limit_ms,
|
|
950
1161
|
active_from_ts: r.active_from_ts,
|
|
951
|
-
active_till_ts: r.
|
|
1162
|
+
active_till_ts: r.active_till_ts,
|
|
952
1163
|
dt_start: r.start_date_ts,
|
|
953
1164
|
reward: r.ach_public_meta.reward,
|
|
954
1165
|
progress: r.progress,
|
|
@@ -998,8 +1209,12 @@ var UserAchievementTransform = function UserAchievementTransform(items) {
|
|
|
998
1209
|
completed_today: completedToday,
|
|
999
1210
|
completed_this_week: completedThisWeek,
|
|
1000
1211
|
completed_this_month: completedThisMonth,
|
|
1001
|
-
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)
|
|
1002
1214
|
};
|
|
1215
|
+
if (r.ach_status_id === exports.AchievementStatus.Recurring) {
|
|
1216
|
+
x.next_recurrence_date_ts = r.next_recurrence_date_ts;
|
|
1217
|
+
}
|
|
1003
1218
|
if (r.ach_status_id === exports.AchievementStatus.RecurringUponCompletion) {
|
|
1004
1219
|
x.completion_count = r.completed_count;
|
|
1005
1220
|
x.max_completion_count = r.recurring_quantity;
|