@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
|
@@ -287,10 +287,8 @@ export class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
287
287
|
* Pass `acknowledge: false` to skip that automatic step.
|
|
288
288
|
* `playMiniGame` then resolves as soon as the spin result is known,
|
|
289
289
|
* without waiting for the win to be marked delivered. You finalise
|
|
290
|
-
* it later by calling {@link miniGameWinAcknowledgeRequest}
|
|
291
|
-
*
|
|
292
|
-
* `client_request_id` of the matching {@link getMiniGamesHistory}
|
|
293
|
-
* row (the spin appears there with `is_claimed: false`).
|
|
290
|
+
* it later by calling {@link miniGameWinAcknowledgeRequest} with the
|
|
291
|
+
* `request_id` returned on this result.
|
|
294
292
|
*
|
|
295
293
|
* What `acknowledge: false` does and does NOT defer:
|
|
296
294
|
* - For STANDARD prizes the value is credited at spin time
|
|
@@ -405,12 +403,9 @@ export class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
405
403
|
* // are credited only by the acknowledge below.
|
|
406
404
|
* console.log('[smartico] prize won — show the result / Claim CTA, then finalise');
|
|
407
405
|
*
|
|
408
|
-
* //
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
-
* await window._smartico.api.miniGameWinAcknowledgeRequest(row.client_request_id);
|
|
412
|
-
* console.log('[smartico] win finalised — refresh getUserProfile / getMiniGames to reflect it');
|
|
413
|
-
* }
|
|
406
|
+
* // On the user's Claim click, finalise with the request_id from the result.
|
|
407
|
+
* await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
408
|
+
* console.log('[smartico] win finalised — refresh getUserProfile / getMiniGames to reflect it');
|
|
414
409
|
* }
|
|
415
410
|
* ```
|
|
416
411
|
*/
|
|
@@ -430,69 +425,83 @@ export class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
430
425
|
err_code: r.errCode,
|
|
431
426
|
err_message: r.errMsg,
|
|
432
427
|
prize_id: r.saw_prize_id,
|
|
428
|
+
request_id: r.request_id,
|
|
433
429
|
};
|
|
434
430
|
|
|
435
431
|
return o;
|
|
436
432
|
}
|
|
437
433
|
|
|
438
434
|
/**
|
|
439
|
-
* Manually acknowledges a mini-game spin — marks the
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
*
|
|
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.
|
|
444
441
|
*
|
|
445
442
|
* @remarks
|
|
446
443
|
* **When to call**
|
|
447
|
-
* - **
|
|
448
|
-
*
|
|
449
|
-
*
|
|
450
|
-
*
|
|
451
|
-
*
|
|
452
|
-
*
|
|
453
|
-
*
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
* spin
|
|
457
|
-
*
|
|
458
|
-
*
|
|
459
|
-
*
|
|
460
|
-
*
|
|
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.
|
|
461
465
|
*
|
|
462
466
|
* **Server-side fallback**
|
|
463
|
-
* Even
|
|
464
|
-
*
|
|
465
|
-
*
|
|
466
|
-
*
|
|
467
|
-
*
|
|
468
|
-
*
|
|
469
|
-
*
|
|
470
|
-
*
|
|
471
|
-
*
|
|
472
|
-
* spin
|
|
473
|
-
*
|
|
474
|
-
*
|
|
475
|
-
* - The spin's `is_claimed`
|
|
476
|
-
* {@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.
|
|
477
481
|
*
|
|
478
482
|
* **Visitor mode**: not supported.
|
|
479
483
|
*
|
|
480
|
-
* @param request_id
|
|
481
|
-
*
|
|
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.
|
|
482
489
|
*
|
|
483
490
|
* @example
|
|
484
491
|
* ```ts
|
|
485
|
-
*
|
|
486
|
-
* 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
|
+
* }
|
|
487
498
|
*
|
|
488
|
-
*
|
|
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)) {
|
|
489
502
|
* console.log('[smartico] re-acknowledging stale spin', row.client_request_id);
|
|
490
503
|
* await window._smartico.api.miniGameWinAcknowledgeRequest(row.client_request_id);
|
|
491
504
|
* }
|
|
492
|
-
*
|
|
493
|
-
* // Re-fetch history to see the updated is_claimed flags.
|
|
494
|
-
* const fresh = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
|
|
495
|
-
* console.log('[smartico] history after recovery —', fresh.filter(h => !h.is_claimed).length, 'still unacknowledged');
|
|
496
505
|
* ```
|
|
497
506
|
*/
|
|
498
507
|
public async miniGameWinAcknowledgeRequest(request_id: string) {
|
package/src/WSAPI/WSAPITypes.ts
CHANGED
|
@@ -102,6 +102,11 @@ export interface TMiniGamePlayResult {
|
|
|
102
102
|
* (including `prize_type === 'no-prize'` for a configured loss
|
|
103
103
|
* slot). Always populated, even when `err_code !== 0`. */
|
|
104
104
|
prize_id: number;
|
|
105
|
+
/** Correlation id of this spin. Pass it to
|
|
106
|
+
* `miniGameWinAcknowledgeRequest` to finalise the win when
|
|
107
|
+
* playing with `acknowledge: false` — no need to look it up via
|
|
108
|
+
* `getMiniGamesHistory`. */
|
|
109
|
+
request_id: string;
|
|
105
110
|
}
|
|
106
111
|
|
|
107
112
|
/**
|
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",
|