@smartico/public-api 0.0.408 → 0.0.410
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/GamePick/GamePickTypes.d.ts +6 -1
- package/dist/MiniGames/SAWDoAknowledgeRequest.d.ts +2 -0
- package/dist/MiniGames/SAWPrize.d.ts +9 -0
- package/dist/MiniGames/SAWTemplate.d.ts +1 -0
- package/dist/SmarticoAPI.d.ts +1 -1
- package/dist/SmarticoLib/index.d.ts +1 -1
- package/dist/Tournaments/GetClanTournamentPlayersResponse.d.ts +2 -16
- package/dist/WSAPI/WSAPIJackpots.d.ts +11 -2
- package/dist/WSAPI/WSAPIMiniGames.d.ts +86 -23
- package/dist/WSAPI/WSAPITypes.d.ts +16 -12
- package/dist/index.js +109 -31
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +106 -28
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/README.md +0 -2
- package/docs/api/classes/WSAPIJackpots.md +11 -2
- package/docs/api/classes/WSAPIMiniGames.md +86 -23
- package/docs/api/functions/clanTournamentPlayersTransform.md +2 -2
- package/docs/api/interfaces/GamePickEvent.md +6 -1
- package/docs/api/interfaces/SAWDoAknowledgeRequest.md +8 -0
- package/docs/api/interfaces/SAWPrize.md +18 -0
- package/docs/api/interfaces/SAWTemplate.md +2 -0
- package/docs/api/interfaces/TMiniGamePrize.md +25 -9
- package/docs/api/interfaces/TMiniGameTemplate.md +3 -3
- package/docs/capabilities/gamePickGetActiveRound.md +1 -1
- package/docs/capabilities/gamePickGetActiveRounds.md +1 -1
- package/docs/capabilities/gamePickGetHistory.md +1 -1
- package/docs/capabilities/gamePickGetRoundInfoForUser.md +1 -1
- package/docs/capabilities/gamePickSubmitSelection.md +1 -1
- package/docs/capabilities/gamePickSubmitSelectionQuiz.md +1 -1
- package/docs/capabilities/getJackpotEligibleGames.md +11 -2
- package/docs/capabilities/getMiniGames.md +35 -12
- package/docs/capabilities/miniGameWinAcknowledgeRequest.md +30 -7
- package/docs/capabilities/playMiniGame.md +27 -14
- package/docs/native/PROTOCOL.md +3 -0
- package/docs/ui/jackpots/UIGuide_getJackpotEligibleGames.md +8 -0
- package/docs/ui/minigames/UIGuide_getMiniGames.md +24 -0
- package/docs/ui/minigames/UIGuide_getMiniGamesHistory.md +1 -1
- package/docs/ui/minigames/UIGuide_playMiniGame.md +28 -1
- package/package.json +2 -2
- package/src/GamePick/GamePickTypes.ts +6 -1
- package/src/MiniGames/SAWDoAknowledgeRequest.ts +2 -0
- package/src/MiniGames/SAWGetTemplatesResponse.ts +2 -0
- package/src/MiniGames/SAWPrize.ts +9 -0
- package/src/MiniGames/SAWTemplate.ts +1 -0
- package/src/SmarticoAPI.ts +2 -1
- package/src/SmarticoLib/index.ts +1 -1
- package/src/Tournaments/GetClanTournamentPlayersResponse.ts +5 -18
- package/src/WSAPI/WSAPIJackpots.ts +11 -2
- package/src/WSAPI/WSAPIMiniGames.ts +85 -24
- package/src/WSAPI/WSAPITypes.ts +16 -12
- package/docs/api/interfaces/TClanTournamentPlayer.md +0 -55
- package/docs/api/interfaces/TClanTournamentPlayersResult.md +0 -13
package/dist/index.js
CHANGED
|
@@ -542,6 +542,8 @@ var SAWTemplatesTransform = function SAWTemplatesTransform(items) {
|
|
|
542
542
|
acknowledge_action_title: p.saw_prize_ui_definition.acknowledge_action_title,
|
|
543
543
|
acknowledge_dp_additional: p.saw_prize_ui_definition.acknowledge_dp_additional,
|
|
544
544
|
acknowledge_action_title_additional: p.saw_prize_ui_definition.acknowledge_action_title_additional,
|
|
545
|
+
second_btn: p.saw_prize_ui_definition.second_btn,
|
|
546
|
+
second_btn_action_title: p.saw_prize_ui_definition.second_btn_action_title,
|
|
545
547
|
out_of_stock_message: p.saw_prize_ui_definition.out_of_stock_message,
|
|
546
548
|
pool: p.pool,
|
|
547
549
|
pool_initial: p.pool_initial,
|
|
@@ -1760,6 +1762,9 @@ exports.AchievementClaimPeriodTypeId = void 0;
|
|
|
1760
1762
|
AchievementClaimPeriodTypeId[AchievementClaimPeriodTypeId["ExactPeriod"] = 1] = "ExactPeriod";
|
|
1761
1763
|
})(exports.AchievementClaimPeriodTypeId || (exports.AchievementClaimPeriodTypeId = {}));
|
|
1762
1764
|
|
|
1765
|
+
// Consumer-facing types live in WSAPITypes.ts (`TClanTournamentPlayers`) — the
|
|
1766
|
+
// single source documented + emitted to docs. This transform maps the raw wire
|
|
1767
|
+
// shape onto it; do not re-declare a parallel result/player type here.
|
|
1763
1768
|
var clanTournamentPlayersTransform = function clanTournamentPlayersTransform(response) {
|
|
1764
1769
|
return {
|
|
1765
1770
|
tournament_instance_id: response.tournament_instance_id,
|
|
@@ -6364,7 +6369,7 @@ var WSAPIJackpots = /*#__PURE__*/function (_WSAPIClans) {
|
|
|
6364
6369
|
*
|
|
6365
6370
|
* @remarks
|
|
6366
6371
|
* **Preconditions**
|
|
6367
|
-
* -
|
|
6372
|
+
* - No authentication required — works in both identified and visitor mode.
|
|
6368
6373
|
* - `jp_template_id` is mandatory.
|
|
6369
6374
|
*
|
|
6370
6375
|
* **`onUpdate` caveat**
|
|
@@ -6382,7 +6387,12 @@ var WSAPIJackpots = /*#__PURE__*/function (_WSAPIClans) {
|
|
|
6382
6387
|
* Non-zero `errCode` on control-group users or generic server errors.
|
|
6383
6388
|
* Branch on `errCode === 0` and surface `errMsg` on failure.
|
|
6384
6389
|
*
|
|
6385
|
-
* **Visitor mode**:
|
|
6390
|
+
* **Visitor mode**: supported via
|
|
6391
|
+
* `_smartico.vapi(lang).getJackpotEligibleGames(...)`. The eligible-games
|
|
6392
|
+
* list is template-level (which games contribute to the pot) and carries no
|
|
6393
|
+
* per-user fields, so a visitor session receives the same list an identified
|
|
6394
|
+
* user would. The `lang` passed to `_smartico.vapi(lang)` drives the
|
|
6395
|
+
* translation of game names.
|
|
6386
6396
|
*
|
|
6387
6397
|
* **UI guidance**: see [UI Guide — `getJackpotEligibleGames`](../../docs/ui/jackpots/UIGuide_getJackpotEligibleGames.md).
|
|
6388
6398
|
*
|
|
@@ -6400,6 +6410,10 @@ var WSAPIJackpots = /*#__PURE__*/function (_WSAPIClans) {
|
|
|
6400
6410
|
*
|
|
6401
6411
|
* const r = await window._smartico.api.getJackpotEligibleGames({ jp_template_id: 42 });
|
|
6402
6412
|
* console.log('[smartico] render', r.eligible_games.length, 'eligible game tiles');
|
|
6413
|
+
*
|
|
6414
|
+
* // Visitor mode — same shape, language driven by the vapi(lang) argument
|
|
6415
|
+
* const visitor = await window._smartico.vapi('EN').getJackpotEligibleGames({ jp_template_id: 42 });
|
|
6416
|
+
* console.log('[smartico] visitor eligible games:', visitor.eligible_games.length);
|
|
6403
6417
|
* ```
|
|
6404
6418
|
*/
|
|
6405
6419
|
;
|
|
@@ -7206,6 +7220,27 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7206
7220
|
* games server (not this SDK); the SAW spin is fired
|
|
7207
7221
|
* server-internally to deduct the buy-in.
|
|
7208
7222
|
*
|
|
7223
|
+
* **Per-prize statistics (`expose_game_stat_on_api`)**
|
|
7224
|
+
* Each template's `prizes` array always carries the definition
|
|
7225
|
+
* fields — name, icon, `prize_type`, `prize_value`, acknowledge
|
|
7226
|
+
* configuration. The stock-statistics fields are gated by an
|
|
7227
|
+
* operator template setting, surfaced as
|
|
7228
|
+
* `expose_game_stat_on_api`:
|
|
7229
|
+
* - Populated when enabled: `pool` (remaining stock),
|
|
7230
|
+
* `wins_count` (total wins across all players), `weekdays`
|
|
7231
|
+
* (ISO 1–7 days the prize can be won), `active_from_ts` /
|
|
7232
|
+
* `active_till_ts` (prize availability window).
|
|
7233
|
+
* - Omitted when disabled (the default) — this keeps the live
|
|
7234
|
+
* prize economy (stock levels, win rates, schedules) hidden
|
|
7235
|
+
* from players.
|
|
7236
|
+
* - Exception: `pool` is always populated for `MatchX` / `Quiz`
|
|
7237
|
+
* templates, whose game flow needs the remaining stock.
|
|
7238
|
+
* - `pool_initial` is populated regardless of the setting.
|
|
7239
|
+
* When enabled, the values are also kept current — the server
|
|
7240
|
+
* refreshes the prize rows on each fetch and drops its template
|
|
7241
|
+
* caches after every play, so `pool` / `wins_count` are safe to
|
|
7242
|
+
* drive an "X prizes left" scarcity UI.
|
|
7243
|
+
*
|
|
7209
7244
|
* **Cache TTL**: the SDK caches the response for 30 seconds. Cache
|
|
7210
7245
|
* is fully cleared on login / logout.
|
|
7211
7246
|
*
|
|
@@ -7433,14 +7468,19 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7433
7468
|
* it later by calling {@link miniGameWinAcknowledgeRequest} with the
|
|
7434
7469
|
* `request_id` returned on this result.
|
|
7435
7470
|
*
|
|
7436
|
-
* What `acknowledge: false`
|
|
7437
|
-
* - For STANDARD prizes the value is credited
|
|
7438
|
-
*
|
|
7439
|
-
*
|
|
7440
|
-
*
|
|
7441
|
-
*
|
|
7442
|
-
*
|
|
7443
|
-
* explicit acknowledge
|
|
7471
|
+
* What `acknowledge: false` defers:
|
|
7472
|
+
* - For STANDARD prizes the value is credited when the spin is
|
|
7473
|
+
* finalised — by your later acknowledge or, failing that, by the
|
|
7474
|
+
* server-side fallback below — so opting out delays the balance
|
|
7475
|
+
* change by at most that fallback window. The `is_claimed` flag in
|
|
7476
|
+
* {@link getMiniGamesHistory} flips on the same finalisation.
|
|
7477
|
+
* - For operator-configured "explicit claim" prizes the credit is
|
|
7478
|
+
* deferred until your explicit acknowledge — the fallback does not
|
|
7479
|
+
* cover them.
|
|
7480
|
+
*
|
|
7481
|
+
* While the spin is un-finalised it can also be finalised as LOST —
|
|
7482
|
+
* prize discarded back to the pool — via
|
|
7483
|
+
* {@link miniGameWinAcknowledgeRequest} with `{ lose: true }`.
|
|
7444
7484
|
*
|
|
7445
7485
|
* A server-side fallback auto-acknowledges ordinary un-acknowledged
|
|
7446
7486
|
* spins after a short delay (about 1–3 minutes), so an ordinary
|
|
@@ -7471,8 +7511,10 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7471
7511
|
* time the call resolves. Balance updates flow via the
|
|
7472
7512
|
* user-properties channel (observe via {@link getUserProfile}).
|
|
7473
7513
|
* - Prize value credited per the prize's type (see "Prize handling"
|
|
7474
|
-
* above)
|
|
7475
|
-
*
|
|
7514
|
+
* above) when the spin is finalised — with the default
|
|
7515
|
+
* auto-acknowledge that happens before the call resolves;
|
|
7516
|
+
* "explicit claim" prizes are credited only by an explicit
|
|
7517
|
+
* acknowledge.
|
|
7476
7518
|
* - The play is recorded server-side for analytics / reporting.
|
|
7477
7519
|
*
|
|
7478
7520
|
* **UI guidance**: see [UI Guide — `playMiniGame`](../../docs/ui/minigames/UIGuide_playMiniGame.md).
|
|
@@ -7537,18 +7579,24 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7537
7579
|
*
|
|
7538
7580
|
* @example
|
|
7539
7581
|
* Manual finalisation (`acknowledge: false`) — e.g. an explicit
|
|
7540
|
-
* "Claim" CTA, or finalising on your own
|
|
7582
|
+
* "Claim" CTA, a decline/forfeit flow, or finalising on your own
|
|
7583
|
+
* schedule:
|
|
7541
7584
|
* ```ts
|
|
7542
7585
|
* const r = await window._smartico.api.playMiniGame(game.id, { acknowledge: false });
|
|
7543
7586
|
* if (r.err_code === 0) {
|
|
7544
|
-
* // Spin resolved but not yet
|
|
7545
|
-
* //
|
|
7546
|
-
* //
|
|
7587
|
+
* // Spin resolved but not yet finalised — the prize is not credited
|
|
7588
|
+
* // yet. Your acknowledge below credits it (for standard prizes the
|
|
7589
|
+
* // server-side fallback would eventually do the same).
|
|
7547
7590
|
* console.log('[smartico] prize won — show the result / Claim CTA, then finalise');
|
|
7548
7591
|
*
|
|
7549
7592
|
* // On the user's Claim click, finalise with the request_id from the result.
|
|
7550
7593
|
* await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
7551
7594
|
* console.log('[smartico] win finalised — refresh getUserProfile / getMiniGames to reflect it');
|
|
7595
|
+
*
|
|
7596
|
+
* // Or, if the game flow ends in the player declining / losing the
|
|
7597
|
+
* // drawn prize, finalise the spin as lost instead — the prize is
|
|
7598
|
+
* // not credited and returns to the prize pool:
|
|
7599
|
+
* // await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id, { lose: true });
|
|
7552
7600
|
* }
|
|
7553
7601
|
* ```
|
|
7554
7602
|
*/
|
|
@@ -7586,9 +7634,10 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7586
7634
|
}
|
|
7587
7635
|
/**
|
|
7588
7636
|
* Manually acknowledges a mini-game spin — marks the win delivered
|
|
7589
|
-
* server-side
|
|
7590
|
-
*
|
|
7591
|
-
* {@link
|
|
7637
|
+
* server-side, or (with `lose: true`) finalises it as lost and
|
|
7638
|
+
* returns the prize to the pool. Most consumers do NOT need this:
|
|
7639
|
+
* {@link playMiniGame} acknowledges by default (`acknowledge: true`)
|
|
7640
|
+
* and {@link playMiniGameBatch} acknowledges automatically. Call this
|
|
7592
7641
|
* directly only when you took ownership of the acknowledge step or
|
|
7593
7642
|
* need to recover a lost one.
|
|
7594
7643
|
*
|
|
@@ -7611,6 +7660,23 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7611
7660
|
* `client_request_id` on a {@link getMiniGamesHistory} row are the
|
|
7612
7661
|
* same correlation id — this method accepts either.
|
|
7613
7662
|
*
|
|
7663
|
+
* **Finalising as lost (`lose: true`)**
|
|
7664
|
+
* Pass `{ lose: true }` to finalise the spin as LOST instead of won:
|
|
7665
|
+
* the prize is NOT credited and is returned to the game's prize pool
|
|
7666
|
+
* (available again for other players), and the spin fires the
|
|
7667
|
+
* mini-game "lose" engagement event instead of the win one. On the
|
|
7668
|
+
* next {@link getMiniGamesHistory} fetch the row shows `is_claimed:
|
|
7669
|
+
* true` with no prize attached. Use this for game mechanics where the
|
|
7670
|
+
* player can decline or forfeit the drawn prize — e.g. a
|
|
7671
|
+
* gamble/discard step, or a client-driven game where the user's final
|
|
7672
|
+
* action decides whether the pre-drawn prize is actually won. It only
|
|
7673
|
+
* works on a spin that is not yet finalised, so it requires playing
|
|
7674
|
+
* with `acknowledge: false` and calling promptly — once the automatic
|
|
7675
|
+
* acknowledge or the server-side fallback (below) has finalised the
|
|
7676
|
+
* spin, `lose: true` is a no-op and the prize stays credited.
|
|
7677
|
+
* ("Explicit claim" prizes are exempt from the fallback, so for them
|
|
7678
|
+
* there is no time pressure.)
|
|
7679
|
+
*
|
|
7614
7680
|
* **Idempotency**: safe. Acknowledging a spin that is already
|
|
7615
7681
|
* finalised — by you, by the automatic acknowledge, or by the
|
|
7616
7682
|
* fallback — is a no-op with no double credit. Acknowledging a
|
|
@@ -7625,11 +7691,12 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7625
7691
|
* call here.
|
|
7626
7692
|
*
|
|
7627
7693
|
* **Side effects** (first successful call for an un-acknowledged spin)
|
|
7628
|
-
* -
|
|
7629
|
-
*
|
|
7630
|
-
*
|
|
7631
|
-
*
|
|
7632
|
-
*
|
|
7694
|
+
* - Default (win): the prize value is credited on this call — this is
|
|
7695
|
+
* the finalisation step that credits standard and "explicit claim"
|
|
7696
|
+
* prizes alike (see {@link playMiniGame} "Prize handling").
|
|
7697
|
+
* - With `lose: true`: no credit; the prize returns to the prize pool
|
|
7698
|
+
* and the "lose" engagement event fires.
|
|
7699
|
+
* - Either way the spin's `is_claimed` flips to `true` on the next
|
|
7633
7700
|
* {@link getMiniGamesHistory} fetch.
|
|
7634
7701
|
*
|
|
7635
7702
|
* **Visitor mode**: not supported.
|
|
@@ -7639,6 +7706,10 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7639
7706
|
* (played with `acknowledge: false`), or the
|
|
7640
7707
|
* `client_request_id` of a
|
|
7641
7708
|
* {@link getMiniGamesHistory} row.
|
|
7709
|
+
* @param options.lose Optional. When `true`, finalises the spin as
|
|
7710
|
+
* lost — the prize is not credited and returns
|
|
7711
|
+
* to the prize pool (see "Finalising as lost").
|
|
7712
|
+
* Omit (or pass `false`) to deliver the win.
|
|
7642
7713
|
*
|
|
7643
7714
|
* @example
|
|
7644
7715
|
* ```ts
|
|
@@ -7649,6 +7720,10 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7649
7720
|
* await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
7650
7721
|
* }
|
|
7651
7722
|
*
|
|
7723
|
+
* // Decline / forfeit — finalise the same spin as lost instead:
|
|
7724
|
+
* // the prize is not credited and goes back to the prize pool.
|
|
7725
|
+
* await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id, { lose: true });
|
|
7726
|
+
*
|
|
7652
7727
|
* // Recovery — re-acknowledge any spins a batch acknowledge missed.
|
|
7653
7728
|
* const history = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
|
|
7654
7729
|
* for (const row of history.filter(h => !h.is_claimed)) {
|
|
@@ -7658,10 +7733,12 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7658
7733
|
* ```
|
|
7659
7734
|
*/
|
|
7660
7735
|
;
|
|
7661
|
-
_proto.miniGameWinAcknowledgeRequest = function miniGameWinAcknowledgeRequest(request_id) {
|
|
7736
|
+
_proto.miniGameWinAcknowledgeRequest = function miniGameWinAcknowledgeRequest(request_id, _temp5) {
|
|
7737
|
+
var _ref4 = _temp5 === void 0 ? {} : _temp5,
|
|
7738
|
+
lose = _ref4.lose;
|
|
7662
7739
|
try {
|
|
7663
7740
|
var _this4 = this;
|
|
7664
|
-
return Promise.resolve(_this4.api.doAcknowledgeRequest(_this4.userExtId, request_id));
|
|
7741
|
+
return Promise.resolve(_this4.api.doAcknowledgeRequest(_this4.userExtId, request_id, lose));
|
|
7665
7742
|
} catch (e) {
|
|
7666
7743
|
return Promise.reject(e);
|
|
7667
7744
|
}
|
|
@@ -7771,9 +7848,9 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7771
7848
|
* ```
|
|
7772
7849
|
*/
|
|
7773
7850
|
;
|
|
7774
|
-
_proto.playMiniGameBatch = function playMiniGameBatch(template_id, spin_count,
|
|
7775
|
-
var
|
|
7776
|
-
onUpdate =
|
|
7851
|
+
_proto.playMiniGameBatch = function playMiniGameBatch(template_id, spin_count, _temp6) {
|
|
7852
|
+
var _ref5 = _temp6 === void 0 ? {} : _temp6,
|
|
7853
|
+
onUpdate = _ref5.onUpdate;
|
|
7777
7854
|
try {
|
|
7778
7855
|
var _this5 = this;
|
|
7779
7856
|
if (typeof onUpdate === 'function') {
|
|
@@ -10828,11 +10905,12 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
10828
10905
|
return Promise.reject(e);
|
|
10829
10906
|
}
|
|
10830
10907
|
};
|
|
10831
|
-
_proto.doAcknowledgeRequest = function doAcknowledgeRequest(user_ext_id, request_id) {
|
|
10908
|
+
_proto.doAcknowledgeRequest = function doAcknowledgeRequest(user_ext_id, request_id, lose) {
|
|
10832
10909
|
try {
|
|
10833
10910
|
var _this16 = this;
|
|
10834
10911
|
var message = _this16.buildMessage(user_ext_id, exports.ClassId.SAW_AKNOWLEDGE_REQUEST, {
|
|
10835
|
-
request_id: request_id
|
|
10912
|
+
request_id: request_id,
|
|
10913
|
+
lose: lose
|
|
10836
10914
|
});
|
|
10837
10915
|
return Promise.resolve(_this16.send(message, exports.ClassId.SAW_AKNOWLEDGE_RESPONSE));
|
|
10838
10916
|
} catch (e) {
|