@smartico/public-api 0.0.438 → 0.0.440

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.
@@ -31,7 +31,9 @@ note below):
31
31
  recurring), so only compare against it when it is set.
32
32
  Sort: `complete_date_ts` DESC (most recent first).
33
33
  3. **Locked** — `is_locked === true`, OR not yet available
34
- (`active_from_ts > Date.now()`). Sort: `position` ASC.
34
+ (`active_from_ts > Date.now()`), OR outside its active weekdays /
35
+ days of the month (`activity_period_next_start_ts > Date.now()`).
36
+ Sort: `position` ASC.
35
37
  4. **In progress** — `is_opted_in === true`, OR (no opt-in required and
36
38
  `progress > 0`). Sort: `position` ASC.
37
39
  5. **Available** — everything else: opt-in required but not yet joined, or
@@ -108,6 +110,8 @@ Top-to-bottom structure (omit sections whose source field is empty):
108
110
  7. Lock icon overlay on the image when `is_locked === true`.
109
111
  8. Time-remaining block — "Available again in" countdown for
110
112
  recurring waiting; "Starts on" for `active_from_ts > now`;
113
+ "Opens in" countdown to `activity_period_next_start_ts` while it is
114
+ in the future (refetch with `getMissions` when it elapses);
111
115
  "Expired on" for missed; countdown for in-window.
112
116
  9. Full `description` (HTML).
113
117
  10. Action button — see the decision matrix below.
@@ -152,6 +156,8 @@ Apply in priority order; **first match wins**:
152
156
  5. `is_requires_optin && !is_opted_in` (and not locked) →
153
157
  **"Opt In" button**. Disable when:
154
158
  - `active_from_ts > Date.now()` (not yet started),
159
+ - `activity_period_next_start_ts > Date.now()` (outside its active
160
+ days — the server refuses the opt-in with `40013`),
155
161
  - the mission falls in the Missed bucket,
156
162
  - `active_till_ts && active_till_ts < Date.now()` (expired).
157
163
  While the opt-in request is in flight, show a loading indicator
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartico/public-api",
3
- "version": "0.0.438",
3
+ "version": "0.0.440",
4
4
  "description": "Smartico public API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -163,7 +163,7 @@ export interface QuizEventMeta {
163
163
  }
164
164
 
165
165
  /**
166
- * GamePickEventMeta describes metadata for a MatchX or Quiz event, including team info and sport context
166
+ * GamePickEventMeta describes metadata for a MatchX, Quiz or Bingo event, including team info and sport context
167
167
  */
