@smartico/public-api 0.0.400 → 0.0.402

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.
Files changed (67) hide show
  1. package/dist/ActivityLog/ActivityLogEntry.d.ts +2 -0
  2. package/dist/Avatars/AvatarCustomized.d.ts +2 -2
  3. package/dist/Core/index.d.ts +1 -0
  4. package/dist/GamePick/GamePickTypes.d.ts +14 -14
  5. package/dist/Level/Level.d.ts +1 -0
  6. package/dist/SmarticoGlobal.d.ts +190 -0
  7. package/dist/WSAPI/WSAPIAvatars.d.ts +1 -1
  8. package/dist/WSAPI/WSAPIGamePick.d.ts +6 -6
  9. package/dist/WSAPI/WSAPIMiniGames.d.ts +55 -42
  10. package/dist/WSAPI/WSAPITypes.d.ts +9 -6
  11. package/dist/index.d.ts +2 -0
  12. package/dist/index.js +73 -57
  13. package/dist/index.js.map +1 -1
  14. package/dist/index.modern.mjs +64 -51
  15. package/dist/index.modern.mjs.map +1 -1
  16. package/docs/api/README.md +20 -0
  17. package/docs/api/classes/WSAPIAvatars.md +2 -9
  18. package/docs/api/classes/WSAPIGamePick.md +48 -48
  19. package/docs/api/classes/WSAPIMiniGames.md +132 -70
  20. package/docs/api/enumerations/GPRoundStatus.md +43 -0
  21. package/docs/api/enumerations/GamePickMarketType.md +19 -0
  22. package/docs/api/enumerations/GamePickResolutionType.md +35 -0
  23. package/docs/api/enumerations/GamePickScoreType.md +19 -0
  24. package/docs/api/enumerations/GamePickSportType.md +375 -0
  25. package/docs/api/enumerations/GameRoundOrderType.md +35 -0
  26. package/docs/api/enumerations/LiquidEntityData.md +6 -0
  27. package/docs/api/interfaces/AvatarCustomized.md +2 -2
  28. package/docs/api/interfaces/GamePickBoardUser.md +75 -0
  29. package/docs/api/interfaces/GamePickEvent.md +123 -0
  30. package/docs/api/interfaces/GamePickEventMeta.md +201 -0
  31. package/docs/api/interfaces/GamePickGameInfo.md +27 -0
  32. package/docs/api/interfaces/GamePickRequestParams.md +39 -0
  33. package/docs/api/interfaces/GamePickRound.md +383 -0
  34. package/docs/api/interfaces/GamePickRoundBase.md +232 -0
  35. package/docs/api/interfaces/GamePickRoundBoard.md +359 -0
  36. package/docs/api/interfaces/GamePickRoundPublicMeta.md +103 -0
  37. package/docs/api/interfaces/GamePickRoundRequestParams.md +63 -0
  38. package/docs/api/interfaces/GamePickUserInfo.md +107 -0
  39. package/docs/api/interfaces/GamesApiResponse.md +33 -0
  40. package/docs/api/interfaces/GemsDiamondsLog.md +2 -0
  41. package/docs/api/interfaces/Level.md +8 -0
  42. package/docs/api/interfaces/PointsLog.md +2 -0
  43. package/docs/api/interfaces/QuizEventMeta.md +61 -0
  44. package/docs/api/interfaces/RafflePrizePublicMeta.md +9 -0
  45. package/docs/api/interfaces/TAvatarCustomized.md +2 -2
  46. package/docs/api/interfaces/TInboxMessage.md +2 -1
  47. package/docs/api/interfaces/TMiniGamePlayResult.md +11 -0
  48. package/docs/api/interfaces/TMissionOrBadge.md +3 -1
  49. package/docs/api/interfaces/TRafflePrize.md +9 -0
  50. package/docs/api/variables/AllRoundsGameBoardID.md +5 -0
  51. package/docs/ui/minigames/UIGuide_playMiniGame.md +6 -5
  52. package/package.json +1 -1
  53. package/src/ActivityLog/ActivityLogEntry.ts +2 -0
  54. package/src/Avatars/AvatarCustomized.ts +2 -2
  55. package/src/Core/index.ts +1 -0
  56. package/src/GamePick/GamePickTypes.ts +14 -14
  57. package/src/Level/Level.ts +1 -0
  58. package/src/Missions/UserAchievement.ts +2 -2
  59. package/src/SmarticoAPI.ts +2 -1
  60. package/src/SmarticoGlobal.ts +209 -0
  61. package/src/Store/StoreItem.ts +1 -1
  62. package/src/WSAPI/WSAPIAvatars.ts +1 -1
  63. package/src/WSAPI/WSAPIGamePick.ts +6 -6
  64. package/src/WSAPI/WSAPIMiniGames.ts +55 -42
  65. package/src/WSAPI/WSAPITypes.ts +9 -6
  66. package/src/index.ts +21 -0
  67. 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 spin as
