@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
@@ -0,0 +1,61 @@
1
+ # Interface: QuizEventMeta
2
+
3
+ QuizEventMeta describes metadata for a quiz-type event (custom question with answer options)
4
+
5
+ ## Extended by
6
+
7
+ - [`GamePickEventMeta`](GamePickEventMeta.md)
8
+
9
+ ## Properties
10
+
11
+ ### answers?
12
+
13
+ > `optional` **answers?**: `object`[]
14
+
15
+ List of possible answer options for the quiz question
16
+
17
+ #### value
18
+
19
+ > **value**: `string`
20
+
21
+ Answer identifier value sent on submission
22
+
23
+ #### text
24
+
25
+ > **text**: `string`
26
+
27
+ Localized display text of the answer
28
+
29
+ #### \_translations
30
+
31
+ > **\_translations**: `object`
32
+
33
+ Per-language overrides for the answer text
34
+
35
+ ##### Index Signature
36
+
37
+ \[`key`: `string`\]: `object`
38
+
39
+ ***
40
+
41
+ ### question\_image?
42
+
43
+ > `optional` **question\_image?**: `string`
44
+
45
+ URL of an image associated with the question
46
+
47
+ ***
48
+
49
+ ### result?
50
+
51
+ > `optional` **result?**: [`QuizAnswersValueType`](../enumerations/QuizAnswersValueType.md)
52
+
53
+ Correct answer value after resolution
54
+
55
+ ***
56
+
57
+ ### custom\_question
58
+
59
+ > **custom\_question**: `string`
60
+
61
+ Custom question text displayed to the user
@@ -31,3 +31,12 @@ URL of the image that represents the prize
31
31
  > **hide\_chance\_to\_win**: `boolean`
32
32
 
33
33
  Indicates whether the chance to win should be hidden in the UI.
