@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.modern.mjs
CHANGED
|
@@ -6930,10 +6930,8 @@ class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
6930
6930
|
* Pass `acknowledge: false` to skip that automatic step.
|
|
6931
6931
|
* `playMiniGame` then resolves as soon as the spin result is known,
|
|
6932
6932
|
* without waiting for the win to be marked delivered. You finalise
|
|
6933
|
-
* it later by calling {@link miniGameWinAcknowledgeRequest}
|
|
6934
|
-
*
|
|
6935
|
-
* `client_request_id` of the matching {@link getMiniGamesHistory}
|
|
6936
|
-
* row (the spin appears there with `is_claimed: false`).
|
|
6933
|
+
* it later by calling {@link miniGameWinAcknowledgeRequest} with the
|
|
6934
|
+
* `request_id` returned on this result.
|
|
6937
6935
|
*
|
|
6938
6936
|
* What `acknowledge: false` does and does NOT defer:
|
|
6939
6937
|
* - For STANDARD prizes the value is credited at spin time
|
|
@@ -7048,12 +7046,9 @@ class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
7048
7046
|
* // are credited only by the acknowledge below.
|
|
7049
7047
|
* console.log('[smartico] prize won — show the result / Claim CTA, then finalise');
|
|
7050
7048
|
*
|
|
7051
|
-
* //
|
|
7052
|
-
*
|
|
7053
|
-
*
|
|
7054
|
-
* await window._smartico.api.miniGameWinAcknowledgeRequest(row.client_request_id);
|
|
7055
|
-
* console.log('[smartico] win finalised — refresh getUserProfile / getMiniGames to reflect it');
|
|
7056
|
-
* }
|
|
7049
|
+
* // On the user's Claim click, finalise with the request_id from the result.
|
|
7050
|
+
* await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
7051
|
+
* console.log('[smartico] win finalised — refresh getUserProfile / getMiniGames to reflect it');
|
|
7057
7052
|
* }
|
|
7058
7053
|
* ```
|
|
7059
7054
|
*/
|
|
@@ -7071,68 +7066,82 @@ class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
7071
7066
|
const o = {
|
|
7072
7067
|
err_code: r.errCode,
|
|
7073
7068
|
err_message: r.errMsg,
|
|
7074
|
-
prize_id: r.saw_prize_id
|
|
7069
|
+
prize_id: r.saw_prize_id,
|
|
7070
|
+
request_id: r.request_id
|
|
7075
7071
|
};
|
|
7076
7072
|
return o;
|
|
7077
7073
|
}
|
|
7078
7074
|
/**
|
|
7079
|
-
* Manually acknowledges a mini-game spin — marks the
|
|
7080
|
-
*
|
|
7081
|
-
*
|
|
7082
|
-
*
|
|
7083
|
-
*
|
|
7075
|
+
* Manually acknowledges a mini-game spin — marks the win delivered
|
|
7076
|
+
* server-side. Most consumers do NOT need this: {@link playMiniGame}
|
|
7077
|
+
* acknowledges by default (`acknowledge: true`) and
|
|
7078
|
+
* {@link playMiniGameBatch} acknowledges automatically. Call this
|
|
7079
|
+
* directly only when you took ownership of the acknowledge step or
|
|
7080
|
+
* need to recover a lost one.
|
|
7084
7081
|
*
|
|
7085
7082
|
* @remarks
|
|
7086
7083
|
* **When to call**
|
|
7087
|
-
* - **
|
|
7088
|
-
*
|
|
7089
|
-
*
|
|
7090
|
-
*
|
|
7091
|
-
*
|
|
7092
|
-
*
|
|
7093
|
-
*
|
|
7094
|
-
*
|
|
7095
|
-
*
|
|
7096
|
-
* spin
|
|
7097
|
-
*
|
|
7098
|
-
*
|
|
7099
|
-
*
|
|
7100
|
-
*
|
|
7084
|
+
* - **Primary — after `playMiniGame(..., { acknowledge: false })`.**
|
|
7085
|
+
* You opted out of the automatic acknowledge to finalise the win
|
|
7086
|
+
* on your own schedule (e.g. on a user "Claim" tap). Pass the
|
|
7087
|
+
* `request_id` from that call's result here when ready. This is
|
|
7088
|
+
* REQUIRED for operator-configured "explicit claim" prizes — they
|
|
7089
|
+
* are not covered by the server-side fallback, so without this
|
|
7090
|
+
* call their prize is never credited.
|
|
7091
|
+
* - **Recovery — a lost acknowledge.** {@link playMiniGameBatch}
|
|
7092
|
+
* acknowledges on a fire-and-forget basis; if one is lost (network
|
|
7093
|
+
* drop) the spin shows `is_claimed: false` in
|
|
7094
|
+
* {@link getMiniGamesHistory}. Pass that row's `client_request_id`
|
|
7095
|
+
* to deliver it.
|
|
7096
|
+
*
|
|
7097
|
+
* The `request_id` on a {@link playMiniGame} result and the
|
|
7098
|
+
* `client_request_id` on a {@link getMiniGamesHistory} row are the
|
|
7099
|
+
* same correlation id — this method accepts either.
|
|
7100
|
+
*
|
|
7101
|
+
* **Idempotency**: safe. Acknowledging a spin that is already
|
|
7102
|
+
* finalised — by you, by the automatic acknowledge, or by the
|
|
7103
|
+
* fallback — is a no-op with no double credit. Acknowledging a
|
|
7104
|
+
* failed spin's id is likewise a no-op.
|
|
7101
7105
|
*
|
|
7102
7106
|
* **Server-side fallback**
|
|
7103
|
-
* Even
|
|
7104
|
-
*
|
|
7105
|
-
*
|
|
7106
|
-
*
|
|
7107
|
-
*
|
|
7108
|
-
*
|
|
7109
|
-
*
|
|
7110
|
-
*
|
|
7111
|
-
*
|
|
7112
|
-
* spin
|
|
7113
|
-
*
|
|
7114
|
-
*
|
|
7115
|
-
* - The spin's `is_claimed`
|
|
7116
|
-
* {@link getMiniGamesHistory}
|
|
7107
|
+
* Even if you never call this, a server-side job finalises ordinary
|
|
7108
|
+
* un-acknowledged spins automatically after a short delay (about 1–3
|
|
7109
|
+
* minutes), flipping `is_claimed` to `true` on the next
|
|
7110
|
+
* {@link getMiniGamesHistory} fetch. "Explicit claim" prizes are the
|
|
7111
|
+
* exception — excluded from the fallback, they require an explicit
|
|
7112
|
+
* call here.
|
|
7113
|
+
*
|
|
7114
|
+
* **Side effects** (first successful call for an un-acknowledged spin)
|
|
7115
|
+
* - For "explicit claim" prizes, the prize value is credited on this
|
|
7116
|
+
* call. For standard prizes the value was already credited at spin
|
|
7117
|
+
* time (see {@link playMiniGame} "Prize handling"); this call only
|
|
7118
|
+
* marks the win delivered.
|
|
7119
|
+
* - The spin's `is_claimed` flips to `true` on the next
|
|
7120
|
+
* {@link getMiniGamesHistory} fetch.
|
|
7117
7121
|
*
|
|
7118
7122
|
* **Visitor mode**: not supported.
|
|
7119
7123
|
*
|
|
7120
|
-
* @param request_id
|
|
7121
|
-
*
|
|
7124
|
+
* @param request_id Correlation id of the spin to finalise: the
|
|
7125
|
+
* `request_id` from a {@link playMiniGame} result
|
|
7126
|
+
* (played with `acknowledge: false`), or the
|
|
7127
|
+
* `client_request_id` of a
|
|
7128
|
+
* {@link getMiniGamesHistory} row.
|
|
7122
7129
|
*
|
|
7123
7130
|
* @example
|
|
7124
7131
|
* ```ts
|
|
7125
|
-
*
|
|
7126
|
-
* const
|
|
7132
|
+
* // Primary — finalise a win you played with acknowledge: false.
|
|
7133
|
+
* const r = await window._smartico.api.playMiniGame(templateId, { acknowledge: false });
|
|
7134
|
+
* if (r.err_code === 0) {
|
|
7135
|
+
* console.log('[smartico] show the prize / Claim CTA; on Claim, finalise the win');
|
|
7136
|
+
* await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
7137
|
+
* }
|
|
7127
7138
|
*
|
|
7128
|
-
*
|
|
7139
|
+
* // Recovery — re-acknowledge any spins a batch acknowledge missed.
|
|
7140
|
+
* const history = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
|
|
7141
|
+
* for (const row of history.filter(h => !h.is_claimed)) {
|
|
7129
7142
|
* console.log('[smartico] re-acknowledging stale spin', row.client_request_id);
|
|
7130
7143
|
* await window._smartico.api.miniGameWinAcknowledgeRequest(row.client_request_id);
|
|
7131
7144
|
* }
|
|
7132
|
-
*
|
|
7133
|
-
* // Re-fetch history to see the updated is_claimed flags.
|
|
7134
|
-
* const fresh = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
|
|
7135
|
-
* console.log('[smartico] history after recovery —', fresh.filter(h => !h.is_claimed).length, 'still unacknowledged');
|
|
7136
7145
|
* ```
|
|
7137
7146
|
*/
|
|
7138
7147
|
async miniGameWinAcknowledgeRequest(request_id) {
|
|
@@ -7998,9 +8007,9 @@ class WSAPIGamePick extends WSAPIAvatars {
|
|
|
7998
8007
|
* **Side effects**
|
|
7999
8008
|
* - First successful submit deducts the buy-in (Points / Gems / Diamonds /
|
|
8000
8009
|
* one Spin) per `saw_buyin_type_id`.
|
|
8001
|
-
* -
|
|
8002
|
-
*
|
|
8003
|
-
*
|
|
8010
|
+
* - Records the user's participation against the round and its events
|
|
8011
|
+
* server-side and reports a prediction event to the operator's activity
|
|
8012
|
+
* stream.
|
|
8004
8013
|
* - Score is awarded after the operator resolves the round
|
|
8005
8014
|
* ({@link GPRoundStatus} = `RoundResolved`).
|
|
8006
8015
|
*
|
|
@@ -8099,9 +8108,9 @@ class WSAPIGamePick extends WSAPIAvatars {
|
|
|
8099
8108
|
* **Idempotency**: identical to {@link gamePickSubmitSelection} — re-submit
|
|
8100
8109
|
* returns `errCode: 3` and never double-charges the buy-in.
|
|
8101
8110
|
*
|
|
8102
|
-
* **Side effects**: identical to {@link gamePickSubmitSelection}
|
|
8103
|
-
*
|
|
8104
|
-
*
|
|
8111
|
+
* **Side effects**: identical to {@link gamePickSubmitSelection} — buy-in
|
|
8112
|
+
* deduction on first submit, participation recorded, score awarded on round
|
|
8113
|
+
* resolution.
|
|
8105
8114
|
*
|
|
8106
8115
|
* **Visitor mode**: not supported.
|
|
8107
8116
|
*
|
|
@@ -10401,7 +10410,7 @@ class SmarticoAPI {
|
|
|
10401
10410
|
body: JSON.stringify(params)
|
|
10402
10411
|
};
|
|
10403
10412
|
} else if (params) {
|
|
10404
|
-
const extraQuery = Object.entries(params).map(([k, v]) => `${k}=${encodeURIComponent(JSON.stringify(v))}`).join('&');
|
|
10413
|
+
const extraQuery = Object.entries(params).filter(([, v]) => v !== null && v !== undefined).map(([k, v]) => `${k}=${encodeURIComponent(typeof v === 'object' ? JSON.stringify(v) : v)}`).join('&');
|
|
10405
10414
|
url += `&${extraQuery}`;
|
|
10406
10415
|
}
|
|
10407
10416
|
try {
|