168
168
  export interface GamePickEventMeta extends QuizEventMeta {
169
169
  /** Display name of the event/match */
@@ -457,7 +457,7 @@ export interface GamesApiResponse<T> {
457
457
  * GamePickRequestParams describes the base parameters required for GamePick API calls
458
458
  */
459
459
  export interface GamePickRequestParams {
460
- /** ID of the MatchX or Quiz game template. The only field the consumer supplies. */
460
+ /** ID of the MatchX, Quiz or Bingo game template. The only field the consumer supplies. */
461
461
  saw_template_id: number;
462
462
  /** External user ID. Injected by the SDK from the active session; consumers omit it. */
463
463
  ext_user_id?: string;
@@ -12,6 +12,7 @@ export enum SAWGameType {
12
12
  Plinko = 11,
13
13
  CoinFlip = 12,
14
14
  CustomMinigame = 13,
15
+ Bingo = 14,
15
16
  }
16
17
 
17
18
  export enum SAWGameTypeName {
@@ -28,6 +29,7 @@ export enum SAWGameTypeName {
28
29
  Plinko = 'plinko',
29
30
  CoinFlip = 'coin_flip',
30
31
  CustomMinigame = 'custom_minigame',
32
+ Bingo = 'bingo',
31
33
  Unknown = 'unknown',
32
34
  }
33
35
 
@@ -48,6 +50,7 @@ export const SAWGameTypeNamed = (type: SAWGameType): SAWGameTypeName => {
48
50
  [SAWGameType.Plinko]: SAWGameTypeName.Plinko,
49
51
  [SAWGameType.CoinFlip]: SAWGameTypeName.CoinFlip,
50
52
  [SAWGameType.CustomMinigame]: SAWGameTypeName.CustomMinigame,
53
+ [SAWGameType.Bingo]: SAWGameTypeName.Bingo,
51
54
  }[type] || SAWGameTypeName.Unknown
52
55
  );
53
56
  };
@@ -11,13 +11,13 @@ export interface SAWPrize {
11
11
  prize_value?: number;
12
12
  /** The type of the prize — see {@link SAWPrizeType} */
13
13
  prize_type_id: SAWPrizeType;
14
- /** Competition games (MatchX / Quiz): first finishing place this prize applies to */
14
+ /** Competition games (MatchX / Quiz / Bingo): first finishing place this prize applies to */
15
15
  place_from?: number;
16
- /** Competition games (MatchX / Quiz): last finishing place this prize applies to; equals `place_from` for a single-place prize */
16
+ /** Competition games (MatchX / Quiz / Bingo): last finishing place this prize applies to; equals `place_from` for a single-place prize */
17
17
  place_to?: number;
18
18
  /** Client-side only — unique id of a win instance generated by the default Smartico UI to dedupe render effects; never sent by the server */
19
19
  sawUniqueWinId?: string;
20
- /** Remaining stock. Present only when the template's `expose_game_stat_on_api` is enabled; always present for MatchX / Quiz games */
20
+ /** Remaining stock. Present only when the template's `expose_game_stat_on_api` is enabled; always present for MatchX / Quiz / Bingo games */
21
21
  pool?: number;
22
22
  /** Initial (configured) stock. Present regardless of `expose_game_stat_on_api` */
23
23
  pool_initial?: number;
@@ -64,7 +64,7 @@ export interface SAWTemplate {
64
64
  lottie_animation_speed?: number;
65
65
  };
66
66
 
67
- /** Operator template setting. When enabled, the per-prize stock statistics (`pool`, `wins_count`, `weekdays`, `active_from_ts` / `active_till_ts`) are populated on `prizes`; when disabled (default) the server strips them from the response (`pool` is kept for MatchX / Quiz games). */
67
+ /** Operator template setting. When enabled, the per-prize stock statistics (`pool`, `wins_count`, `weekdays`, `active_from_ts` / `active_till_ts`) are populated on `prizes`; when disabled (default) the server strips them from the response (`pool` is kept for MatchX / Quiz / Bingo games). */
68
68
  expose_game_stat_on_api?: boolean;
69
69
 
70
70
  /** Prize Drop only: when true, the pushed prize requires an explicit claim by the user before it is credited */
@@ -478,8 +478,8 @@ export interface SAWTemplateUI {
478
478
  * widget loads `custom_game_url` in an iframe instead of rendering the
479
479
  * built-in game. `saw_game_type_id` still reports the original type, so
480
480
  * treat this flag — not the type — as the answer to "is this played as a
481
- * custom game", together with `SAWGameType.CustomMinigame`, which is always
482
- * played that way.
481
+ * custom game", together with `SAWGameType.CustomMinigame` and
482
+ * `SAWGameType.Bingo`, which are always played that way.
483
483
  *
484
484
  * When `false` or omitted, the template is played as its own game type.
485
485
  * Back-Office label: _"Use Custom Game"_.
@@ -14,8 +14,8 @@ export enum AchievementAvailabilityStatus {
14
14
  /** Mission without date/time restrictions or with passed active from date, opt-in is required, user is opted-in or mission is unlocked*/
15
15
  AvailableActive = 2,
16
16
 
17
- /** Mission with active from date defined, date is in future.
18
- * Field: active_from_ts
17
+ /** 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.
18
+ * Field: activity_period_next_start_ts when set (the time the mission opens next), otherwise active_from_ts
19
19
  */
20
20
  UnavailableWithActiveFrom = 3,
21
21
 
@@ -56,6 +56,11 @@ export class MissionUtils {
56
56
  return null;
57
57
  }
58
58
 
59
+ // a mission available only on some weekdays / days of the month, currently outside them
60
+ if (mission.activity_period_next_start_ts && MissionUtils.getMs(mission.activity_period_next_start_ts) > Date.now()) {
61
+ return AchievementAvailabilityStatus.UnavailableWithActiveFrom;
62
+ }
63
+
59
64
  const activeFrom = mission.active_from_ts ? MissionUtils.getMs(mission.active_from_ts) : null
60
65
  const activeTill = mission.active_till_ts ? MissionUtils.getMs(mission.active_till_ts) : null;
61
66
  const startDate = mission.start_date_ts ? MissionUtils.getMs(mission.start_date_ts) : null;
@@ -35,6 +35,7 @@ export interface UserAchievement {
35
35
  related_games?: AchRelatedGame[];
36
36
  active_from_ts?: number; // indicates when 'scheduled' mission is active from,
37
37
  active_till_ts?: number; // indicates when 'scheduled' mission is active till,
38
+ activity_period_next_start_ts?: number; // when a mission limited to some weekdays / days of the month opens next; set only while it is outside its active days
38
39
  ach_categories?: number[];
39
40
  recurring_quantity?: number; // max completion count for Recurring upon completion
40
41
  completed_count?: number; // completion count for Recurring upon completion
@@ -102,6 +103,7 @@ export const UserAchievementTransform = (items: UserAchievement[]): TMissionOrBa
102
103
  time_limit_ms: r.time_limit_ms,
103
104
  active_from_ts: r.active_from_ts,
104
105
  active_till_ts: r.active_till_ts,
106
+ activity_period_next_start_ts: r.activity_period_next_start_ts,
105
107
  dt_start: r.start_date_ts,
106
108
  reward: r.ach_public_meta.reward,
107
109
  progress: r.progress,
@@ -4,7 +4,7 @@ import { WSAPIAvatars } from './WSAPIAvatars';
4
4
  /** @group GamePick */
5
5
  export class WSAPIGamePick extends WSAPIAvatars {
6
6
  /**
7
- * Returns every open round for a MatchX or Quiz game template, with the full
7
+ * Returns every open round for a MatchX, Quiz or Bingo game template, with the full
8
8
  * event list (matches / questions) and the current user's selections per event.
9
9
  *
10
10
  * Use to power the rounds-lobby screen — typically a list of round cards a user
@@ -14,7 +14,7 @@ export class WSAPIGamePick extends WSAPIAvatars {
14
14
  * @remarks
15
15
  * **Preconditions**
16
16
  * - User must be authenticated.
17
- * - `saw_template_id` must reference a MatchX or Quiz game template. The SDK
17
+ * - `saw_template_id` must reference a MatchX, Quiz or Bingo game template. The SDK
18
18
  * throws synchronously if it's missing.
19
19
  *
20
20
  * **Transport**
@@ -47,7 +47,7 @@ export class WSAPIGamePick extends WSAPIAvatars {
47
47
  *
48
48
  * **UI guidance**: see [UI Guide — `gamePickGetActiveRounds`](../../docs/ui/gamepick/UIGuide_gamePickGetActiveRounds.md).
49
49
  *
50
- * @param props.saw_template_id ID of the MatchX or Quiz game template.
50
+ * @param props.saw_template_id ID of the MatchX, Quiz or Bingo game template.
51
51
  * @returns Wrapped {@link GamesApiResponse} of {@link GamePickRound} array.
52
52
  *
53
53
  * @example
@@ -73,7 +73,7 @@ export class WSAPIGamePick extends WSAPIAvatars {
73
73
 
74
74
  /**
75
75
  * Returns a single round (events, user selections, scoring rules) for a
76
- * MatchX or Quiz game. Use to power the round-detail / prediction-input
76
+ * MatchX, Quiz or Bingo game. Use to power the round-detail / prediction-input
77
77
  * screen the user lands on after picking a round from the lobby.
78
78
  *
79
79
  * Same shape as one entry of {@link gamePickGetActiveRounds}; cheaper when the
@@ -105,7 +105,7 @@ export class WSAPIGamePick extends WSAPIAvatars {
105
105
  *
106
106
  * **UI guidance**: see [UI Guide — `gamePickGetActiveRound`](../../docs/ui/gamepick/UIGuide_gamePickGetActiveRound.md).
107
107
  *
108
- * @param props.saw_template_id ID of the MatchX or Quiz game template.
108
+ * @param props.saw_template_id ID of the MatchX, Quiz or Bingo game template.
109
109
  * @param props.round_id ID of the round to fetch.
110
110
  * @returns Wrapped {@link GamesApiResponse} of a single {@link GamePickRound}.
111
111
  *
@@ -134,7 +134,7 @@ export class WSAPIGamePick extends WSAPIAvatars {
134
134
  }
135
135
 
136
136
  /**
137
- * Returns the full round history (active + resolved) for a MatchX or Quiz game
137
+ * Returns the full round history (active + resolved) for a MatchX, Quiz or Bingo game
138
138
  * template, newest-first. Each round carries the user's predictions plus the
139
139
  * server-resolved outcome on each event.
140
140
  *
@@ -168,7 +168,7 @@ export class WSAPIGamePick extends WSAPIAvatars {
168
168
  *
169
169
  * **UI guidance**: see [UI Guide — `gamePickGetHistory`](../../docs/ui/gamepick/UIGuide_gamePickGetHistory.md).
170
170
  *
171
- * @param props.saw_template_id ID of the MatchX or Quiz game template.
171
+ * @param props.saw_template_id ID of the MatchX, Quiz or Bingo game template.
172
172
  * @returns Wrapped {@link GamesApiResponse} of {@link GamePickRound} array,
173
173
  * newest-first.
174
174
  *
@@ -189,7 +189,7 @@ export class WSAPIGamePick extends WSAPIAvatars {
189
189
  }
190
190
 
191
191
  /**
192
- * Returns the leaderboard for a MatchX or Quiz game round — ranked list of
192
+ * Returns the leaderboard for a MatchX, Quiz or Bingo game round — ranked list of
193
193
  * players plus the current user's entry (`my_user`). Pass `round_id: -1` for
194
194
  * the season / overall leaderboard across every round in the template.
195
195
  *
@@ -229,7 +229,7 @@ export class WSAPIGamePick extends WSAPIAvatars {
229
229
  *
230
230
  * **UI guidance**: see [UI Guide — `gamePickGetBoard`](../../docs/ui/gamepick/UIGuide_gamePickGetBoard.md).
231
231
  *
232
- * @param props.saw_template_id ID of the MatchX or Quiz game template.
232
+ * @param props.saw_template_id ID of the MatchX, Quiz or Bingo game template.
233
233
  * @param props.round_id Round ID, or `-1` for the season leaderboard.
234
234
  * @returns Wrapped {@link GamesApiResponse} of {@link GamePickRoundBoard}.
235
235
  *
@@ -497,7 +497,7 @@ export class WSAPIGamePick extends WSAPIAvatars {
497
497
  *
498
498
  * **UI guidance**: see [UI Guide — `gamePickGetUserInfo`](../../docs/ui/gamepick/UIGuide_gamePickGetUserInfo.md).
499
499
  *
500
- * @param props.saw_template_id ID of the MatchX or Quiz game template.
500
+ * @param props.saw_template_id ID of the MatchX, Quiz or Bingo game template.
501
501
  * @returns Wrapped {@link GamesApiResponse} of {@link GamePickUserInfo}.
502
502
  *
503
503
  * @example
@@ -555,7 +555,7 @@ export class WSAPIGamePick extends WSAPIAvatars {
555
555
  *
556
556
  * **UI guidance**: see [UI Guide — `gamePickGetGameInfo`](../../docs/ui/gamepick/UIGuide_gamePickGetGameInfo.md).
557
557
  *
558
- * @param props.saw_template_id ID of the MatchX or Quiz game template.
558
+ * @param props.saw_template_id ID of the MatchX, Quiz or Bingo game template.
559
559
  * @returns Wrapped {@link GamesApiResponse} of {@link GamePickGameInfo}.
560
560
  *
561
561
  * @example
@@ -616,7 +616,7 @@ export class WSAPIGamePick extends WSAPIAvatars {
616
616
  *
617
617
  * **UI guidance**: see [UI Guide — `gamePickGetRoundInfoForUser`](../../docs/ui/gamepick/UIGuide_gamePickGetRoundInfoForUser.md).
618
618
  *
619
- * @param props.saw_template_id ID of the MatchX or Quiz game template.
619
+ * @param props.saw_template_id ID of the MatchX, Quiz or Bingo game template.
620
620
  * @param props.round_id ID of the round to inspect.
621
621
  * @param props.int_user_id Internal user ID from
622
622
  * `gamePickGetBoard.users[].int_user_id`.
@@ -53,14 +53,14 @@ export class WSAPIMiniGames extends WSAPIRaffles {
53
53
  * substitution at fetch time.
54
54
  *
55
55
  * **Game-type variants**
56
- * All twelve `SAWGameType` values (`SpinAWheel`, `ScratchCard`,
56
+ * All `SAWGameType` values (`SpinAWheel`, `ScratchCard`,
57
57
  * `MatchX`, `GiftBox`, `PrizeDrop`, `Quiz`, `LootboxWeekdays`,
58
58
  * `LootboxCalendarDays`, `TreasureHunt`, `Voyager`, `Plinko`,
59
- * `CoinFlip`) surface through the same template shape. Most are
59
+ * `CoinFlip`, `CustomMinigame`, `Bingo`) surface through the same template shape. Most are
60
60
  * played via {@link playMiniGame}; the exceptions are:
61
61
  * - `PrizeDrop` — server-push only; the consumer does NOT call
62
62
  * `playMiniGame`. Prizes arrive via the prize-drop push channel.
63
- * - `MatchX` / `Quiz` — predictions are submitted via a separate
63
+ * - `MatchX` / `Quiz` / `Bingo` — predictions are submitted via a separate
64
64
  * games server (not this SDK); the SAW spin is fired
65
65
  * server-internally to deduct the buy-in.
66
66
  *
@@ -239,7 +239,7 @@ export class WSAPIMiniGames extends WSAPIRaffles {
239
239
  * Works for all `SAWGameType` values EXCEPT:
240
240
  * - `PrizeDrop` — prizes arrive server-pushed; do NOT call
241
241
  * `playMiniGame` for this type.
242
- * - `MatchX` / `Quiz` — prediction submission goes through a
242
+ * - `MatchX` / `Quiz` / `Bingo` — prediction submission goes through a
243
243
  * separate games server; `playMiniGame` is not the entry point.
244
244
  *
245
245
  * @remarks
@@ -61,6 +61,10 @@ export class WSAPIMissions extends WSAPIGeneral {
61
61
  * - `RECURRING` missions between cycles, until the next cycle starts.
62
62
  * - `RECURRING_QUANTITY` missions outside their `active_from_ts` /
63
63
  * `active_till_ts` window.
64
+ * - Missions available only on some weekdays or days of the month, while
65
+ * outside those days — unless the mission is configured to be shown
66
+ * before it opens (then it arrives with `activity_period_next_start_ts`),
67
+ * and always once it will not open again. Completed missions stay.
64
68
  *
65
69
  * Client-side filtering you may still want: missions with
66
70
  * `only_in_custom_section: true` are intended for their custom-section
@@ -79,7 +83,9 @@ export class WSAPIMissions extends WSAPIGeneral {
79
83
  * missions) at least one cycle done / the cap reached — see the recurring
80
84
  * caveats below. Sort by `complete_date_ts` DESC.
81
85
  * 3. **Locked** — `is_locked === true`, OR not yet started
82
- * (`active_from_ts > Date.now()`). Sort by `position` ASC.
86
+ * (`active_from_ts > Date.now()`), OR outside its active days
87
+ * (`activity_period_next_start_ts > Date.now()` — show an "opens in"
88
+ * countdown to it, and refetch when it elapses). Sort by `position` ASC.
83
89
  * 4. **In-progress** — `is_opted_in === true`, OR (no opt-in required and
84
90
  * `progress > 0`). Sort by `position` ASC.
85
91
  * 5. **Available** — everything else (opt-in required but not yet joined, or
@@ -416,8 +422,9 @@ export class WSAPIMissions extends WSAPIGeneral {
416
422
  * means local mission state was stale (e.g. user opted in from another
417
423
  * session/tab).
418
424
  * - `40013` — mission not opt-in-able: missing `requires_optin`, in
419
- * DRAFT/ARCHIVED state, or outside its `active_from_ts` /
420
- * `active_till_ts` window.
425
+ * DRAFT/ARCHIVED state, outside its `active_from_ts` /
426
+ * `active_till_ts` window, or outside its active weekdays / days of the
427
+ * month (`activity_period_next_start_ts` is set).
421
428
  * - `40014` — mission is locked; user has unlock-tasks remaining.
422
429
  * Surface the mission's `unlock_mission_description` to guide them.
423
430
  * - other non-zero — generic server error. Surface `err_message` if any.
@@ -65,7 +65,7 @@ export interface TMiniGamePrize {
65
65
  second_btn_action_title?: string;
66
66
  /** Message when the prize pool is empty for that specific prize */
67
67
  out_of_stock_message?: string;
68
- /** Remaining stock of the prize — decrements on each win, refunded if the spin is finalised as lost. Populated only when the template's `expose_game_stat_on_api` is enabled; always populated for MatchX / Quiz games */
68
+ /** Remaining stock of the prize — decrements on each win, refunded if the spin is finalised as lost. Populated only when the template's `expose_game_stat_on_api` is enabled; always populated for MatchX / Quiz / Bingo games */
69
69
  pool?: number;
70
70
  /** Initial (configured) stock of the prize. Populated regardless of `expose_game_stat_on_api` */
71
71
  pool_initial?: number;
@@ -887,6 +887,9 @@ export interface TMissionOrBadge {
887
887
  /** Holds time till mission will become unavailable, for the missions that are targeted to be available from specific date/time */
888
888
  active_till_ts: number;
889
889
 
890
+ /** 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 */
891
+ activity_period_next_start_ts?: number;
892
+
890
893
  /** 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. */
891
894
  dt_start: number;
892
895
  /** The progress of the mission in percents calculated as the aggregated relative percentage of all tasks */