@smartico/public-api 0.0.400 → 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 +55 -42
- package/dist/WSAPI/WSAPITypes.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +71 -55
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +62 -49
- 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 +55 -42
- package/src/WSAPI/WSAPITypes.ts +2 -2
- package/src/index.ts +1 -0
- package/tsconfig.json +1 -0
|
@@ -432,63 +432,76 @@ export class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
432
432
|
}
|
|
433
433
|
|
|
434
434
|
/**
|
|
435
|
-
* Manually acknowledges a mini-game spin — marks the
|
|
436
|
-
*
|
|
437
|
-
*
|
|
438
|
-
*
|
|
439
|
-
*
|
|
435
|
+
* Manually acknowledges a mini-game spin — marks the win delivered
|
|
436
|
+
* server-side. Most consumers do NOT need this: {@link playMiniGame}
|
|
437
|
+
* acknowledges by default (`acknowledge: true`) and
|
|
438
|
+
* {@link playMiniGameBatch} acknowledges automatically. Call this
|
|
439
|
+
* directly only when you took ownership of the acknowledge step or
|
|
440
|
+
* need to recover a lost one.
|
|
440
441
|
*
|
|
441
442
|
* @remarks
|
|
442
443
|
* **When to call**
|
|
443
|
-
* - **
|
|
444
|
-
*
|
|
445
|
-
*
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
|
-
*
|
|
449
|
-
*
|
|
450
|
-
*
|
|
451
|
-
*
|
|
452
|
-
* spin
|
|
453
|
-
*
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
444
|
+
* - **Primary — after `playMiniGame(..., { acknowledge: false })`.**
|
|
445
|
+
* You opted out of the automatic acknowledge to finalise the win
|
|
446
|
+
* on your own schedule (e.g. on a user "Claim" tap). Pass the
|
|
447
|
+
* `request_id` from that call's result here when ready. This is
|
|
448
|
+
* REQUIRED for operator-configured "explicit claim" prizes — they
|
|
449
|
+
* are not covered by the server-side fallback, so without this
|
|
450
|
+
* call their prize is never credited.
|
|
451
|
+
* - **Recovery — a lost acknowledge.** {@link playMiniGameBatch}
|
|
452
|
+
* acknowledges on a fire-and-forget basis; if one is lost (network
|
|
453
|
+
* drop) the spin shows `is_claimed: false` in
|
|
454
|
+
* {@link getMiniGamesHistory}. Pass that row's `client_request_id`
|
|
455
|
+
* to deliver it.
|
|
456
|
+
*
|
|
457
|
+
* The `request_id` on a {@link playMiniGame} result and the
|
|
458
|
+
* `client_request_id` on a {@link getMiniGamesHistory} row are the
|
|
459
|
+
* same correlation id — this method accepts either.
|
|
460
|
+
*
|
|
461
|
+
* **Idempotency**: safe. Acknowledging a spin that is already
|
|
462
|
+
* finalised — by you, by the automatic acknowledge, or by the
|
|
463
|
+
* fallback — is a no-op with no double credit. Acknowledging a
|
|
464
|
+
* failed spin's id is likewise a no-op.
|
|
457
465
|
*
|
|
458
466
|
* **Server-side fallback**
|
|
459
|
-
* Even
|
|
460
|
-
*
|
|
461
|
-
*
|
|
462
|
-
*
|
|
463
|
-
*
|
|
464
|
-
*
|
|
465
|
-
*
|
|
466
|
-
*
|
|
467
|
-
*
|
|
468
|
-
* spin
|
|
469
|
-
*
|
|
470
|
-
*
|
|
471
|
-
* - The spin's `is_claimed`
|
|
472
|
-
* {@link getMiniGamesHistory}
|
|
467
|
+
* Even if you never call this, a server-side job finalises ordinary
|
|
468
|
+
* un-acknowledged spins automatically after a short delay (about 1–3
|
|
469
|
+
* minutes), flipping `is_claimed` to `true` on the next
|
|
470
|
+
* {@link getMiniGamesHistory} fetch. "Explicit claim" prizes are the
|
|
471
|
+
* exception — excluded from the fallback, they require an explicit
|
|
472
|
+
* call here.
|
|
473
|
+
*
|
|
474
|
+
* **Side effects** (first successful call for an un-acknowledged spin)
|
|
475
|
+
* - For "explicit claim" prizes, the prize value is credited on this
|
|
476
|
+
* call. For standard prizes the value was already credited at spin
|
|
477
|
+
* time (see {@link playMiniGame} "Prize handling"); this call only
|
|
478
|
+
* marks the win delivered.
|
|
479
|
+
* - The spin's `is_claimed` flips to `true` on the next
|
|
480
|
+
* {@link getMiniGamesHistory} fetch.
|
|
473
481
|
*
|
|
474
482
|
* **Visitor mode**: not supported.
|
|
475
483
|
*
|
|
476
|
-
* @param request_id
|
|
477
|
-
*
|
|
484
|
+
* @param request_id Correlation id of the spin to finalise: the
|
|
485
|
+
* `request_id` from a {@link playMiniGame} result
|
|
486
|
+
* (played with `acknowledge: false`), or the
|
|
487
|
+
* `client_request_id` of a
|
|
488
|
+
* {@link getMiniGamesHistory} row.
|
|
478
489
|
*
|
|
479
490
|
* @example
|
|
480
491
|
* ```ts
|
|
481
|
-
*
|
|
482
|
-
* const
|
|
492
|
+
* // Primary — finalise a win you played with acknowledge: false.
|
|
493
|
+
* const r = await window._smartico.api.playMiniGame(templateId, { acknowledge: false });
|
|
494
|
+
* if (r.err_code === 0) {
|
|
495
|
+
* console.log('[smartico] show the prize / Claim CTA; on Claim, finalise the win');
|
|
496
|
+
* await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
497
|
+
* }
|
|
483
498
|
*
|
|
484
|
-
*
|
|
499
|
+
* // Recovery — re-acknowledge any spins a batch acknowledge missed.
|
|
500
|
+
* const history = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
|
|
501
|
+
* for (const row of history.filter(h => !h.is_claimed)) {
|
|
485
502
|
* console.log('[smartico] re-acknowledging stale spin', row.client_request_id);
|
|
486
503
|
* await window._smartico.api.miniGameWinAcknowledgeRequest(row.client_request_id);
|
|
487
504
|
* }
|
|
488
|
-
*
|
|
489
|
-
* // Re-fetch history to see the updated is_claimed flags.
|
|
490
|
-
* const fresh = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
|
|
491
|
-
* console.log('[smartico] history after recovery —', fresh.filter(h => !h.is_claimed).length, 'still unacknowledged');
|
|
492
505
|
* ```
|
|
493
506
|
*/
|
|
494
507
|
public async miniGameWinAcknowledgeRequest(request_id: string) {
|
package/src/WSAPI/WSAPITypes.ts
CHANGED
|
@@ -103,9 +103,9 @@ export interface TMiniGamePlayResult {
|
|
|
103
103
|
* slot). Always populated, even when `err_code !== 0`. */
|
|
104
104
|
prize_id: number;
|
|
105
105
|
/** Correlation id of this spin. Pass it to
|
|
106
|
-
*
|
|
106
|
+
* `miniGameWinAcknowledgeRequest` to finalise the win when
|
|
107
107
|
* playing with `acknowledge: false` — no need to look it up via
|
|
108
|
-
*
|
|
108
|
+
* `getMiniGamesHistory`. */
|
|
109
109
|
request_id: string;
|
|
110
110
|
}
|
|
111
111
|
|
package/src/index.ts
CHANGED
package/tsconfig.json
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"src/WSAPI/WSAPILeaderBoard.ts",
|
|
31
31
|
"src/WSAPI/WSAPIInbox.ts",
|
|
32
32
|
"src/WSAPI/WSAPITypes.ts",
|
|
33
|
+
"src/GamePick/GamePickTypes.ts",
|
|
33
34
|
"src/Tournaments/TournamentRegistrationStatus.ts",
|
|
34
35
|
"src/Tournaments/TournamentRegistrationType.ts",
|
|
35
36
|
"src/Tournaments/TournamentRegistrationError.ts",
|