@smartico/public-api 0.0.437 → 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.
@@ -30,6 +30,8 @@ export interface TMiniGamePrize {
30
30
  * For example for prize '100 points' the prize_value will be 100, for '100 free spins' 100, for '50 Diamonds' 50.
31
31
  */
32
32
  prize_value?: number;
33
+ /** For 'gems-and-diamonds' prizes — which currency the prize gives: 'gems', 'diamonds', or 'gems-and-diamonds' (both; `prize_value` is then their sum). Absent for other types */
34
+ gems_diamonds_type?: 'gems' | 'diamonds' | 'gems-and-diamonds';
33
35
  /** Custom font size in px for rendering the prize name on the game surface (e.g. a wheel sector), desktop */
34
36
  font_size?: number;
35
37
  /** Custom font size in px for the prize name, mobile; falls back to `font_size` when absent */
@@ -855,6 +857,8 @@ export interface TMissionOrBadge {
855
857
  active_from_ts: number;
856
858
  /** Holds time till mission will become unavailable, for the missions that are targeted to be available from specific date/time */
857
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;
858
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. */
859
863
  dt_start: number;
860
864
  /** The progress of the mission in percents calculated as the aggregated relative percentage of all tasks */
package/dist/index.js CHANGED
@@ -499,6 +499,14 @@ var sawPrizeValue = function sawPrizeValue(p) {
499
499
  }
500
500
  return n > 0 ? n : p.prize_value;
501
501
  };
502
+ var GEMS_DIAMONDS_TYPES = ['gems', 'diamonds', 'gems-and-diamonds'];
503
+ /** Which currency a gems-and-diamonds prize gives (`_gems_diamonds_type`: 0 gems, 1 diamonds, 2 both). */
504
+ var sawGemsDiamondsType = function sawGemsDiamondsType(p) {
505
+ var _GEMS_DIAMONDS_TYPES$;
506
+ if (p.prize_type_id !== exports.SAWPrizeType.GEMS_AND_DIAMONDS) return undefined;
507
+ var d = p.prize_details_json;
508
+ return (_GEMS_DIAMONDS_TYPES$ = GEMS_DIAMONDS_TYPES[d == null ? void 0 : d._gems_diamonds_type]) != null ? _GEMS_DIAMONDS_TYPES$ : d != null && d.gems && d != null && d.diamonds ? 'gems-and-diamonds' : d != null && d.diamonds ? 'diamonds' : 'gems';
509
+ };
502
510
  var SAWTemplatesTransform = function SAWTemplatesTransform(items) {
503
511
  return items.map(function (r) {
504
512
  var _r$saw_skin_ui_defini;
@@ -553,6 +561,7 @@ var SAWTemplatesTransform = function SAWTemplatesTransform(items) {
553
561
  name: p.saw_prize_ui_definition.name,
554
562
  prize_type: MiniGamePrizeTypeNamed(p.prize_type_id),
555
563
  prize_value: sawPrizeValue(p),
564
+ gems_diamonds_type: sawGemsDiamondsType(p),
556
565
  font_size: p.saw_prize_ui_definition.font_size,
557
566
  font_size_mobile: p.saw_prize_ui_definition.font_size_mobile,
558
567
  icon: p.saw_prize_ui_definition.icon,
@@ -1272,8 +1281,8 @@ exports.AchievementAvailabilityStatus = void 0;
1272
1281
  AchievementAvailabilityStatus[AchievementAvailabilityStatus["AvailableInactive"] = 1] = "AvailableInactive";
1273
1282
  /** Mission without date/time restrictions or with passed active from date, opt-in is required, user is opted-in or mission is unlocked*/
1274
1283
  AchievementAvailabilityStatus[AchievementAvailabilityStatus["AvailableActive"] = 2] = "AvailableActive";
1275
- /** Mission with active from date defined, date is in future.
1276
- * 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
1277
1286
  */
1278
1287
  AchievementAvailabilityStatus[AchievementAvailabilityStatus["UnavailableWithActiveFrom"] = 3] = "UnavailableWithActiveFrom";
1279
1288
  /** Mission with active till date defined, date is in future, and no opt-in required and mission is unlocked.
@@ -1373,6 +1382,10 @@ MissionUtils.getAvailabilityStatus = function (mission) {
1373
1382
  if (!mission) {
1374
1383
  return null;
1375
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
+ }
1376
1389
  var activeFrom = mission.active_from_ts ? _MissionUtils.getMs(mission.active_from_ts) : null;
1377
1390
  var activeTill = mission.active_till_ts ? _MissionUtils.getMs(mission.active_till_ts) : null;
1378
1391
  var startDate = mission.start_date_ts ? _MissionUtils.getMs(mission.start_date_ts) : null;
@@ -1671,6 +1684,7 @@ var UserAchievementTransform = function UserAchievementTransform(items) {
1671
1684
  time_limit_ms: r.time_limit_ms,
1672
1685
  active_from_ts: r.active_from_ts,
1673
1686
  active_till_ts: r.active_till_ts,
1687
+ activity_period_next_start_ts: r.activity_period_next_start_ts,
1674
1688
  dt_start: r.start_date_ts,
1675
1689
  reward: r.ach_public_meta.reward,
1676
1690
  progress: r.progress,
@@ -3448,6 +3462,10 @@ var WSAPIMissions = /*#__PURE__*/function (_WSAPIGeneral) {
3448
3462
  * - `RECURRING` missions between cycles, until the next cycle starts.
3449
3463
  * - `RECURRING_QUANTITY` missions outside their `active_from_ts` /
3450
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.
3451
3469
  *
3452
3470
  * Client-side filtering you may still want: missions with
3453
3471
  * `only_in_custom_section: true` are intended for their custom-section
@@ -3466,7 +3484,9 @@ var WSAPIMissions = /*#__PURE__*/function (_WSAPIGeneral) {
3466
3484
  * missions) at least one cycle done / the cap reached — see the recurring
3467
3485
  * caveats below. Sort by `complete_date_ts` DESC.
3468
3486
  * 3. **Locked** — `is_locked === true`, OR not yet started
3469
- * (`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.
3470
3490
  * 4. **In-progress** — `is_opted_in === true`, OR (no opt-in required and
3471
3491
  * `progress > 0`). Sort by `position` ASC.
3472
3492
  * 5. **Available** — everything else (opt-in required but not yet joined, or
@@ -3814,8 +3834,9 @@ var WSAPIMissions = /*#__PURE__*/function (_WSAPIGeneral) {
3814
3834
  * means local mission state was stale (e.g. user opted in from another
3815
3835
  * session/tab).
3816
3836
  * - `40013` — mission not opt-in-able: missing `requires_optin`, in
3817
- * DRAFT/ARCHIVED state, or outside its `active_from_ts` /
3818
- * `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).
3819
3840
  * - `40014` — mission is locked; user has unlock-tasks remaining.
3820
3841
  * Surface the mission's `unlock_mission_description` to guide them.
3821
3842
  * - other non-zero — generic server error. Surface `err_message` if any.