@smartico/public-api 0.0.399 → 0.0.401
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/dist/Core/index.d.ts +1 -0
- package/dist/GamePick/GamePickTypes.d.ts +8 -8
- package/dist/Level/Level.d.ts +1 -0
- package/dist/SmarticoGlobal.d.ts +190 -0
- package/dist/WSAPI/WSAPIGamePick.d.ts +6 -6
- package/dist/WSAPI/WSAPIMiniGames.d.ts +60 -52
- package/dist/WSAPI/WSAPITypes.d.ts +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +78 -66
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +69 -60
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/README.md +20 -0
- package/docs/api/classes/WSAPIAvatars.md +1 -8
- package/docs/api/classes/WSAPIGamePick.md +48 -48
- package/docs/api/classes/WSAPIMiniGames.md +132 -70
- package/docs/api/enumerations/GPRoundStatus.md +43 -0
- package/docs/api/enumerations/GamePickMarketType.md +19 -0
- package/docs/api/enumerations/GamePickResolutionType.md +35 -0
- package/docs/api/enumerations/GamePickScoreType.md +19 -0
- package/docs/api/enumerations/GamePickSportType.md +375 -0
- package/docs/api/enumerations/GameRoundOrderType.md +35 -0
- package/docs/api/enumerations/LiquidEntityData.md +6 -0
- package/docs/api/interfaces/GamePickBoardUser.md +75 -0
- package/docs/api/interfaces/GamePickEvent.md +123 -0
- package/docs/api/interfaces/GamePickEventMeta.md +201 -0
- package/docs/api/interfaces/GamePickGameInfo.md +27 -0
- package/docs/api/interfaces/GamePickRequestParams.md +39 -0
- package/docs/api/interfaces/GamePickRound.md +383 -0
- package/docs/api/interfaces/GamePickRoundBase.md +232 -0
- package/docs/api/interfaces/GamePickRoundBoard.md +359 -0
- package/docs/api/interfaces/GamePickRoundPublicMeta.md +103 -0
- package/docs/api/interfaces/GamePickRoundRequestParams.md +63 -0
- package/docs/api/interfaces/GamePickUserInfo.md +107 -0
- package/docs/api/interfaces/GamesApiResponse.md +33 -0
- package/docs/api/interfaces/Level.md +8 -0
- package/docs/api/interfaces/QuizEventMeta.md +61 -0
- package/docs/api/interfaces/RafflePrizePublicMeta.md +9 -0
- package/docs/api/interfaces/TMiniGamePlayResult.md +11 -0
- package/docs/api/interfaces/TRafflePrize.md +9 -0
- package/docs/api/variables/AllRoundsGameBoardID.md +5 -0
- package/docs/ui/minigames/UIGuide_playMiniGame.md +6 -5
- package/package.json +1 -1
- package/src/Core/index.ts +1 -0
- package/src/GamePick/GamePickTypes.ts +8 -8
- package/src/Level/Level.ts +1 -0
- package/src/SmarticoAPI.ts +2 -1
- package/src/SmarticoGlobal.ts +209 -0
- package/src/WSAPI/WSAPIGamePick.ts +6 -6
- package/src/WSAPI/WSAPIMiniGames.ts +61 -52
- package/src/WSAPI/WSAPITypes.ts +5 -0
- package/src/index.ts +1 -0
- package/tsconfig.json +1 -0
package/docs/api/README.md
CHANGED
|
@@ -19,6 +19,12 @@
|
|
|
19
19
|
- [AchMissionsTabsOptions](enumerations/AchMissionsTabsOptions.md)
|
|
20
20
|
- [AchOverviewMissionsFilter](enumerations/AchOverviewMissionsFilter.md)
|
|
21
21
|
- [LiquidEntityData](enumerations/LiquidEntityData.md)
|
|
22
|
+
- [GamePickMarketType](enumerations/GamePickMarketType.md)
|
|
23
|
+
- [GamePickResolutionType](enumerations/GamePickResolutionType.md)
|
|
24
|
+
- [GPRoundStatus](enumerations/GPRoundStatus.md)
|
|
25
|
+
- [GamePickScoreType](enumerations/GamePickScoreType.md)
|
|
26
|
+
- [GamePickSportType](enumerations/GamePickSportType.md)
|
|
27
|
+
- [GameRoundOrderType](enumerations/GameRoundOrderType.md)
|
|
22
28
|
- [QuizAnswersValueType](enumerations/QuizAnswersValueType.md)
|
|
23
29
|
- [SAWGPMarketType](enumerations/SAWGPMarketType.md)
|
|
24
30
|
- [InboxCategories](enumerations/InboxCategories.md)
|
|
@@ -94,6 +100,19 @@
|
|
|
94
100
|
- [GetClanInfoResponse](interfaces/GetClanInfoResponse.md)
|
|
95
101
|
- [GetCustomSectionsResponse](interfaces/GetCustomSectionsResponse.md)
|
|
96
102
|
- [UICustomSection](interfaces/UICustomSection.md)
|
|
103
|
+
- [QuizEventMeta](interfaces/QuizEventMeta.md)
|
|
104
|
+
- [GamePickEventMeta](interfaces/GamePickEventMeta.md)
|
|
105
|
+
- [GamePickEvent](interfaces/GamePickEvent.md)
|
|
106
|
+
- [GamePickRoundPublicMeta](interfaces/GamePickRoundPublicMeta.md)
|
|
107
|
+
- [GamePickRoundBase](interfaces/GamePickRoundBase.md)
|
|
108
|
+
- [GamePickRound](interfaces/GamePickRound.md)
|
|
109
|
+
- [GamePickRoundBoard](interfaces/GamePickRoundBoard.md)
|
|
110
|
+
- [GamePickBoardUser](interfaces/GamePickBoardUser.md)
|
|
111
|
+
- [GamePickUserInfo](interfaces/GamePickUserInfo.md)
|
|
112
|
+
- [GamePickGameInfo](interfaces/GamePickGameInfo.md)
|
|
113
|
+
- [GamesApiResponse](interfaces/GamesApiResponse.md)
|
|
114
|
+
- [GamePickRequestParams](interfaces/GamePickRequestParams.md)
|
|
115
|
+
- [GamePickRoundRequestParams](interfaces/GamePickRoundRequestParams.md)
|
|
97
116
|
- [InboxMessageBody](interfaces/InboxMessageBody.md)
|
|
98
117
|
- [InboxMessage](interfaces/InboxMessage.md)
|
|
99
118
|
- [GetJackpotEligibleGamesRequest](interfaces/GetJackpotEligibleGamesRequest.md)
|
|
@@ -247,6 +266,7 @@
|
|
|
247
266
|
|
|
248
267
|
## Variables
|
|
249
268
|
|
|
269
|
+
- [AllRoundsGameBoardID](variables/AllRoundsGameBoardID.md)
|
|
250
270
|
- [PrizeModifiersKeysNames](variables/PrizeModifiersKeysNames.md)
|
|
251
271
|
- [SAWWinSoundFiles](variables/SAWWinSoundFiles.md)
|
|
252
272
|
|
|
@@ -357,12 +357,6 @@ activate it.
|
|
|
357
357
|
|
|
358
358
|
##### props
|
|
359
359
|
|
|
360
|
-
###### label_id
|
|
361
|
-
|
|
362
|
-
`number`
|
|
363
|
-
|
|
364
|
-
Numeric Smartico label (brand) ID the user belongs to.
|
|
365
|
-
|
|
366
360
|
###### user_id
|
|
367
361
|
|
|
368
362
|
`number`
|
|
@@ -451,13 +445,12 @@ charges for) a new variant. Guard the call site against double-clicks.
|
|
|
451
445
|
#### Example
|
|
452
446
|
|
|
453
447
|
```ts
|
|
454
|
-
//
|
|
448
|
+
// user_id identifies the Smartico user being customized.
|
|
455
449
|
const prompts = await window._smartico.api.getAvatarPrompts();
|
|
456
450
|
const prompt = prompts[0];
|
|
457
451
|
|
|
458
452
|
console.log('[smartico] generating avatar — show a spinner for ~5-20s and disable the Generate button');
|
|
459
453
|
const result = await window._smartico.api.avatarsCustomize({
|
|
460
|
-
label_id,
|
|
461
454
|
user_id,
|
|
462
455
|
prompt_id: prompt.prompt_id,
|
|
463
456
|
avatar_url: baseAvatar.avatar_url,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
### gamePickGetActiveRounds()
|
|
5
5
|
|
|
6
|
-
> **gamePickGetActiveRounds**(`props`): `Promise
|
|
6
|
+
> **gamePickGetActiveRounds**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)[]\>\>
|
|
7
7
|
|
|
8
8
|
Returns every open round for a MatchX or Quiz game template, with the full
|
|
9
9
|
event list (matches / questions) and the current user's selections per event.
|
|
@@ -16,13 +16,13 @@ can tap into to make predictions. For a single round, use
|
|
|
16
16
|
|
|
17
17
|
##### props
|
|
18
18
|
|
|
19
|
-
`GamePickRequestParams`
|
|
19
|
+
[`GamePickRequestParams`](../interfaces/GamePickRequestParams.md)
|
|
20
20
|
|
|
21
21
|
#### Returns
|
|
22
22
|
|
|
23
|
-
`Promise
|
|
23
|
+
`Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)[]\>\>
|
|
24
24
|
|
|
25
|
-
Wrapped GamesApiResponse of GamePickRound array.
|
|
25
|
+
Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) of [GamePickRound](../interfaces/GamePickRound.md) array.
|
|
26
26
|
|
|
27
27
|
#### Remarks
|
|
28
28
|
|
|
@@ -37,7 +37,7 @@ Game Pick methods are HTTP REST calls to a separate Game Pick games server
|
|
|
37
37
|
subscription — every call is a fresh server roundtrip.
|
|
38
38
|
|
|
39
39
|
**Round status**
|
|
40
|
-
Each round's `round_status_id` is a GPRoundStatus value. Rounds with
|
|
40
|
+
Each round's `round_status_id` is a [GPRoundStatus](../enumerations/GPRoundStatus.md) value. Rounds with
|
|
41
41
|
status `NoEventsDefined` (1) are filtered out server-side and never appear
|
|
42
42
|
here. Other values: `Other` (-1, normally open), `NoMoreBetsAllowed` (2),
|
|
43
43
|
`AllEventsResolved_ButNotRound` (3), `RoundResolved` (4 — appears here only
|
|
@@ -80,7 +80,7 @@ for (const round of r.data ?? []) {
|
|
|
80
80
|
|
|
81
81
|
### gamePickGetActiveRound()
|
|
82
82
|
|
|
83
|
-
> **gamePickGetActiveRound**(`props`): `Promise
|
|
83
|
+
> **gamePickGetActiveRound**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
|
|
84
84
|
|
|
85
85
|
Returns a single round (events, user selections, scoring rules) for a
|
|
86
86
|
MatchX or Quiz game. Use to power the round-detail / prediction-input
|
|
@@ -93,13 +93,13 @@ UI only shows one round at a time.
|
|
|
93
93
|
|
|
94
94
|
##### props
|
|
95
95
|
|
|
96
|
-
`GamePickRoundRequestParams`
|
|
96
|
+
[`GamePickRoundRequestParams`](../interfaces/GamePickRoundRequestParams.md)
|
|
97
97
|
|
|
98
98
|
#### Returns
|
|
99
99
|
|
|
100
|
-
`Promise
|
|
100
|
+
`Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
|
|
101
101
|
|
|
102
|
-
Wrapped GamesApiResponse of a single GamePickRound.
|
|
102
|
+
Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) of a single [GamePickRound](../interfaces/GamePickRound.md).
|
|
103
103
|
|
|
104
104
|
#### Remarks
|
|
105
105
|
|
|
@@ -147,7 +147,7 @@ if (r.errCode === 0 && r.data) {
|
|
|
147
147
|
|
|
148
148
|
### gamePickGetHistory()
|
|
149
149
|
|
|
150
|
-
> **gamePickGetHistory**(`props`): `Promise
|
|
150
|
+
> **gamePickGetHistory**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)[]\>\>
|
|
151
151
|
|
|
152
152
|
Returns the full round history (active + resolved) for a MatchX or Quiz game
|
|
153
153
|
template, newest-first. Each round carries the user's predictions plus the
|
|
@@ -160,13 +160,13 @@ use [gamePickGetActiveRounds](#gamepickgetactiverounds) (faster — skips resolv
|
|
|
160
160
|
|
|
161
161
|
##### props
|
|
162
162
|
|
|
163
|
-
`GamePickRequestParams`
|
|
163
|
+
[`GamePickRequestParams`](../interfaces/GamePickRequestParams.md)
|
|
164
164
|
|
|
165
165
|
#### Returns
|
|
166
166
|
|
|
167
|
-
`Promise
|
|
167
|
+
`Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)[]\>\>
|
|
168
168
|
|
|
169
|
-
Wrapped GamesApiResponse of GamePickRound array,
|
|
169
|
+
Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) of [GamePickRound](../interfaces/GamePickRound.md) array,
|
|
170
170
|
newest-first.
|
|
171
171
|
|
|
172
172
|
#### Remarks
|
|
@@ -179,7 +179,7 @@ Server returns rounds newest-first. No client-side sort needed.
|
|
|
179
179
|
|
|
180
180
|
**Per-event resolution**
|
|
181
181
|
Each event in the rounds carries `resolution_type_id` — values are from
|
|
182
|
-
GamePickResolutionType: `None` (0, not yet resolved), `Lost` (2),
|
|
182
|
+
[GamePickResolutionType](../enumerations/GamePickResolutionType.md): `None` (0, not yet resolved), `Lost` (2),
|
|
183
183
|
`PartialWin` (3), `FullWin` (4). Use these to render result badges on
|
|
184
184
|
each event row.
|
|
185
185
|
|
|
@@ -211,7 +211,7 @@ for (const round of r.data ?? []) {
|
|
|
211
211
|
|
|
212
212
|
### gamePickGetBoard()
|
|
213
213
|
|
|
214
|
-
> **gamePickGetBoard**(`props`): `Promise
|
|
214
|
+
> **gamePickGetBoard**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRoundBoard`](../interfaces/GamePickRoundBoard.md)\>\>
|
|
215
215
|
|
|
216
216
|
Returns the leaderboard for a MatchX or Quiz game round — ranked list of
|
|
217
217
|
players plus the current user's entry (`my_user`). Pass `round_id: -1` for
|
|
@@ -221,13 +221,13 @@ the season / overall leaderboard across every round in the template.
|
|
|
221
221
|
|
|
222
222
|
##### props
|
|
223
223
|
|
|
224
|
-
`GamePickRoundRequestParams`
|
|
224
|
+
[`GamePickRoundRequestParams`](../interfaces/GamePickRoundRequestParams.md)
|
|
225
225
|
|
|
226
226
|
#### Returns
|
|
227
227
|
|
|
228
|
-
`Promise
|
|
228
|
+
`Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRoundBoard`](../interfaces/GamePickRoundBoard.md)\>\>
|
|
229
229
|
|
|
230
|
-
Wrapped GamesApiResponse of GamePickRoundBoard.
|
|
230
|
+
Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) of [GamePickRoundBoard](../interfaces/GamePickRoundBoard.md).
|
|
231
231
|
|
|
232
232
|
#### Remarks
|
|
233
233
|
|
|
@@ -288,7 +288,7 @@ if (r.errCode === 0 && r.data) {
|
|
|
288
288
|
|
|
289
289
|
### gamePickSubmitSelection()
|
|
290
290
|
|
|
291
|
-
> **gamePickSubmitSelection**(`props`): `Promise
|
|
291
|
+
> **gamePickSubmitSelection**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
|
|
292
292
|
|
|
293
293
|
Submits all score predictions for a round in a MatchX game in one shot.
|
|
294
294
|
Each event in the round must carry `team1_user_selection` and
|
|
@@ -303,13 +303,13 @@ selections.
|
|
|
303
303
|
|
|
304
304
|
##### props
|
|
305
305
|
|
|
306
|
-
`GamePickRequestParams` & `object`
|
|
306
|
+
[`GamePickRequestParams`](../interfaces/GamePickRequestParams.md) & `object`
|
|
307
307
|
|
|
308
308
|
#### Returns
|
|
309
309
|
|
|
310
|
-
`Promise
|
|
310
|
+
`Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
|
|
311
311
|
|
|
312
|
-
Wrapped GamesApiResponse with the updated round.
|
|
312
|
+
Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) with the updated round.
|
|
313
313
|
|
|
314
314
|
#### Remarks
|
|
315
315
|
|
|
@@ -349,11 +349,11 @@ buy-in is consumed exactly once per round-per-user. Re-submitting after
|
|
|
349
349
|
**Side effects**
|
|
350
350
|
- First successful submit deducts the buy-in (Points / Gems / Diamonds /
|
|
351
351
|
one Spin) per `saw_buyin_type_id`.
|
|
352
|
-
-
|
|
353
|
-
-
|
|
354
|
-
|
|
352
|
+
- Records the user's participation against the round and its events
|
|
353
|
+
server-side and reports a prediction event to the operator's activity
|
|
354
|
+
stream.
|
|
355
355
|
- Score is awarded after the operator resolves the round
|
|
356
|
-
(GPRoundStatus = `RoundResolved`).
|
|
356
|
+
([GPRoundStatus](../enumerations/GPRoundStatus.md) = `RoundResolved`).
|
|
357
357
|
|
|
358
358
|
**Visitor mode**: not supported.
|
|
359
359
|
|
|
@@ -405,7 +405,7 @@ switch (r.errCode) {
|
|
|
405
405
|
|
|
406
406
|
### gamePickSubmitSelectionQuiz()
|
|
407
407
|
|
|
408
|
-
> **gamePickSubmitSelectionQuiz**(`props`): `Promise
|
|
408
|
+
> **gamePickSubmitSelectionQuiz**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
|
|
409
409
|
|
|
410
410
|
Submits all quiz answers for a round in one shot. Each event in the round
|
|
411
411
|
must carry `user_selection` (the answer value — typically `"1"` / `"2"` /
|
|
@@ -420,13 +420,13 @@ the same round are free.
|
|
|
420
420
|
|
|
421
421
|
##### props
|
|
422
422
|
|
|
423
|
-
`GamePickRequestParams` & `object`
|
|
423
|
+
[`GamePickRequestParams`](../interfaces/GamePickRequestParams.md) & `object`
|
|
424
424
|
|
|
425
425
|
#### Returns
|
|
426
426
|
|
|
427
|
-
`Promise
|
|
427
|
+
`Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
|
|
428
428
|
|
|
429
|
-
Wrapped GamesApiResponse with the updated round.
|
|
429
|
+
Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) with the updated round.
|
|
430
430
|
|
|
431
431
|
#### Remarks
|
|
432
432
|
|
|
@@ -454,9 +454,9 @@ semantics.
|
|
|
454
454
|
**Idempotency**: identical to [gamePickSubmitSelection](#gamepicksubmitselection) — re-submit
|
|
455
455
|
returns `errCode: 3` and never double-charges the buy-in.
|
|
456
456
|
|
|
457
|
-
**Side effects**: identical to [gamePickSubmitSelection](#gamepicksubmitselection)
|
|
458
|
-
|
|
459
|
-
|
|
457
|
+
**Side effects**: identical to [gamePickSubmitSelection](#gamepicksubmitselection) — buy-in
|
|
458
|
+
deduction on first submit, participation recorded, score awarded on round
|
|
459
|
+
resolution.
|
|
460
460
|
|
|
461
461
|
**Visitor mode**: not supported.
|
|
462
462
|
|
|
@@ -498,7 +498,7 @@ if (r.errCode === 0) {
|
|
|
498
498
|
|
|
499
499
|
### gamePickGetUserInfo()
|
|
500
500
|
|
|
501
|
-
> **gamePickGetUserInfo**(`props`): `Promise
|
|
501
|
+
> **gamePickGetUserInfo**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickUserInfo`](../interfaces/GamePickUserInfo.md)\>\>
|
|
502
502
|
|
|
503
503
|
Returns the current user's profile within the Game Pick system — display
|
|
504
504
|
name, avatar, balances, and last wallet-sync timestamp. The Game Pick server
|
|
@@ -514,13 +514,13 @@ with this game" call.
|
|
|
514
514
|
|
|
515
515
|
##### props
|
|
516
516
|
|
|
517
|
-
`GamePickRequestParams`
|
|
517
|
+
[`GamePickRequestParams`](../interfaces/GamePickRequestParams.md)
|
|
518
518
|
|
|
519
519
|
#### Returns
|
|
520
520
|
|
|
521
|
-
`Promise
|
|
521
|
+
`Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickUserInfo`](../interfaces/GamePickUserInfo.md)\>\>
|
|
522
522
|
|
|
523
|
-
Wrapped GamesApiResponse of GamePickUserInfo.
|
|
523
|
+
Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) of [GamePickUserInfo](../interfaces/GamePickUserInfo.md).
|
|
524
524
|
|
|
525
525
|
#### Remarks
|
|
526
526
|
|
|
@@ -561,7 +561,7 @@ if (r.errCode === 0 && r.data) {
|
|
|
561
561
|
|
|
562
562
|
### gamePickGetGameInfo()
|
|
563
563
|
|
|
564
|
-
> **gamePickGetGameInfo**(`props`): `Promise
|
|
564
|
+
> **gamePickGetGameInfo**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickGameInfo`](../interfaces/GamePickGameInfo.md)\>\>
|
|
565
565
|
|
|
566
566
|
Returns the game template configuration plus a metadata listing of every
|
|
567
567
|
round (without events). Use to power the game's welcome / lobby screen —
|
|
@@ -577,13 +577,13 @@ the user actually opens.
|
|
|
577
577
|
|
|
578
578
|
##### props
|
|
579
579
|
|
|
580
|
-
`GamePickRequestParams`
|
|
580
|
+
[`GamePickRequestParams`](../interfaces/GamePickRequestParams.md)
|
|
581
581
|
|
|
582
582
|
#### Returns
|
|
583
583
|
|
|
584
|
-
`Promise
|
|
584
|
+
`Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickGameInfo`](../interfaces/GamePickGameInfo.md)\>\>
|
|
585
585
|
|
|
586
|
-
Wrapped GamesApiResponse of GamePickGameInfo.
|
|
586
|
+
Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) of [GamePickGameInfo](../interfaces/GamePickGameInfo.md).
|
|
587
587
|
|
|
588
588
|
#### Remarks
|
|
589
589
|
|
|
@@ -629,7 +629,7 @@ if (r.errCode === 0 && r.data) {
|
|
|
629
629
|
|
|
630
630
|
### gamePickGetRoundInfoForUser()
|
|
631
631
|
|
|
632
|
-
> **gamePickGetRoundInfoForUser**(`props`): `Promise
|
|
632
|
+
> **gamePickGetRoundInfoForUser**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
|
|
633
633
|
|
|
634
634
|
Returns a round with another player's predictions instead of the current
|
|
635
635
|
user's. The target player is identified by `int_user_id` (the Game Pick
|
|
@@ -643,14 +643,14 @@ rows — community / social inspection of how a top-ranked user predicted.
|
|
|
643
643
|
|
|
644
644
|
##### props
|
|
645
645
|
|
|
646
|
-
`GamePickRoundRequestParams` & `object`
|
|
646
|
+
[`GamePickRoundRequestParams`](../interfaces/GamePickRoundRequestParams.md) & `object`
|
|
647
647
|
|
|
648
648
|
#### Returns
|
|
649
649
|
|
|
650
|
-
`Promise
|
|
650
|
+
`Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
|
|
651
651
|
|
|
652
|
-
Wrapped GamesApiResponse with the target user's
|
|
653
|
-
GamePickRound.
|
|
652
|
+
Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) with the target user's
|
|
653
|
+
[GamePickRound](../interfaces/GamePickRound.md).
|
|
654
654
|
|
|
655
655
|
#### Remarks
|
|
656
656
|
|
|
@@ -663,10 +663,10 @@ GamePickRound.
|
|
|
663
663
|
templates.
|
|
664
664
|
|
|
665
665
|
**Shape vs `gamePickGetActiveRound`**
|
|
666
|
-
Same GamePickRound structure, but `user_selection` /
|
|
666
|
+
Same [GamePickRound](../interfaces/GamePickRound.md) structure, but `user_selection` /
|
|
667
667
|
`team1_user_selection` / `team2_user_selection` reflect the TARGET user's
|
|
668
668
|
predictions instead of the caller's. Each event still carries its own
|
|
669
|
-
`resolution_type_id` (see GamePickResolutionType) so the UI can
|
|
669
|
+
`resolution_type_id` (see [GamePickResolutionType](../enumerations/GamePickResolutionType.md)) so the UI can
|
|
670
670
|
render result badges per pick.
|
|
671
671
|
|
|
672
672
|
**Error codes** (in `errCode`)
|
|
@@ -221,10 +221,12 @@ console.log('[smartico] page 2 loaded —', page2.length, 'more rows;',
|
|
|
221
221
|
|
|
222
222
|
Plays one round of a mini-game template — runs the server's
|
|
223
223
|
randomised prize selection, deducts the buy-in cost (if any),
|
|
224
|
-
and returns the won `prize_id`.
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
224
|
+
credits the won prize, and returns the won `prize_id`. By default
|
|
225
|
+
(`acknowledge: true`) the SDK then sends a server-side
|
|
226
|
+
acknowledgement and AWAITS it before resolving, so the win is
|
|
227
|
+
marked delivered by the time the promise settles. Pass
|
|
228
|
+
`acknowledge: false` to skip that step and finalise the win
|
|
229
|
+
yourself later (see the `acknowledge` parameter).
|
|
228
230
|
|
|
229
231
|
Works for all `SAWGameType` values EXCEPT:
|
|
230
232
|
- `PrizeDrop` — prizes arrive server-pushed; do NOT call
|
|
@@ -239,17 +241,32 @@ Works for all `SAWGameType` values EXCEPT:
|
|
|
239
241
|
`number`
|
|
240
242
|
|
|
241
243
|
The mini-game template ID (from
|
|
242
|
-
|
|
244
|
+
`TMiniGameTemplate.id`).
|
|
243
245
|
|
|
244
246
|
##### params?
|
|
245
247
|
|
|
246
|
-
Optional
|
|
247
|
-
subscribe to subsequent template refreshes.
|
|
248
|
+
Optional options bag.
|
|
248
249
|
|
|
249
250
|
###### onUpdate?
|
|
250
251
|
|
|
251
252
|
(`data`) => `void`
|
|
252
253
|
|
|
254
|
+
Pass a callback to subscribe to
|
|
255
|
+
subsequent template refreshes (same
|
|
256
|
+
channel as [getMiniGames](#getminigames)).
|
|
257
|
+
|
|
258
|
+
###### acknowledge?
|
|
259
|
+
|
|
260
|
+
`boolean` = `true`
|
|
261
|
+
|
|
262
|
+
Whether the SDK automatically sends and
|
|
263
|
+
awaits the win acknowledge after the
|
|
264
|
+
spin. Defaults to `true` (recommended).
|
|
265
|
+
Set `false` to finalise the win yourself
|
|
266
|
+
via [miniGameWinAcknowledgeRequest](#minigamewinacknowledgerequest)
|
|
267
|
+
— see "Acknowledge" above for the
|
|
268
|
+
request-id caveat.
|
|
269
|
+
|
|
253
270
|
#### Returns
|
|
254
271
|
|
|
255
272
|
`Promise`\<[`TMiniGamePlayResult`](../interfaces/TMiniGamePlayResult.md)\>
|
|
@@ -315,17 +332,34 @@ On `err_code === 0`, `prize_id` matches an entry in
|
|
|
315
332
|
corresponding domain methods.
|
|
316
333
|
- `'manual'` — operator delivers offline.
|
|
317
334
|
|
|
318
|
-
**
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
335
|
+
**Acknowledge** (the `acknowledge` parameter, default `true`)
|
|
336
|
+
Every spin is finalised by a follow-up acknowledge step that
|
|
337
|
+
marks the win delivered. By default the SDK sends that
|
|
338
|
+
acknowledge and AWAITS it, so `playMiniGame` resolves only after
|
|
339
|
+
the win is finalised server-side. Keep the default unless you
|
|
340
|
+
have a specific reason not to.
|
|
341
|
+
|
|
342
|
+
Pass `acknowledge: false` to skip that automatic step.
|
|
343
|
+
`playMiniGame` then resolves as soon as the spin result is known,
|
|
344
|
+
without waiting for the win to be marked delivered. You finalise
|
|
345
|
+
it later by calling [miniGameWinAcknowledgeRequest](#minigamewinacknowledgerequest) with the
|
|
346
|
+
`request_id` returned on this result.
|
|
347
|
+
|
|
348
|
+
What `acknowledge: false` does and does NOT defer:
|
|
349
|
+
- For STANDARD prizes the value is credited at spin time
|
|
350
|
+
regardless, so opting out does NOT delay the balance change —
|
|
351
|
+
it only defers the "delivered" bookkeeping and the `is_claimed`
|
|
352
|
+
flag flipping in [getMiniGamesHistory](#getminigameshistory).
|
|
353
|
+
- For operator-configured "explicit claim" prizes the credit IS
|
|
354
|
+
deferred until the spin is acknowledged, so those require an
|
|
355
|
+
explicit acknowledge to finalise.
|
|
356
|
+
|
|
357
|
+
A server-side fallback auto-acknowledges ordinary un-acknowledged
|
|
358
|
+
spins after a short delay (about 1–3 minutes), so an ordinary
|
|
359
|
+
prize is never lost even without consumer action. "Explicit
|
|
360
|
+
claim" prizes are excluded from that fallback — if you use
|
|
361
|
+
`acknowledge: false` for one, you MUST acknowledge it explicitly
|
|
362
|
+
or its prize is never credited.
|
|
329
363
|
|
|
330
364
|
**Idempotency**: NOT idempotent. A double-click sends two
|
|
331
365
|
spins and deducts the buy-in twice. The SDK does NOT guard
|
|
@@ -344,22 +378,21 @@ affected template's `spin_count` / `jackpot_current` /
|
|
|
344
378
|
refreshed array.
|
|
345
379
|
|
|
346
380
|
**Side effects** (on `err_code === 0`)
|
|
347
|
-
- Buy-in deducted
|
|
348
|
-
|
|
349
|
-
Balance updates flow via the
|
|
350
|
-
(
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
-
|
|
355
|
-
the result status.
|
|
381
|
+
- Buy-in deducted at spin time (points / gems / diamonds / spin
|
|
382
|
+
tickets — depending on `saw_buyin_type`), already applied by the
|
|
383
|
+
time the call resolves. Balance updates flow via the
|
|
384
|
+
user-properties channel (observe via [getUserProfile](WSAPIUser.md#getuserprofile)).
|
|
385
|
+
- Prize value credited per the prize's type (see "Prize handling"
|
|
386
|
+
above). Standard prizes are credited at spin time; "explicit
|
|
387
|
+
claim" prizes are credited when the spin is acknowledged.
|
|
388
|
+
- The play is recorded server-side for analytics / reporting.
|
|
356
389
|
|
|
357
390
|
**UI guidance**: see [UI Guide — `playMiniGame`](../_media/UIGuide_playMiniGame.md).
|
|
358
391
|
|
|
359
392
|
**Visitor mode**: not supported. Visitor sessions trying to
|
|
360
393
|
spin receive `SAW_VISITOR_STOP_SPIN_REQUEST (-40001)`.
|
|
361
394
|
|
|
362
|
-
####
|
|
395
|
+
#### Examples
|
|
363
396
|
|
|
364
397
|
```ts
|
|
365
398
|
const games = await window._smartico.api.getMiniGames({
|
|
@@ -398,17 +431,34 @@ if (r.err_code === 0) {
|
|
|
398
431
|
}
|
|
399
432
|
```
|
|
400
433
|
|
|
434
|
+
Manual finalisation (`acknowledge: false`) — e.g. an explicit
|
|
435
|
+
"Claim" CTA, or finalising on your own schedule:
|
|
436
|
+
```ts
|
|
437
|
+
const r = await window._smartico.api.playMiniGame(game.id, { acknowledge: false });
|
|
438
|
+
if (r.err_code === 0) {
|
|
439
|
+
// Spin resolved but not yet acknowledged. For standard prizes the
|
|
440
|
+
// balance already changed server-side; "explicit claim" prizes
|
|
441
|
+
// are credited only by the acknowledge below.
|
|
442
|
+
console.log('[smartico] prize won — show the result / Claim CTA, then finalise');
|
|
443
|
+
|
|
444
|
+
// On the user's Claim click, finalise with the request_id from the result.
|
|
445
|
+
await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
446
|
+
console.log('[smartico] win finalised — refresh getUserProfile / getMiniGames to reflect it');
|
|
447
|
+
}
|
|
448
|
+
```
|
|
449
|
+
|
|
401
450
|
***
|
|
402
451
|
|
|
403
452
|
### miniGameWinAcknowledgeRequest()
|
|
404
453
|
|
|
405
454
|
> **miniGameWinAcknowledgeRequest**(`request_id`): `Promise`\<[`SAWDoAknowledgeResponse`](../interfaces/SAWDoAknowledgeResponse.md)\>
|
|
406
455
|
|
|
407
|
-
Manually acknowledges a mini-game spin — marks the
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
456
|
+
Manually acknowledges a mini-game spin — marks the win delivered
|
|
457
|
+
server-side. Most consumers do NOT need this: [playMiniGame](#playminigame)
|
|
458
|
+
acknowledges by default (`acknowledge: true`) and
|
|
459
|
+
[playMiniGameBatch](#playminigamebatch) acknowledges automatically. Call this
|
|
460
|
+
directly only when you took ownership of the acknowledge step or
|
|
461
|
+
need to recover a lost one.
|
|
412
462
|
|
|
413
463
|
#### Parameters
|
|
414
464
|
|
|
@@ -416,8 +466,11 @@ this only for recovery scenarios.
|
|
|
416
466
|
|
|
417
467
|
`string`
|
|
418
468
|
|
|
419
|
-
|
|
420
|
-
|
|
469
|
+
Correlation id of the spin to finalise: the
|
|
470
|
+
`request_id` from a [playMiniGame](#playminigame) result
|
|
471
|
+
(played with `acknowledge: false`), or the
|
|
472
|
+
`client_request_id` of a
|
|
473
|
+
[getMiniGamesHistory](#getminigameshistory) row.
|
|
421
474
|
|
|
422
475
|
#### Returns
|
|
423
476
|
|
|
@@ -426,53 +479,62 @@ The `client_request_id` from a `TSawHistory`
|
|
|
426
479
|
#### Remarks
|
|
427
480
|
|
|
428
481
|
**When to call**
|
|
429
|
-
- **
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
spin
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
482
|
+
- **Primary — after `playMiniGame(..., { acknowledge: false })`.**
|
|
483
|
+
You opted out of the automatic acknowledge to finalise the win
|
|
484
|
+
on your own schedule (e.g. on a user "Claim" tap). Pass the
|
|
485
|
+
`request_id` from that call's result here when ready. This is
|
|
486
|
+
REQUIRED for operator-configured "explicit claim" prizes — they
|
|
487
|
+
are not covered by the server-side fallback, so without this
|
|
488
|
+
call their prize is never credited.
|
|
489
|
+
- **Recovery — a lost acknowledge.** [playMiniGameBatch](#playminigamebatch)
|
|
490
|
+
acknowledges on a fire-and-forget basis; if one is lost (network
|
|
491
|
+
drop) the spin shows `is_claimed: false` in
|
|
492
|
+
[getMiniGamesHistory](#getminigameshistory). Pass that row's `client_request_id`
|
|
493
|
+
to deliver it.
|
|
494
|
+
|
|
495
|
+
The `request_id` on a [playMiniGame](#playminigame) result and the
|
|
496
|
+
`client_request_id` on a [getMiniGamesHistory](#getminigameshistory) row are the
|
|
497
|
+
same correlation id — this method accepts either.
|
|
498
|
+
|
|
499
|
+
**Idempotency**: safe. Acknowledging a spin that is already
|
|
500
|
+
finalised — by you, by the automatic acknowledge, or by the
|
|
501
|
+
fallback — is a no-op with no double credit. Acknowledging a
|
|
502
|
+
failed spin's id is likewise a no-op.
|
|
443
503
|
|
|
444
504
|
**Server-side fallback**
|
|
445
|
-
Even
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
spin
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
- The spin's `is_claimed`
|
|
458
|
-
[getMiniGamesHistory](#getminigameshistory)
|
|
505
|
+
Even if you never call this, a server-side job finalises ordinary
|
|
506
|
+
un-acknowledged spins automatically after a short delay (about 1–3
|
|
507
|
+
minutes), flipping `is_claimed` to `true` on the next
|
|
508
|
+
[getMiniGamesHistory](#getminigameshistory) fetch. "Explicit claim" prizes are the
|
|
509
|
+
exception — excluded from the fallback, they require an explicit
|
|
510
|
+
call here.
|
|
511
|
+
|
|
512
|
+
**Side effects** (first successful call for an un-acknowledged spin)
|
|
513
|
+
- For "explicit claim" prizes, the prize value is credited on this
|
|
514
|
+
call. For standard prizes the value was already credited at spin
|
|
515
|
+
time (see [playMiniGame](#playminigame) "Prize handling"); this call only
|
|
516
|
+
marks the win delivered.
|
|
517
|
+
- The spin's `is_claimed` flips to `true` on the next
|
|
518
|
+
[getMiniGamesHistory](#getminigameshistory) fetch.
|
|
459
519
|
|
|
460
520
|
**Visitor mode**: not supported.
|
|
461
521
|
|
|
462
522
|
#### Example
|
|
463
523
|
|
|
464
524
|
```ts
|
|
465
|
-
|
|
466
|
-
const
|
|
525
|
+
// Primary — finalise a win you played with acknowledge: false.
|
|
526
|
+
const r = await window._smartico.api.playMiniGame(templateId, { acknowledge: false });
|
|
527
|
+
if (r.err_code === 0) {
|
|
528
|
+
console.log('[smartico] show the prize / Claim CTA; on Claim, finalise the win');
|
|
529
|
+
await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
530
|
+
}
|
|
467
531
|
|
|
468
|
-
|
|
532
|
+
// Recovery — re-acknowledge any spins a batch acknowledge missed.
|
|
533
|
+
const history = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
|
|
534
|
+
for (const row of history.filter(h => !h.is_claimed)) {
|
|
469
535
|
console.log('[smartico] re-acknowledging stale spin', row.client_request_id);
|
|
470
536
|
await window._smartico.api.miniGameWinAcknowledgeRequest(row.client_request_id);
|
|
471
537
|
}
|
|
472
|
-
|
|
473
|
-
// Re-fetch history to see the updated is_claimed flags.
|
|
474
|
-
const fresh = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
|
|
475
|
-
console.log('[smartico] history after recovery —', fresh.filter(h => !h.is_claimed).length, 'still unacknowledged');
|
|
476
538
|
```
|
|
477
539
|
|
|
478
540
|
***
|