@smartico/public-api 0.0.410 → 0.0.412

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 (51) hide show
  1. package/README.md +1 -1
  2. package/dist/Jackpots/JackpotPublicMeta.d.ts +1 -1
  3. package/dist/Level/LevelPublicMeta.d.ts +1 -1
  4. package/dist/MiniGames/SAWPrize.d.ts +9 -0
  5. package/dist/MiniGames/SAWPrizeUI.d.ts +1 -0
  6. package/dist/MiniGames/SAWTemplate.d.ts +25 -0
  7. package/dist/Raffle/Raffle.d.ts +1 -1
  8. package/dist/SmarticoLib/index.d.ts +3 -3
  9. package/dist/WSAPI/WSAPIMiniGames.d.ts +7 -1
  10. package/dist/WSAPI/WSAPIMissions.d.ts +40 -12
  11. package/dist/WSAPI/WSAPITypes.d.ts +40 -37
  12. package/dist/index.js +49 -13
  13. package/dist/index.js.map +1 -1
  14. package/dist/index.modern.mjs +49 -13
  15. package/dist/index.modern.mjs.map +1 -1
  16. package/docs/api/classes/WSAPIMiniGames.md +7 -1
  17. package/docs/api/classes/WSAPIMissions.md +40 -12
  18. package/docs/api/interfaces/JackpotPublicMeta.md +1 -1
  19. package/docs/api/interfaces/LevelPublicMeta.md +1 -1
  20. package/docs/api/interfaces/RafflePublicMeta.md +1 -1
  21. package/docs/api/interfaces/SAWPrize.md +18 -0
  22. package/docs/api/interfaces/SAWPrizeUI.md +2 -0
  23. package/docs/api/interfaces/SAWTemplate.md +46 -0
  24. package/docs/api/interfaces/TMiniGamePrize.md +28 -20
  25. package/docs/api/interfaces/TMiniGameTemplate.md +12 -13
  26. package/docs/api/interfaces/TMissionOrBadge.md +6 -4
  27. package/docs/api/interfaces/TRaffle.md +1 -1
  28. package/docs/capabilities/getBadges.md +4 -4
  29. package/docs/capabilities/getMiniGames.md +30 -29
  30. package/docs/capabilities/getMissions.md +44 -16
  31. package/docs/capabilities/getRaffles.md +1 -1
  32. package/docs/capabilities/jackpotGet.md +1 -1
  33. package/docs/capabilities/miniGameWinAcknowledgeRequest.md +7 -1
  34. package/docs/native/PROTOCOL.md +4 -0
  35. package/docs/ui/minigames/UIGuide_getMiniGames.md +22 -0
  36. package/docs/ui/minigames/UIGuide_miniGameWinAcknowledgeRequest.md +90 -0
  37. package/docs/ui/minigames/UIGuide_playMiniGame.md +12 -3
  38. package/docs/ui/missions/UIGuide_getMissions.md +44 -24
  39. package/package.json +1 -1
  40. package/src/Jackpots/JackpotPublicMeta.ts +1 -1
  41. package/src/Level/LevelPublicMeta.ts +1 -1
  42. package/src/MiniGames/SAWGetTemplatesResponse.ts +1 -0
  43. package/src/MiniGames/SAWPrize.ts +9 -0
  44. package/src/MiniGames/SAWPrizeUI.ts +2 -1
  45. package/src/MiniGames/SAWTemplate.ts +28 -4
  46. package/src/Raffle/Raffle.ts +1 -1
  47. package/src/SmarticoAPI.ts +5 -0
  48. package/src/SmarticoLib/index.ts +3 -3
  49. package/src/WSAPI/WSAPIMiniGames.ts +7 -1
  50. package/src/WSAPI/WSAPIMissions.ts +40 -12
  51. package/src/WSAPI/WSAPITypes.ts +42 -39
