@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/dist/index.js
CHANGED
|
@@ -7378,10 +7378,8 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7378
7378
|
* Pass `acknowledge: false` to skip that automatic step.
|
|
7379
7379
|
* `playMiniGame` then resolves as soon as the spin result is known,
|
|
7380
7380
|
* without waiting for the win to be marked delivered. You finalise
|
|
7381
|
-
* it later by calling {@link miniGameWinAcknowledgeRequest}
|
|
7382
|
-
*
|
|
7383
|
-
* `client_request_id` of the matching {@link getMiniGamesHistory}
|
|
7384
|
-
* row (the spin appears there with `is_claimed: false`).
|
|
7381
|
+
* it later by calling {@link miniGameWinAcknowledgeRequest} with the
|
|
7382
|
+
* `request_id` returned on this result.
|
|
7385
7383
|
*
|
|
7386
7384
|
* What `acknowledge: false` does and does NOT defer:
|
|
7387
7385
|
* - For STANDARD prizes the value is credited at spin time
|
|
@@ -7496,12 +7494,9 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7496
7494
|
* // are credited only by the acknowledge below.
|
|
7497
7495
|
* console.log('[smartico] prize won — show the result / Claim CTA, then finalise');
|
|
7498
7496
|
*
|
|
7499
|
-
* //
|
|
7500
|
-
*
|
|
7501
|
-
*
|
|
7502
|
-
* await window._smartico.api.miniGameWinAcknowledgeRequest(row.client_request_id);
|
|
7503
|
-
* console.log('[smartico] win finalised — refresh getUserProfile / getMiniGames to reflect it');
|
|
7504
|
-
* }
|
|
7497
|
+
* // On the user's Claim click, finalise with the request_id from the result.
|
|
7498
|
+
* await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
7499
|
+
* console.log('[smartico] win finalised — refresh getUserProfile / getMiniGames to reflect it');
|
|
7505
7500
|
* }
|
|
7506
7501
|
* ```
|
|
7507
7502
|
*/
|
|
@@ -7521,7 +7516,8 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7521
7516
|
var o = {
|
|
7522
7517
|
err_code: r.errCode,
|
|
7523
7518
|
err_message: r.errMsg,
|
|
7524
|
-
prize_id: r.saw_prize_id
|
|
7519
|
+
prize_id: r.saw_prize_id,
|
|
7520
|
+
request_id: r.request_id
|
|
7525
7521
|
};
|
|
7526
7522
|
return o;
|
|
7527
7523
|
}
|
|
@@ -7537,63 +7533,76 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7537
7533
|
}
|
|
7538
7534
|
}
|
|
7539
7535
|
/**
|
|
7540
|
-
* Manually acknowledges a mini-game spin — marks the
|
|
7541
|
-
*
|
|
7542
|
-
*
|
|
7543
|
-
*
|
|
7544
|
-
*
|
|
7536
|
+
* Manually acknowledges a mini-game spin — marks the win delivered
|
|
7537
|
+
* server-side. Most consumers do NOT need this: {@link playMiniGame}
|
|
7538
|
+
* acknowledges by default (`acknowledge: true`) and
|
|
7539
|
+
* {@link playMiniGameBatch} acknowledges automatically. Call this
|
|
7540
|
+
* directly only when you took ownership of the acknowledge step or
|
|
7541
|
+
* need to recover a lost one.
|
|
7545
7542
|
*
|
|
7546
7543
|
* @remarks
|
|
7547
7544
|
* **When to call**
|
|
7548
|
-
* - **
|
|
7549
|
-
*
|
|
7550
|
-
*
|
|
7551
|
-
*
|
|
7552
|
-
*
|
|
7553
|
-
*
|
|
7554
|
-
*
|
|
7555
|
-
*
|
|
7556
|
-
*
|
|
7557
|
-
* spin
|
|
7558
|
-
*
|
|
7559
|
-
*
|
|
7560
|
-
*
|
|
7561
|
-
*
|
|
7545
|
+
* - **Primary — after `playMiniGame(..., { acknowledge: false })`.**
|
|
7546
|
+
* You opted out of the automatic acknowledge to finalise the win
|
|
7547
|
+
* on your own schedule (e.g. on a user "Claim" tap). Pass the
|
|
7548
|
+
* `request_id` from that call's result here when ready. This is
|
|
7549
|
+
* REQUIRED for operator-configured "explicit claim" prizes — they
|
|
7550
|
+
* are not covered by the server-side fallback, so without this
|
|
7551
|
+
* call their prize is never credited.
|
|
7552
|
+
* - **Recovery — a lost acknowledge.** {@link playMiniGameBatch}
|
|
7553
|
+
* acknowledges on a fire-and-forget basis; if one is lost (network
|
|
7554
|
+
* drop) the spin shows `is_claimed: false` in
|
|
7555
|
+
* {@link getMiniGamesHistory}. Pass that row's `client_request_id`
|
|
7556
|
+
* to deliver it.
|
|
7557
|
+
*
|
|
7558
|
+
* The `request_id` on a {@link playMiniGame} result and the
|
|
7559
|
+
* `client_request_id` on a {@link getMiniGamesHistory} row are the
|
|
7560
|
+
* same correlation id — this method accepts either.
|
|
7561
|
+
*
|
|
7562
|
+
* **Idempotency**: safe. Acknowledging a spin that is already
|
|
7563
|
+
* finalised — by you, by the automatic acknowledge, or by the
|
|
7564
|
+
* fallback — is a no-op with no double credit. Acknowledging a
|
|
7565
|
+
* failed spin's id is likewise a no-op.
|
|
7562
7566
|
*
|
|
7563
7567
|
* **Server-side fallback**
|
|
7564
|
-
* Even
|
|
7565
|
-
*
|
|
7566
|
-
*
|
|
7567
|
-
*
|
|
7568
|
-
*
|
|
7569
|
-
*
|
|
7570
|
-
*
|
|
7571
|
-
*
|
|
7572
|
-
*
|
|
7573
|
-
* spin
|
|
7574
|
-
*
|
|
7575
|
-
*
|
|
7576
|
-
* - The spin's `is_claimed`
|
|
7577
|
-
* {@link getMiniGamesHistory}
|
|
7568
|
+
* Even if you never call this, a server-side job finalises ordinary
|
|
7569
|
+
* un-acknowledged spins automatically after a short delay (about 1–3
|
|
7570
|
+
* minutes), flipping `is_claimed` to `true` on the next
|
|
7571
|
+
* {@link getMiniGamesHistory} fetch. "Explicit claim" prizes are the
|
|
7572
|
+
* exception — excluded from the fallback, they require an explicit
|
|
7573
|
+
* call here.
|
|
7574
|
+
*
|
|
7575
|
+
* **Side effects** (first successful call for an un-acknowledged spin)
|
|
7576
|
+
* - For "explicit claim" prizes, the prize value is credited on this
|
|
7577
|
+
* call. For standard prizes the value was already credited at spin
|
|
7578
|
+
* time (see {@link playMiniGame} "Prize handling"); this call only
|
|
7579
|
+
* marks the win delivered.
|
|
7580
|
+
* - The spin's `is_claimed` flips to `true` on the next
|
|
7581
|
+
* {@link getMiniGamesHistory} fetch.
|
|
7578
7582
|
*
|
|
7579
7583
|
* **Visitor mode**: not supported.
|
|
7580
7584
|
*
|
|
7581
|
-
* @param request_id
|
|
7582
|
-
*
|
|
7585
|
+
* @param request_id Correlation id of the spin to finalise: the
|
|
7586
|
+
* `request_id` from a {@link playMiniGame} result
|
|
7587
|
+
* (played with `acknowledge: false`), or the
|
|
7588
|
+
* `client_request_id` of a
|
|
7589
|
+
* {@link getMiniGamesHistory} row.
|
|
7583
7590
|
*
|
|
7584
7591
|
* @example
|
|
7585
7592
|
* ```ts
|
|
7586
|
-
*
|
|
7587
|
-
* const
|
|
7593
|
+
* // Primary — finalise a win you played with acknowledge: false.
|
|
7594
|
+
* const r = await window._smartico.api.playMiniGame(templateId, { acknowledge: false });
|
|
7595
|
+
* if (r.err_code === 0) {
|
|
7596
|
+
* console.log('[smartico] show the prize / Claim CTA; on Claim, finalise the win');
|
|
7597
|
+
* await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
7598
|
+
* }
|
|
7588
7599
|
*
|
|
7589
|
-
*
|
|
7600
|
+
* // Recovery — re-acknowledge any spins a batch acknowledge missed.
|
|
7601
|
+
* const history = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
|
|
7602
|
+
* for (const row of history.filter(h => !h.is_claimed)) {
|
|
7590
7603
|
* console.log('[smartico] re-acknowledging stale spin', row.client_request_id);
|
|
7591
7604
|
* await window._smartico.api.miniGameWinAcknowledgeRequest(row.client_request_id);
|
|
7592
7605
|
* }
|
|
7593
|
-
*
|
|
7594
|
-
* // Re-fetch history to see the updated is_claimed flags.
|
|
7595
|
-
* const fresh = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
|
|
7596
|
-
* console.log('[smartico] history after recovery —', fresh.filter(h => !h.is_claimed).length, 'still unacknowledged');
|
|
7597
7606
|
* ```
|
|
7598
7607
|
*/
|
|
7599
7608
|
;
|
|
@@ -8565,9 +8574,9 @@ var WSAPIGamePick = /*#__PURE__*/function (_WSAPIAvatars) {
|
|
|
8565
8574
|
* **Side effects**
|
|
8566
8575
|
* - First successful submit deducts the buy-in (Points / Gems / Diamonds /
|
|
8567
8576
|
* one Spin) per `saw_buyin_type_id`.
|
|
8568
|
-
* -
|
|
8569
|
-
*
|
|
8570
|
-
*
|
|
8577
|
+
* - Records the user's participation against the round and its events
|
|
8578
|
+
* server-side and reports a prediction event to the operator's activity
|
|
8579
|
+
* stream.
|
|
8571
8580
|
* - Score is awarded after the operator resolves the round
|
|
8572
8581
|
* ({@link GPRoundStatus} = `RoundResolved`).
|
|
8573
8582
|
*
|
|
@@ -8672,9 +8681,9 @@ var WSAPIGamePick = /*#__PURE__*/function (_WSAPIAvatars) {
|
|
|
8672
8681
|
* **Idempotency**: identical to {@link gamePickSubmitSelection} — re-submit
|
|
8673
8682
|
* returns `errCode: 3` and never double-charges the buy-in.
|
|
8674
8683
|
*
|
|
8675
|
-
* **Side effects**: identical to {@link gamePickSubmitSelection}
|
|
8676
|
-
*
|
|
8677
|
-
*
|
|
8684
|
+
* **Side effects**: identical to {@link gamePickSubmitSelection} — buy-in
|
|
8685
|
+
* deduction on first submit, participation recorded, score awarded on round
|
|
8686
|
+
* resolution.
|
|
8678
8687
|
*
|
|
8679
8688
|
* **Visitor mode**: not supported.
|
|
8680
8689
|
*
|
|
@@ -11672,10 +11681,13 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
11672
11681
|
body: JSON.stringify(params)
|
|
11673
11682
|
};
|
|
11674
11683
|
} else if (params) {
|
|
11675
|
-
var extraQuery = Object.entries(params).
|
|
11676
|
-
var
|
|
11677
|
-
|
|
11678
|
-
|
|
11684
|
+
var extraQuery = Object.entries(params).filter(function (_ref5) {
|
|
11685
|
+
var v = _ref5[1];
|
|
11686
|
+
return v !== null && v !== undefined;
|
|
11687
|
+
}).map(function (_ref6) {
|
|
11688
|
+
var k = _ref6[0],
|
|
11689
|
+
v = _ref6[1];
|
|
11690
|
+
return k + "=" + encodeURIComponent(typeof v === 'object' ? JSON.stringify(v) : v);
|
|
11679
11691
|
}).join('&');
|
|
11680
11692
|
url += "&" + extraQuery;
|
|
11681
11693
|
}
|
|
@@ -11696,9 +11708,9 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
11696
11708
|
return Promise.reject(e);
|
|
11697
11709
|
}
|
|
11698
11710
|
};
|
|
11699
|
-
_proto.sendAvatarApi = function sendAvatarApi(
|
|
11700
|
-
var method =
|
|
11701
|
-
body =
|
|
11711
|
+
_proto.sendAvatarApi = function sendAvatarApi(_ref7) {
|
|
11712
|
+
var method = _ref7.method,
|
|
11713
|
+
body = _ref7.body;
|
|
11702
11714
|
try {
|
|
11703
11715
|
var _this75 = this;
|
|
11704
11716
|
if (!_this75.tracker) {
|