@smartico/public-api 0.0.379 → 0.0.381

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 (219) hide show
  1. package/.nvmrc +1 -1
  2. package/CLAUDE.md +103 -0
  3. package/README.md +53 -2
  4. package/dist/Base/ClassId.d.ts +2 -0
  5. package/dist/Jackpots/JackpotDetails.d.ts +14 -15
  6. package/dist/Jackpots/JackpotPot.d.ts +10 -6
  7. package/dist/Raffle/GetRaffleWonPrizesRequest.d.ts +9 -0
  8. package/dist/Raffle/GetRaffleWonPrizesResponse.d.ts +52 -0
  9. package/dist/Raffle/index.d.ts +2 -0
  10. package/dist/SmarticoAPI.d.ts +6 -1
  11. package/dist/SmarticoLib/index.d.ts +5 -1
  12. package/dist/Store/BuyStoreItemErrorCode.d.ts +9 -1
  13. package/dist/Tournaments/TournamentRegistrationError.d.ts +3 -1
  14. package/dist/WSAPI/WSAPI.d.ts +13 -1235
  15. package/dist/WSAPI/WSAPIAvatars.d.ts +296 -0
  16. package/dist/WSAPI/WSAPIBase.d.ts +71 -0
  17. package/dist/WSAPI/WSAPIBonuses.d.ts +240 -0
  18. package/dist/WSAPI/WSAPIClans.d.ts +388 -0
  19. package/dist/WSAPI/WSAPIGamePick.d.ts +593 -0
  20. package/dist/WSAPI/WSAPIGeneral.d.ts +172 -0
  21. package/dist/WSAPI/WSAPIInbox.d.ts +615 -0
  22. package/dist/WSAPI/WSAPIJackpots.d.ts +344 -0
  23. package/dist/WSAPI/WSAPILeaderBoard.d.ts +139 -0
  24. package/dist/WSAPI/WSAPIMiniGames.d.ts +510 -0
  25. package/dist/WSAPI/WSAPIMissions.d.ts +517 -0
  26. package/dist/WSAPI/WSAPIRaffles.d.ts +643 -0
  27. package/dist/WSAPI/WSAPIStore.d.ts +656 -0
  28. package/dist/WSAPI/WSAPITournaments.d.ts +501 -0
  29. package/dist/WSAPI/WSAPITypes.d.ts +376 -205
  30. package/dist/WSAPI/WSAPIUser.d.ts +533 -0
  31. package/dist/index.js +6745 -1661
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.modern.mjs +6324 -1342
  34. package/dist/index.modern.mjs.map +1 -1
  35. package/docs/Callbacks.md +162 -0
  36. package/docs/SmarticoObject.md +445 -0
  37. package/docs/Transforms.md +99 -0
  38. package/docs/api/README.md +82 -2
  39. package/docs/api/classes/WSAPIAvatars.md +344 -0
  40. package/docs/api/classes/WSAPIBonuses.md +271 -0
  41. package/docs/api/classes/WSAPIClans.md +436 -0
  42. package/docs/api/classes/WSAPIGamePick.md +710 -0
  43. package/docs/api/classes/WSAPIGeneral.md +212 -0
  44. package/docs/api/classes/WSAPIInbox.md +801 -0
  45. package/docs/api/classes/WSAPIJackpots.md +439 -0
  46. package/docs/api/classes/WSAPILeaderBoard.md +157 -0
  47. package/docs/api/classes/WSAPIMiniGames.md +612 -0
  48. package/docs/api/classes/WSAPIMissions.md +590 -0
  49. package/docs/api/classes/WSAPIRaffles.md +773 -0
  50. package/docs/api/classes/WSAPIStore.md +719 -0
  51. package/docs/api/classes/WSAPITournaments.md +571 -0
  52. package/docs/api/classes/WSAPIUser.md +637 -0
  53. package/docs/api/documents/Callbacks.md +162 -0
  54. package/docs/api/documents/SmarticoObject.md +445 -0
  55. package/docs/api/documents/Transforms.md +99 -0
  56. package/docs/api/enumerations/AchievementClaimPeriodTypeId.md +13 -0
  57. package/docs/api/enumerations/BonusStatus-1.md +11 -6
  58. package/docs/api/enumerations/BuyStoreItemErrorCode.md +32 -0
  59. package/docs/api/enumerations/JoinClanErrorCode.md +81 -0
  60. package/docs/api/enumerations/TournamentRegistrationError.md +12 -0
  61. package/docs/api/functions/clanTournamentPlayersTransform.md +13 -0
  62. package/docs/api/interfaces/AvatarCustomized.md +25 -0
  63. package/docs/api/interfaces/AvatarDefinition.md +94 -0
  64. package/docs/api/interfaces/AvatarPrompt.md +45 -0
  65. package/docs/api/interfaces/BonusMetaMap-1.md +4 -1
  66. package/docs/api/interfaces/BonusTemplateMetaMap-1.md +9 -4
  67. package/docs/api/interfaces/Clan.md +4 -0
  68. package/docs/api/interfaces/ClanInfo.md +109 -0
  69. package/docs/api/interfaces/ClanMember.md +53 -0
  70. package/docs/api/interfaces/ClanPrizePublicMeta.md +41 -0
  71. package/docs/api/interfaces/ClanPrizeStructureEntry.md +7 -1
  72. package/docs/api/interfaces/ClanPublicMeta.md +4 -0
  73. package/docs/api/interfaces/ClanTournamentPlayerRaw.md +67 -0
  74. package/docs/api/interfaces/GemsDiamondsLog.md +43 -0
  75. package/docs/api/interfaces/GetClanInfoResponse.md +61 -0
  76. package/docs/api/interfaces/GetClanTournamentPlayersResponse.md +81 -0
  77. package/docs/api/interfaces/GetRaffleWonPrizesRequest.md +59 -0
  78. package/docs/api/interfaces/GetRaffleWonPrizesResponse.md +95 -0
  79. package/docs/api/interfaces/InboxMarkMessageAction.md +10 -2
  80. package/docs/api/interfaces/JackpotDetails.md +14 -15
  81. package/docs/api/interfaces/JackpotPot.md +9 -6
  82. package/docs/api/interfaces/LeaderBoardDetailsT.md +14 -8
  83. package/docs/api/interfaces/LeaderBoardUserT.md +8 -5
  84. package/docs/api/interfaces/LeaderBoardsRewardsT.md +7 -0
  85. package/docs/api/interfaces/PointsLog.md +43 -0
  86. package/docs/api/interfaces/RaffleWonPrize.md +59 -0
  87. package/docs/api/interfaces/RaffleWonPrizePublicMeta.md +27 -0
  88. package/docs/api/interfaces/RaffleWonPrizeUser.md +43 -0
  89. package/docs/api/interfaces/SAWTemplateUI.md +10 -0
  90. package/docs/api/interfaces/TAchCategory.md +14 -4
  91. package/docs/api/interfaces/TAvatarCustomized.md +4 -4
  92. package/docs/api/interfaces/TAvatarDefinition.md +13 -14
  93. package/docs/api/interfaces/TAvatarPrompt.md +6 -6
  94. package/docs/api/interfaces/TBonus.md +16 -8
  95. package/docs/api/interfaces/TBuyStoreItemResult.md +4 -11
  96. package/docs/api/interfaces/TClaimBonusResult.md +5 -5
  97. package/docs/api/interfaces/TClan.md +8 -4
  98. package/docs/api/interfaces/TClanInfo.md +47 -0
  99. package/docs/api/interfaces/TClanJoinResult.md +11 -1
  100. package/docs/api/interfaces/TClanTournamentPlayer.md +55 -0
  101. package/docs/api/interfaces/TClanTournamentPlayersResult.md +27 -0
  102. package/docs/api/interfaces/TClans.md +3 -1
  103. package/docs/api/interfaces/TGetTranslations.md +4 -0
  104. package/docs/api/interfaces/TInboxMessage.md +14 -6
  105. package/docs/api/interfaces/TInboxMessageBody.md +18 -12
  106. package/docs/api/interfaces/TLevel.md +17 -20
  107. package/docs/api/interfaces/TLevelCurrent.md +19 -18
  108. package/docs/api/interfaces/TMiniGamePlayBatchResult.md +14 -6
  109. package/docs/api/interfaces/TMiniGamePlayResult.md +9 -4
  110. package/docs/api/interfaces/TMissionClaimRewardResult.md +6 -3
  111. package/docs/api/interfaces/TMissionOptInResult.md +6 -3
  112. package/docs/api/interfaces/TMissionOrBadge.md +5 -4
  113. package/docs/api/interfaces/TRaffleOptinResponse.md +4 -2
  114. package/docs/api/interfaces/TSegmentCheckResult.md +10 -0
  115. package/docs/api/interfaces/TSetAvatarResult.md +3 -3
  116. package/docs/api/interfaces/TStoreItem.md +11 -1
  117. package/docs/api/interfaces/TTournament.md +1 -1
  118. package/docs/api/interfaces/TTournamentDetailed.md +9 -1
  119. package/docs/api/interfaces/TTournamentRegistrationResult.md +4 -2
  120. package/docs/api/interfaces/TUICustomSection.md +23 -19
  121. package/docs/api/interfaces/TUserProfile.md +18 -16
  122. package/docs/api/interfaces/TransformedRaffleClaimPrizeResponse.md +6 -2
  123. package/docs/api/interfaces/UserAchievement.md +1 -1
  124. package/docs/api/interfaces/UserLevelExtraCountersT.md +9 -2
  125. package/docs/api/type-aliases/ActivityLogEntry.md +3 -0
  126. package/docs/native/ADDING_METHODS.md +7 -2
  127. package/docs/native/PROTOCOL.md +337 -0
  128. package/docs/ui/avatars/UIGuide_getAvatarPrompts.md +100 -0
  129. package/docs/ui/avatars/UIGuide_getAvatarsCustomized.md +90 -0
  130. package/docs/ui/avatars/UIGuide_getAvatarsList.md +105 -0
  131. package/docs/ui/avatars/UIGuide_setAvatar.md +118 -0
  132. package/docs/ui/bonuses/UIGuide_claimBonus.md +144 -0
  133. package/docs/ui/bonuses/UIGuide_getBonuses.md +176 -0
  134. package/docs/ui/clans/UIGuide_getClanInfo.md +153 -0
  135. package/docs/ui/clans/UIGuide_getClans.md +172 -0
  136. package/docs/ui/clans/UIGuide_joinClan.md +196 -0
  137. package/docs/ui/gamepick/UIGuide_gamePickGetActiveRound.md +99 -0
  138. package/docs/ui/gamepick/UIGuide_gamePickGetActiveRounds.md +76 -0
  139. package/docs/ui/gamepick/UIGuide_gamePickGetBoard.md +81 -0
  140. package/docs/ui/gamepick/UIGuide_gamePickGetGameInfo.md +78 -0
  141. package/docs/ui/gamepick/UIGuide_gamePickGetHistory.md +55 -0
  142. package/docs/ui/gamepick/UIGuide_gamePickGetRoundInfoForUser.md +71 -0
  143. package/docs/ui/gamepick/UIGuide_gamePickGetUserInfo.md +64 -0
  144. package/docs/ui/gamepick/UIGuide_gamePickSubmitSelection.md +103 -0
  145. package/docs/ui/gamepick/UIGuide_gamePickSubmitSelectionQuiz.md +67 -0
  146. package/docs/ui/general/UIGuide_getCustomSections.md +137 -0
  147. package/docs/ui/general/UIGuide_getRelatedItemsForGame.md +140 -0
  148. package/docs/ui/inbox/UIGuide_deleteInboxMessage.md +135 -0
  149. package/docs/ui/inbox/UIGuide_getInboxMessageBody.md +133 -0
  150. package/docs/ui/inbox/UIGuide_getInboxMessages.md +186 -0
  151. package/docs/ui/inbox/UIGuide_markInboxMessageAsRead.md +122 -0
  152. package/docs/ui/inbox/UIGuide_markUnmarkInboxMessageAsFavorite.md +84 -0
  153. package/docs/ui/jackpots/UIGuide_getJackpotEligibleGames.md +73 -0
  154. package/docs/ui/jackpots/UIGuide_getJackpotWinners.md +83 -0
  155. package/docs/ui/jackpots/UIGuide_jackpotGet.md +138 -0
  156. package/docs/ui/jackpots/UIGuide_jackpotOptIn.md +85 -0
  157. package/docs/ui/jackpots/UIGuide_jackpotOptOut.md +65 -0
  158. package/docs/ui/leaderboard/UIGuide_getLeaderBoard.md +166 -0
  159. package/docs/ui/minigames/UIGuide_getMiniGames.md +153 -0
  160. package/docs/ui/minigames/UIGuide_getMiniGamesHistory.md +90 -0
  161. package/docs/ui/minigames/UIGuide_playMiniGame.md +150 -0
  162. package/docs/ui/minigames/UIGuide_playMiniGameBatch.md +128 -0
  163. package/docs/ui/missions/UIGuide_getAchCategories.md +17 -0
  164. package/docs/ui/missions/UIGuide_getBadges.md +237 -0
  165. package/docs/ui/missions/UIGuide_getMissions.md +268 -0
  166. package/docs/ui/missions/UIGuide_requestMissionClaimReward.md +21 -0
  167. package/docs/ui/missions/UIGuide_requestMissionOptIn.md +16 -0
  168. package/docs/ui/raffles/UIGuide_claimRafflePrize.md +99 -0
  169. package/docs/ui/raffles/UIGuide_getRaffleDrawRun.md +117 -0
  170. package/docs/ui/raffles/UIGuide_getRaffleDrawRunsHistory.md +92 -0
  171. package/docs/ui/raffles/UIGuide_getRaffleWonPrizes.md +120 -0
  172. package/docs/ui/raffles/UIGuide_getRaffles.md +175 -0
  173. package/docs/ui/raffles/UIGuide_requestRaffleOptin.md +114 -0
  174. package/docs/ui/store/UIGuide_buyStoreItem.md +133 -0
  175. package/docs/ui/store/UIGuide_getStoreCategories.md +19 -0
  176. package/docs/ui/store/UIGuide_getStoreItems.md +264 -0
  177. package/docs/ui/store/UIGuide_getStorePurchasedItems.md +122 -0
  178. package/docs/ui/tournaments/UIGuide_getClanTournamentPlayers.md +140 -0
  179. package/docs/ui/tournaments/UIGuide_getTournamentInstanceInfo.md +265 -0
  180. package/docs/ui/tournaments/UIGuide_getTournamentsList.md +236 -0
  181. package/docs/ui/tournaments/UIGuide_registerInTournament.md +156 -0
  182. package/docs/ui/user/UIGuide_getActivityLog.md +130 -0
  183. package/docs/ui/user/UIGuide_getLevels.md +167 -0
  184. package/docs/ui/user/UIGuide_getUserProfile.md +213 -0
  185. package/package.json +3 -3
  186. package/scripts/postdoc-cleanup.js +195 -0
  187. package/src/Base/ClassId.ts +2 -0
  188. package/src/Jackpots/JackpotDetails.ts +14 -15
  189. package/src/Jackpots/JackpotPot.ts +10 -6
  190. package/src/Missions/MissionsUtils.ts +5 -2
  191. package/src/Raffle/GetRaffleWonPrizesRequest.ts +12 -0
  192. package/src/Raffle/GetRaffleWonPrizesResponse.ts +56 -0
  193. package/src/Raffle/index.ts +3 -1
  194. package/src/SmarticoAPI.ts +14 -1
  195. package/src/SmarticoLib/index.ts +4 -0
  196. package/src/Store/BuyStoreItemErrorCode.ts +8 -0
  197. package/src/Store/StoreItem.ts +1 -0
  198. package/src/Store/StoreItemPurchased.ts +1 -0
  199. package/src/Store/StoreItemType.ts +1 -1
  200. package/src/Tournaments/TournamentRegistrationError.ts +4 -0
  201. package/src/WSAPI/WSAPI.ts +27 -2007
  202. package/src/WSAPI/WSAPIAvatars.ts +345 -0
  203. package/src/WSAPI/WSAPIBase.ts +93 -0
  204. package/src/WSAPI/WSAPIBonuses.ts +268 -0
  205. package/src/WSAPI/WSAPIClans.ts +417 -0
  206. package/src/WSAPI/WSAPIGamePick.ts +667 -0
  207. package/src/WSAPI/WSAPIGeneral.ts +199 -0
  208. package/src/WSAPI/WSAPIInbox.ts +711 -0
  209. package/src/WSAPI/WSAPIJackpots.ts +448 -0
  210. package/src/WSAPI/WSAPILeaderBoard.ts +154 -0
  211. package/src/WSAPI/WSAPIMiniGames.ts +597 -0
  212. package/src/WSAPI/WSAPIMissions.ts +572 -0
  213. package/src/WSAPI/WSAPIRaffles.ts +703 -0
  214. package/src/WSAPI/WSAPIStore.ts +732 -0
  215. package/src/WSAPI/WSAPITournaments.ts +541 -0
  216. package/src/WSAPI/WSAPITypes.ts +376 -207
  217. package/src/WSAPI/WSAPIUser.ts +606 -0
  218. package/tsconfig.json +26 -2
  219. package/docs/api/classes/WSAPI.md +0 -1927