@@ -535,6 +535,7 @@ const SAWTemplatesTransform = items => {
535
535
  sectors: p.saw_prize_ui_definition.sectors,
536
536
  acknowledge_type: SAWAcknowledgeTypeNamed(p.saw_prize_ui_definition.acknowledge_type),
537
537
  aknowledge_message: p.saw_prize_ui_definition.aknowledge_message,
538
+ aknowledge_message_lose: p.saw_prize_ui_definition.aknowledge_message_lose,
538
539
  acknowledge_dp: p.saw_prize_ui_definition.acknowledge_dp,
539
540
  acknowledge_action_title: p.saw_prize_ui_definition.acknowledge_action_title,
540
541
  acknowledge_dp_additional: p.saw_prize_ui_definition.acknowledge_dp_additional,
@@ -3278,18 +3279,46 @@ class WSAPIMissions extends WSAPIGeneral {
3278
3279
  * `only_in_custom_section: true` are intended for their custom-section
3279
3280
  * view only and should be hidden from the main mission list.
3280
3281
  *
3281
- * **Reading state from the returned mission**
3282
- * Drive availability chips ("missed", "coming soon", "needs opt-in",
3283
- * "in progress", "expired") from `availability_status` (enum
3284
- * {@link AchievementAvailabilityStatus}) — it's the canonical derived
3285
- * state and reflects all server-side timing/visibility rules in one
3286
- * field. For time-limited and recurring missions, `dt_start` doubles
3287
- * as the opt-in timestamp (for opt-in missions) or unlock timestamp
3288
- * (for previously-locked missions); the expiration of a time-limited
3289
- * mission is `dt_start + time_limit_ms`. `next_recurrence_date_ts`
3290
- * is populated for `RECURRING` / `RECURRING_QUANTITY` missions but
3291
- * is no longer meaningful once the mission's `active_till_ts` has
3292
- * passed.
3282
+ * **Status bucketing (which tab / section a mission belongs to)**
3283
+ * There is no pre-computed bucket field — assign each mission to exactly
3284
+ * ONE section reading the raw state fields directly (NOT `availability_status`;
3285
+ * see "Timers" below). Priority order, FIRST match wins:
3286
+ * 1. **Missed / Expired** — not completed and the window has closed:
3287
+ * `!is_completed && ((time_limit_ms && dt_start && dt_start + time_limit_ms < Date.now())`
3288
+ * `|| (active_till_ts && active_till_ts < Date.now()))`. Do NOT gate this on
3289
+ * opt-in — an opt-in mission whose window closed before the user ever
3290
+ * opted in is still Missed. Sort by `position` ASC.
3291
+ * 2. **Completed** — `is_completed === true`, OR (recurring-upon-completion
3292
+ * missions) at least one cycle done / the cap reached — see the recurring
3293
+ * caveats below. Sort by `complete_date_ts` DESC.
3294
+ * 3. **Locked** — `is_locked === true`, OR not yet started
3295
+ * (`active_from_ts > Date.now()`). Sort by `position` ASC.
3296
+ * 4. **In-progress** — `is_opted_in === true`, OR (no opt-in required and
3297
+ * `progress > 0`). Sort by `position` ASC.
3298
+ * 5. **Available** — everything else (opt-in required but not yet joined, or
3299
+ * an unrestricted mission not yet started). Sort by `position` ASC.
3300
+ *
3301
+ * **Recurring-upon-completion caveats** (the common mis-bucketing trap):
3302
+ * - `is_completed` NEVER flips true for a recurring-upon-completion mission
3303
+ * (only for one-shot missions) — detect a completed cycle from
3304
+ * `completion_count > 0`, not `is_completed`.
3305
+ * - A non-null `completion_count` is what identifies a recurring-upon-completion
3306
+ * mission. `max_completion_count === null` means an INFINITE cap (still
3307
+ * recurring — never read null as "not recurring"), so only test
3308
+ * `completion_count >= max_completion_count` when `max_completion_count` is set.
3309
+ *
3310
+ * **Timers & timestamps** (display only — NOT bucketing)
3311
+ * `availability_status` (enum {@link AchievementAvailabilityStatus}) is the
3312
+ * timer/window signal: use it to pick WHICH countdown to show and whether the
3313
+ * window has elapsed — NOT to choose the section. It does not read
3314
+ * `completion_count`, and between cycles the server may keep reporting the
3315
+ * just-elapsed cycle's `Missed*` value even after `dt_start` / `active_till_ts`
3316
+ * are cleared for the next attempt, so bucketing by it sends recurring missions
3317
+ * to the wrong tab. For time-limited / opt-in missions `dt_start` is the opt-in
3318
+ * timestamp (or unlock timestamp for previously-locked missions), and a
3319
+ * time-limited mission expires at `dt_start + time_limit_ms`.
3320
+ * `next_recurrence_date_ts` is populated for `RECURRING` / `RECURRING_QUANTITY`
3321
+ * missions but is no longer meaningful once `active_till_ts` has passed.
3293
3322
  *
3294
3323
  * **Refresh after a mutation**
3295
3324
  * After `requestMissionOptIn(...)` or `requestMissionClaimReward(...)`
@@ -7199,7 +7228,11 @@ class WSAPIMiniGames extends WSAPIRaffles {
7199
7228
  * true` with no prize attached. Use this for game mechanics where the
7200
7229
  * player can decline or forfeit the drawn prize — e.g. a
7201
7230
  * gamble/discard step, or a client-driven game where the user's final
7202
- * action decides whether the pre-drawn prize is actually won. It only
7231
+ * action decides whether the pre-drawn prize is actually won (the
7232
+ * default Smartico UI does this for the Voyager game: failing the
7233
+ * star-collection run finalises the spin as lost). When configured,
7234
+ * the prize's `aknowledge_message_lose` is the operator's result copy
7235
+ * for this case — show it instead of `aknowledge_message`. It only
7203
7236
  * works on a spin that is not yet finalised, so it requires playing
7204
7237
  * with `acknowledge: false` and calling promptly — once the automatic
7205
7238
  * acknowledge or the server-side fallback (below) has finalised the
@@ -7229,6 +7262,8 @@ class WSAPIMiniGames extends WSAPIRaffles {
7229
7262
  * - Either way the spin's `is_claimed` flips to `true` on the next
7230
7263
  * {@link getMiniGamesHistory} fetch.
7231
7264
  *
7265
+ * **UI guidance**: see [UI Guide — `miniGameWinAcknowledgeRequest`](../../docs/ui/minigames/UIGuide_miniGameWinAcknowledgeRequest.md).
7266
+ *
7232
7267
  * **Visitor mode**: not supported.
7233
7268
  *
7234
7269
  * @param request_id Correlation id of the spin to finalise: the
@@ -9997,6 +10032,7 @@ class SmarticoAPI {
9997
10032
  t.prizes.forEach(p => {
9998
10033
  p.saw_prize_ui_definition.name = IntUtils.replaceAll(p.saw_prize_ui_definition.name, '{{jackpot}}', jackpotValue);
9999
10034
  p.saw_prize_ui_definition.aknowledge_message = IntUtils.replaceAll(p.saw_prize_ui_definition.aknowledge_message, '{{jackpot}}', jackpotValue);
10035
+ p.saw_prize_ui_definition.aknowledge_message_lose = IntUtils.replaceAll(p.saw_prize_ui_definition.aknowledge_message_lose, '{{jackpot}}', jackpotValue);
10000
10036
  });
10001
10037
  }
10002
10038
  });