@smartico/public-api 0.0.438 → 0.0.439

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.
@@ -10,8 +10,8 @@ export declare enum AchievementAvailabilityStatus {
10
10
  AvailableInactive = 1,
11
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
12
  AvailableActive = 2,
13
- /** Mission with active from date defined, date is in future.
14
- * Field: active_from_ts
13
+ /** Mission with active from date defined, date is in future, or a mission available only on some weekdays / days of the month that is outside its active days.
14
+ * Field: activity_period_next_start_ts when set (the time the mission opens next), otherwise active_from_ts
15
15
  */
16
16
  UnavailableWithActiveFrom = 3,
17
17
  /** Mission with active till date defined, date is in future, and no opt-in required and mission is unlocked.
@@ -31,6 +31,7 @@ export interface UserAchievement {
31
31
  related_games?: AchRelatedGame[];
32
32
  active_from_ts?: number;
33
33
  active_till_ts?: number;
34
+ activity_period_next_start_ts?: number;
34
35
  ach_categories?: number[];
35
36
  recurring_quantity?: number;
36
37
  completed_count?: number;
@@ -50,6 +50,10 @@ export declare class WSAPIMissions extends WSAPIGeneral {
50
50
  * - `RECURRING` missions between cycles, until the next cycle starts.
51
51
  * - `RECURRING_QUANTITY` missions outside their `active_from_ts` /
52
52
  * `active_till_ts` window.
53
+ * - Missions available only on some weekdays or days of the month, while
54
+ * outside those days — unless the mission is configured to be shown
55
+ * before it opens (then it arrives with `activity_period_next_start_ts`),
56
+ * and always once it will not open again. Completed missions stay.
53
57
  *
54
58
  * Client-side filtering you may still want: missions with
55
59
  * `only_in_custom_section: true` are intended for their custom-section
@@ -68,7 +72,9 @@ export declare class WSAPIMissions extends WSAPIGeneral {
68
72
  * missions) at least one cycle done / the cap reached — see the recurring
69
73
  * caveats below. Sort by `complete_date_ts` DESC.
70
74
  * 3. **Locked** — `is_locked === true`, OR not yet started
71
- * (`active_from_ts > Date.now()`). Sort by `position` ASC.
75
+ * (`active_from_ts > Date.now()`), OR outside its active days
76
+ * (`activity_period_next_start_ts > Date.now()` — show an "opens in"
77
+ * countdown to it, and refetch when it elapses). Sort by `position` ASC.
72
78
  * 4. **In-progress** — `is_opted_in === true`, OR (no opt-in required and
73
79
  * `progress > 0`). Sort by `position` ASC.
74
80
  * 5. **Available** — everything else (opt-in required but not yet joined, or
@@ -378,8 +384,9 @@ export declare class WSAPIMissions extends WSAPIGeneral {
378
384
  * means local mission state was stale (e.g. user opted in from another
379
385
  * session/tab).
380
386
  * - `40013` — mission not opt-in-able: missing `requires_optin`, in
381
- * DRAFT/ARCHIVED state, or outside its `active_from_ts` /
382
- * `active_till_ts` window.
387
+ * DRAFT/ARCHIVED state, outside its `active_from_ts` /
388
+ * `active_till_ts` window, or outside its active weekdays / days of the
389
+ * month (`activity_period_next_start_ts` is set).
383
390
  * - `40014` — mission is locked; user has unlock-tasks remaining.
384
391
  * Surface the mission's `unlock_mission_description` to guide them.
385
392
  * - other non-zero — generic server error. Surface `err_message` if any.
@@ -857,6 +857,8 @@ export interface TMissionOrBadge {
857
857
  active_from_ts: number;
858
858
  /** Holds time till mission will become unavailable, for the missions that are targeted to be available from specific date/time */
859
859
  active_till_ts: number;
860
+ /** Time (epoch ms) when a mission that is available only on some weekdays or days of the month opens next. Set only while the mission is outside its active days and is shown before it opens; absent when it is open now or has no such limit */
861
+ activity_period_next_start_ts?: number;
860
862
  /** 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. */
861
863
  dt_start: number;
862
864
  /** The progress of the mission in percents calculated as the aggregated relative percentage of all tasks */
package/dist/index.js CHANGED
@@ -1281,8 +1281,8 @@ exports.AchievementAvailabilityStatus = void 0;
1281
1281
  AchievementAvailabilityStatus[AchievementAvailabilityStatus["AvailableInactive"] = 1] = "AvailableInactive";
1282
1282
  /** Mission without date/time restrictions or with passed active from date, opt-in is required, user is opted-in or mission is unlocked*/
1283
1283
  AchievementAvailabilityStatus[AchievementAvailabilityStatus["AvailableActive"] = 2] = "AvailableActive";
1284
- /** Mission with active from date defined, date is in future.
1285
- * Field: active_from_ts
1284
+ /** Mission with active from date defined, date is in future, or a mission available only on some weekdays / days of the month that is outside its active days.
1285
+ * Field: activity_period_next_start_ts when set (the time the mission opens next), otherwise active_from_ts
1286
1286
  */
1287
1287
  AchievementAvailabilityStatus[AchievementAvailabilityStatus["UnavailableWithActiveFrom"] = 3] = "UnavailableWithActiveFrom";
1288
1288
  /** Mission with active till date defined, date is in future, and no opt-in required and mission is unlocked.
@@ -1382,6 +1382,10 @@ MissionUtils.getAvailabilityStatus = function (mission) {
1382
1382
  if (!mission) {
1383
1383
  return null;
1384
1384
  }
1385
+ // a mission available only on some weekdays / days of the month, currently outside them
1386
+ if (mission.activity_period_next_start_ts && _MissionUtils.getMs(mission.activity_period_next_start_ts) > Date.now()) {
1387
+ return exports.AchievementAvailabilityStatus.UnavailableWithActiveFrom;
1388
+ }
1385
1389
  var activeFrom = mission.active_from_ts ? _MissionUtils.getMs(mission.active_from_ts) : null;
1386
1390
  var activeTill = mission.active_till_ts ? _MissionUtils.getMs(mission.active_till_ts) : null;
1387
1391
  var startDate = mission.start_date_ts ? _MissionUtils.getMs(mission.start_date_ts) : null;
@@ -1680,6 +1684,7 @@ var UserAchievementTransform = function UserAchievementTransform(items) {
1680
1684
  time_limit_ms: r.time_limit_ms,
1681
1685
  active_from_ts: r.active_from_ts,
1682
1686
  active_till_ts: r.active_till_ts,
1687
+ activity_period_next_start_ts: r.activity_period_next_start_ts,
1683
1688
  dt_start: r.start_date_ts,
1684
1689
  reward: r.ach_public_meta.reward,
1685
1690
  progress: r.progress,
@@ -3457,6 +3462,10 @@ var WSAPIMissions = /*#__PURE__*/function (_WSAPIGeneral) {
3457
3462
  * - `RECURRING` missions between cycles, until the next cycle starts.
3458
3463
  * - `RECURRING_QUANTITY` missions outside their `active_from_ts` /
3459
3464
  * `active_till_ts` window.
3465
+ * - Missions available only on some weekdays or days of the month, while
3466
+ * outside those days — unless the mission is configured to be shown
3467
+ * before it opens (then it arrives with `activity_period_next_start_ts`),
3468
+ * and always once it will not open again. Completed missions stay.
3460
3469
  *
3461
3470
  * Client-side filtering you may still want: missions with
3462
3471
  * `only_in_custom_section: true` are intended for their custom-section
@@ -3475,7 +3484,9 @@ var WSAPIMissions = /*#__PURE__*/function (_WSAPIGeneral) {
3475
3484
  * missions) at least one cycle done / the cap reached — see the recurring
3476
3485
  * caveats below. Sort by `complete_date_ts` DESC.
3477
3486
  * 3. **Locked** — `is_locked === true`, OR not yet started
3478
- * (`active_from_ts > Date.now()`). Sort by `position` ASC.
3487
+ * (`active_from_ts > Date.now()`), OR outside its active days
3488
+ * (`activity_period_next_start_ts > Date.now()` — show an "opens in"
3489
+ * countdown to it, and refetch when it elapses). Sort by `position` ASC.
3479
3490
  * 4. **In-progress** — `is_opted_in === true`, OR (no opt-in required and
3480
3491
  * `progress > 0`). Sort by `position` ASC.
3481
3492
  * 5. **Available** — everything else (opt-in required but not yet joined, or
@@ -3823,8 +3834,9 @@ var WSAPIMissions = /*#__PURE__*/function (_WSAPIGeneral) {
3823
3834
  * means local mission state was stale (e.g. user opted in from another
3824
3835
  * session/tab).
3825
3836
  * - `40013` — mission not opt-in-able: missing `requires_optin`, in
3826
- * DRAFT/ARCHIVED state, or outside its `active_from_ts` /
3827
- * `active_till_ts` window.
3837
+ * DRAFT/ARCHIVED state, outside its `active_from_ts` /
3838
+ * `active_till_ts` window, or outside its active weekdays / days of the
3839
+ * month (`activity_period_next_start_ts` is set).
3828
3840
  * - `40014` — mission is locked; user has unlock-tasks remaining.
3829
3841
  * Surface the mission's `unlock_mission_description` to guide them.
3830
3842
  * - other non-zero — generic server error. Surface `err_message` if any.