@smartico/public-api 0.0.402 → 0.0.404
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.
- package/.claude/skills/api-tsdoc/SKILL.md +675 -0
- package/.claude/skills/api-tsdoc-final/SKILL.md +266 -0
- package/.claude/skills/api-tsdoc-howto/SKILL.md +143 -0
- package/dist/MiniGames/SAWTemplate.d.ts +4 -0
- package/dist/NodeCache.d.ts +1 -0
- package/dist/OCache.d.ts +7 -0
- package/dist/SmarticoGlobal.d.ts +0 -6
- package/dist/WSAPI/WSAPITypes.d.ts +43 -0
- package/dist/WSAPI/WSAPIUser.d.ts +3 -0
- package/dist/index.js +92 -33
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +60 -10
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/interfaces/TUserProfile.md +136 -0
- package/docs/capabilities/_responses/buyStoreItem.json +4 -0
- package/docs/capabilities/_responses/claimBonus.json +4 -0
- package/docs/capabilities/_responses/gamePickGetActiveRound.json +95 -0
- package/docs/capabilities/_responses/gamePickGetActiveRounds.json +191 -0
- package/docs/capabilities/_responses/gamePickGetBoard.json +47 -0
- package/docs/capabilities/_responses/gamePickGetGameInfo.json +355 -0
- package/docs/capabilities/_responses/gamePickGetHistory.json +191 -0
- package/docs/capabilities/_responses/gamePickGetUserInfo.json +14 -0
- package/docs/capabilities/_responses/getAchCategories.json +12 -0
- package/docs/capabilities/_responses/getActivityLog.json +1 -0
- package/docs/capabilities/_responses/getAvatarPrompts.json +16 -0
- package/docs/capabilities/_responses/getAvatarsCustomized.json +12 -0
- package/docs/capabilities/_responses/getAvatarsList.json +24 -0
- package/docs/capabilities/_responses/getBadges.json +98 -0
- package/docs/capabilities/_responses/getBonuses.json +18 -0
- package/docs/capabilities/_responses/getClanInfo.json +39 -0
- package/docs/capabilities/_responses/getClans.json +35 -0
- package/docs/capabilities/_responses/getCurrentLevel.json +20 -0
- package/docs/capabilities/_responses/getCustomSections.json +25 -0
- package/docs/capabilities/_responses/getInboxMessageBody.json +7 -0
- package/docs/capabilities/_responses/getInboxMessages.json +18 -0
- package/docs/capabilities/_responses/getInboxUnreadCount.json +1 -0
- package/docs/capabilities/_responses/getJackpotEligibleGames.json +20 -0
- package/docs/capabilities/_responses/getJackpotWinners.json +28 -0
- package/docs/capabilities/_responses/getLeaderBoard.json +45 -0
- package/docs/capabilities/_responses/getLevels.json +40 -0
- package/docs/capabilities/_responses/getMiniGames.json +208 -0
- package/docs/capabilities/_responses/getMiniGamesHistory.json +1 -0
- package/docs/capabilities/_responses/getMissions.json +117 -0
- package/docs/capabilities/_responses/getRaffleDrawRun.json +62 -0
- package/docs/capabilities/_responses/getRaffleDrawRunsHistory.json +34 -0
- package/docs/capabilities/_responses/getRaffles.json +140 -0
- package/docs/capabilities/_responses/getStoreCategories.json +12 -0
- package/docs/capabilities/_responses/getStoreItems.json +47 -0
- package/docs/capabilities/_responses/getStorePurchasedItems.json +49 -0
- package/docs/capabilities/_responses/getTournamentInstanceInfo.json +75 -0
- package/docs/capabilities/_responses/getTournamentsList.json +66 -0
- package/docs/capabilities/_responses/getTranslations.json +25 -0
- package/docs/capabilities/_responses/getUserLevelExtraCounters.json +4 -0
- package/docs/capabilities/_responses/getUserProfile.json +34 -0
- package/docs/capabilities/_responses/jackpotGet.json +113 -0
- package/docs/capabilities/_responses/jackpotOptIn.json +9 -0
- package/docs/capabilities/_responses/jackpotOptOut.json +9 -0
- package/docs/capabilities/_responses/markAllInboxMessagesAsRead.json +4 -0
- package/docs/capabilities/_responses/markInboxMessageAsRead.json +4 -0
- package/docs/capabilities/_responses/markUnmarkInboxMessageAsFavorite.json +4 -0
- package/docs/capabilities/_responses/miniGameWinAcknowledgeRequest.json +10 -0
- package/docs/capabilities/_responses/playMiniGame.json +6 -0
- package/docs/capabilities/_responses/playMiniGameBatch.json +9 -0
- package/docs/capabilities/_responses/registerInTournament.json +4 -0
- package/docs/capabilities/_responses/requestMissionOptIn.json +4 -0
- package/docs/capabilities/_responses/setAvatar.json +4 -0
- package/docs/capabilities/avatarsCustomize.md +115 -0
- package/docs/capabilities/buyStoreItem.md +179 -0
- package/docs/capabilities/checkSegmentListMatch.md +69 -0
- package/docs/capabilities/checkSegmentMatch.md +74 -0
- package/docs/capabilities/claimBonus.md +125 -0
- package/docs/capabilities/claimRafflePrize.md +116 -0
- package/docs/capabilities/deleteAllInboxMessages.md +66 -0
- package/docs/capabilities/deleteInboxMessage.md +60 -0
- package/docs/capabilities/gamePickGetActiveRound.md +248 -0
- package/docs/capabilities/gamePickGetActiveRounds.md +259 -0
- package/docs/capabilities/gamePickGetBoard.md +202 -0
- package/docs/capabilities/gamePickGetGameInfo.md +318 -0
- package/docs/capabilities/gamePickGetHistory.md +244 -0
- package/docs/capabilities/gamePickGetRoundInfoForUser.md +189 -0
- package/docs/capabilities/gamePickGetUserInfo.md +91 -0
- package/docs/capabilities/gamePickSubmitSelection.md +222 -0
- package/docs/capabilities/gamePickSubmitSelectionQuiz.md +198 -0
- package/docs/capabilities/getAchCategories.md +119 -0
- package/docs/capabilities/getActivityLog.md +108 -0
- package/docs/capabilities/getAvatarPrompts.md +81 -0
- package/docs/capabilities/getAvatarsCustomized.md +96 -0
- package/docs/capabilities/getAvatarsList.md +101 -0
- package/docs/capabilities/getBadges.md +237 -0
- package/docs/capabilities/getBonuses.md +159 -0
- package/docs/capabilities/getClanInfo.md +164 -0
- package/docs/capabilities/getClanTournamentPlayers.md +112 -0
- package/docs/capabilities/getClans.md +168 -0
- package/docs/capabilities/getCurrentLevel.md +123 -0
- package/docs/capabilities/getCustomSections.md +96 -0
- package/docs/capabilities/getInboxMessageBody.md +87 -0
- package/docs/capabilities/getInboxMessages.md +146 -0
- package/docs/capabilities/getInboxUnreadCount.md +54 -0
- package/docs/capabilities/getJackpotEligibleGames.md +93 -0
- package/docs/capabilities/getJackpotWinners.md +113 -0
- package/docs/capabilities/getLeaderBoard.md +187 -0
- package/docs/capabilities/getLeaderBoards.md +88 -0
- package/docs/capabilities/getLevels.md +118 -0
- package/docs/capabilities/getMiniGames.md +295 -0
- package/docs/capabilities/getMiniGamesHistory.md +183 -0
- package/docs/capabilities/getMissions.md +253 -0
- package/docs/capabilities/getRaffleDrawRun.md +210 -0
- package/docs/capabilities/getRaffleDrawRunsHistory.md +116 -0
- package/docs/capabilities/getRaffleWonPrizes.md +153 -0
- package/docs/capabilities/getRaffles.md +249 -0
- package/docs/capabilities/getRelatedItemsForGame.md +236 -0
- package/docs/capabilities/getStoreCategories.md +128 -0
- package/docs/capabilities/getStoreItems.md +260 -0
- package/docs/capabilities/getStorePurchasedItems.md +280 -0
- package/docs/capabilities/getTournamentInstanceInfo.md +301 -0
- package/docs/capabilities/getTournamentsList.md +234 -0
- package/docs/capabilities/getTranslations.md +95 -0
- package/docs/capabilities/getUserLevelExtraCounters.md +92 -0
- package/docs/capabilities/getUserProfile.md +184 -0
- package/docs/capabilities/jackpotGet.md +173 -0
- package/docs/capabilities/jackpotOptIn.md +94 -0
- package/docs/capabilities/jackpotOptOut.md +92 -0
- package/docs/capabilities/joinClan.md +169 -0
- package/docs/capabilities/markAllInboxMessagesAsRead.md +72 -0
- package/docs/capabilities/markInboxMessageAsRead.md +69 -0
- package/docs/capabilities/markUnmarkInboxMessageAsFavorite.md +75 -0
- package/docs/capabilities/miniGameWinAcknowledgeRequest.md +98 -0
- package/docs/capabilities/playMiniGame.md +217 -0
- package/docs/capabilities/playMiniGameBatch.md +129 -0
- package/docs/capabilities/registerInTournament.md +187 -0
- package/docs/capabilities/reportClickEvent.md +74 -0
- package/docs/capabilities/reportImpressionEvent.md +67 -0
- package/docs/capabilities/requestMissionClaimReward.md +117 -0
- package/docs/capabilities/requestMissionOptIn.md +98 -0
- package/docs/capabilities/requestRaffleOptin.md +108 -0
- package/docs/capabilities/setAvatar.md +132 -0
- package/docs/capabilities/smarticoCallbacks.md +165 -0
- package/docs/capabilities/smarticoGlobal.md +62 -0
- package/package.json +3 -2
- package/readme-smartico-dev.md +208 -0
- package/scripts/capture-responses-browser.mjs +301 -0
- package/scripts/gen-capabilities.js +368 -0
- package/scripts/run-public-api.mjs +105 -0
- package/src/MiniGames/SAWGetTemplatesResponse.ts +2 -0
- package/src/MiniGames/SAWTemplate.ts +5 -0
- package/src/NodeCache.ts +8 -0
- package/src/OCache.ts +17 -0
- package/src/SmarticoGlobal.ts +0 -7
- package/src/WSAPI/WSAPI.ts +3 -3
- package/src/WSAPI/WSAPIJackpots.ts +4 -1
- package/src/WSAPI/WSAPIMiniGames.ts +1 -1
- package/src/WSAPI/WSAPITypes.ts +44 -0
- package/src/WSAPI/WSAPIUser.ts +30 -5
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# getRaffleWonPrizes — API (GetRaffleWonPrizesResponse)
|
|
2
|
+
|
|
3
|
+
> Returns every prize the current user has won within a single raffle — across ALL of that raffle's draws, newest-won first — in one paginated call.
|
|
4
|
+
> Import: `import { GetRaffleWonPrizesResponse } from '@smartico/public-api'`
|
|
5
|
+
> Search terms: getRaffleWonPrizes, raffles, GetRaffleWonPrizesResponse, RaffleWonPrizeUser, RaffleWonPrize, RaffleWonPrizePublicMeta
|
|
6
|
+
|
|
7
|
+
## Signature
|
|
8
|
+
```ts
|
|
9
|
+
_smartico.api.getRaffleWonPrizes(props: { raffle_id: number; offset?: number; limit?: number }): Promise<GetRaffleWonPrizesResponse>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Parameters
|
|
13
|
+
- `props.raffle_id` — The parent raffle's `id` (from `TRaffle.id`). Required.
|
|
14
|
+
- `props.offset` — Zero-based index of the first row to return. Defaults to `0`.
|
|
15
|
+
- `props.limit` — Page size. Defaults to `20`.
|
|
16
|
+
|
|
17
|
+
## Returns — `Promise<GetRaffleWonPrizesResponse>`
|
|
18
|
+
`GetRaffleWonPrizesResponse`:
|
|
19
|
+
- `cid` (number)
|
|
20
|
+
- `ts` (number)
|
|
21
|
+
- `uuid` (string)
|
|
22
|
+
- `errCode` (number)
|
|
23
|
+
- `errMsg` (string)
|
|
24
|
+
- `user` (RaffleWonPrizeUser | null) — The user the won prizes belong to; `null` when `won_prizes` is empty.
|
|
25
|
+
- `user_id` (number) — Internal user ID.
|
|
26
|
+
- `avatar_id` (string) — Avatar image: a full URL for a system avatar, otherwise an avatar token to resolve against the widget's avatar domain.
|
|
27
|
+
- `avatar_real_id` (number) — Numeric ID of the user's selected avatar definition.
|
|
28
|
+
- `public_username` (string) — Public username; server-masked for other users (e.g. `"32:r*****"`).
|
|
29
|
+
- `avatar_url` (string | null) — Always `null` on the wire — use `avatar_id`.
|
|
30
|
+
- `won_prizes` (RaffleWonPrize[]) — Page of won prizes for the requested raffle, newest-first.
|
|
31
|
+
- `raf_won_id` (number) — Unique ID of the winning row (pass to `claimRafflePrize` when `requires_claim` is `true`).
|
|
32
|
+
- `prize_id` (number) — ID of the prize definition.
|
|
33
|
+
- `raffle_run_id` (number) — Run-instance ID of the draw that awarded this prize.
|
|
34
|
+
- `draw_id` (number) — Schedule ID of the draw that awarded this prize.
|
|
35
|
+
- `public_meta` (RaffleWonPrizePublicMeta) — Presentation meta (name / image).
|
|
36
|
+
- `name` (string) — Name of the prize, e.g. '1 $'.
|
|
37
|
+
- `hide_chance_to_win` (boolean) — Indicates whether the chance to win should be hidden in the UI.
|
|
38
|
+
- `image_url` (string) — URL of the image that represents the prize.
|
|
39
|
+
- `requires_claim` (boolean) — Whether this prize requires a claim action from the user.
|
|
40
|
+
- `claimed_date` (number | null) — Epoch ms when the prize was claimed; `null` when not yet claimed.
|
|
41
|
+
- `total` (number) — Total number of won prizes for this user/raffle across all draws (for pagination).
|
|
42
|
+
- `offset` (number) — Zero-based offset of this page (echoes the resolved request).
|
|
43
|
+
- `limit` (number) — Page size (echoes the resolved request).
|
|
44
|
+
|
|
45
|
+
## Behavioral contract
|
|
46
|
+
**Authentication required**
|
|
47
|
+
Works only for an identified (logged-in) user. Visitor / anonymous
|
|
48
|
+
sessions are rejected — call this only after identify.
|
|
49
|
+
|
|
50
|
+
**Preconditions**
|
|
51
|
+
`raffle_id` is required — the SDK throws synchronously when it is
|
|
52
|
+
missing or falsy.
|
|
53
|
+
|
|
54
|
+
**Coverage & sort order**
|
|
55
|
+
Includes the user's wins from every draw of the raffle — recurring,
|
|
56
|
+
one-shot, and grand draws, across all historical runs. Rows are ordered
|
|
57
|
+
newest-win first; there is no "unclaimed first" ordering, so sort
|
|
58
|
+
client-side if you want claimable prizes at the top.
|
|
59
|
+
|
|
60
|
+
**Pagination**
|
|
61
|
+
`offset` / `limit` page the `won_prizes[]` rows (the SDK defaults to
|
|
62
|
+
`0` / `20`). `total` is the authoritative full count of the user's wins
|
|
63
|
+
for this raffle across all draws — drive "load more" from it
|
|
64
|
+
(`offset + won_prizes.length < total`). An `offset` past the end returns
|
|
65
|
+
an empty `won_prizes[]` with the real `total` and `errCode 0` — not an
|
|
66
|
+
error. The server does NOT clamp `limit`, so always pass an explicit,
|
|
67
|
+
sane page size.
|
|
68
|
+
|
|
69
|
+
**Rate limit**
|
|
70
|
+
The server caps this at roughly 30 calls per minute with a ~5-second
|
|
71
|
+
minimum gap between calls. Fetch on screen open and on explicit "load
|
|
72
|
+
more" — don't poll it on a timer.
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
**Reading the result**
|
|
77
|
+
- Null-check `user` before reading it — it is `null` whenever
|
|
78
|
+
`won_prizes` is empty.
|
|
79
|
+
- For the avatar, use `user.avatar_id` (already a full URL for a system
|
|
80
|
+
avatar, otherwise an avatar token to resolve against the widget's
|
|
81
|
+
avatar domain); `user.avatar_url` is always `null`.
|
|
82
|
+
- Render `public_username` as-is (it is server-masked for privacy, e.g.
|
|
83
|
+
`"32:r*****"`) and substitute a "You" label for the current user.
|
|
84
|
+
- Treat `claimed_date` as the claim flag: `null` until claimed, then
|
|
85
|
+
epoch ms.
|
|
86
|
+
|
|
87
|
+
**Idempotency / Side effects**: safe and read-only — one-shot promise,
|
|
88
|
+
no client cache, no subscription. The server caches the response
|
|
89
|
+
briefly; a successful `claimRafflePrize` invalidates that cache,
|
|
90
|
+
so a follow-up call reflects the new `claimed_date`. This method does
|
|
91
|
+
NOT refresh the `getRaffles` list or fire its `onUpdate` — re-call
|
|
92
|
+
manually to pick up newly-won prizes or a `claimed_date` flip.
|
|
93
|
+
|
|
94
|
+
**UI guidance**: see [UI Guide — `getRaffleWonPrizes`](../../docs/ui/raffles/UIGuide_getRaffleWonPrizes.md).
|
|
95
|
+
|
|
96
|
+
**Visitor mode**: not supported (see "Authentication required").
|
|
97
|
+
|
|
98
|
+
## Example
|
|
99
|
+
```ts
|
|
100
|
+
const raffles = await window._smartico.api.getRaffles();
|
|
101
|
+
const raffle = raffles[0];
|
|
102
|
+
|
|
103
|
+
// First page of the user's won prizes for this raffle.
|
|
104
|
+
const page = await window._smartico.api.getRaffleWonPrizes({
|
|
105
|
+
raffle_id: raffle.id,
|
|
106
|
+
offset: 0,
|
|
107
|
+
limit: 20,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
if (page.errCode !== 0) {
|
|
111
|
+
console.error('[smartico] could not load won prizes — show a retry state:', page.errMsg);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (page.won_prizes.length === 0) {
|
|
115
|
+
console.log('[smartico] no wins in this raffle (or not eligible) — render the empty state');
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
console.log('[smartico]', page.user?.public_username, 'won', page.total, 'prizes total');
|
|
120
|
+
for (const prize of page.won_prizes) {
|
|
121
|
+
console.log('[smartico] render prize card —', prize.public_meta.name, prize.public_meta.image_url);
|
|
122
|
+
if (prize.requires_claim && !prize.claimed_date) {
|
|
123
|
+
console.log('[smartico] show a Claim CTA — on click call claimRafflePrize({ won_id:', prize.raf_won_id, '})');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Load more.
|
|
128
|
+
if (page.offset + page.won_prizes.length < page.total) {
|
|
129
|
+
const next = await window._smartico.api.getRaffleWonPrizes({
|
|
130
|
+
raffle_id: raffle.id,
|
|
131
|
+
offset: page.offset + page.limit,
|
|
132
|
+
limit: 20,
|
|
133
|
+
});
|
|
134
|
+
console.log('[smartico] appended', next.won_prizes.length, 'more prizes');
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Errors
|
|
139
|
+
**Error codes** (in `errCode`)
|
|
140
|
+
- `0` — success. Also returned with an empty `won_prizes[]` and
|
|
141
|
+
`total 0` when the user has no wins, or is not eligible to see this
|
|
142
|
+
raffle.
|
|
143
|
+
- `1` — generic server error; surface `errMsg` if present.
|
|
144
|
+
|
|
145
|
+
There are no granular codes — an unknown raffle, an ineligible user,
|
|
146
|
+
and "no wins" all surface as `errCode 0` with an empty list.
|
|
147
|
+
|
|
148
|
+
## Related
|
|
149
|
+
- `getRaffleDrawRunsHistory`
|
|
150
|
+
- `getRaffleDrawRun`
|
|
151
|
+
- `claimRafflePrize`
|
|
152
|
+
- `getRaffles`
|
|
153
|
+
- `GetRaffleWonPrizesResponse`
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# getRaffles — API (TRaffle)
|
|
2
|
+
|
|
3
|
+
> Returns all raffles visible to the current user, each carrying an embedded `draws[]` array with per-draw state (current state, ticket counts, opt-in status, prize structure).
|
|
4
|
+
> Import: `import { TRaffle } from '@smartico/public-api'`
|
|
5
|
+
> Search terms: getRaffles, raffles, TRaffle, TRaffleDraw, TRafflePrize, RaffleDrawInstanceState, RaffleDrawTypeExecution, TRaffleTicket, RaffleTicketCapVisualization, onUpdate, subscription, id, name, description, custom_section_id, image_url, image_url_mobile, start_date, end_date
|
|
6
|
+
|
|
7
|
+
## Signature
|
|
8
|
+
```ts
|
|
9
|
+
_smartico.api.getRaffles({ onUpdate }: { onUpdate?: (data: TRaffle[]) => void } = {}): Promise<TRaffle[]>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Parameters
|
|
13
|
+
- `params` — Optional. Omit to fetch without subscribing.
|
|
14
|
+
- `params.onUpdate` — Callback invoked with the full refreshed raffles list after every `claimRafflePrize` or `requestRaffleOptin` round-trip on this connection.
|
|
15
|
+
|
|
16
|
+
## Returns — `Promise<TRaffle[]>`
|
|
17
|
+
Array of `TRaffle`. Each item:
|
|
18
|
+
- `id` (number) — ID of the Raffle template
|
|
19
|
+
- `name` (string) — Name of the raffle
|
|
20
|
+
- `description` (string) — Description of the raffle
|
|
21
|
+
- `custom_section_id` (number) — ID of the custom section that is linked to the raffle in the Gamification widget
|
|
22
|
+
- `image_url` (string) — URL of the image that represents the raffle, 890x193px
|
|
23
|
+
- `image_url_mobile` (string) — URL of the mobile image that represents the raffle, 300x142px
|
|
24
|
+
- `custom_data` (string) — Custom data as string or JSON string that can be used in API to build custom UI You can request from Smartico to define fields for your specific case that will be managed from Smartico BackOffice Read more here - https://help.smartico.ai/welcome/products/general-concepts/custom-fields-attributes
|
|
25
|
+
- `start_date` (number) — Date of start
|
|
26
|
+
- `end_date` (number) — Date of end
|
|
27
|
+
- `max_tickets_count` (number) — Maximum numer of tickets that can be given to all users for the whole period of raffle
|
|
28
|
+
- `current_tickets_count` (number) — Number of tickets that are already given to all users for this raffle
|
|
29
|
+
- `draws` (TRaffleDraw[]) — List of draws that are available for this raffle. For example, if the raffle is containg one hourly draw, one daily draw and one draw on fixed date like 01/01/2022, Then the list will always return 3 draws, no matter if the draws are already executed or they are in the future.
|
|
30
|
+
- `id` (number) — Id of the Draw definition, for the repetative draws (e.g. daily), this number will be the same for all draws that are repeating daily (internal name: schedule_id)
|
|
31
|
+
- `name` (string) — Name of the draw, e.g. 'Daily draw'
|
|
32
|
+
- `description` (string) — Description of the draw
|
|
33
|
+
- `image_url` (string) — URL of the image that represents the draw, 365x175px
|
|
34
|
+
- `image_url_mobile` (string) — URL of the moible image that represents the draw, 300x145px
|
|
35
|
+
- `icon_url` (string) — URL of the icon that represents the draw
|
|
36
|
+
- `background_image_url` (string) — URL of the background image that will be used in the draw list item
|
|
37
|
+
- `background_image_url_mobile` (string) — URL of the moible background image that will be used in the draw list item
|
|
38
|
+
- `is_grand` (boolean) — Show if the draw is grand and is marked as special
|
|
39
|
+
- `prizes` (TRafflePrize[]) — Information about prizes in the draw
|
|
40
|
+
- `id` (string) — The unique identifier for the prize definition
|
|
41
|
+
- `name` (string) — Name of the prize
|
|
42
|
+
- `description` (string) — Description of the prize
|
|
43
|
+
- `image_url` (string) — URL of the image that represents the prize, 256x256px
|
|
44
|
+
- `custom_data` (string) — Custom data field set in the backoffice prize setup. Can be used to build custom UI for gamification.
|
|
45
|
+
- `prizes_per_run` (number) — The number of prizes available per run of the draw. E.g. if the draw is run daily, this is the number of prizes available each day, for example 3 iPhones.
|
|
46
|
+
- `prizes_per_run_actual` (number) — The actual number of prizes for the current instance. This value is taking into account follwing values: - min_required_total_tickets, - add_one_prize_per_each_x_tickets - stock_items_per_draw - total_tickets_count (from Draw instance) - cap_prizes_per_run For example: - prizes_per_run = 1 - min_required_total_tickets = 1000 - add_one_prize_per_each_x_tickets = 1000 - stock_items_per_draw = 5 - total_tickets_count = 7000 - cap_prizes_per_run = 6 prizes_per_run_actual will be 5, because 7000 tickets are collected, so 7 iPhones are available, but the cap is 6 and the stock is 5.
|
|
47
|
+
- `chances_to_win_perc` (number) — The chances to win the prize by current player. Calculated as the ratio of the number of tickets collected by the current player to the total number of tickets collected by all players and multiplied by number of actual prizes of this kind.
|
|
48
|
+
- `min_required_total_tickets` (number) — The minimum number of total tickets collected during draw period required to unlock the prize. If the number of tickets collected is less than this value, the prize is not available. Under total tickets we understand the number of tickets collected by all users. The 'draw period' is the time between the ticket_start_date value of the draw and the current time.
|
|
49
|
+
- `add_one_prize_per_each_x_tickets` (number) — One additional prize will be awarded for each X tickets. E.g. if the prize is 1 iPhone and the value is set to 1000, then for every 1000 tickets collected, an additional iPhone is awarded. If min_required_total_tickets is set to 1000, then next iPhone is awarded when 2000 tickets are collected, and so on. If min_required_total_tickets is not set, then the next iPhone will be awarded when 1000 tickets are collected.
|
|
50
|
+
- `requires_claim` (boolean) — Indicates whether the prize requires a claim action from the user.
|
|
51
|
+
- `min_required_tickets_for_user` (number) — The minimum number of tickets a user must have to be eligible for the prize. For example iPhone prize may require 10 tickets to be collected, only users with 10 or more tickets will be eligible for the prize. More tickets are better, as they increase the chances of winning.
|
|
52
|
+
- `cap_prizes_per_run` (number) — The maximum number of prizes that can be given withing one instance/run of draw. For example the prize is iPhone and add_one_prize_per_each_x_tickets is set to 1000, cap_prizes_per_run is set to 3, and the total number of tickets collected is 7000. In this case, the prizes_per_run_actual will be limitted by 3
|
|
53
|
+
- `priority` (number) — The priority of the prize. The low number means higher priority (e.g. 1 is higher priority than 2). If there are multiple prizes available, the prize with the highest priority (lowest number) will be awarded first.
|
|
54
|
+
- `stock_items_per_draw` (number) — Optional field that indicates total remaining number of the prize for all draws of the type. For example, the Daily draw has 1 iPhone daily, and the total number of iPhones is 10. the stock_items_per_draw will be decreasing by 1 each day (assuming there is enough tickets and it is won every day), and when it reaches 0, the prize is not available anymore.
|
|
55
|
+
- `should_claim` (boolean) — Shows if the prize has been claimed
|
|
56
|
+
- `winners` (TRafflePrizeWinner[])
|
|
57
|
+
- `id` (number) — Id of the winner definition, for the repetative winners (e.g. same winner won two prizes), this number will be the same for all winner that are repeating (internal name: schedule_id)
|
|
58
|
+
- `username` (string) — Winner user name
|
|
59
|
+
- `avatar_url` (string) — URL of the image of user avatar
|
|
60
|
+
- `ticket` (TRaffleTicket) — Ticket information (number string and integer)
|
|
61
|
+
- `ticekt_id` (number) — Int presentation of the ticket
|
|
62
|
+
- `ticket_id_string` (string) — String presentation of the ticket
|
|
63
|
+
- `raf_won_id` (number) — Unique ID of winning
|
|
64
|
+
- `claimed_date` (number) — Date when the prize was claimed
|
|
65
|
+
- `current_state` (RaffleDrawInstanceState) — State of current instance of Draw
|
|
66
|
+
- `run_id` (number) — Field indicates the ID of the latest instance/run of draw
|
|
67
|
+
- `execution_type` (RaffleDrawTypeExecution) — Type of the draw execution, indicating how and when the draw is executed. - ExecDate: Draw is executed only once at a specific date and time. - Recurring: Draw is executed on a recurring basis (e.g., daily, weekly). - Grand: Draw is executed once and is marked as grand, often with larger prizes or more importance.
|
|
68
|
+
- `execution_ts` (number) — Date/time of the draw execution
|
|
69
|
+
- `previous_run_ts` (number) — Date of the previously executed draw (if there is such)
|
|
70
|
+
- `previous_run_id` (number) — Unique ID of the previusly executed draw (if there is such)
|
|
71
|
+
- `ticket_start_ts` (number) — Date/time starting from which the tickets will participate in the upcoming draw This value need to be taken into account with next_execute_ts field value, for example Next draw is at 10:00, ticket_start_date is 9:00, so all tickets that are collected after 9:00 will participate in the draw at 10:00 (internally this value is calculated as next_execute_ts - ticket_start_date)
|
|
72
|
+
- `allow_multi_prize_per_ticket` (boolean) — Field is indicating if same ticket can win multiple prizes in the same draw For example there are 3 types of prizes in the draw - iPhone, iPad, MacBook If this field is true, then one ticket can win all 3 prizes (depending on the chances of course), if false, then one ticket can win only one prize. The distribution of the prizes is start from top (assuming on top are the most valuable prizes) to bottom (less valuable prizes) If specific prize has multiple values, e.g. we have 3 iPhones, then the same ticket can win only one prize of a kind, but can win multiple prizes of different kind (if allow_multi_prize_per_ticket is true)
|
|
73
|
+
- `total_tickets_count` (number) — The number of tickets that are already given to all users for this instance of draw. In other words tickets that are collected between ticket_start_date and current time (or till current_execution_ts is the instance is executed).
|
|
74
|
+
- `my_tickets_count` (number) — The number of tickets collected by current user for this instance of draw.
|
|
75
|
+
- `my_last_tickets` (TRaffleTicket[])
|
|
76
|
+
- `ticekt_id` (number) — Int presentation of the ticket
|
|
77
|
+
- `ticket_id_string` (string) — String presentation of the ticket
|
|
78
|
+
- `user_opted_in` (boolean) — If true, the user has opted-in to the raffle.
|
|
79
|
+
- `requires_optin` (boolean) — If true, the user needs to opt-in to the raffle before they can participate.
|
|
80
|
+
- `is_active` (boolean) — If true, the draw is active and can be participated in.
|
|
81
|
+
- `winners_limit` (number) — The number of winners to return
|
|
82
|
+
- `winners_offset` (number) — The offset of the winners to return
|
|
83
|
+
- `winners_total` (number) — The total number of winners
|
|
84
|
+
- `ticket_cap_visualization` (RaffleTicketCapVisualization) — Ticket cap visualization
|
|
85
|
+
|
|
86
|
+
## Behavioral contract
|
|
87
|
+
**Subscription model (`onUpdate`)**
|
|
88
|
+
The callback receives the FULL refreshed raffle list (never a
|
|
89
|
+
diff/patch). Each subsequent call to `getRaffles({ onUpdate })`
|
|
90
|
+
REPLACES the prior callback. Pass `onUpdate: undefined` (or omit
|
|
91
|
+
it) to keep the prior callback in place; the callback is never
|
|
92
|
+
auto-cleared.
|
|
93
|
+
|
|
94
|
+
**Update triggers** — the callback fires when:
|
|
95
|
+
|
|
96
|
+
1. `claimRafflePrize` resolves on this connection (any
|
|
97
|
+
response code) — the refreshed list reflects the new
|
|
98
|
+
`has_unclaimed_prize` / `claimed_date` state.
|
|
99
|
+
2. `requestRaffleOptin` resolves on this connection (any
|
|
100
|
+
response code) — the refreshed list reflects the new
|
|
101
|
+
`user_opted_in` state on the affected draw.
|
|
102
|
+
|
|
103
|
+
Does NOT fire for: server-side draw executions, ticket increments
|
|
104
|
+
(other users earning tickets), or operator-side raffle/draw config
|
|
105
|
+
changes. Those changes surface only on the next cache miss (after
|
|
106
|
+
the 30 s TTL) — poll manually if your UI needs sub-30s freshness
|
|
107
|
+
during an in-progress draw.
|
|
108
|
+
|
|
109
|
+
**Reading state from the returned raffle**
|
|
110
|
+
- `current_tickets_count` vs `max_tickets_count` drives the
|
|
111
|
+
`ticket_cap_visualization` banner (enum
|
|
112
|
+
`RaffleTicketCapVisualization`: `Empty` = no banner,
|
|
113
|
+
`Counter` = show "X tickets remaining", `Message` = show
|
|
114
|
+
sold-out message).
|
|
115
|
+
- Within each draw, `current_state`
|
|
116
|
+
(`RaffleDrawInstanceState`) buckets the draw into Open
|
|
117
|
+
(accepting tickets), WinnerSelection (currently drawing), or
|
|
118
|
+
Executed (winners selected).
|
|
119
|
+
- `execution_type` (`RaffleDrawTypeExecution`) distinguishes
|
|
120
|
+
one-shot (`ExecDate`), repeating (`Recurring`), or special
|
|
121
|
+
one-shot (`Grand`) draws. Recurring draws share a stable
|
|
122
|
+
`draws[i].id` (the schedule definition) across runs — `run_id`
|
|
123
|
+
is the per-execution instance.
|
|
124
|
+
|
|
125
|
+
**Cache TTL**: the SDK caches the response for 30 seconds. Cache
|
|
126
|
+
is fully cleared on login / logout. The server also invalidates
|
|
127
|
+
the SDK cache when a draw executes on the server side.
|
|
128
|
+
|
|
129
|
+
**Idempotency / Side effects**: safe. Read-only.
|
|
130
|
+
|
|
131
|
+
**UI guidance**: see [UI Guide — `getRaffles`](../../docs/ui/raffles/UIGuide_getRaffles.md).
|
|
132
|
+
|
|
133
|
+
**Visitor mode**: supported. The same shape is returned, scoped
|
|
134
|
+
to the brand's public raffles. Per-user fields (`my_tickets_count`,
|
|
135
|
+
`my_last_tickets`, `user_opted_in`) are not meaningful for
|
|
136
|
+
visitors. The `onUpdate` callback is accepted but never fires
|
|
137
|
+
because the mutation methods that trigger it
|
|
138
|
+
(`claimRafflePrize`, `requestRaffleOptin`) are not
|
|
139
|
+
available / not effective in visitor mode.
|
|
140
|
+
|
|
141
|
+
## Example
|
|
142
|
+
```ts
|
|
143
|
+
const raffles = await window._smartico.api.getRaffles({
|
|
144
|
+
onUpdate: (refreshed) => {
|
|
145
|
+
console.log('[smartico] raffles refreshed (after claim/optin) — re-render from this array:', refreshed);
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
for (const raffle of raffles) {
|
|
150
|
+
console.log('[smartico] render raffle', raffle.id, '—', raffle.name, ':', raffle.draws.length, 'draws');
|
|
151
|
+
|
|
152
|
+
// Bucket draws: active/upcoming first (sorted by execution_ts ASC), then executed last.
|
|
153
|
+
const sorted = [...raffle.draws].sort((a, b) => {
|
|
154
|
+
const aDone = a.current_state === 3; // Executed
|
|
155
|
+
const bDone = b.current_state === 3;
|
|
156
|
+
if (aDone !== bDone) return aDone ? 1 : -1; // executed sink to the bottom
|
|
157
|
+
return a.execution_ts - b.execution_ts;
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
for (const d of sorted) {
|
|
161
|
+
if (d.requires_optin && !d.user_opted_in && d.is_active && d.current_state !== 3) {
|
|
162
|
+
console.log('[smartico] draw', d.run_id, '— show OPT IN CTA (requires_optin + not yet opted in + still active)');
|
|
163
|
+
}
|
|
164
|
+
if (d.current_state === 3) {
|
|
165
|
+
console.log('[smartico] draw', d.run_id, 'executed — fetch winner details via getRaffleDrawRun');
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// For winner detail on an executed draw, call getRaffleDrawRun separately.
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Example response (REAL shape)
|
|
174
|
+
> Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
|
|
175
|
+
```json
|
|
176
|
+
[
|
|
177
|
+
{
|
|
178
|
+
"id": 158,
|
|
179
|
+
"name": "ICE Raffle 3.0",
|
|
180
|
+
"description": "<h2>🎉 Join the Excitement – Enter Our Raffle Draws Today! 🎟️</h2>\n\n<p>Get ready to dive into the thrill of <b>winning amazing prizes</b>! 🏆 Don’t miss you…",
|
|
181
|
+
"custom_section_id": 1621,
|
|
182
|
+
"image_url": "https://cdn.example/14077931496fd2091ac794-RaffleLobbyImage.png",
|
|
183
|
+
"image_url_mobile": "https://cdn.example/330ba5ab6c0aa2e74d203d-Rafflelobbyimagemobile.png",
|
|
184
|
+
"start_date": 1780669800000,
|
|
185
|
+
"end_date": 1796157059000,
|
|
186
|
+
"max_tickets_count": 2000000,
|
|
187
|
+
"current_tickets_count": 13198,
|
|
188
|
+
"draws": [
|
|
189
|
+
{
|
|
190
|
+
"id": 322,
|
|
191
|
+
"name": "Daily draw",
|
|
192
|
+
"description": "🎟️🔥Hot Daily Raffle Alert!🔥🎟️ Spin your way to amazing prizes every single day! Don't miss out!",
|
|
193
|
+
"image_url": "https://cdn.example/0e61ee7d31eea85ea1e2e5-DailyDraw-Promoimage.png",
|
|
194
|
+
"image_url_mobile": "https://cdn.example/7da52af5814e089897b470-DailyDraw-Promoimagemobile.png",
|
|
195
|
+
"icon_url": "https://cdn.example/c681faad98ec20cf94c6cf-DailyDraw-Drawicon.png",
|
|
196
|
+
"background_image_url": "https://cdn.example/e17b7d69c350b47ae0878f-DrawBackground.png",
|
|
197
|
+
"background_image_url_mobile": "https://cdn.example/9ec0cc0bcf58d038ab59f9-DrawBackgroundMobilecopy.png",
|
|
198
|
+
"is_grand": false,
|
|
199
|
+
"prizes": [
|
|
200
|
+
{
|
|
201
|
+
"id": 1244,
|
|
202
|
+
"name": "16\" Lenovo laptop",
|
|
203
|
+
"image_url": "https://cdn.example/6b4690ea0429208b244f7c-DailyDraw-516inchLaptopLenovoPrizeimage.png",
|
|
204
|
+
"prizes_per_run": 1,
|
|
205
|
+
"prizes_per_run_actual": 1,
|
|
206
|
+
"chances_to_win_perc": 0,
|
|
207
|
+
"min_required_total_tickets": 100,
|
|
208
|
+
"cap_prizes_per_run": 3,
|
|
209
|
+
"priority": 1,
|
|
210
|
+
"stock_items_per_draw": 9991,
|
|
211
|
+
"should_claim": false,
|
|
212
|
+
"winners": [],
|
|
213
|
+
"requires_claim": false,
|
|
214
|
+
"min_required_tickets_for_user": 10
|
|
215
|
+
}
|
|
216
|
+
],
|
|
217
|
+
"current_state": 1,
|
|
218
|
+
"run_id": 775459,
|
|
219
|
+
"execution_type": 2,
|
|
220
|
+
"execution_ts": 1782378000000,
|
|
221
|
+
"previous_run_ts": 1782291600000,
|
|
222
|
+
"previous_run_id": 771353,
|
|
223
|
+
"ticket_start_ts": 1782291600000,
|
|
224
|
+
"allow_multi_prize_per_ticket": false,
|
|
225
|
+
"total_tickets_count": 93,
|
|
226
|
+
"my_tickets_count": 0,
|
|
227
|
+
"my_last_tickets": [],
|
|
228
|
+
"user_opted_in": true,
|
|
229
|
+
"requires_optin": false,
|
|
230
|
+
"is_active": true,
|
|
231
|
+
"winners_limit": 20,
|
|
232
|
+
"winners_offset": 0,
|
|
233
|
+
"winners_total": 0
|
|
234
|
+
}
|
|
235
|
+
]
|
|
236
|
+
}
|
|
237
|
+
]
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## Errors
|
|
241
|
+
See this method's TSDoc / the mutation pages for `err_code` handling.
|
|
242
|
+
|
|
243
|
+
## Related
|
|
244
|
+
- `getRaffleDrawRun`
|
|
245
|
+
- `claimRafflePrize`
|
|
246
|
+
- `requestRaffleOptin`
|
|
247
|
+
- `RaffleTicketCapVisualization`
|
|
248
|
+
- `RaffleDrawInstanceState`
|
|
249
|
+
- `RaffleDrawTypeExecution`
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# getRelatedItemsForGame — API (GetRelatedAchTourResponse)
|
|
2
|
+
|
|
3
|
+
> Returns the missions and tournaments associated with a casino / sportsbook game in the operator's games catalog — the reverse of "given this mission, which games count for it" — so you can surface "play this game to progress mission X" / "tournament Y features this game" badges on game tiles or detail screens.
|
|
4
|
+
> Import: `import { GetRelatedAchTourResponse } from '@smartico/public-api'`
|
|
5
|
+
> Search terms: getRelatedItemsForGame, general, GetRelatedAchTourResponse, UserAchievement, AchievementType, AchievementPublicMeta, UserAchievementTask, AchievementStatus, ScheduledMissionType, AchRelatedGame, BadgesTimeLimitStates, Tournament, TournamentType, TournamentPublicMeta, TournamentRegistrationType
|
|
6
|
+
|
|
7
|
+
## Signature
|
|
8
|
+
```ts
|
|
9
|
+
_smartico.api.getRelatedItemsForGame(related_game_id: string): Promise<GetRelatedAchTourResponse>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Parameters
|
|
13
|
+
- `related_game_id` — External Games Catalog ID of the game (e.g. `"gold-slot2"`).
|
|
14
|
+
|
|
15
|
+
## Returns — `Promise<GetRelatedAchTourResponse>`
|
|
16
|
+
`GetRelatedAchTourResponse`:
|
|
17
|
+
- `cid` (number)
|
|
18
|
+
- `ts` (number)
|
|
19
|
+
- `uuid` (string)
|
|
20
|
+
- `errCode` (number)
|
|
21
|
+
- `errMsg` (string)
|
|
22
|
+
- `achievements` (UserAchievement[])
|
|
23
|
+
- `ach_id` (number)
|
|
24
|
+
- `ach_type_id` (AchievementType)
|
|
25
|
+
- `ach_public_meta` (AchievementPublicMeta)
|
|
26
|
+
- `description` (string)
|
|
27
|
+
- `unlock_mission_description` (string)
|
|
28
|
+
- `custom_data` (string)
|
|
29
|
+
- `cta_text` (string)
|
|
30
|
+
- `cta_action` (string)
|
|
31
|
+
- `label_tag` (string)
|
|
32
|
+
- `custom_label_tag` (string)
|
|
33
|
+
- `reward` (string)
|
|
34
|
+
- `image_url` (string)
|
|
35
|
+
- `name` (string)
|
|
36
|
+
- `position` (number)
|
|
37
|
+
- `hide_tasks` (boolean)
|
|
38
|
+
- `hide_locked_mission` (boolean)
|
|
39
|
+
- `custom_section_id` (number)
|
|
40
|
+
- `only_in_custom_section` (boolean)
|
|
41
|
+
- `hint_text` (string)
|
|
42
|
+
- `hide_badge_from_ui` (boolean)
|
|
43
|
+
- `show_badge_first_task_completed` (boolean)
|
|
44
|
+
- `isCompleted` (boolean)
|
|
45
|
+
- `isLocked` (boolean)
|
|
46
|
+
- `requiresOptin` (boolean)
|
|
47
|
+
- `isOptedIn` (boolean)
|
|
48
|
+
- `start_date` (string) — time when mission unlocked or opted-in. Needed to calculated "remaining time" in case time_limit_ms is set
|
|
49
|
+
- `start_date_ts` (number)
|
|
50
|
+
- `time_limit_ms` (number)
|
|
51
|
+
- `progress` (number)
|
|
52
|
+
- `complete_date` (string)
|
|
53
|
+
- `complete_date_ts` (number)
|
|
54
|
+
- `unlock_date` (string)
|
|
55
|
+
- `milliseconds_till_available` (number)
|
|
56
|
+
- `completed_tasks` (number)
|
|
57
|
+
- `achievementTasks` (UserAchievementTask[])
|
|
58
|
+
- `task_id` (number)
|
|
59
|
+
- `task_public_meta` (AchievementTaskPublicMeta)
|
|
60
|
+
- `name` (string)
|
|
61
|
+
- `points_reward` (number)
|
|
62
|
+
- `task_type_id` (AchievementTaskType)
|
|
63
|
+
- `isCompleted` (boolean)
|
|
64
|
+
- `userExecutedCount` (number)
|
|
65
|
+
- `userProgress` (number)
|
|
66
|
+
- `lastExecutionDate` (string)
|
|
67
|
+
- `unlocked_by_mission_id` (number)
|
|
68
|
+
- `unlocked_by_level_id` (number)
|
|
69
|
+
- `next_recurrence_date_ts` (number)
|
|
70
|
+
- `ach_status_id` (AchievementStatus)
|
|
71
|
+
- `scheduledMissionType` (ScheduledMissionType)
|
|
72
|
+
- `related_games` (AchRelatedGame[])
|
|
73
|
+
- `ext_game_id` (string) — The ID of the related game
|
|
74
|
+
- `game_public_meta` ({
|
|
75
|
+
/** The name of the game */
|
|
76
|
+
name: string;
|
|
77
|
+
/** The URL to the game */
|
|
78
|
+
link: string;
|
|
79
|
+
/** The URL to the image of the game, 1:1 aspect ratio */
|
|
80
|
+
image: string;
|
|
81
|
+
/** The indicator if the game is enabled */
|
|
82
|
+
enabled: boolean;
|
|
83
|
+
/** The list of categories of the game */
|
|
84
|
+
game_categories: string[];
|
|
85
|
+
/** The name of the game provider */
|
|
86
|
+
game_provider: string;
|
|
87
|
+
/** The URL to the mobile game */
|
|
88
|
+
mobile_spec_link: string;
|
|
89
|
+
/** The priority of the game */
|
|
90
|
+
priority?: number;
|
|
91
|
+
}) — Game public meta information
|
|
92
|
+
- `active_from_ts` (number) — indicates when 'scheduled' mission is active from,
|
|
93
|
+
- `active_till_ts` (number) — indicates when 'scheduled' mission is active till,
|
|
94
|
+
- `ach_categories` (number[])
|
|
95
|
+
- `recurring_quantity` (number) — max completion count for Recurring upon completion
|
|
96
|
+
- `completed_count` (number) — completion count for Recurring upon completion
|
|
97
|
+
- `ach_completed_id` (number) — ID of the completion fact from ach_completed or ach_completed_recurring tables
|
|
98
|
+
- `requires_prize_claim` (boolean) — flag from achievement if the mission prize will be given only after user claims it
|
|
99
|
+
- `prize_claimed_date_ts` (number) — the date/timestamp indicating when the prize was claimed by the user
|
|
100
|
+
- `completed_today` (boolean)
|
|
101
|
+
- `completed_this_week` (boolean)
|
|
102
|
+
- `completed_this_month` (boolean)
|
|
103
|
+
- `custom_section_type_id` (number)
|
|
104
|
+
- `badgeTimeLimitState` (BadgesTimeLimitStates)
|
|
105
|
+
- `tournaments` (Tournament[])
|
|
106
|
+
- `tournamentId` (number) — ID of tournament template
|
|
107
|
+
- `tournamentInstanceId` (number) — ID of tournament instance. Generated every time when tournament based on specific template is scheduled for run
|
|
108
|
+
- `tournamentType` (TournamentType) — Type of the tournament. For now only SCHEDULED is support
|
|
109
|
+
- `publicMeta` (TournamentPublicMeta) — Meta information about tournament that should be used to build UI
|
|
110
|
+
- `name` (string) — Name of tournament
|
|
111
|
+
- `image_url` (string) — 1st image
|
|
112
|
+
- `image_url2` (string) — 2nd image
|
|
113
|
+
- `image_url2_mobile` (string) — 2nd image for mobile
|
|
114
|
+
- `description` (string) — Description, html capable
|
|
115
|
+
- `prize_pool_short` (string) — Short explanation of prize pool
|
|
116
|
+
- `segment_dont_match_message` (string) — Message to show when user is not matching to the segment allowed to register (error code 30005 in registration response)
|
|
117
|
+
- `custom_price_text` (string) — Short explanation of registration price
|
|
118
|
+
- `show_other_users_score` (boolean) — Indicator if the scores of other users should be shown in the leaderboard of tournament
|
|
119
|
+
- `custom_section_id` (number)
|
|
120
|
+
- `only_in_custom_section` (boolean)
|
|
121
|
+
- `label_tag` (string)
|
|
122
|
+
- `custom_label_tag` (string)
|
|
123
|
+
- `featured` (boolean)
|
|
124
|
+
- `position` (number)
|
|
125
|
+
- `custom_data` (string)
|
|
126
|
+
- `buyInAmount` (number) — Cost of registration in the tournament in gamification points
|
|
127
|
+
- `prizePool` (number) — Not in use
|
|
128
|
+
- `startTime` (string) — The time when tournament is going to start
|
|
129
|
+
- `endTime` (string) — The time when tournament is going to finish
|
|
130
|
+
- `startTimeTs` (number) — The time when tournament is going to start, epoch
|
|
131
|
+
- `endTimeTs` (number) — The time when tournament is going to finish, epoch
|
|
132
|
+
- `registrationCount` (number) — Number of users registered in the tournament
|
|
133
|
+
- `totalCount` (number) — Not in use
|
|
134
|
+
- `registrationType` (TournamentRegistrationType) — Type of registration in the tournament
|
|
135
|
+
- `tournamentRegistrationStatus` (TournamentRegistrationStatus) — Status of registration in the tournament for current user
|
|
136
|
+
- `tournamentInstanceStatus` (TournamentInstanceStatus) — Status of tournament instance
|
|
137
|
+
- `isUserRegistered` (boolean) — flag indicating if current user is registered in the tournament
|
|
138
|
+
- `allowLateRegistration` (boolean) — Indicator if tournament allows later registration, when tournament is already started
|
|
139
|
+
- `playersMinCount` (number) — Minimum number of participant for this tournament. If tournament doesnt have enough registrations, it will not start
|
|
140
|
+
- `playersMaxCount` (number) — Maximum number of participant for this tournament. When reached, new users won't be able to register
|
|
141
|
+
- `durationMs` (number) — Tournament duration in millisecnnds
|
|
142
|
+
- `prizeStructure` ({
|
|
143
|
+
prizes: TournamentPrize[];
|
|
144
|
+
}) — prizes structure
|
|
145
|
+
- `name` (string)
|
|
146
|
+
- `description` (string)
|
|
147
|
+
- `image_url` (string)
|
|
148
|
+
- `place_from` (number)
|
|
149
|
+
- `place_to` (number)
|
|
150
|
+
- `type` (ActivityTypeLimited)
|
|
151
|
+
- `points` (number)
|
|
152
|
+
- `gems` (number)
|
|
153
|
+
- `diamonds` (number)
|
|
154
|
+
- `tournamentPlayer` (TournamentPlayer) — Information about current user
|
|
155
|
+
- `userAltName` (string)
|
|
156
|
+
- `cleanExtUserId` (string)
|
|
157
|
+
- `crmBrandId` (number)
|
|
158
|
+
- `position` (number)
|
|
159
|
+
- `scores` (number)
|
|
160
|
+
- `isMe` (boolean)
|
|
161
|
+
- `userId` (number)
|
|
162
|
+
- `avatar_id` (string)
|
|
163
|
+
- `avatar_url` (string)
|
|
164
|
+
- `related_games` (AchRelatedGame[]) — List of casino games (or other types of entities) related to the tournament
|
|
165
|
+
- `ext_game_id` (string) — The ID of the related game
|
|
166
|
+
- `game_public_meta` ({
|
|
167
|
+
/** The name of the game */
|
|
168
|
+
name: string;
|
|
169
|
+
/** The URL to the game */
|
|
170
|
+
link: string;
|
|
171
|
+
/** The URL to the image of the game, 1:1 aspect ratio */
|
|
172
|
+
image: string;
|
|
173
|
+
/** The indicator if the game is enabled */
|
|
174
|
+
enabled: boolean;
|
|
175
|
+
/** The list of categories of the game */
|
|
176
|
+
game_categories: string[];
|
|
177
|
+
/** The name of the game provider */
|
|
178
|
+
game_provider: string;
|
|
179
|
+
/** The URL to the mobile game */
|
|
180
|
+
mobile_spec_link: string;
|
|
181
|
+
/** The priority of the game */
|
|
182
|
+
priority?: number;
|
|
183
|
+
}) — Game public meta information
|
|
184
|
+
- `minScoreToWin` (number) — The minimum amount of score points that the user should get in order to be qualified for the prize
|
|
185
|
+
- `hideLeaderboardsMinScores` (boolean) — When enabled, users who don't meet the minimum qualifying score will be hidden from the Leaderboard.
|
|
186
|
+
- `totalScores` (number) — Total scores across all participants in the tournament
|
|
187
|
+
- `isClanBased` (boolean) — Indicates if the tournament is clan-based
|
|
188
|
+
|
|
189
|
+
## Behavioral contract
|
|
190
|
+
**Preconditions**
|
|
191
|
+
- `related_game_id` must be a Games Catalog ID (the same external string the
|
|
192
|
+
operator uses in the catalog at
|
|
193
|
+
`https` ://help.smartico.ai/welcome/technical-guides/games-catalog-api).
|
|
194
|
+
|
|
195
|
+
**Server-side eligibility filtering**
|
|
196
|
+
Missions and tournaments are filtered by the user's segments / level / brand
|
|
197
|
+
before being returned. A user who is ineligible for a mission segment will
|
|
198
|
+
NOT see that mission in the result even if it lists the game. The same
|
|
199
|
+
filtering applies to tournaments. Treat the response as "what this user
|
|
200
|
+
should see" — no client-side eligibility pass needed.
|
|
201
|
+
|
|
202
|
+
**No cache**
|
|
203
|
+
Every call is a live server round-trip. Missions/tournaments are operator-
|
|
204
|
+
mutated state (opt-in, completion, expiry) that changes during a session;
|
|
205
|
+
caching staler than the user's last action would mis-render eligibility.
|
|
206
|
+
Avoid building a consumer-side cache for UI-critical paths.
|
|
207
|
+
|
|
208
|
+
**Refresh**
|
|
209
|
+
- Re-call when the user navigates to a new game tile / detail surface.
|
|
210
|
+
- Re-call after the user opts into / completes a related mission to refresh
|
|
211
|
+
the "play this game" badge.
|
|
212
|
+
|
|
213
|
+
**Visitor mode**: supported via `_smartico.vapi(lang).getRelatedItemsForGame(...)`.
|
|
214
|
+
|
|
215
|
+
**UI guidance**: see [UI Guide — `getRelatedItemsForGame`](../../docs/ui/general/UIGuide_getRelatedItemsForGame.md).
|
|
216
|
+
|
|
217
|
+
## Example
|
|
218
|
+
```ts
|
|
219
|
+
const r = await window._smartico.api.getRelatedItemsForGame('gold-slot2');
|
|
220
|
+
|
|
221
|
+
const missions = r.achievements ?? [];
|
|
222
|
+
const tournaments = r.tournaments ?? [];
|
|
223
|
+
|
|
224
|
+
if (missions.length === 0 && tournaments.length === 0) {
|
|
225
|
+
console.log('[smartico] no related missions / tournaments — hide the related badge on the game tile');
|
|
226
|
+
} else {
|
|
227
|
+
console.log('[smartico] related entities:', missions.length, 'missions /', tournaments.length, 'tournaments — show a "X missions / Y tournaments" badge');
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Errors
|
|
232
|
+
See this method's TSDoc / the mutation pages for `err_code` handling.
|
|
233
|
+
|
|
234
|
+
## Related
|
|
235
|
+
- `https`
|
|
236
|
+
- `GetRelatedAchTourResponse`
|