@@ -0,0 +1,199 @@
1
+ import { ECacheContext, OCache } from '../OCache';
2
+ import {
3
+ TGetTranslations,
4
+ TUICustomSection,
5
+ } from './WSAPITypes';
6
+ import { GetRelatedAchTourResponse } from '../Missions/GetRelatedAchTourResponse';
7
+ import {
8
+ CACHE_DATA_SEC,
9
+ onUpdateContextKey,
10
+ } from './WSAPIBase';
11
+ import { WSAPIUser } from './WSAPIUser';
12
+
13
+ /** @group General */
14
+ export class WSAPIGeneral extends WSAPIUser {
15
+ /**
16
+ * Returns the operator-configured "custom sections" the current user is eligible
17
+ * to see. Custom sections are nav-level entries the operator builds in the BO —
18
+ * HTML pages, themed mission grids, store / raffle / tournament category pages,
19
+ * lootbox calendars, redirect links, and Liquid-templated dashboards — each
20
+ * surfaced with its own icon and label.
21
+ *
22
+ * Use the response to build the side menu / bottom-bar / nav grid of a
23
+ * gamification widget. Each section's `section_type_id` (see
24
+ * {@link AchCustomSectionType}) tells the consumer which page component to mount
25
+ * when the user opens the section.
26
+ *
27
+ * @remarks
28
+ * **Preconditions**
29
+ * - No prerequisite calls. Typically fetched once at app boot to build the
30
+ * navigation skeleton.
31
+ *
32
+ * **Server-side eligibility filtering**
33
+ * Sections are filtered server-side by the user's segments / level / brand and
34
+ * the section's `active_from_date` / `active_till_date` window. Sections the
35
+ * user is ineligible for are omitted from the response entirely — there is no
36
+ * "locked" state to render.
37
+ *
38
+ * **Ordering**
39
+ * Response is server-ordered. Render in the order received; do NOT re-sort
40
+ * client-side (the operator's order is the intended nav order).
41
+ *
42
+ * **Refresh**
43
+ * - The SDK caches results for 30 seconds.
44
+ * - No push subscription. Re-call after a segment / level change might
45
+ * make new sections eligible, or just rely on the 30 s cache turnover.
46
+ *
47
+ * **Visitor mode**: supported.
48
+ *
49
+ * **UI guidance**: see [UI Guide — `getCustomSections`](../../docs/ui/general/UIGuide_getCustomSections.md).
50
+ *
51
+ * @returns Array of {@link TUICustomSection} — empty if the label has no
52
+ * active custom sections or the user is ineligible for all of them.
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * const sections = await window._smartico.api.getCustomSections();
57
+ *
58
+ * for (const s of sections) {
59
+ * console.log('[smartico] nav entry', s.menu_name, 'type', s.section_type_id, '→ mount the matching page component');
60
+ * // Render s.menu_img (64x64) as the nav icon and s.menu_name as the label.
61
+ * // For section_type_id === AchCustomSectionType.REDIRECT_LINK, do NOT mount a page —
62
+ * // resolve s.url_or_dp on click (DP string or external URL).
63
+ * }
64
+ * ```
65
+ */
66
+ public async getCustomSections(): Promise<TUICustomSection[]> {
67
+ return OCache.use(
68
+ onUpdateContextKey.CustomSections,
69
+ ECacheContext.WSAPI,
70
+ () => this.api.customSectionsGetT(this.userExtId),
71
+ CACHE_DATA_SEC,
72
+ );
73
+ }
74
+
75
+ /**
76
+ * Returns the full set of operator-defined translation key/value pairs for the
77
+ * label, merged across the requested language and the English baseline.
78
+ *
79
+ * Translation keys are free-form strings defined by the operator in the BO. The
80
+ * SDK consumer treats the result as a flat dictionary: `translations[key]`. If
81
+ * the key is missing entirely, do NOT trust `undefined` semantics — defensively
82
+ * fall back to the key string itself or a hardcoded literal.
83
+ *
84
+ * @remarks
85
+ * **Preconditions**
86
+ * - No prerequisite calls.
87
+ * - `lang_code` is the ISO language code the operator uses in the BO
88
+ * (e.g. `"EN"`, `"FR"`, `"ES"`). Case is not normalised — match what the
89
+ * operator configured.
90
+ *
91
+ * **EN fallback**
92
+ * The SDK issues an English-baseline fetch first, then overlays the
93
+ * `lang_code` translations on top. Any key the operator has only defined in
94
+ * English (i.e. missing in the requested language) is returned with the
95
+ * English value. Keys missing in both are absent from the map — the consumer
96
+ * must handle missing keys (the default Smartico UI returns the key string
97
+ * itself as the fallback text).
98
+ *
99
+ * **What's included**
100
+ * The SDK passes an empty `areas` filter to the server, which returns ALL
101
+ * translation namespaces configured for the label (Gamification, Casino,
102
+ * Trading, Affiliation, etc. — whichever are populated). For a Gamification-
103
+ * only widget, the consumer can ignore unused namespaces — keys are flat
104
+ * strings, not nested.
105
+ *
106
+ * **Refresh**
107
+ * - Cached internally per `(lang_code, label, brand)` for ~30 seconds.
108
+ * - No push subscription. Operators editing translations in the BO will see
109
+ * the change after the cache window expires.
110
+ *
111
+ * **Visitor mode**: supported. Translations are label-scoped, not user-
112
+ * scoped — `lang_code` is the sole language selector and is independent of
113
+ * the `vapi(lang)` argument used elsewhere.
114
+ *
115
+ * @param lang_code ISO language code (e.g. `"EN"`, `"FR"`). Defaults to
116
+ * `"EN"` server-side if empty.
117
+ * @returns {@link TGetTranslations} — `{ translations: { [key]: string } }`.
118
+ *
119
+ * @example
120
+ * ```ts
121
+ * const r = await window._smartico.api.getTranslations('FR');
122
+ *
123
+ * // Defensive lookup: fall back to the key itself if the operator hasn't
124
+ * // defined the string.
125
+ * const t = (k: string) => r.translations[k] ?? k;
126
+ *
127
+ * console.log('[smartico] localized label "missions_title" →', t('missions_title'));
128
+ * ```
129
+ */
130
+ public async getTranslations(lang_code: string): Promise<TGetTranslations> {
131
+ const r = await this.api.getTranslationsT(this.userExtId, lang_code, []);
132
+
133
+ return {
134
+ translations: r.translations,
135
+ };
136
+ }
137
+
138
+ /**
139
+ * Returns the missions and tournaments associated with a casino / sportsbook
140
+ * game in the operator's games catalog — the reverse of "given this mission,
141
+ * which games count for it" — so you can surface "play this game to progress
142
+ * mission X" / "tournament Y features this game" badges on game tiles or
143
+ * detail screens.
144
+ *
145
+ * The shape mirrors `getMissions` (`UserAchievement[]`) and `getTournamentsList`
146
+ * (`Tournament[]`) — same wire types, no reduced subset.
147
+ *
148
+ * @remarks
149
+ * **Preconditions**
150
+ * - `related_game_id` must be a Games Catalog ID (the same external string the
151
+ * operator uses in the catalog at
152
+ * {@link https://help.smartico.ai/welcome/technical-guides/games-catalog-api}).
153
+ *
154
+ * **Server-side eligibility filtering**
155
+ * Missions and tournaments are filtered by the user's segments / level / brand
156
+ * before being returned. A user who is ineligible for a mission segment will
157
+ * NOT see that mission in the result even if it lists the game. The same
158
+ * filtering applies to tournaments. Treat the response as "what this user
159
+ * should see" — no client-side eligibility pass needed.
160
+ *
161
+ * **No cache**
162
+ * Every call is a live server round-trip. Missions/tournaments are operator-
163
+ * mutated state (opt-in, completion, expiry) that changes during a session;
164
+ * caching staler than the user's last action would mis-render eligibility.
165
+ * Avoid building a consumer-side cache for UI-critical paths.
166
+ *
167
+ * **Refresh**
168
+ * - Re-call when the user navigates to a new game tile / detail surface.
169
+ * - Re-call after the user opts into / completes a related mission to refresh
170
+ * the "play this game" badge.
171
+ *
172
+ * **Visitor mode**: supported via `_smartico.vapi(lang).getRelatedItemsForGame(...)`.
173
+ *
174
+ * **UI guidance**: see [UI Guide — `getRelatedItemsForGame`](../../docs/ui/general/UIGuide_getRelatedItemsForGame.md).
175
+ *
176
+ * @param related_game_id External Games Catalog ID of the game (e.g. `"gold-slot2"`).
177
+ * @returns {@link GetRelatedAchTourResponse} — `{ achievements, tournaments? }`.
178
+ * `tournaments` may be `undefined` (treat as empty); both arrays may be empty
179
+ * when no eligible entities reference the game.
180
+ *
181
+ * @example
182
+ * ```ts
183
+ * const r = await window._smartico.api.getRelatedItemsForGame('gold-slot2');
184
+ *
185
+ * const missions = r.achievements ?? [];
186
+ * const tournaments = r.tournaments ?? [];
187
+ *
188
+ * if (missions.length === 0 && tournaments.length === 0) {
189
+ * console.log('[smartico] no related missions / tournaments — hide the related badge on the game tile');
190
+ * } else {
191
+ * console.log('[smartico] related entities:', missions.length, 'missions /', tournaments.length, 'tournaments — show a "X missions / Y tournaments" badge');
192
+ * }
193
+ * ```
194
+ */
195
+ public async getRelatedItemsForGame(related_game_id: string): Promise<GetRelatedAchTourResponse> {
196
+ const result = await this.api.getRelatedItemsForGame(this.userExtId, related_game_id);
197
+ return result;
198
+ }
199
+ }