@smartico/public-api 0.0.403 → 0.0.405

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 (148) hide show
  1. package/.claude/skills/api-tsdoc/SKILL.md +675 -0
  2. package/.claude/skills/api-tsdoc-final/SKILL.md +266 -0
  3. package/.claude/skills/api-tsdoc-howto/SKILL.md +143 -0
  4. package/dist/MiniGames/SAWTemplate.d.ts +4 -0
  5. package/dist/MiniGames/SAWTemplateUI.d.ts +6 -2
  6. package/dist/SmarticoGlobal.d.ts +0 -6
  7. package/dist/WSAPI/WSAPITypes.d.ts +43 -0
  8. package/dist/index.js +2 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/index.modern.mjs +2 -0
  11. package/dist/index.modern.mjs.map +1 -1
  12. package/docs/api/interfaces/SAWTemplate.md +16 -0
  13. package/docs/api/interfaces/TMiniGameTemplate.md +21 -0
  14. package/docs/api/interfaces/TUserProfile.md +136 -0
  15. package/docs/capabilities/_responses/buyStoreItem.json +4 -0
  16. package/docs/capabilities/_responses/claimBonus.json +4 -0
  17. package/docs/capabilities/_responses/gamePickGetActiveRound.json +95 -0
  18. package/docs/capabilities/_responses/gamePickGetActiveRounds.json +191 -0
  19. package/docs/capabilities/_responses/gamePickGetBoard.json +47 -0
  20. package/docs/capabilities/_responses/gamePickGetGameInfo.json +355 -0
  21. package/docs/capabilities/_responses/gamePickGetHistory.json +191 -0
  22. package/docs/capabilities/_responses/gamePickGetUserInfo.json +14 -0
  23. package/docs/capabilities/_responses/getAchCategories.json +12 -0
  24. package/docs/capabilities/_responses/getActivityLog.json +1 -0
  25. package/docs/capabilities/_responses/getAvatarPrompts.json +16 -0
  26. package/docs/capabilities/_responses/getAvatarsCustomized.json +12 -0
  27. package/docs/capabilities/_responses/getAvatarsList.json +24 -0
  28. package/docs/capabilities/_responses/getBadges.json +98 -0
  29. package/docs/capabilities/_responses/getBonuses.json +18 -0
  30. package/docs/capabilities/_responses/getClanInfo.json +39 -0
  31. package/docs/capabilities/_responses/getClans.json +35 -0
  32. package/docs/capabilities/_responses/getCurrentLevel.json +20 -0
  33. package/docs/capabilities/_responses/getCustomSections.json +25 -0
  34. package/docs/capabilities/_responses/getInboxMessageBody.json +7 -0
  35. package/docs/capabilities/_responses/getInboxMessages.json +18 -0
  36. package/docs/capabilities/_responses/getInboxUnreadCount.json +1 -0
  37. package/docs/capabilities/_responses/getJackpotEligibleGames.json +20 -0
  38. package/docs/capabilities/_responses/getJackpotWinners.json +28 -0
  39. package/docs/capabilities/_responses/getLeaderBoard.json +45 -0
  40. package/docs/capabilities/_responses/getLevels.json +40 -0
  41. package/docs/capabilities/_responses/getMiniGames.json +208 -0
  42. package/docs/capabilities/_responses/getMiniGamesHistory.json +1 -0
  43. package/docs/capabilities/_responses/getMissions.json +117 -0
  44. package/docs/capabilities/_responses/getRaffleDrawRun.json +62 -0
  45. package/docs/capabilities/_responses/getRaffleDrawRunsHistory.json +34 -0
  46. package/docs/capabilities/_responses/getRaffles.json +140 -0
  47. package/docs/capabilities/_responses/getStoreCategories.json +12 -0
  48. package/docs/capabilities/_responses/getStoreItems.json +47 -0
  49. package/docs/capabilities/_responses/getStorePurchasedItems.json +49 -0
  50. package/docs/capabilities/_responses/getTournamentInstanceInfo.json +75 -0
  51. package/docs/capabilities/_responses/getTournamentsList.json +66 -0
  52. package/docs/capabilities/_responses/getTranslations.json +25 -0
  53. package/docs/capabilities/_responses/getUserLevelExtraCounters.json +4 -0
  54. package/docs/capabilities/_responses/getUserProfile.json +34 -0
  55. package/docs/capabilities/_responses/jackpotGet.json +113 -0
  56. package/docs/capabilities/_responses/jackpotOptIn.json +9 -0
  57. package/docs/capabilities/_responses/jackpotOptOut.json +9 -0
  58. package/docs/capabilities/_responses/markAllInboxMessagesAsRead.json +4 -0
  59. package/docs/capabilities/_responses/markInboxMessageAsRead.json +4 -0
  60. package/docs/capabilities/_responses/markUnmarkInboxMessageAsFavorite.json +4 -0
  61. package/docs/capabilities/_responses/miniGameWinAcknowledgeRequest.json +10 -0
  62. package/docs/capabilities/_responses/playMiniGame.json +6 -0
  63. package/docs/capabilities/_responses/playMiniGameBatch.json +9 -0
  64. package/docs/capabilities/_responses/registerInTournament.json +4 -0
  65. package/docs/capabilities/_responses/requestMissionOptIn.json +4 -0
  66. package/docs/capabilities/_responses/setAvatar.json +4 -0
  67. package/docs/capabilities/avatarsCustomize.md +115 -0
  68. package/docs/capabilities/buyStoreItem.md +179 -0
  69. package/docs/capabilities/checkSegmentListMatch.md +69 -0
  70. package/docs/capabilities/checkSegmentMatch.md +74 -0
  71. package/docs/capabilities/claimBonus.md +125 -0
  72. package/docs/capabilities/claimRafflePrize.md +116 -0
  73. package/docs/capabilities/deleteAllInboxMessages.md +66 -0
  74. package/docs/capabilities/deleteInboxMessage.md +60 -0
  75. package/docs/capabilities/gamePickGetActiveRound.md +248 -0
  76. package/docs/capabilities/gamePickGetActiveRounds.md +259 -0
  77. package/docs/capabilities/gamePickGetBoard.md +202 -0
  78. package/docs/capabilities/gamePickGetGameInfo.md +318 -0
  79. package/docs/capabilities/gamePickGetHistory.md +244 -0
  80. package/docs/capabilities/gamePickGetRoundInfoForUser.md +189 -0
  81. package/docs/capabilities/gamePickGetUserInfo.md +91 -0
  82. package/docs/capabilities/gamePickSubmitSelection.md +222 -0
  83. package/docs/capabilities/gamePickSubmitSelectionQuiz.md +198 -0
  84. package/docs/capabilities/getAchCategories.md +119 -0
  85. package/docs/capabilities/getActivityLog.md +108 -0
  86. package/docs/capabilities/getAvatarPrompts.md +81 -0
  87. package/docs/capabilities/getAvatarsCustomized.md +96 -0
  88. package/docs/capabilities/getAvatarsList.md +101 -0
  89. package/docs/capabilities/getBadges.md +237 -0
  90. package/docs/capabilities/getBonuses.md +159 -0
  91. package/docs/capabilities/getClanInfo.md +164 -0
  92. package/docs/capabilities/getClanTournamentPlayers.md +112 -0
  93. package/docs/capabilities/getClans.md +168 -0
  94. package/docs/capabilities/getCurrentLevel.md +123 -0
  95. package/docs/capabilities/getCustomSections.md +96 -0
  96. package/docs/capabilities/getInboxMessageBody.md +87 -0
  97. package/docs/capabilities/getInboxMessages.md +146 -0
  98. package/docs/capabilities/getInboxUnreadCount.md +54 -0
  99. package/docs/capabilities/getJackpotEligibleGames.md +93 -0
  100. package/docs/capabilities/getJackpotWinners.md +113 -0
  101. package/docs/capabilities/getLeaderBoard.md +187 -0
  102. package/docs/capabilities/getLeaderBoards.md +88 -0
  103. package/docs/capabilities/getLevels.md +118 -0
  104. package/docs/capabilities/getMiniGames.md +295 -0
  105. package/docs/capabilities/getMiniGamesHistory.md +183 -0
  106. package/docs/capabilities/getMissions.md +253 -0
  107. package/docs/capabilities/getRaffleDrawRun.md +210 -0
  108. package/docs/capabilities/getRaffleDrawRunsHistory.md +116 -0
  109. package/docs/capabilities/getRaffleWonPrizes.md +153 -0
  110. package/docs/capabilities/getRaffles.md +249 -0
  111. package/docs/capabilities/getRelatedItemsForGame.md +236 -0
  112. package/docs/capabilities/getStoreCategories.md +128 -0
  113. package/docs/capabilities/getStoreItems.md +260 -0
  114. package/docs/capabilities/getStorePurchasedItems.md +280 -0
  115. package/docs/capabilities/getTournamentInstanceInfo.md +301 -0
  116. package/docs/capabilities/getTournamentsList.md +234 -0
  117. package/docs/capabilities/getTranslations.md +95 -0
  118. package/docs/capabilities/getUserLevelExtraCounters.md +92 -0
  119. package/docs/capabilities/getUserProfile.md +184 -0
  120. package/docs/capabilities/jackpotGet.md +173 -0
  121. package/docs/capabilities/jackpotOptIn.md +94 -0
  122. package/docs/capabilities/jackpotOptOut.md +92 -0
  123. package/docs/capabilities/joinClan.md +169 -0
  124. package/docs/capabilities/markAllInboxMessagesAsRead.md +72 -0
  125. package/docs/capabilities/markInboxMessageAsRead.md +69 -0
  126. package/docs/capabilities/markUnmarkInboxMessageAsFavorite.md +75 -0
  127. package/docs/capabilities/miniGameWinAcknowledgeRequest.md +98 -0
  128. package/docs/capabilities/playMiniGame.md +217 -0
  129. package/docs/capabilities/playMiniGameBatch.md +129 -0
  130. package/docs/capabilities/registerInTournament.md +187 -0
  131. package/docs/capabilities/reportClickEvent.md +74 -0
  132. package/docs/capabilities/reportImpressionEvent.md +67 -0
  133. package/docs/capabilities/requestMissionClaimReward.md +117 -0
  134. package/docs/capabilities/requestMissionOptIn.md +98 -0
  135. package/docs/capabilities/requestRaffleOptin.md +108 -0
  136. package/docs/capabilities/setAvatar.md +132 -0
  137. package/docs/capabilities/smarticoCallbacks.md +165 -0
  138. package/docs/capabilities/smarticoGlobal.md +62 -0
  139. package/package.json +3 -2
  140. package/readme-smartico-dev.md +208 -0
  141. package/scripts/capture-responses-browser.mjs +301 -0
  142. package/scripts/gen-capabilities.js +368 -0
  143. package/scripts/run-public-api.mjs +105 -0
  144. package/src/MiniGames/SAWGetTemplatesResponse.ts +2 -0
  145. package/src/MiniGames/SAWTemplate.ts +5 -0
  146. package/src/MiniGames/SAWTemplateUI.ts +6 -2
  147. package/src/SmarticoGlobal.ts +0 -7
  148. package/src/WSAPI/WSAPITypes.ts +44 -0