34
+
35
+ ***
36
+
37
+ ### custom\_data?
38
+
39
+ > `optional` **custom\_data?**: `string`
40
+
41
+ Custom data field set in the backoffice prize setup.
42
+ Can be used to build custom UI for gamification.
@@ -22,6 +22,6 @@ Absolute CDN URL of the AI-generated image. Can be passed as `avatar_url` to `se
22
22
 
23
23
  ### dt\_created
24
24
 
25
- > **dt\_created**: `string`
25
+ > **dt\_created**: `number`
26
26
 
27
- ISO date string of when the variant was generated.
27
+ Unix-ms timestamp of when the variant was generated.
@@ -20,7 +20,8 @@ and the mark / favorite / delete mutations.
20
20
 
21
21
  > **sent\_date**: `string`
22
22
 
23
- Date when the message was sent (server timestamp).
23
+ Date-time the message was sent, as a `"dd/MM/yyyy HH:mm:ss"` string
24
+ (server local — NOT ISO-8601, so `new Date(sent_date)` will not parse it).
24
25
 
25
26
  ***
26
27
 
@@ -30,3 +30,14 @@ Optional server-side error message. Present only on non-zero
30
30
  ID of the won prize. Look up in `template.prizes` to interpret
31
31
  (including `prize_type === 'no-prize'` for a configured loss
32
32
  slot). Always populated, even when `err_code !== 0`.
33
+
34
+ ***
35
+
36
+ ### request\_id
37
+
38
+ > **request\_id**: `string`
39
+
40
+ Correlation id of this spin. Pass it to
41
+ `miniGameWinAcknowledgeRequest` to finalise the win when
42
+ playing with `acknowledge: false` — no need to look it up via
43
+ `getMiniGamesHistory`.
@@ -261,7 +261,9 @@ The date/timestamp indicating when the prize was claimed by the user
261
261
 
262
262
  > `optional` **complete\_date?**: `string`
263
263
 
264
- Time in hours that took this player to complete mission
264
+ Date-time the mission/badge was completed, as a `"dd/MM/yyyy HH:mm:ss"` string
265
+ (server local — NOT ISO-8601, so `new Date(complete_date)` will not parse it).
266
+ Prefer the epoch-ms `complete_date_ts` for date math.
265
267
 
266
268
  ***
267
269
 
@@ -34,6 +34,15 @@ URL of the image that represents the prize, 256x256px
34
34
 
35
35
  ***
36
36
 
37
+ ### custom\_data?
38
+
39
+ > `optional` **custom\_data?**: `string`
40
+
41
+ Custom data field set in the backoffice prize setup.
42
+ Can be used to build custom UI for gamification.
43
+
44
+ ***
45
+
37
46
  ### prizes\_per\_run
38
47
 
39
48
  > **prizes\_per\_run**: `number`
@@ -0,0 +1,5 @@
1
+ # Variable: AllRoundsGameBoardID
2
+
3
+ > `const` **AllRoundsGameBoardID**: `-1` = `-1`
4
+
5
+ Round ID constant used to request the overall/seasonal leaderboard across all rounds
@@ -86,11 +86,12 @@ For `ExplicitAcknowledge`, gate the acknowledge on the user's Claim
86
86
  tap: call `playMiniGame(template_id, { acknowledge: false })` so the
87
87
  SDK does NOT auto-finalise, then call
88
88
  [`miniGameWinAcknowledgeRequest`](../../api/classes/WSAPIMiniGames.md#minigamewinacknowledgerequest)
89
- when the user taps Claim. Pass the spin's `client_request_id`, read
90
- from the matching [`getMiniGamesHistory`](../../api/classes/WSAPIMiniGames.md#getminigameshistory)
91
- row (it appears with `is_claimed: false`). Note: "explicit claim"
92
- prizes are NOT covered by the server-side auto-acknowledge fallback,
93
- so for these you MUST acknowledge or the prize is never credited.
89
+ with the `request_id` from that play result when the user taps Claim.
90
+ (The same id also surfaces as `client_request_id` on a
91
+ [`getMiniGamesHistory`](../../api/classes/WSAPIMiniGames.md#getminigameshistory)
92
+ row if you need to recover it later.) Note: "explicit claim" prizes
93
+ are NOT covered by the server-side auto-acknowledge fallback, so for
94
+ these you MUST acknowledge or the prize is never credited.
94
95
 
95
96
  Modal contents per prize:
96
97
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartico/public-api",
3
- "version": "0.0.400",
3
+ "version": "0.0.402",
4
4
  "description": "Smartico public API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -2,6 +2,7 @@ import { PointChangeSourceType } from './PointChangeSourceType';
2
2
  import { UserBalanceType } from './UserBalanceType';
3
3
 
4
4
  export interface PointsLog {
5
+ /** Epoch timestamp in SECONDS (not ms — unlike most SDK timestamps). */
5
6
  create_date: number;
6
7
  user_ext_id: string;
7
8
  crm_brand_id: number;
@@ -12,6 +13,7 @@ export interface PointsLog {
12
13
  }
13
14
 
14
15
  export interface GemsDiamondsLog {
16
+ /** Epoch timestamp in SECONDS (not ms — unlike most SDK timestamps). */
15
17
  create_date: number;
16
18
  user_ext_id: string;
17
19
  crm_brand_id: number;
@@ -3,6 +3,6 @@ export interface AvatarCustomized {
3
3
  avatar_real_id: number;
4
4
  /** CDN URL of the AI-customized avatar image */
5
5
  url: string;
6
- /** ISO date string when the customization was created */
7
- dt_created: string;
6
+ /** Unix-ms timestamp when the customization was created. */
7
+ dt_created: number;
8
8
  }
package/src/Core/index.ts CHANGED
@@ -5,5 +5,6 @@ export * from './GetLabelInfoResponse';
5
5
  export * from './GetTranslationsRequest';
6
6
  export * from './GetTranslationsResponse';
7
7
  export * from './PublicLabelSettings';
8
+ export * from './PublicProperties';
8
9
  export * from './ResponseIdentify';
9
10
  export * from './TranslationArea';
@@ -211,10 +211,10 @@ export interface GamePickEventMeta extends QuizEventMeta {
211
211
  export interface GamePickEvent {
212
212
  /** Unique identifier of the event */
213
213
  gp_event_id: number;
214
- /** Timestamp (ms) when the event was resolved, null if not yet resolved */
215
- event_resolution_date: number;
216
- /** Timestamp (ms) of the match/event start time */
217
- match_date: number;
214
+ /** ISO 8601 date-time string when the event was resolved; null until resolved. */
215
+ event_resolution_date: string;
216
+ /** ISO 8601 date-time string of the match/event start time. */
217
+ match_date: string;
218
218
  /** Market type defining the prediction format (e.g. two-team score, quiz question, custom) */
219
219
  market_type_id: SAWGPMarketType;
220
220
  /** Event metadata containing team names, images, sport type, and question details */
@@ -412,8 +412,8 @@ export interface GamePickUserInfo {
412
412
  part_wins_count?: number;
413
413
  /** User's total score */
414
414
  resolution_score?: number;
415
- /** Last time the user's balance was synced from the Smartico platform */
416
- last_wallet_sync_time?: Date;
415
+ /** ISO 8601 date-time string of the last time the user's balance was synced from the Smartico platform. */
416
+ last_wallet_sync_time?: string;
417
417
  /** User's current points balance */
418
418
  ach_points_balance?: number;
419
419
  /** User's current gems balance */
@@ -440,9 +440,9 @@ export interface GamePickGameInfo {
440
440
  * GamesApiResponse is the standard response wrapper for all GamePick/Quiz API calls
441
441
  */
442
442
  export interface GamesApiResponse<T> {
443
- /** Error code: 0 on success, non-zero on failure */
443
+ /** Error code; `0` = success. Per-method code tables live in each `gamePick*` method's TSDoc. */
444
444
  errCode: number;
445
- /** Human-readable error message when errCode is non-zero */
445
+ /** Human-readable error message; populated when `errCode` is non-zero. */
446
446
  errMessage?: string;
447
447
  /** Response payload, present on success */
448
448
  data?: T;
@@ -452,13 +452,13 @@ export interface GamesApiResponse<T> {
452
452
  * GamePickRequestParams describes the base parameters required for GamePick API calls
453
453
  */
454
454
  export interface GamePickRequestParams {
455
- /** ID of the MatchX or Quiz game template */
455
+ /** ID of the MatchX or Quiz game template. The only field the consumer supplies. */
456
456
  saw_template_id: number;
457
- /** External user ID */
458
- ext_user_id: string;
459
- /** Smartico external user ID used for platform API calls */
460
- smartico_ext_user_id: string;
461
- /** Language code for translations (e.g. 'EN', 'DE') */
457
+ /** External user ID. Injected by the SDK from the active session; consumers omit it. */
458
+ ext_user_id?: string;
459
+ /** Platform external user ID. Injected by the SDK from the active session; consumers omit it. */
460
+ smartico_ext_user_id?: string;
461
+ /** Language code for translations (e.g. 'EN', 'DE'). Defaults to the session language. */
462
462
  lang?: string;
463
463
  }
464
464
 
@@ -10,5 +10,6 @@ export interface Level {
10
10
  required_level_counter_1: number;
11
11
  required_level_counter_2: number;
12
12
  general_level_progress: number;
13
+ /** 1-based position of this level within the level ladder. */
13
14
  ordinal_position?: number;
14
15
  }
@@ -23,9 +23,9 @@ export interface UserAchievement {
23
23
  start_date_ts?: number;
24
24
  time_limit_ms?: number;
25
25
  progress?: number;
26
- complete_date?: string;
26
+ complete_date?: string; // "dd/MM/yyyy HH:mm:ss" string (not ISO-8601); use complete_date_ts for epoch-ms
27
27
  complete_date_ts?: number;
28
- unlock_date?: string;
28
+ unlock_date?: string; // "dd/MM/yyyy HH:mm:ss" string (not ISO-8601)
29
29
  milliseconds_till_available?: number;
30
30
  completed_tasks?: number;
31
31
  achievementTasks?: UserAchievementTask[];
@@ -1478,7 +1478,8 @@ class SmarticoAPI {
1478
1478
  };
1479
1479
  } else if (params) {
1480
1480
  const extraQuery = Object.entries(params)
1481
- .map(([k, v]) => `${k}=${encodeURIComponent(JSON.stringify(v))}`)
1481
+ .filter(([, v]) => v !== null && v !== undefined)
1482
+ .map(([k, v]) => `${k}=${encodeURIComponent(typeof v === 'object' ? JSON.stringify(v) : v)}`)
1482
1483
  .join('&');
1483
1484
  url += `&${extraQuery}`;
1484
1485
  }
@@ -0,0 +1,209 @@
1
+ import type { WSAPI } from './WSAPI/WSAPI';
2
+ import type { PublicProperties } from './Core/PublicProperties';
3
+
4
+ /**
5
+ * Type-only module. Contains no runtime code — interfaces, type aliases and the
6
+ * `declare global` augmentation below all compile to **nothing**, so importing
7
+ * `@smartico/public-api` for these types adds zero bytes to a consumer bundle.
8
+ *
9
+ * It exists so that any TypeScript app embedding the Smartico SDK gets the global
10
+ * `window._smartico` object fully typed *without hand-redeclaring it*. The two
11
+ * heaviest members — `api` and `vapi` — resolve to the real {@link WSAPI} class
12
+ * exported by this same package, so they can never drift out of sync with the SDK
13
+ * the way a hand-copied subset does.
14
+ *
15
+ * The `_smartico` object itself is implemented in the tracker bundle
16
+ * (`window._smartico`) and is loaded on the page by the Smartico embed snippet.
17
+ * This file only describes its *shape*; it does not provide an implementation.
18
+ *
19
+ * @document docs/SmarticoObject.md
20
+ */
21
+
22
+ /**
23
+ * Widget kinds accepted by {@link SmarticoGlobal.showWidget}. Mirrors the widget
24
+ * set the SDK supports; values are stable string identifiers.
25
+ */
26
+ export type SmarticoWidgetType =
27
+ | 'achievements'
28
+ | 'short_info'
29
+ | 'tournaments'
30
+ | 'store'
31
+ | 'inbox'
32
+ | 'missions'
33
+ | 'mini-game'
34
+ | 'match-x-2'
35
+ | 'quiz'
36
+ | 'custom-section'
37
+ | 'inbox-widget'
38
+ | 'ui-widget'
39
+ | 'liquid';
40
+
41
+ /** Presentation options for {@link SmarticoGlobal.showWidget} / {@link SmarticoGlobal.miniGame}. */
42
+ export interface SmarticoWidgetParams {
43
+ /** Theme name to render the widget with. */
44
+ theme?: string;
45
+ /** `'auto'` to size to content, or an explicit CSS height. */
46
+ height?: 'auto' | string;
47
+ /** Render inline instead of as an overlay. */
48
+ inline?: boolean;
49
+ /** Zoom factor applied to the widget iframe. */
50
+ zoom?: number;
51
+ /** Force the mobile layout regardless of viewport. */
52
+ force_mobile?: boolean;
53
+ }
54
+
55
+ /**
56
+ * Options passed to {@link SmarticoGlobal.init} / {@link SmarticoGlobal.initVisitorMode}.
57
+ * All fields are optional; only `brand_key` is commonly set.
58
+ */
59
+ export interface SmarticoInitParams {
60
+ /** Brand key for multi-brand labels. */
61
+ brand_key?: string | null;
62
+ /** Enable verbose SDK logging. */
63
+ debug?: boolean;
64
+ /** Initial UI language (e.g. `'EN'`). */
65
+ lang?: string;
66
+ /** Override the SDK WebSocket endpoint. */
67
+ ws_url?: string | null;
68
+ /** Allow additional forward-compatible init options. */
69
+ [key: string]: unknown;
70
+ }
71
+
72
+ /**
73
+ * The global `_smartico` object exposed by the Smartico embed on `window`.
74
+ *
75
+ * `api` and `vapi` are the {@link WSAPI} surface documented across this package's
76
+ * API reference; every other member is a core SDK control method implemented in
77
+ * the tracker bundle (see the `_smartico` object reference doc).
78
+ *
79
+ * @document docs/SmarticoObject.md
80
+ */
81
+ export interface SmarticoGlobal {
82
+ /**
83
+ * The authenticated WebSocket API surface (`_smartico.api.*`). Available once
84
+ * the SDK has initialized and identified the user — gate calls on
85
+ * {@link SmarticoGlobal.checkSuccessfullyIdentify}.
86
+ */
87
+ api: WSAPI;
88
+
89
+ /**
90
+ * Visitor-mode (unauthenticated) API surface for the given language. Returns a
91
+ * {@link WSAPI} scoped to anonymous visitors.
92
+ */
93
+ vapi(language: string): WSAPI;
94
+
95
+ /**
96
+ * `true` once the SDK is initialized **and** the user has been successfully
97
+ * identified. Use as a synchronous gate before calling any `api.*` method.
98
+ */
99
+ checkSuccessfullyIdentify(): boolean;
100
+
101
+ /** Initialize the SDK for an identified integration. */
102
+ init(labelApiKey: string, params?: SmarticoInitParams): void;
103
+ /** Initialize the SDK in visitor (anonymous) mode. */
104
+ initVisitorMode(labelApiKey: string, params?: SmarticoInitParams): void;
105
+ /** Identify the current user against the label. */
106
+ identify(extUserId: string, hash: string, payload?: Record<string, unknown>): Promise<void>;
107
+ /** Mark an identified user as online for the given language. */
108
+ online(extUserId: string, language: string, userHash: string, payload?: Record<string, unknown>): Promise<void>;
109
+ /** Re-run the login flow for the current session. */
110
+ login(language?: string, payload?: Record<string, unknown>): void;
111
+ /** Log the current user out of the SDK session. */
112
+ logout(payload?: Record<string, unknown>): void;
113
+ /** Clear SDK state/cookies. */
114
+ clear(params?: Record<string, unknown>): void;
115
+ /** Switch the active UI language. */
116
+ changeLanguage(language: string): void;
117
+
118
+ /**
119
+ * Subscribe to a lifecycle/engagement callback. Pass `null` as the handler to
120
+ * unsubscribe. See the callbacks reference for available keys.
121
+ */
122
+ on(event: string, cb: null | ((...args: any[]) => void), params?: Record<string, unknown>): void;
123
+ /** Remove a previously registered callback. */
124
+ off(event: string, cb: null | ((...args: any[]) => void)): void;
125
+
126
+ /** Trigger a Smartico deep link. */
127
+ dp(deepLink: string): void;
128
+ /** Open a Smartico widget overlay/inline. */
129
+ showWidget(widgetType: SmarticoWidgetType, params?: SmarticoWidgetParams): void;
130
+ /** Open a mini-game widget for the given template. */
131
+ miniGame(sawTemplateId: string, params: SmarticoWidgetParams, pendingMessageId?: string | number): void;
132
+ /** Render a banner into a host element. */
133
+ showBanner(params: { dom_id: string; placement_key: string }): void;
134
+ /** Push data into an already-rendered banner. */
135
+ sendDataToBanner(params: { placement_key: string; data: Record<string, unknown> }): void;
136
+ /** Embed the gamification block into a host element. */
137
+ gamificationBlock(params: { dom_id: string; url: string; fit?: 'content' | 'fill' }): void;
138
+
139
+ /** Snapshot of the user's public gamification properties. */
140
+ getPublicProps(): PublicProperties;
141
+ /** Add/remove/replace/clear the user's public tags. */
142
+ updatePublicTags(operation: 'add' | 'remove' | 'replace' | 'clear', tags?: string[]): void;
143
+ /** Set UTM attribution for the session. */
144
+ setUTMs(source: string, campaign: string): void;
145
+ /** Record the last login entry point. */
146
+ setLoginEntry(entry: string): void;
147
+ /** Set the user's avatar. */
148
+ setAvatar(avatarId: string): void;
149
+ /** Set the user's nickname. */
150
+ setNickname(nickname: string): void;
151
+ /** Set the active UI skin. */
152
+ setSkin(skinName: string): void;
153
+
154
+ /** Prompt the browser for web-push permission. */
155
+ requestPushPermissions(): void;
156
+ /** Register a native push token (mobile webviews). */
157
+ registerNativePushToken(token: string, platform?: number, appPackageId?: string): void;
158
+
159
+ /** Send a client event. */
160
+ event(eventType: string, payload?: Record<string, unknown>): void;
161
+ /** Send a client action. */
162
+ action(actionValue: unknown, extraPayload?: Record<string, unknown>): void;
163
+ /** Report a client-side error to the server. */
164
+ sendServerError(message: string): void;
165
+ /** Send a client-side debug message to the server. */
166
+ sendServerDebug(message: string): void;
167
+
168
+ /** Temporarily suspend/resume automatic popups. */
169
+ suspendPopups(flag: boolean): void;
170
+ /** Temporarily suspend/resume the inbox. */
171
+ suspendInbox(flag: boolean): void;
172
+ /** Temporarily suspend/resume mini-games. */
173
+ suspendMiniGames(flag: boolean): void;
174
+
175
+ /** Show a visitor-mode game. */
176
+ showVisitorGame(params: Record<string, unknown>): void;
177
+ /** Convert a visitor-mode win into an identified reward. */
178
+ convertVisitorGame(visitorWinUuid: string): void;
179
+
180
+ /** Start landing-page analytics for a template. */
181
+ startLpAnalytics(params: { lp_template_uuid: string; shadow_root?: ShadowRoot | null }): void;
182
+ /** Send a landing-page analytics activity. */
183
+ sendAnalytics(activityId: number, viewTimeSec?: number): void;
184
+
185
+ /** `true` on mobile viewports. */
186
+ isMobile(): boolean;
187
+ /** Parse the current URL query into a map. */
188
+ parseUrl(): Record<string, string>;
189
+ /** Parse the current URL hash into a map. */
190
+ parseUrlHash(): Record<string, string>;
191
+ }
192
+
193
+ declare global {
194
+ interface Window {
195
+ /**
196
+ * Params injected by the Smartico widget runtime (`widget.js`) when a widget
197
+ * is embedded via `_smartico.showWidget` / a widget script tag. Keys mirror
198
+ * the params passed in the embedding snippet (e.g. `id`).
199
+ */
200
+ __SMARTICO_LP_PARAMS__?: Record<string, string | number>;
201
+
202
+ /**
203
+ * The global Smartico SDK object, present once the embed snippet has loaded.
204
+ * Optional because it is `undefined` until the script initializes — guard
205
+ * access (`window._smartico?.…`) or gate on `checkSuccessfullyIdentify()`.
206
+ */
207
+ _smartico?: SmarticoGlobal;
208
+ }
209
+ }
@@ -37,7 +37,7 @@ export const StoreItemTransform = (items: StoreItem[]): TStoreItem[] => {
37
37
  id: r.id,
38
38
  name: r.itemPublicMeta.name,
39
39
  purchase_type: mapPurchaseType(r.itemPublicMeta.purchase_type),
40
- price: r.itemPublicMeta.price as any as number, // AA: strange why it's string
40
+ price: Number(r.itemPublicMeta.price), // wire delivers price as a string; coerce to the number the type promises
41
41
  image: r.itemPublicMeta.image_url,
42
42
  description: r.itemPublicMeta.description,
43
43
  ribbon: r.itemPublicMeta.label_tag === 'custom' ? r.itemPublicMeta.custom_label_tag : r.itemPublicMeta.label_tag,
@@ -142,7 +142,7 @@ export class WSAPIAvatars extends WSAPIMiniGames {
142
142
  *
143
143
  * // Newest-first within each base.
144
144
  * for (const list of byBase.values()) {
145
- * list.sort((a, b) => b.dt_created.localeCompare(a.dt_created));
145
+ * list.sort((a, b) => b.dt_created - a.dt_created);
146
146
  * }
147
147
  *
148
148
  * console.log('[smartico] AI variants by base avatar — render as a carousel under each base');
@@ -307,9 +307,9 @@ export class WSAPIGamePick extends WSAPIAvatars {
307
307
  * **Side effects**
308
308
  * - First successful submit deducts the buy-in (Points / Gems / Diamonds /
309
309
  * one Spin) per `saw_buyin_type_id`.
310
- * - Reports a `minigame_matchx_prediction` event to the operator's event log.
311
- * - Updates the round's participant counter (`users_cnt`) and per-event
312
- * counters (`num_users`).
310
+ * - Records the user's participation against the round and its events
311
+ * server-side and reports a prediction event to the operator's activity
312
+ * stream.
313
313
  * - Score is awarded after the operator resolves the round
314
314
  * ({@link GPRoundStatus} = `RoundResolved`).
315
315
  *
@@ -408,9 +408,9 @@ export class WSAPIGamePick extends WSAPIAvatars {
408
408
  * **Idempotency**: identical to {@link gamePickSubmitSelection} — re-submit
409
409
  * returns `errCode: 3` and never double-charges the buy-in.
410
410
  *
411
- * **Side effects**: identical to {@link gamePickSubmitSelection}, with the
412
- * reported event being `minigame_quiz_prediction` instead of
413
- * `minigame_matchx_prediction`.
411
+ * **Side effects**: identical to {@link gamePickSubmitSelection} — buy-in
412
+ * deduction on first submit, participation recorded, score awarded on round
413
+ * resolution.
414
414
  *
415
415
  * **Visitor mode**: not supported.
416
416
  *