@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.
@@ -1255,8 +1255,8 @@ var AchievementAvailabilityStatus;
1255
1255
  AchievementAvailabilityStatus[AchievementAvailabilityStatus["AvailableInactive"] = 1] = "AvailableInactive";
1256
1256
  /** Mission without date/time restrictions or with passed active from date, opt-in is required, user is opted-in or mission is unlocked*/
1257
1257
  AchievementAvailabilityStatus[AchievementAvailabilityStatus["AvailableActive"] = 2] = "AvailableActive";
1258
- /** Mission with active from date defined, date is in future.
1259
- * Field: active_from_ts
1258
+ /** 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.
1259
+ * Field: activity_period_next_start_ts when set (the time the mission opens next), otherwise active_from_ts
1260
1260
  */
1261
1261
  AchievementAvailabilityStatus[AchievementAvailabilityStatus["UnavailableWithActiveFrom"] = 3] = "UnavailableWithActiveFrom";
1262
1262
  /** Mission with active till date defined, date is in future, and no opt-in required and mission is unlocked.
@@ -1354,6 +1354,10 @@ MissionUtils.getAvailabilityStatus = mission => {
1354
1354
  if (!mission) {
1355
1355
  return null;
1356
1356
  }
1357
+ // a mission available only on some weekdays / days of the month, currently outside them
1358
+ if (mission.activity_period_next_start_ts && _MissionUtils.getMs(mission.activity_period_next_start_ts) > Date.now()) {
1359
+ return AchievementAvailabilityStatus.UnavailableWithActiveFrom;
1360
+ }
1357
1361
  const activeFrom = mission.active_from_ts ? _MissionUtils.getMs(mission.active_from_ts) : null;
1358
1362
  const activeTill = mission.active_till_ts ? _MissionUtils.getMs(mission.active_till_ts) : null;
1359
1363
  const startDate = mission.start_date_ts ? _MissionUtils.getMs(mission.start_date_ts) : null;
@@ -1648,6 +1652,7 @@ const UserAchievementTransform = items => {
1648
1652
  time_limit_ms: r.time_limit_ms,
1649
1653
  active_from_ts: r.active_from_ts,
1650
1654
  active_till_ts: r.active_till_ts,
1655
+ activity_period_next_start_ts: r.activity_period_next_start_ts,
1651
1656
  dt_start: r.start_date_ts,
1652
1657
  reward: r.ach_public_meta.reward,
1653
1658
  progress: r.progress,
@@ -3323,6 +3328,10 @@ class WSAPIMissions extends WSAPIGeneral {
3323
3328
  * - `RECURRING` missions between cycles, until the next cycle starts.
3324
3329
  * - `RECURRING_QUANTITY` missions outside their `active_from_ts` /
3325
3330
  * `active_till_ts` window.
3331
+ * - Missions available only on some weekdays or days of the month, while
3332
+ * outside those days — unless the mission is configured to be shown
3333
+ * before it opens (then it arrives with `activity_period_next_start_ts`),
3334
+ * and always once it will not open again. Completed missions stay.
3326
3335
  *
3327
3336
  * Client-side filtering you may still want: missions with
3328
3337
  * `only_in_custom_section: true` are intended for their custom-section
@@ -3341,7 +3350,9 @@ class WSAPIMissions extends WSAPIGeneral {
3341
3350
  * missions) at least one cycle done / the cap reached — see the recurring
3342
3351
  * caveats below. Sort by `complete_date_ts` DESC.
3343
3352
  * 3. **Locked** — `is_locked === true`, OR not yet started
3344
- * (`active_from_ts > Date.now()`). Sort by `position` ASC.
3353
+ * (`active_from_ts > Date.now()`), OR outside its active days
3354
+ * (`activity_period_next_start_ts > Date.now()` — show an "opens in"
3355
+ * countdown to it, and refetch when it elapses). Sort by `position` ASC.
3345
3356
  * 4. **In-progress** — `is_opted_in === true`, OR (no opt-in required and
3346
3357
  * `progress > 0`). Sort by `position` ASC.
3347
3358
  * 5. **Available** — everything else (opt-in required but not yet joined, or
@@ -3666,8 +3677,9 @@ class WSAPIMissions extends WSAPIGeneral {
3666
3677
  * means local mission state was stale (e.g. user opted in from another
3667
3678
  * session/tab).
3668
3679
  * - `40013` — mission not opt-in-able: missing `requires_optin`, in
3669
- * DRAFT/ARCHIVED state, or outside its `active_from_ts` /
3670
- * `active_till_ts` window.
3680
+ * DRAFT/ARCHIVED state, outside its `active_from_ts` /
3681
+ * `active_till_ts` window, or outside its active weekdays / days of the
3682
+ * month (`activity_period_next_start_ts` is set).
3671
3683
  * - `40014` — mission is locked; user has unlock-tasks remaining.
3672
3684
  * Surface the mission's `unlock_mission_description` to guide them.
3673
3685
  * - other non-zero — generic server error. Surface `err_message` if any.