@@ -0,0 +1,266 @@
1
+ ---
2
+ name: api-tsdoc-final
3
+ description: Run the FULL Smartico public-api documentation-refresh batch in one pass — actualize the `_smartico.on` callback list, refresh the `_smartico` object reference, extend the native WebSocket protocol doc, enrich WSAPI method TSDocs (via the api-tsdoc skill), keep the transforms concept + doc-build wiring current, and finish by preparing a commit message for human review. Use when the user types `/api-tsdoc-final`, or asks to "do the full docs batch", "refresh all SDK docs", or "actualize the public-api docs".
4
+ ---
5
+
6
+ # api-tsdoc-final
7
+
8
+ The end-to-end documentation refresh for the Smartico **public-api** SDK
9
+ (`/Users/aa/Desktop/SM/public-api/`). It orchestrates every documentation
10
+ action performed per release into one ordered batch, then stops at a prepared
11
+ commit message for a human to review.
12
+
13
+ This skill **wraps** the per-method [`api-tsdoc`](../api-tsdoc/SKILL.md) skill —
14
+ it does not replace it. `api-tsdoc` enriches one domain/method (hive extraction,
15
+ validation, UI guides, spillover, README + doc-todo housekeeping). This skill
16
+ adds the surrounding documentation surfaces that aren't tied to a single WSAPI
17
+ method: callbacks, the `_smartico` object, the native protocol, the transforms
18
+ concept, and the doc-build wiring — and ties it all off with a review-ready
19
+ commit message.
20
+
21
+ ## Hard rules (same spirit as api-tsdoc)
22
+
23
+ - **NEVER commit, stage, or push.** This skill ENDS by *preparing* a commit
24
+ message for human review (step 7). Do not run `git commit` / `git push`.
25
+ - **NEVER run `npm run doc`.** It is human-triggered. The skill leaves a
26
+ verification checklist for the human to run it and confirm a clean build.
27
+ - **Edit only:**
28
+ - `.ts` under `public-api/src/` (domain classes, `WSAPITypes.ts`, and the
29
+ vendored `SmarticoLib/index.ts` enum — see step 1 caveat),
30
+ - UI guides under `public-api/docs/ui/<domain>/`,
31
+ - the hand-authored concept docs `public-api/docs/{Callbacks,SmarticoObject,Transforms}.md`,
32
+ - the native protocol `public-api/docs/native/PROTOCOL.md` (+ `ADDING_METHODS.md`),
33
+ - `public-api/tsconfig.json` (only `typedocOptions.entryPoints` and `projectDocuments`),
34
+ - `public-api/README.md`, `public-api/doc-todo.md`.
35
+ - **NEVER edit `public-api/docs/api/**`** — TypeDoc output, wiped by
36
+ `cleanOutputDir: true` on every `npm run doc`. To add an interface page,
37
+ add its source `.ts` to `tsconfig` `entryPoints` (never hand-create the `.md`).
38
+ - **`server/llm-sources/` is a read-only RAG mirror and off-limits by default.**
39
+ Canonical sources are the tracker repo and the live help site
40
+ (`help.smartico.ai`). If the help-page narrative is needed, ask the user to
41
+ point at the canonical help repo, or proceed only on explicit user override.
42
+ - Keep all `/** */` and concept-doc content **consumer-facing** — no internal
43
+ class/file refs, ClassId values (except in PROTOCOL.md, which is the raw
44
+ protocol spec), DB schemas, or Jira refs. Reference the in-tracker UI as
45
+ "the default Smartico UI".
46
+
47
+ ## Sources of truth
48
+
49
+ | Artifact | Edit | Canonical source(s) to read |
50
+ |---|---|---|
51
+ | Callback list (`docs/Callbacks.md`) | `public-api/docs/Callbacks.md` | `tracker/submodule/client-common-libs/src/lib-common/enum/ExternalCallbackKey.ts` (the 18-key enum) + trigger sites: `tracker/src/tracker/{Tracker,Gamification,Smartico,TrackerVisitor}.ts` (grep `triggerExternalCallBack`) + iframe-origin emitters in `tracker/ach/src/core/engine/{SawEngine,UserEngine}.ts` |
52
+ | Vendored callback enum | `public-api/src/SmarticoLib/index.ts` (`declare enum EXTERNAL_CALLBACK_KEY`) | Same `ExternalCallbackKey.ts` (keep in sync; it's a generated bundle — see step 1) |
53
+ | `_smartico` object (`docs/SmarticoObject.md`) | `public-api/docs/SmarticoObject.md` | `tracker/src/tracker/Smartico.ts` (grep `public static`); deep-link values from `DpType` + widget types from `EWidgetType` (verify against `public-api/src/SmarticoLib/index.ts` / `tracker/src/shared/Enums.ts`) |
54
+ | Native protocol (`docs/native/PROTOCOL.md`) | `public-api/docs/native/PROTOCOL.md` | Concept in `public-api/docs/native/ADDING_METHODS.md`; ClassIds from `public-api/src/Base/ClassId.ts`; raw request/response shapes from `public-api/src/SmarticoAPI.ts` + the per-domain `*Request.ts` / `*Response.ts` |
55
+ | WSAPI method TSDocs + UI guides | `public-api/src/WSAPI/*.ts`, `docs/ui/<domain>/` | Delegated to the `api-tsdoc` skill |
56
+ | Transforms concept (`docs/Transforms.md`) | `public-api/docs/Transforms.md` | `grep -rn "export const .*Transform" src/` + `*T` methods in `public-api/src/SmarticoAPI.ts` |
57
+ | Build wiring | `public-api/tsconfig.json`, `public-api/scripts/postdoc-cleanup.js` | — |
58
+
59
+ ## Workflow
60
+
61
+ Run the steps in order. Each step is idempotent — it reconciles the doc against
62
+ the current code, so re-running the skill just picks up the delta. Track
63
+ progress with TaskCreate/TaskUpdate (one task per step).
64
+
65
+ ### Step 1 — Actualize callbacks (`_smartico.on`)
66
+
67
+ 1. Read the canonical enum `ExternalCallbackKey.ts`. Diff its keys against:
68
+ - the events documented in `docs/Callbacks.md`, and
69
+ - the `declare enum EXTERNAL_CALLBACK_KEY` in `src/SmarticoLib/index.ts`.
70
+ 2. For each **new** key: grep the tracker for its `triggerExternalCallBack(EXTERNAL_CALLBACK_KEY.X, ...)`
71
+ site(s) to capture the exact handler arguments; for iframe-origin events
72
+ (`MNIGAME_WIN`, `ACH_GAME_OPENING`, `GF_UX`) read the ach emit sites. Add a
73
+ row to the Callbacks.md event table (grouped: Lifecycle / User state / Widget
74
+ lifecycle / Wins & launches / Errors) with when-it-fires + handler args.
75
+ 3. For **removed/renamed** keys: remove/adjust the row.
76
+ 4. Sync `src/SmarticoLib/index.ts`'s enum to match canonical (keep canonical
77
+ order). **Caveat:** that file is `// Generated by dts-bundle-generator` — there
78
+ is no regen script in this repo, so it's a committed vendored artifact;
79
+ editing it aligns the committed copy with canonical, but flag in the return
80
+ summary that the upstream smartico.js `.d.ts` bundle should be regenerated so
81
+ it doesn't drift back.
82
+ 5. Keep Callbacks.md links plain-text (no relative `.md` links — see step 6
83
+ "media-copy" note).
84
+
85
+ ### Step 2 — Update the `_smartico` object reference
86
+
87
+ 1. Read `Smartico.ts`; list `public static` methods + the `api` / `vapi`
88
+ members. Diff against `docs/SmarticoObject.md`.
89
+ 2. Add/adjust method entries (signature, behavior, preconditions, visitor-mode
90
+ notes). Group: Setup & identity / User profile / Deep links & embedding /
91
+ Events & analytics / Push / Visitor games / Data API / Utilities.
92
+ 3. Verify the deep-link table values against the `DpType` enum and widget types
93
+ against `EWidgetType`. Cross-reference `on`/`off` to Callbacks.md (plain text).
94
+ 4. (Optional) If the user authorizes reading the help page, fold in operator-
95
+ facing narrative (session/login window, identity-via-globals + hash formula,
96
+ control-group flag, URL-triggered deep links, localhost flag, IFrame bridge).
97
+
98
+ ### Step 3 — Extend the native protocol doc
99
+
100
+ Follow the `docs/native/ADDING_METHODS.md` concept for any WSAPI method **not yet
101
+ in PROTOCOL.md**:
102
+
103
+ 1. Determine which methods are missing: compare PROTOCOL.md's API-Methods ToC
104
+ against the WSAPI surface. **Exclude GamePick** (`gamePick*`) — it's HTTP REST
105
+ to a separate games server, not the WebSocket protocol.
106
+
107
+ **Name-mapping caveat (avoid false positives).** PROTOCOL.md is keyed by
108
+ **protocol-layer** method names, NOT the WSAPI wrapper names — a naive
109
+ string-match of WSAPI names against the ToC reports many already-covered
110
+ methods as "missing". Map before concluding a gap; known aliases:
111
+ | WSAPI wrapper | PROTOCOL.md name |
112
+ |---|---|
113
+ | `jackpotGet` | `getJackpots` |
114
+ | `getActivityLog` | `getPointsHistory` |
115
+ | `getUserLevelExtraCounters` / `getCurrentLevel` | `getUserGamificationInfo` (level/counters derived) |
116
+ | `miniGameWinAcknowledgeRequest` | `miniGameWinAcknowledge` |
117
+ | `markUnmarkInboxMessageAsFavorite` | `markInboxMessageAsFavorite` |
118
+ | `checkSegmentMatch` | covered by `checkSegmentListMatch` (shared request) |
119
+ | `getBadges` | shares `GET_ACHIEVEMENT_MAP` with `getMissions` (no own section) |
120
+ | `setNickname` | `setCustomUsername` |
121
+ Confirm a true gap by checking the **request ClassId** isn't already documented
122
+ (grep the CID in PROTOCOL.md), not just the method name. Client-only derived
123
+ methods (e.g. `getCurrentLevel`) have no protocol call and are correctly absent.
124
+ 2. For each missing WS method: find request/response ClassId (numeric) in
125
+ `Base/ClassId.ts`; document the **raw** wire shape (NOT the friendly `T`
126
+ types) as request + response field tables; add `### Error Codes` table when
127
+ the method has named codes; add a JSON example where helpful.
128
+ 3. Link complex array/object types to `../api/interfaces/<Type>.md`. If that page
129
+ doesn't exist, **add the interface's source `.ts` to `tsconfig` `entryPoints`**
130
+ (do NOT hand-create the `.md` in `docs/api/`). Or inline a compact field table.
131
+ 4. Add ToC entries (new `####` categories as needed); GitHub auto-slugs anchors.
132
+ 5. Note: a method that shares a request with another (e.g. `getBadges` reuses
133
+ `GET_ACHIEVEMENT_MAP_REQUEST` from `getMissions`) needs no new section —
134
+ just confirm the shared section documents the distinction.
135
+
136
+ ### Step 4 — Enrich WSAPI method TSDocs (delegate to `api-tsdoc`)
137
+
138
+ Run the `api-tsdoc` skill for the target domain(s)/method(s) the user named (or,
139
+ with no target, scan `src/WSAPI/WSAPI<Domain>.ts` for thin TSDocs and propose a
140
+ list). `api-tsdoc` owns: hive extraction + mandatory validation pass, the
141
+ TSDoc/UI-guide contract, UI guides under `docs/ui/<domain>/`, spillover into
142
+ `WSAPITypes.ts`, and the README "UI Guides" column + `doc-todo.md` tally + SDK
143
+ gaps list. Do not duplicate that work here — invoke the skill.
144
+
145
+ ### Step 5 — Refresh the transforms concept doc
146
+
147
+ Re-survey `grep -rnE "export const [A-Za-z]+[Tt]ransform" src/` and the `*T`
148
+ methods in `SmarticoAPI.ts`. If new domains/transforms appeared, update
149
+ `docs/Transforms.md` (the three naming conventions table, the "what a transform
150
+ does" categories, and the before/after example stay accurate). Keep its links
151
+ plain-text.
152
+
153
+ ### Step 6 — Build hygiene (NO `npm run doc`)
154
+
155
+ Reconcile the doc-build wiring so the next human `npm run doc` is clean:
156
+
157
+ - **Entry points**: every interface `.md` linked from PROTOCOL.md (or a `{@link Type}`
158
+ that should resolve) must have its source `.ts` in `tsconfig` `entryPoints`.
159
+ - **projectDocuments**: every hand-authored concept doc
160
+ (`Callbacks.md`, `SmarticoObject.md`, `Transforms.md`, + any new one) must be
161
+ listed in `tsconfig` `typedocOptions.projectDocuments`, AND linked from README.
162
+ - **No relative `.md` links inside concept docs / project documents.** TypeDoc
163
+ media-copies resolvable relative `.md` links into `docs/api/_media/`; use
164
+ plain-text references (e.g. "see `docs/native/PROTOCOL.md`") instead.
165
+ - **`@param` warnings**: a destructured object param **without** a `= {}` default
166
+ makes TypeDoc warn on `@param params.*` ("not used"). Fix by moving the
167
+ descriptions onto the inline type-literal properties as `/** */` comments and
168
+ removing the `@param params.*` tags (do NOT add `= {}` to params that have
169
+ required fields). Methods with `= {}` defaults are fine as-is.
170
+ - **Unresolved `{@link}` warnings**: a `{@link method}` to a method defined
171
+ *later* in the WSAPI inheritance chain won't resolve → convert to backtick
172
+ code (`` `method` ``). For an enum/type (e.g. `JoinClanErrorCode`), prefer
173
+ adding its source to `entryPoints` so the link resolves.
174
+ - Leave the human a checklist (step 8) to run `npm run doc` and confirm zero new
175
+ warnings + that `docs/api/documents/<concept>.md` generated.
176
+
177
+ ### Step 7 — Prepare the commit message (DO NOT COMMIT)
178
+
179
+ 1. Run `git status` and `git diff --stat` from `public-api/`.
180
+ 2. Draft a single review-ready commit message grouped by area
181
+ (callbacks / `_smartico` object / native protocol / WSAPI TSDocs / transforms /
182
+ build wiring). Conventional-commit style, e.g.:
183
+
184
+ ```
185
+ docs(public-api): refresh SDK docs — callbacks, _smartico object, native protocol, <domains>
186
+
187
+ - callbacks: add <N> events to Callbacks.md; sync EXTERNAL_CALLBACK_KEY vendored enum
188
+ - _smartico object: <added/updated methods>
189
+ - native protocol: document <methods> (ClassIds <…>); +<N> interface entry points
190
+ - WSAPI TSDoc: enrich <domain> (<N> methods, <N> UI guides) via api-tsdoc
191
+ - transforms: <delta or "verified current">
192
+ - build: projectDocuments/entryPoints wiring; fixed <N> typedoc warnings
193
+ ```
194
+ 3. **Present it for review. Do not run `git commit`.** Surface, separately: the
195
+ SmarticoLib enum regen caveat (step 1), any hive-sourced claims not directly
196
+ verified, and any links pending the next `npm run doc`.
197
+
198
+ ### Step 8 — Verification checklist (for the human)
199
+
200
+ Output these for the human to run after review:
201
+
202
+ ```sh
203
+ cd /Users/aa/Desktop/SM/public-api
204
+ # tsconfig is valid + concept docs wired
205
+ node -e "const o=require('./tsconfig.json'); console.log(o.typedocOptions.projectDocuments)"
206
+ # concept docs have no relative .md links (media-copy safe)
207
+ grep -nE "\]\([a-z][^)]*\.md" docs/Callbacks.md docs/SmarticoObject.md docs/Transforms.md || echo OK
208
+ # every PROTOCOL.md interface link has a target after npm run doc
209
+ npm run doc # human-run; confirm ZERO new warnings
210
+ grep -rn "../../docs/ui/" docs/api/classes/ && echo BROKEN || echo OK
211
+ ```
212
+
213
+ ## Output (return summary)
214
+
215
+ - **Per-step delta**: what changed in each surface (callbacks added, `_smartico`
216
+ methods touched, native methods documented, domains enriched, transforms delta,
217
+ build wiring).
218
+ - **Files edited** (paths).
219
+ - **The prepared commit message** (for review — not committed).
220
+ - **Open items / caveats**: SmarticoLib enum regen, links pending `npm run doc`,
221
+ any unverified hive claims, the help-page (llm-sources) source caveat.
222
+ - **Cost**: hive totals from the `api-tsdoc` sub-run.
223
+
224
+ Then **stop**. No commit, no push, no `npm run doc`.
225
+
226
+ ## Notes / scope reminders
227
+
228
+ - GamePick is HTTP REST (separate `r-games-server`), excluded from PROTOCOL.md.
229
+ - `getBadges` shares `GET_ACHIEVEMENT_MAP_REQUEST` with `getMissions` — no
230
+ separate native section.
231
+ - `doc-todo.md` (running tally + numbered SDK-gaps list) is maintained by the
232
+ `api-tsdoc` sub-run in step 4; the batch just confirms it's updated.
233
+
234
+ ## Step 6.5 — Capability pages (RAG ingestion lane)
235
+
236
+ After the method TSDocs are enriched (step 4) and before the verification
237
+ checklist, refresh the **capability pages** — the docs the IDE coding agent
238
+ actually retrieves (`docs/capabilities/<method>.md`, generated by the public-api
239
+ repo's `scripts/gen-capabilities.js`). The IDE's `api` search lane is wired to
240
+ read **only** these (bo_server `LLMSourceTypeId.PUBLIC_API_CAPABILITY`), not the
241
+ raw source — so a method with no capability page is invisible to the agent.
242
+
243
+ Two sub-steps (see the `api-tsdoc` skill's "Capability pages" section for the full
244
+ recipe — capture conventions, anonymization, the `run_public_api` creds, the
245
+ `getUserProfile`/tracker-state browser fallback):
246
+
247
+ 1. **Capture missing/stale responses.** For every method enriched this batch (and
248
+ any with no `docs/capabilities/_responses/<method>.json` yet), capture a real
249
+ response via `mcp__hive__run_public_api`, anonymize, and write the JSON. Track
250
+ coverage: `ls docs/capabilities/_responses/ | wc -l` vs the method count.
251
+ 2. **Regenerate.** `npm run gen-capabilities` → rewrites all
252
+ `docs/capabilities/*.md`. Spot-check a handful (right per-domain field
253
+ comments, real example response present, no internal-name leaks surfaced from a
254
+ field comment — fix any leak at the source type, then re-run).
255
+
256
+ Add a line to the verification checklist for the human:
257
+
258
+ ```sh
259
+ npm run gen-capabilities # regenerate capability pages
260
+ # every capability page that should have a real response payload has one:
261
+ for m in getMissions getStoreItems getTournamentsList getMiniGames getInboxMessages; do
262
+ test -f docs/capabilities/_responses/$m.json && echo "OK $m" || echo "MISS $m"; done
263
+ ```
264
+
265
+ **Never hand-edit `docs/capabilities/*.md`** (generated, overwritten). Do not
266
+ commit; this is part of the review-ready batch like everything else.
@@ -0,0 +1,143 @@
1
+ ---
2
+ name: api-tsdoc-howto
3
+ description: Inspect the Smartico public-api working tree (uncommitted changes + recent commits), determine which docs / capability pages / captured responses are now stale, and output the EXACT ordered commands to bring the docs + RAG pipeline back in sync. Read-only — never edits, never runs the build/capture/commit steps itself. Use when the user types /api-tsdoc-howto, or asks "what docs need updating", "how do I sync the SDK docs", "what's stale", "what do I run to finish the docs".
4
+ ---
5
+
6
+ # api-tsdoc-howto
7
+
8
+ A **read-only diagnostic** for the `@smartico/public-api` docs + RAG pipeline.
9
+ It looks at what changed (uncommitted + recent commits), works out what is now
10
+ out of date, and prints a **copy-pasteable, ordered command plan** to complete
11
+ the full flow. It does NOT make edits or run any build/capture/commit step — it
12
+ tells the human exactly what to run.
13
+
14
+ Full background: `/Users/aa/Desktop/SM/public-api/readme-smartico-dev.md`.
15
+
16
+ ## Hard rules
17
+
18
+ - **Read-only.** Only run inspection commands (`git status`, `git diff`,
19
+ `git log`, `ls`, `grep`, `node -e` for counting). NEVER run
20
+ `npm run gen-capabilities`, `npm run doc`, the capture scripts,
21
+ `git commit`, `npm publish`, or `bump-tracker`. NEVER edit files.
22
+ - **Output = a plan, not actions.** End with an ordered list of exact commands
23
+ the human runs, plus a one-paragraph "what's stale and why".
24
+ - Work in `/Users/aa/Desktop/SM/public-api` (the `PUB` dir below).
25
+
26
+ ## The pipeline (what feeds what)
27
+
28
+ ```
29
+ SOURCE (edit) → REGEN STEP → ARTIFACT (don't edit)
30
+ src/WSAPI/WSAPI<Domain>.ts (method TSDoc) ┐
31
+ src/WSAPI/WSAPITypes.ts + src/<Domain>/*.ts ├ npm run gen-capabilities → docs/capabilities/<method>.md
32
+ docs/ui/<domain>/UIGuide_<method>.md │
33
+ docs/capabilities/_responses/<method>.json ┘
34
+ src/**.ts (TSDoc) + tsconfig entryPoints → npm run doc → docs/api/**
35
+ docs/capabilities/** → JobLLM2 (env2 cron, auto) → RAG (PUBLIC_API_CAPABILITY)
36
+ ```
37
+
38
+ ## Step 1 — gather state
39
+
40
+ ```sh
41
+ PUB=/Users/aa/Desktop/SM/public-api
42
+ git -C "$PUB" status --porcelain
43
+ git -C "$PUB" --no-pager diff --stat HEAD
44
+ git -C "$PUB" --no-pager log --oneline -10
45
+ # coverage
46
+ echo "pages: $(ls "$PUB"/docs/capabilities/*.md 2>/dev/null | wc -l | tr -d ' ') | responses: $(ls "$PUB"/docs/capabilities/_responses/*.json 2>/dev/null | wc -l | tr -d ' ')"
47
+ ```
48
+
49
+ Consider BOTH uncommitted changes and the last few commits — a method enriched
50
+ in a recent commit may still be missing its regenerated page or captured
51
+ response if the author stopped early.
52
+
53
+ ## Step 2 — classify each changed path → impact
54
+
55
+ | Changed path | What it means | Needs |
56
+ |---|---|---|
57
+ | `src/WSAPI/WSAPI<Domain>.ts` | method TSDoc/signature/return changed | `gen-capabilities`; `doc` |
58
+ | `src/WSAPI/WSAPITypes.ts`, `src/<Domain>/*.ts` (types) | field shapes/comments changed | `gen-capabilities`; `doc`; maybe **re-capture** if the wire shape changed |
59
+ | `docs/ui/<domain>/UIGuide_<method>.md` | behavioral contract changed | `gen-capabilities` |
60
+ | `docs/capabilities/_responses/<method>.json` | new/updated real response | `gen-capabilities` |
61
+ | `scripts/gen-capabilities.js` | generator logic changed | `gen-capabilities` (all pages) |
62
+ | `tsconfig.json` (`entryPoints`/`projectDocuments`) | new public type/doc | `doc` |
63
+ | **`docs/capabilities/*.md`** edited by hand | ⚠️ generated file hand-edited | WARN — will be overwritten; move the change to the source + regenerate |
64
+ | **`docs/api/**`** edited by hand | ⚠️ TypeDoc output hand-edited | WARN — overwritten by `doc` |
65
+ | a **new public method** in `WSAPI<Domain>.ts` | brand-new surface | full flow: TSDoc → capture → `gen-capabilities` → entryPoints/`doc` |
66
+
67
+ ## Step 3 — concrete staleness checks (run these)
68
+
69
+ ```sh
70
+ PUB=/Users/aa/Desktop/SM/public-api
71
+
72
+ # (a) Inputs changed but capability pages NOT regenerated → pages are STALE.
73
+ # If any of these appear in `git status` while docs/capabilities/*.md do NOT,
74
+ # gen-capabilities must run.
75
+ git -C "$PUB" status --porcelain -- src/WSAPI docs/ui docs/capabilities/_responses scripts/gen-capabilities.js
76
+ git -C "$PUB" status --porcelain -- docs/capabilities/'*.md' # empty here = not yet regenerated
77
+
78
+ # (b) Public methods with NO capability page (new methods) or NO captured response.
79
+ node -e '
80
+ const fs=require("fs"),path=require("path");
81
+ const W=path.join("'"$PUB"'","src/WSAPI"), C=path.join("'"$PUB"'","docs/capabilities"), R=path.join(C,"_responses");
82
+ const methods=new Set();
83
+ for(const f of fs.readdirSync(W)){ if(!/^WSAPI.*\.ts$/.test(f)||f==="WSAPITypes.ts"||f==="WSAPIBase.ts")continue;
84
+ for(const m of fs.readFileSync(path.join(W,f),"utf8").matchAll(/^\tpublic (?:async )?([a-zA-Z][A-Za-z0-9]*)\s*[(<]/gm)) methods.add(m[1]); }
85
+ const pages=new Set(fs.existsSync(C)?fs.readdirSync(C).filter(f=>f.endsWith(".md")).map(f=>f.slice(0,-3)):[]);
86
+ const resp=new Set(fs.existsSync(R)?fs.readdirSync(R).filter(f=>f.endsWith(".json")).map(f=>f.slice(0,-5)):[]);
87
+ const noPage=[...methods].filter(m=>!pages.has(m));
88
+ const noResp=[...methods].filter(m=>!resp.has(m));
89
+ console.log("methods:",methods.size,"| no capability page:",noPage.join(", ")||"none","| no captured response:",noResp.join(", ")||"none");
90
+ '
91
+
92
+ # (c) New exported public types not yet in TypeDoc entryPoints.
93
+ grep -oE "export (interface|class|enum|type) [A-Z][A-Za-z0-9_]+" "$PUB"/src/WSAPI/WSAPITypes.ts | awk '{print $3}' | sort -u > /tmp/_types.txt
94
+ node -e 'const o=require("'"$PUB"'/tsconfig.json");console.log("entryPoints:",(o.typedocOptions.entryPoints||[]).join(" "))'
95
+ ```
96
+
97
+ Interpretation:
98
+ - **(a)** source/ui/response changed AND `docs/capabilities/*.md` unchanged → **run gen-capabilities**.
99
+ - **(b)** `no capability page` → a new method; needs TSDoc + capture + gen. `no captured response` → page exists but only type-fallback Returns (no real example) → capture if reachable.
100
+ - **(c)** a new public type referenced by a method but absent from `entryPoints`/`docs/api` → add it + run `doc`.
101
+
102
+ ## Step 4 — emit the ordered command plan
103
+
104
+ Print ONLY the steps that apply, in order. Template:
105
+
106
+ ```
107
+ Docs sync plan (run from /Users/aa/Desktop/SM/public-api):
108
+
109
+ # 1. capture real responses (only if new/changed methods need a real example)
110
+ # visitor-reachable methods — fastest, no browser:
111
+ # use the mcp__hive__run_public_api tool (see readme §4a)
112
+ # auth-only (getUserProfile / gamePick* / getInboxMessageBody) or a full refresh:
113
+ SM_MUTATIONS=1 node scripts/capture-responses-browser.mjs # omit SM_MUTATIONS for read-only
114
+ # (one-time: npm i -D playwright && npx playwright install chromium)
115
+
116
+ # 2. regenerate capability pages (REQUIRED whenever any source/type/ui/response changed)
117
+ npm run gen-capabilities
118
+
119
+ # 3. regenerate the TypeDoc reference (only if TSDoc or tsconfig entryPoints changed)
120
+ npm run doc
121
+
122
+ # 4. verify
123
+ ls docs/capabilities/_responses/*.json | wc -l # coverage vs method count
124
+ git status
125
+
126
+ # 5. ship
127
+ git add -A && git commit -m "<message>"
128
+ npm version patch && npm publish # so run_public_api + consumers see new methods
129
+ npm run bump-tracker # flow into live _smartico.api
130
+ # RAG re-indexes automatically (JobLLM2, env2 cron) — no manual step.
131
+ ```
132
+
133
+ Drop steps that don't apply (e.g. no entryPoints change → skip `npm run doc`;
134
+ no method change → skip capture). If hand-edited generated files were found,
135
+ lead with a ⚠️ telling the human to move the edit into the source first.
136
+
137
+ ## Output format
138
+
139
+ 1. **Changed (uncommitted + recent commits)** — short bullet list, grouped by impact.
140
+ 2. **Stale / missing** — what's out of date and why (pages not regenerated, methods with no captured response, types missing from entryPoints, hand-edited generated files).
141
+ 3. **Run this** — the ordered, trimmed command plan from Step 4.
142
+
143
+ Then stop. No edits, no execution beyond read-only inspection.
@@ -21,6 +21,10 @@ export interface SAWTemplate {
21
21
  maxSpinsCount: number;
22
22
  maxSpinsPediodMs: number;
23
23
  next_available_spin_ts?: number;
24
+ /** Soonest-expiring spin's expiration time for this user (epoch ms); `null`/absent when no expirable spins. */
25
+ earliest_expiration_dt?: number | null;
26
+ /** Latest-expiring spin's expiration time for this user (epoch ms); `null`/absent when no expirable spins. */
27
+ latest_expiration_dt?: number | null;
24
28
  saw_skin_key: string;
25
29
  saw_skin_ui_definition: {
26
30
  skin_folder: string;
@@ -365,8 +365,12 @@ export interface SAWTemplateUI {
365
365
  game_difficulty?: SAWGameDifficultyType;
366
366
  /**
367
367
  * URL of the operator-hosted custom mini-game, loaded inside an iframe by
368
- * the widget for `SAWGameType.CustomMinigame`. The operator is trusted, so
369
- * the iframe is rendered without a sandbox.
368
+ * the widget for `SAWGameType.CustomMinigame`. The operator is trusted
369
+ * (the URL resolves to the operator's own published Web Studio game), but
370
+ * the iframe is still rendered with a restrictive sandbox as defence in
371
+ * depth: `sandbox="allow-scripts allow-forms allow-same-origin allow-popups
372
+ * allow-pointer-lock"`. Top-level navigation is intentionally not allowed,
373
+ * so the game cannot redirect the host page.
370
374
  * Back-Office label: _"Game URL"_.
371
375
  */
372
376
  custom_game_url?: string;
@@ -174,12 +174,6 @@ export interface SmarticoGlobal {
174
174
  }
175
175
  declare global {
176
176
  interface Window {
177
- /**
178
- * Params injected by the Smartico widget runtime (`widget.js`) when a widget
179
- * is embedded via `_smartico.showWidget` / a widget script tag. Keys mirror
180
- * the params passed in the embedding snippet (e.g. `id`).
181
- */
182
- __SMARTICO_LP_PARAMS__?: Record<string, string | number>;
183
177
  /**
184
178
  * The global Smartico SDK object, present once the embed snippet has loaded.
185
179
  * Optional because it is `undefined` until the script initializes — guard
@@ -160,6 +160,15 @@ export interface TMiniGameTemplate {
160
160
  * Important: this field will not be populated if “Max number of attempts a user can do” is set to value different from 1
161
161
  * */
162
162
  next_available_spin_ts: number;
163
+ /** Soonest-expiring spin's expiration time for the current user, as an epoch-ms timestamp.
164
+ * `null` when the user has no expirable spins for this template — spins only expire when the
165
+ * template defines a spin-expiration rule (Wheel of Fortune, Loot Boxes, etc.). Pair with
166
+ * `latest_expiration_dt` to render a "spins expire between X and Y" window. */
167
+ earliest_expiration_dt?: number | null;
168
+ /** Latest-expiring spin's expiration time for the current user, as an epoch-ms timestamp.
169
+ * `null` when the user has no expirable spins; equals `earliest_expiration_dt` when a single
170
+ * expiration applies. */
171
+ latest_expiration_dt?: number | null;
163
172
  /** The message that should be shown to the user when he cannot play the game, server rejected attempt with error code SAWSpinErrorCode.SAW_FAILED_MAX_SPINS_REACHED */
164
173
  over_limit_message: string;
165
174
  /** The message that should be shown to the user when he cannot play the game because he doesn't have spin attempts or points. */
@@ -242,6 +251,40 @@ export interface TUserProfile {
242
251
  /** AI-recommended casino bet amount for this user. Undefined when no
243
252
  * recommendation is currently available. */
244
253
  core_recommended_casino_bet_amount?: number;
254
+ /** Display name of the user's current level (e.g. `"Silver"`); resolve the id via `getCurrentLevel()`. */
255
+ ach_level_current?: string;
256
+ /** `true` when the user is in the gamification A/B control group (gamification UI suppressed). */
257
+ ach_gamification_in_control_group?: boolean;
258
+ /** Smartico-internal numeric user id. */
259
+ user_id?: number;
260
+ /** ISO country code of the user (e.g. `"BG"`). */
261
+ user_country?: string;
262
+ /** Wallet currency code (e.g. `"EUR"`). */
263
+ core_wallet_currency?: string;
264
+ /** Registration timestamp (epoch ms); `0` when unknown. */
265
+ core_registration_date?: number;
266
+ /** Last-session browser push-permission state (e.g. `"BLOCKED"`, `"GRANTED"`). */
267
+ user_last_session_push_state?: string;
268
+ /** `true` when the account is flagged as a bonus abuser. */
269
+ acc_bonus_abuser?: boolean;
270
+ /** Selected avatar id (catalogue avatar or AI-variant base). */
271
+ avatar_id?: string;
272
+ /** `avatar_real_id` of the selected avatar; `0` when none. */
273
+ avatar_real_id?: number;
274
+ /** `avatar_real_id` of the user's core avatar; null when unset. */
275
+ core_avatar_real_id?: number | null;
276
+ /** Current clan id (string); empty/null when not in a clan. */
277
+ core_clan_id?: string;
278
+ /** `true` when the user was kicked from their clan; null when not applicable. */
279
+ core_clan_is_kicked?: boolean | null;
280
+ /** Id of the clan the user was kicked from; null when not applicable. */
281
+ core_clan_kicked_out_id?: number | null;
282
+ /** ext_user_id of the friend who referred this user; null when none. */
283
+ aff_referred_by_friend_ext_user_id?: string | null;
284
+ /** Refer-a-friend share URL; null when the feature is disabled. */
285
+ aff_refer_friend_url?: string | null;
286
+ /** Count of friends this user has referred. */
287
+ aff_refered_friends_count?: number;
245
288
  }
246
289
  /**
247
290
  * TLevel describes one level in the label's level ladder.
package/dist/index.js CHANGED
@@ -510,6 +510,8 @@ var SAWTemplatesTransform = function SAWTemplatesTransform(items) {
510
510
  activeFromDate: r.activeFromDate,
511
511
  activeTillDate: r.activeTillDate,
512
512
  next_available_spin_ts: r.next_available_spin_ts,
513
+ earliest_expiration_dt: r.earliest_expiration_dt,
514
+ latest_expiration_dt: r.latest_expiration_dt,
513
515
  steps_to_finish_game: r.saw_template_ui_definition.steps_to_finish_game,
514
516
  custom_section_id: r.saw_template_ui_definition.custom_section_id,
515
517
  saw_template_ui_definition: r.saw_template_ui_definition