436
- * "delivered" so the prize takes effect server-side. Most consumers
437
- * do NOT need to call this method directly; {@link playMiniGame}
438
- * and {@link playMiniGameBatch} auto-acknowledge on success. Use
439
- * this only for recovery scenarios.
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
- * - **Lost auto-acknowledge** — when the WebSocket dropped between
444
- * the spin response and the auto-acknowledge fire-and-forget,
445
- * the spin shows `is_claimed: false` in
446
- * {@link getMiniGamesHistory}. Pass that row's
447
- * `client_request_id` here to deliver the prize.
448
- * - **Explicit-acknowledge UI** — for templates configured with
449
- * the `ExplicitAcknowledge` acknowledge type (operator
450
- * decision), the consumer's UI shows a "Claim" CTA after the
451
- * prize animation. Click handler calls this method with the
452
- * spin's `client_request_id` rather than auto-acknowledging.
453
- *
454
- * **No-op on already-acknowledged spins**
455
- * The server's acknowledge SQL matches on `acknowledge_date IS
456
- * NULL` — a duplicate call returns successfully with no effect.
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 without ever calling this method, a server-side job
460
- * auto-acknowledges stale spins every ~60 seconds — so prizes are
461
- * eventually delivered. The `is_claimed` flag flips on the next
462
- * `getMiniGamesHistory` call after the job runs.
463
- *
464
- * **Idempotency**: safe. Repeated calls have no effect after the
465
- * first.
466
- *
467
- * **Side effects** (on first successful call for an unacknowledged
468
- * spin)
469
- * - Prize value credited per the prize's type (see
470
- * {@link playMiniGame} "Prize handling").
471
- * - The spin's `is_claimed` flag flips to `true` on the next
472
- * {@link getMiniGamesHistory} call.
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 The `client_request_id` from a `TSawHistory`
477
- * row returned by {@link getMiniGamesHistory}.
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
- * const history = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
482
- * const unacknowledged = history.filter(h => !h.is_claimed);
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
- * for (const row of unacknowledged) {
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) {
@@ -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
- * {@link miniGameWinAcknowledgeRequest} to finalise the win when
106
+ * `miniGameWinAcknowledgeRequest` to finalise the win when
107
107
  * playing with `acknowledge: false` — no need to look it up via
108
- * {@link getMiniGamesHistory}. */
108
+ * `getMiniGamesHistory`. */
109
109
  request_id: string;
110
110
  }
111
111
 
@@ -869,7 +869,9 @@ export interface TMissionOrBadge {
869
869
  /** The date/timestamp indicating when the prize was claimed by the user */
870
870
  prize_claimed_date_ts?: number;
871
871
 
872
- /** Time in hours that took this player to complete mission */
872
+ /** Date-time the mission/badge was completed, as a `"dd/MM/yyyy HH:mm:ss"` string
873
+ * (server local — NOT ISO-8601, so `new Date(complete_date)` will not parse it).
874
+ * Prefer the epoch-ms `complete_date_ts` for date math. */
873
875
  complete_date?: string;
874
876
 
875
877
  /** Time of mission/badge being completed, this property shows the epoch time in UTC */
@@ -1032,7 +1034,8 @@ export interface TInboxMessage {
1032
1034
  /** Unique identifier of the message. Pass to `getInboxMessageBody`
1033
1035
  * and the mark / favorite / delete mutations. */
1034
1036
  message_guid: string;
1035
- /** Date when the message was sent (server timestamp). */
1037
+ /** Date-time the message was sent, as a `"dd/MM/yyyy HH:mm:ss"` string
1038
+ * (server local — NOT ISO-8601, so `new Date(sent_date)` will not parse it). */
1036
1039
  sent_date: string;
1037
1040
  /** `true` when the message has been marked read. */
1038
1041
  read: boolean;
@@ -1792,8 +1795,8 @@ export interface TAvatarCustomized {
1792
1795
  avatar_real_id: number;
1793
1796
  /** Absolute CDN URL of the AI-generated image. Can be passed as `avatar_url` to `setAvatar()`. */
1794
1797
  url: string;
1795
- /** ISO date string of when the variant was generated. */
1796
- dt_created: string;
1798
+ /** Unix-ms timestamp of when the variant was generated. */
1799
+ dt_created: number;
1797
1800
  }
1798
1801
 
1799
1802
  /**
package/src/index.ts CHANGED
@@ -2,8 +2,29 @@ export * from './Base/ClassId';
2
2
  export * from './ILogger';
3
3
  export * from './SmarticoAPI';
4
4
  export * from './WSAPI/WSAPI';
5
+ export * from './SmarticoGlobal';
5
6
  export * from './CookieStore';
6
7
 
8
+ // Consumer-facing transformed ("T") types. They are defined in WSAPI/WSAPITypes.ts
9
+ // and returned by the WSAPI methods, but that file is not a barrel export, so the
10
+ // names never reached the package root — integrators could not `import { TX }`.
11
+ // Re-export them by name here. (Names that collide with a domain-module export —
12
+ // AchRelatedGame, BonusStatus, BonusMetaMap, BonusTemplateMetaMap — are intentionally
13
+ // omitted; import those from their domain module.)
14
+ export type {
15
+ TAchCategory, TActivityLog, TAvatarCustomized, TAvatarDefinition, TAvatarPrompt,
16
+ TBonus, TBuyStoreItemResult, TClaimBonusResult, TClan, TClanInfo, TClanJoinResult,
17
+ TClanTournamentPlayers, TClans, TGetTranslations, TInboxMessage, TInboxMessageBody,
18
+ TLevel, TLevelCurrent, TMiniGamePlayBatchResult, TMiniGamePlayResult, TMiniGamePrize,
19
+ TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge,
20
+ TMissionOrBadgeTask, TRaffle, TRaffleDraw, TRaffleDrawRun, TRaffleOptinResponse,
21
+ TRafflePrize, TRafflePrizeWinner, TRaffleTicket, TSawHistory, TSegmentCheckResult,
22
+ TSetAvatarResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed,
23
+ TTournamentRegistrationResult, TUICustomSection, TUserProfile,
24
+ TransformedRaffleClaimPrizeResponse, InboxMarkMessageAction, LeaderBoardDetailsT,
25
+ LeaderBoardUserT, LeaderBoardsRewardsT, UserLevelExtraCountersT,
26
+ } from './WSAPI/WSAPITypes';
27
+
7
28
  export * from './Analytics';
8
29
  export * from './Core';
9
30
  export * from './UserProfile';
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",