@smartico/public-api 0.0.380 → 0.0.382
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/CLAUDE.md +103 -0
- package/README.md +32 -10
- package/dist/Base/ClassId.d.ts +2 -0
- package/dist/Jackpots/JackpotDetails.d.ts +14 -15
- package/dist/Jackpots/JackpotPot.d.ts +10 -6
- package/dist/MiniGames/SAWGameType.d.ts +3 -1
- package/dist/MiniGames/SAWTemplateUI.d.ts +7 -0
- package/dist/Raffle/GetRaffleWonPrizesRequest.d.ts +9 -0
- package/dist/Raffle/GetRaffleWonPrizesResponse.d.ts +52 -0
- package/dist/Raffle/index.d.ts +2 -0
- package/dist/SmarticoAPI.d.ts +6 -1
- package/dist/SmarticoLib/index.d.ts +5 -1
- package/dist/WSAPI/WSAPIAvatars.d.ts +267 -49
- package/dist/WSAPI/WSAPIBonuses.d.ts +224 -10
- package/dist/WSAPI/WSAPIGamePick.d.ts +538 -253
- package/dist/WSAPI/WSAPIGeneral.d.ts +156 -14
- package/dist/WSAPI/WSAPIInbox.d.ts +547 -58
- package/dist/WSAPI/WSAPIJackpots.d.ts +292 -57
- package/dist/WSAPI/WSAPILeaderBoard.d.ts +127 -13
- package/dist/WSAPI/WSAPIMiniGames.d.ts +465 -49
- package/dist/WSAPI/WSAPIRaffles.d.ts +576 -52
- package/dist/WSAPI/WSAPITournaments.d.ts +3 -3
- package/dist/WSAPI/WSAPITypes.d.ts +243 -132
- package/dist/WSAPI/WSAPIUser.d.ts +193 -43
- package/dist/index.js +3412 -616
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +3395 -609
- package/dist/index.modern.mjs.map +1 -1
- package/docs/Callbacks.md +162 -0
- package/docs/SmarticoObject.md +445 -0
- package/docs/Transforms.md +99 -0
- package/docs/api/README.md +26 -0
- package/docs/api/classes/WSAPIAvatars.md +282 -54
- package/docs/api/classes/WSAPIBonuses.md +233 -12
- package/docs/api/classes/WSAPIClans.md +380 -10
- package/docs/api/classes/WSAPIGamePick.md +555 -26
- package/docs/api/classes/WSAPIGeneral.md +165 -16
- package/docs/api/classes/WSAPIInbox.md +588 -64
- package/docs/api/classes/WSAPIJackpots.md +320 -66
- package/docs/api/classes/WSAPILeaderBoard.md +133 -15
- package/docs/api/classes/WSAPIMiniGames.md +501 -64
- package/docs/api/classes/WSAPIMissions.md +58 -79
- package/docs/api/classes/WSAPIRaffles.md +647 -69
- package/docs/api/classes/WSAPIStore.md +83 -108
- package/docs/api/classes/WSAPITournaments.md +495 -28
- package/docs/api/classes/WSAPIUser.md +520 -83
- package/docs/api/documents/Callbacks.md +162 -0
- package/docs/api/documents/SmarticoObject.md +445 -0
- package/docs/api/documents/Transforms.md +99 -0
- package/docs/api/enumerations/BonusStatus-1.md +11 -6
- package/docs/api/enumerations/JoinClanErrorCode.md +81 -0
- package/docs/api/enumerations/TournamentRegistrationError.md +12 -0
- package/docs/api/functions/clanTournamentPlayersTransform.md +13 -0
- package/docs/api/interfaces/AvatarCustomized.md +25 -0
- package/docs/api/interfaces/AvatarDefinition.md +94 -0
- package/docs/api/interfaces/AvatarPrompt.md +45 -0
- package/docs/api/interfaces/BonusMetaMap-1.md +4 -1
- package/docs/api/interfaces/BonusTemplateMetaMap-1.md +9 -4
- package/docs/api/interfaces/Clan.md +4 -0
- package/docs/api/interfaces/ClanInfo.md +109 -0
- package/docs/api/interfaces/ClanMember.md +53 -0
- package/docs/api/interfaces/ClanTournamentPlayerRaw.md +67 -0
- package/docs/api/interfaces/GemsDiamondsLog.md +43 -0
- package/docs/api/interfaces/GetClanInfoResponse.md +61 -0
- package/docs/api/interfaces/GetClanTournamentPlayersResponse.md +81 -0
- package/docs/api/interfaces/GetRaffleWonPrizesRequest.md +59 -0
- package/docs/api/interfaces/GetRaffleWonPrizesResponse.md +95 -0
- package/docs/api/interfaces/InboxMarkMessageAction.md +10 -2
- package/docs/api/interfaces/JackpotDetails.md +14 -15
- package/docs/api/interfaces/JackpotPot.md +9 -6
- package/docs/api/interfaces/LeaderBoardDetailsT.md +14 -8
- package/docs/api/interfaces/LeaderBoardUserT.md +8 -5
- package/docs/api/interfaces/LeaderBoardsRewardsT.md +7 -0
- package/docs/api/interfaces/PointsLog.md +43 -0
- package/docs/api/interfaces/RaffleWonPrize.md +59 -0
- package/docs/api/interfaces/RaffleWonPrizePublicMeta.md +27 -0
- package/docs/api/interfaces/RaffleWonPrizeUser.md +43 -0
- package/docs/api/interfaces/TAchCategory.md +2 -7
- package/docs/api/interfaces/TAvatarCustomized.md +4 -4
- package/docs/api/interfaces/TAvatarDefinition.md +13 -14
- package/docs/api/interfaces/TAvatarPrompt.md +6 -6
- package/docs/api/interfaces/TBonus.md +16 -8
- package/docs/api/interfaces/TBuyStoreItemResult.md +4 -29
- package/docs/api/interfaces/TClaimBonusResult.md +5 -5
- package/docs/api/interfaces/TClan.md +8 -4
- package/docs/api/interfaces/TClanInfo.md +47 -0
- package/docs/api/interfaces/TClanJoinResult.md +11 -1
- package/docs/api/interfaces/TClanTournamentPlayer.md +55 -0
- package/docs/api/interfaces/TClanTournamentPlayersResult.md +27 -0
- package/docs/api/interfaces/TClans.md +3 -1
- package/docs/api/interfaces/TGetTranslations.md +4 -0
- package/docs/api/interfaces/TInboxMessage.md +14 -6
- package/docs/api/interfaces/TInboxMessageBody.md +18 -12
- package/docs/api/interfaces/TLevel.md +17 -20
- package/docs/api/interfaces/TLevelCurrent.md +19 -18
- package/docs/api/interfaces/TMiniGamePlayBatchResult.md +14 -6
- package/docs/api/interfaces/TMiniGamePlayResult.md +9 -4
- package/docs/api/interfaces/TMissionClaimRewardResult.md +1 -9
- package/docs/api/interfaces/TMissionOptInResult.md +1 -5
- package/docs/api/interfaces/TMissionOrBadge.md +4 -7
- package/docs/api/interfaces/TRaffleOptinResponse.md +4 -2
- package/docs/api/interfaces/TSegmentCheckResult.md +10 -0
- package/docs/api/interfaces/TSetAvatarResult.md +3 -3
- package/docs/api/interfaces/TStoreItem.md +3 -13
- package/docs/api/interfaces/TTournament.md +1 -1
- package/docs/api/interfaces/TTournamentDetailed.md +1 -1
- package/docs/api/interfaces/TTournamentRegistrationResult.md +4 -2
- package/docs/api/interfaces/TUICustomSection.md +23 -19
- package/docs/api/interfaces/TUserProfile.md +18 -16
- package/docs/api/interfaces/TransformedRaffleClaimPrizeResponse.md +6 -2
- package/docs/api/interfaces/UserLevelExtraCountersT.md +9 -2
- package/docs/api/type-aliases/ActivityLogEntry.md +3 -0
- package/docs/native/ADDING_METHODS.md +7 -2
- package/docs/native/PROTOCOL.md +337 -0
- package/docs/ui/avatars/UIGuide_getAvatarPrompts.md +100 -0
- package/docs/ui/avatars/UIGuide_getAvatarsCustomized.md +90 -0
- package/docs/ui/avatars/UIGuide_getAvatarsList.md +105 -0
- package/docs/ui/avatars/UIGuide_setAvatar.md +118 -0
- package/docs/ui/bonuses/UIGuide_claimBonus.md +144 -0
- package/docs/ui/bonuses/UIGuide_getBonuses.md +176 -0
- package/docs/ui/gamepick/UIGuide_gamePickGetActiveRound.md +99 -0
- package/docs/ui/gamepick/UIGuide_gamePickGetActiveRounds.md +76 -0
- package/docs/ui/gamepick/UIGuide_gamePickGetBoard.md +81 -0
- package/docs/ui/gamepick/UIGuide_gamePickGetGameInfo.md +78 -0
- package/docs/ui/gamepick/UIGuide_gamePickGetHistory.md +55 -0
- package/docs/ui/gamepick/UIGuide_gamePickGetRoundInfoForUser.md +71 -0
- package/docs/ui/gamepick/UIGuide_gamePickGetUserInfo.md +64 -0
- package/docs/ui/gamepick/UIGuide_gamePickSubmitSelection.md +103 -0
- package/docs/ui/gamepick/UIGuide_gamePickSubmitSelectionQuiz.md +67 -0
- package/docs/ui/general/UIGuide_getCustomSections.md +137 -0
- package/docs/ui/general/UIGuide_getRelatedItemsForGame.md +140 -0
- package/docs/ui/inbox/UIGuide_deleteInboxMessage.md +135 -0
- package/docs/ui/inbox/UIGuide_getInboxMessageBody.md +133 -0
- package/docs/ui/inbox/UIGuide_getInboxMessages.md +186 -0
- package/docs/ui/inbox/UIGuide_markInboxMessageAsRead.md +122 -0
- package/docs/ui/inbox/UIGuide_markUnmarkInboxMessageAsFavorite.md +84 -0
- package/docs/ui/jackpots/UIGuide_getJackpotEligibleGames.md +73 -0
- package/docs/ui/jackpots/UIGuide_getJackpotWinners.md +83 -0
- package/docs/ui/jackpots/UIGuide_jackpotGet.md +138 -0
- package/docs/ui/jackpots/UIGuide_jackpotOptIn.md +85 -0
- package/docs/ui/jackpots/UIGuide_jackpotOptOut.md +65 -0
- package/docs/ui/leaderboard/UIGuide_getLeaderBoard.md +166 -0
- package/docs/ui/minigames/UIGuide_getMiniGames.md +153 -0
- package/docs/ui/minigames/UIGuide_getMiniGamesHistory.md +90 -0
- package/docs/ui/minigames/UIGuide_playMiniGame.md +150 -0
- package/docs/ui/minigames/UIGuide_playMiniGameBatch.md +128 -0
- package/docs/ui/raffles/UIGuide_claimRafflePrize.md +99 -0
- package/docs/ui/raffles/UIGuide_getRaffleDrawRun.md +117 -0
- package/docs/ui/raffles/UIGuide_getRaffleDrawRunsHistory.md +92 -0
- package/docs/ui/raffles/UIGuide_getRaffleWonPrizes.md +120 -0
- package/docs/ui/raffles/UIGuide_getRaffles.md +175 -0
- package/docs/ui/raffles/UIGuide_requestRaffleOptin.md +114 -0
- package/docs/ui/user/UIGuide_getActivityLog.md +130 -0
- package/docs/ui/user/UIGuide_getLevels.md +47 -42
- package/package.json +1 -1
- package/src/Base/ClassId.ts +2 -0
- package/src/Jackpots/JackpotDetails.ts +14 -15
- package/src/Jackpots/JackpotPot.ts +10 -6
- package/src/MiniGames/SAWGameType.ts +3 -0
- package/src/MiniGames/SAWTemplateUI.ts +10 -0
- package/src/Raffle/GetRaffleWonPrizesRequest.ts +12 -0
- package/src/Raffle/GetRaffleWonPrizesResponse.ts +56 -0
- package/src/Raffle/index.ts +3 -1
- package/src/SmarticoAPI.ts +14 -1
- package/src/SmarticoLib/index.ts +4 -0
- package/src/WSAPI/WSAPIAvatars.ts +267 -49
- package/src/WSAPI/WSAPIBonuses.ts +224 -10
- package/src/WSAPI/WSAPIGamePick.ts +538 -253
- package/src/WSAPI/WSAPIGeneral.ts +156 -14
- package/src/WSAPI/WSAPIInbox.ts +545 -56
- package/src/WSAPI/WSAPIJackpots.ts +297 -61
- package/src/WSAPI/WSAPILeaderBoard.ts +127 -13
- package/src/WSAPI/WSAPIMiniGames.ts +465 -49
- package/src/WSAPI/WSAPIRaffles.ts +592 -64
- package/src/WSAPI/WSAPITournaments.ts +3 -3
- package/src/WSAPI/WSAPITypes.ts +243 -132
- package/src/WSAPI/WSAPIUser.ts +193 -43
- package/tsconfig.json +9 -1
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Event callbacks — `_smartico.on(...)`
|
|
2
|
+
|
|
3
|
+
Beyond the request/response `_smartico.api.*` methods, the SDK emits **lifecycle
|
|
4
|
+
and engagement events** you can subscribe to. Register a handler with
|
|
5
|
+
`_smartico.on(...)` and it fires whenever that event occurs — user identified,
|
|
6
|
+
balance changed, gamification widget opened, mini-game won, jackpot hit, etc.
|
|
7
|
+
|
|
8
|
+
This is the push side of the SDK: instead of polling, you react to events as
|
|
9
|
+
they happen.
|
|
10
|
+
|
|
11
|
+
## Registering and removing handlers
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
// Subscribe (works after smartico.js has loaded)
|
|
15
|
+
_smartico.on('identify', (errCode, props) => {
|
|
16
|
+
console.log('[smartico] user identified — render the logged-in UI');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// The queue form also works BEFORE the library finishes loading — the call
|
|
20
|
+
// is queued and replayed once smartico.js is ready. Use this when wiring
|
|
21
|
+
// handlers in your page <head> before the script loads.
|
|
22
|
+
_smartico('on', 'identify', (errCode, props) => { /* ... */ });
|
|
23
|
+
|
|
24
|
+
// Remove a specific handler
|
|
25
|
+
function onProps(props) { /* ... */ }
|
|
26
|
+
_smartico.on('props_change', onProps);
|
|
27
|
+
_smartico.off('props_change', onProps);
|
|
28
|
+
|
|
29
|
+
// Passing null removes ALL handlers registered for that key
|
|
30
|
+
_smartico.on('props_change', null);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Behavior
|
|
34
|
+
|
|
35
|
+
- **Multiple handlers per event stack.** Calling `on` repeatedly for the same
|
|
36
|
+
key adds handlers; they all fire. Use `off(key, fn)` to remove one, or
|
|
37
|
+
`on(key, null)` to clear all for that key.
|
|
38
|
+
- **Handlers fire asynchronously** (on the next tick) and are isolated — a
|
|
39
|
+
handler that throws logs a warning and does NOT prevent the other handlers
|
|
40
|
+
(or the SDK) from running. Don't rely on execution order between handlers.
|
|
41
|
+
- **Works in both authenticated and visitor mode.** A handler registered via
|
|
42
|
+
`_smartico.on(...)` is active whether the session is a logged-in user or a
|
|
43
|
+
visitor (`_smartico.vapi(...)`). Events that require an account (`identify`,
|
|
44
|
+
`login`, `logout`) simply never fire in visitor mode — see the per-event
|
|
45
|
+
notes below.
|
|
46
|
+
- **Late subscription misses past events.** `on` does not replay events that
|
|
47
|
+
already happened. If you subscribe to `init` after the library has already
|
|
48
|
+
initialized, your handler won't be called. For one-time lifecycle events
|
|
49
|
+
(`init`, `identify`), register early (use the `_smartico('on', ...)` queue
|
|
50
|
+
form in your page head).
|
|
51
|
+
|
|
52
|
+
## Event reference
|
|
53
|
+
|
|
54
|
+
The first argument of `_smartico.on(...)` is the event key — one of the
|
|
55
|
+
strings below.
|
|
56
|
+
|
|
57
|
+
### Lifecycle
|
|
58
|
+
|
|
59
|
+
| Event key | Fires when | Handler arguments |
|
|
60
|
+
|---|---|---|
|
|
61
|
+
| `init` | The SDK has finished loading and initializing. Fires shortly after `_smartico.init(...)`, **before** the user is identified. | `(errCode)` — `0` on success |
|
|
62
|
+
| `label_init_completed` | The label configuration / settings have loaded (the handshake that follows `init`). At this point gamification products are known. | `(errCode, message)` |
|
|
63
|
+
| `identify` | A user identify attempt completes — **both success and failure**. Branch on `errCode`. | `(errCode, props, message)` on success; `(errCode, {})` on failure. Not fired in visitor mode. |
|
|
64
|
+
| `login` | A login completes successfully. | `()` — no arguments. Not fired in visitor mode. |
|
|
65
|
+
| `logout` | A logout completes successfully. | `()` — no arguments. Not fired in visitor mode. |
|
|
66
|
+
|
|
67
|
+
### User state
|
|
68
|
+
|
|
69
|
+
| Event key | Fires when | Handler arguments |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| `props_change` | Any public user property changes — points, level, balances (gems/diamonds), avatar, unread inbox count, nickname, etc. Fires once right after identify with the full initial set, then again on each change with the changed subset. | `(props)` — a partial public-properties object containing the changed fields. `avatar_id` is returned as a fully-qualified URL. |
|
|
72
|
+
| `page_navigation` | A page load or SPA route change is detected. | `({ url, prev_url, referrer, source })` — `source` is `'load'` (initial page load) or the navigation trigger. |
|
|
73
|
+
| `session_based_dp_detected` | A deep link stored earlier in the browser session is detected after identify (and is about to be executed). | `()` — no arguments. |
|
|
74
|
+
|
|
75
|
+
### Gamification widget lifecycle
|
|
76
|
+
|
|
77
|
+
| Event key | Fires when | Handler arguments |
|
|
78
|
+
|---|---|---|
|
|
79
|
+
| `gf_starting` | The main gamification widget begins opening (e.g. the user taps the gamification entry point or a deep link opens it). | `()` |
|
|
80
|
+
| `gf_started` | The gamification widget has rendered and is displayed to the user. Fires after `gf_starting`. | `()` |
|
|
81
|
+
| `gf_closing` | The gamification widget (or a standalone mini-game) begins closing. | `()` |
|
|
82
|
+
| `saw_starting` | A standalone mini-game surface (Spin-a-Wheel / MatchX / Quiz) begins opening. | `()` |
|
|
83
|
+
| `inbox_starting` | The standalone inbox widget begins opening. | `()` |
|
|
84
|
+
| `gf_ux` | A screen-view / UX analytics event occurs inside the gamification widget (the user navigates to a screen or section). Use to mirror in-widget navigation into your own analytics. | `({ screen_name_id, custom_section_id, entity_id, screen_subname_id })` |
|
|
85
|
+
|
|
86
|
+
### Wins and game launches
|
|
87
|
+
|
|
88
|
+
| Event key | Fires when | Handler arguments |
|
|
89
|
+
|---|---|---|
|
|
90
|
+
| `mini_game_win` | A mini-game spin finishes and a prize is determined. Fires for both real and visitor-mode plays. | `({ prize_id, name, visitor_win_uuid })` — `name` is the prize display name. In visitor mode, `visitor_win_uuid` can be passed to `_smartico.convertVisitorGame(uuid)` to attach the win to a real account on registration. |
|
|
91
|
+
| `jackpot_win` | A jackpot the user participates in is hit (the pot explodes and the user is among the recipients). | `(message)` — the win payload (winner details + jackpot info). See the Jackpots UI guide (`docs/ui/jackpots/`) for how the default Smartico UI surfaces wins. |
|
|
92
|
+
| `ach_game_opening` | The user taps a related / eligible casino game tile from inside the gamification widget (mission, tournament, jackpot, or store context). Use this to launch the game in your own casino lobby. | `(game)` — the game object (catalog id, name, launch links, plus a `context` field naming where it was opened from). If you do not handle this event, the default Smartico UI opens the game's configured link itself. |
|
|
93
|
+
|
|
94
|
+
### Errors
|
|
95
|
+
|
|
96
|
+
| Event key | Fires when | Handler arguments |
|
|
97
|
+
|---|---|---|
|
|
98
|
+
| `protocol_error` | The server rejected a request as an unsupported command (a protocol-level error, distinct from a method's `err_code`). | `({ errCode, errMsg })` |
|
|
99
|
+
|
|
100
|
+
## Examples
|
|
101
|
+
|
|
102
|
+
### Keep a balance widget live
|
|
103
|
+
|
|
104
|
+
```js
|
|
105
|
+
// Render once on identify, then patch on every change.
|
|
106
|
+
_smartico.on('identify', (errCode, props) => {
|
|
107
|
+
if (errCode === 0) {
|
|
108
|
+
console.log('[smartico] initial balance — render widget:', props.ach_points_balance);
|
|
109
|
+
} else {
|
|
110
|
+
console.error('[smartico] identify failed — show logged-out state');
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
_smartico.on('props_change', (props) => {
|
|
115
|
+
if (props.ach_points_balance !== undefined) {
|
|
116
|
+
console.log('[smartico] points changed — update the balance widget:', props.ach_points_balance);
|
|
117
|
+
}
|
|
118
|
+
if (props.core_inbox_unread_count !== undefined) {
|
|
119
|
+
console.log('[smartico] unread count changed — update the inbox badge:', props.core_inbox_unread_count);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### React to a mini-game win
|
|
125
|
+
|
|
126
|
+
```js
|
|
127
|
+
_smartico.on('mini_game_win', ({ prize_id, name, visitor_win_uuid }) => {
|
|
128
|
+
console.log('[smartico] user won prize', prize_id, '—', name, '— show your own celebration overlay');
|
|
129
|
+
|
|
130
|
+
if (visitor_win_uuid) {
|
|
131
|
+
console.log('[smartico] visitor win — after the user registers, call _smartico.convertVisitorGame to attach this win');
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Launch casino games from the gamification widget yourself
|
|
137
|
+
|
|
138
|
+
```js
|
|
139
|
+
// Take over game launching so games open in your lobby instead of the
|
|
140
|
+
// default link-open behavior.
|
|
141
|
+
_smartico.on('ach_game_opening', (game) => {
|
|
142
|
+
console.log('[smartico] user wants to play game — launch it in your lobby:', game.ext_game_id, '(context:', game.context + ')');
|
|
143
|
+
});
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Mirror in-widget navigation into your analytics
|
|
147
|
+
|
|
148
|
+
```js
|
|
149
|
+
_smartico.on('gf_ux', ({ screen_name_id, custom_section_id, entity_id }) => {
|
|
150
|
+
console.log('[smartico] gamification screen view — forward to your analytics:', screen_name_id, custom_section_id, entity_id);
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Notes
|
|
155
|
+
|
|
156
|
+
- The handler argument shapes above describe what the SDK passes today. Treat
|
|
157
|
+
unfamiliar fields defensively (optional-chain / null-check) — payloads can
|
|
158
|
+
gain fields over time.
|
|
159
|
+
- For request/response data (the current list of missions, the user profile,
|
|
160
|
+
the jackpot pots, etc.), use the `_smartico.api.*` methods (see the API
|
|
161
|
+
reference). Callbacks are for reacting to events; the API methods are for
|
|
162
|
+
fetching and mutating state.
|
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
# The `_smartico` object — core methods
|
|
2
|
+
|
|
3
|
+
The global `_smartico` object is the entry point to the SDK. It has three
|
|
4
|
+
surfaces:
|
|
5
|
+
|
|
6
|
+
- **Core methods** (this document) — `init`, identify, language, deep links,
|
|
7
|
+
embedding widgets, push, etc. These are top-level calls: `_smartico.<method>(...)`.
|
|
8
|
+
- **`_smartico.api.*`** — the gamification data/mutation API (missions, store,
|
|
9
|
+
jackpots, …). See the API reference.
|
|
10
|
+
- **`_smartico.on(...)`** — lifecycle/engagement event callbacks. See the Event
|
|
11
|
+
callbacks reference (`docs/Callbacks.md`).
|
|
12
|
+
|
|
13
|
+
## Two ways to call
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
// Direct form — after smartico.js has loaded.
|
|
17
|
+
_smartico.init('LABEL_API_KEY');
|
|
18
|
+
|
|
19
|
+
// Queue form — safe to call BEFORE the library finishes loading. Calls are
|
|
20
|
+
// queued and replayed once the script is ready. Use this in your page <head>.
|
|
21
|
+
_smartico('init', 'LABEL_API_KEY');
|
|
22
|
+
_smartico('on', 'identify', () => { /* ... */ });
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The standard integration snippet (see
|
|
26
|
+
https://help.smartico.ai/welcome/technical-guides/front-end-integration)
|
|
27
|
+
defines `_smartico` as a queue function, then loads the library which drains
|
|
28
|
+
the queue. Both forms map to the same methods.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Setup & identity
|
|
33
|
+
|
|
34
|
+
### `init(label_api_key, params?)`
|
|
35
|
+
|
|
36
|
+
Initializes the library for a label. Must be called once before anything else.
|
|
37
|
+
|
|
38
|
+
- **Idempotent** — calling `init` again with the same label key is a no-op.
|
|
39
|
+
Calling it with a **different** label key (or after visitor mode) tears down
|
|
40
|
+
and re-initializes.
|
|
41
|
+
- Fires the `init` callback (~immediately after setup; see the Event callbacks
|
|
42
|
+
reference).
|
|
43
|
+
- `params` is optional configuration. Common fields: `brand_key` (string),
|
|
44
|
+
`lang` (default `'EN'`), `visitor_mode` (boolean), `debug` (boolean).
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
_smartico('init', 'YOUR_LABEL_API_KEY', { brand_key: 'main', lang: 'EN' });
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### `initVisitorMode(label_api_key, params?)`
|
|
51
|
+
|
|
52
|
+
Shorthand for `init(label_api_key, { ...params, visitor_mode: true })` —
|
|
53
|
+
enables visitor (unauthenticated) features. See the "Visitor mode" section
|
|
54
|
+
in the project README and use `_smartico.vapi(lang)` for visitor data calls.
|
|
55
|
+
|
|
56
|
+
### `online(ext_user_id, language, user_hash, payload?)`
|
|
57
|
+
|
|
58
|
+
Identifies (logs in) a user. This is the recommended single call to attach a
|
|
59
|
+
real user to the session — it identifies the user, clears any cached data from
|
|
60
|
+
a previous session, and applies the language in one step.
|
|
61
|
+
|
|
62
|
+
- `ext_user_id` — the operator's user id. Required (throws if empty).
|
|
63
|
+
- `language` — 2-letter language code; applied via `changeLanguage`.
|
|
64
|
+
- `user_hash` — the server-issued authentication hash for the user.
|
|
65
|
+
- Fires the `identify` callback (success or failure) and, on success, the
|
|
66
|
+
`login` callback. After it resolves, `_smartico.api.*` calls act on behalf
|
|
67
|
+
of this user.
|
|
68
|
+
|
|
69
|
+
```js
|
|
70
|
+
_smartico('online', 'user-123', 'EN', 'SERVER_ISSUED_HASH');
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Login-event window**: the `login` event is generated when a new session
|
|
74
|
+
starts. Within ~30 minutes, page refreshes / navigations do NOT re-trigger
|
|
75
|
+
`login`. If the user logs out on your site you MUST call `_smartico.logout()`
|
|
76
|
+
explicitly — otherwise a subsequent login within the 30-minute window won't
|
|
77
|
+
re-trigger `login`.
|
|
78
|
+
|
|
79
|
+
### Identifying via global variables (alternative)
|
|
80
|
+
|
|
81
|
+
Instead of calling `online` / `identify`, you can set the user identity through
|
|
82
|
+
globals before the library initializes — the SDK reads them on init:
|
|
83
|
+
|
|
84
|
+
```html
|
|
85
|
+
<script>
|
|
86
|
+
window._smartico_user_id = 'some_id';
|
|
87
|
+
window._smartico_language = 'fr';
|
|
88
|
+
// Optional but recommended when ext ids are guessable — see hash note below.
|
|
89
|
+
window._smartico_user_hash = '019b370929095f0cfe6c9b02ea7524a2:1638050700000';
|
|
90
|
+
</script>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Hash protection**: when `ext_user_id` is guessable (sequential number,
|
|
94
|
+
username, …), pass a `user_hash` so a third party can't impersonate a user.
|
|
95
|
+
The hash is `md5( (ext_user_id + ':' + salt_key + ':' + validity_ts_ms).toLowerCase() ) + ':' + validity_ts_ms`,
|
|
96
|
+
**computed server-side**. The salt key is issued by your Smartico Success
|
|
97
|
+
Manager and must be kept secret.
|
|
98
|
+
|
|
99
|
+
### `identify(ext_user_id, hash, payload?)` · `login(language?, payload?)`
|
|
100
|
+
|
|
101
|
+
The older identify/login pair. `identify` attaches the user; `login` sets the
|
|
102
|
+
login payload and (optionally) the language. Both are being consolidated into
|
|
103
|
+
`online(...)` — prefer `online` for new integrations. `identify` throws if
|
|
104
|
+
`ext_user_id` is empty.
|
|
105
|
+
|
|
106
|
+
### `logout(payload?)`
|
|
107
|
+
|
|
108
|
+
Logs the current user out, forgets the session, and reconnects as anonymous.
|
|
109
|
+
Fires the `logout` callback on success.
|
|
110
|
+
|
|
111
|
+
### `changeLanguage(language)`
|
|
112
|
+
|
|
113
|
+
Switches the active language. The code is normalized to a 2-letter form
|
|
114
|
+
(`en-US` → `en`). Changing the language clears the SDK data caches so
|
|
115
|
+
subsequent `_smartico.api.*` calls return content in the new language. Throws
|
|
116
|
+
if `language` is missing.
|
|
117
|
+
|
|
118
|
+
### `clear(params?)`
|
|
119
|
+
|
|
120
|
+
Tears down the tracker, clears caches and timers, and forgets the session.
|
|
121
|
+
Used when fully resetting the SDK (rarely needed directly — `init` with a new
|
|
122
|
+
label key calls this for you).
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## User profile
|
|
127
|
+
|
|
128
|
+
### `getPublicProps()`
|
|
129
|
+
|
|
130
|
+
Returns a synchronous snapshot of the user's current public properties, or
|
|
131
|
+
`null` if the SDK isn't initialized yet. For live updates, subscribe to the
|
|
132
|
+
`props_change` event (see the Event callbacks reference). For the rich typed
|
|
133
|
+
profile, use `_smartico.api.getUserProfile()`.
|
|
134
|
+
|
|
135
|
+
Commonly-used properties:
|
|
136
|
+
|
|
137
|
+
| Property | Meaning |
|
|
138
|
+
|---|---|
|
|
139
|
+
| `avatar_id` | Avatar image URL |
|
|
140
|
+
| `ach_points_balance` / `ach_gems_balance` / `ach_diamonds_balance` | Current currency balances |
|
|
141
|
+
| `ach_points_ever` | Lifetime points earned |
|
|
142
|
+
| `ach_level_current` | Current level name |
|
|
143
|
+
| `core_inbox_unread_count` | Unread inbox messages |
|
|
144
|
+
| `core_public_tags` | Array of upper-cased user tags (see `updatePublicTags`) |
|
|
145
|
+
| `ach_gamification_in_control_group` | `true` when gamification is DISABLED for this user (control group) |
|
|
146
|
+
| `core_registration_date` | Set once the server-side profile is ready |
|
|
147
|
+
|
|
148
|
+
**Control group**: use `ach_gamification_in_control_group` to hide your
|
|
149
|
+
gamification entry points for users gamification is disabled for. Keep the
|
|
150
|
+
entry hidden by default and reveal it only when the flag is `false`:
|
|
151
|
+
|
|
152
|
+
```js
|
|
153
|
+
_smartico.on('props_change', (props) => {
|
|
154
|
+
if (props.ach_gamification_in_control_group !== undefined) {
|
|
155
|
+
const btn = document.getElementById('rewards-btn');
|
|
156
|
+
btn.style.display = props.ach_gamification_in_control_group ? 'none' : 'block';
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### `setNickname(nickname)`
|
|
162
|
+
|
|
163
|
+
Sets the user's public display name.
|
|
164
|
+
|
|
165
|
+
### `setAvatar(avatar_id)`
|
|
166
|
+
|
|
167
|
+
Sets the user's avatar — pass the URL of a PNG with a 1:1 (square) proportion.
|
|
168
|
+
For the full avatar catalog / AI-customization flow, use the `_smartico.api`
|
|
169
|
+
avatar methods instead.
|
|
170
|
+
|
|
171
|
+
```js
|
|
172
|
+
_smartico.setAvatar('https://somesite.com/avatar.png');
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### `setSkin(skin_name)`
|
|
176
|
+
|
|
177
|
+
Switches the gamification widget's visual skin (e.g. `'v3_base_dark'`,
|
|
178
|
+
`'v3_base_vip'`). Useful for matching a day/night site theme, or for giving
|
|
179
|
+
specific users a special skin:
|
|
180
|
+
|
|
181
|
+
```js
|
|
182
|
+
_smartico.on('props_change', (props) => {
|
|
183
|
+
if (props.ach_level_current === 5) {
|
|
184
|
+
_smartico.setSkin('v3_base_vip');
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### `updatePublicTags(operation, tags?)`
|
|
190
|
+
|
|
191
|
+
Mutates the user's public tags. `operation` is one of `'add'`, `'remove'`,
|
|
192
|
+
`'replace'`, `'clear'`. Tags can also be set server-side from campaigns /
|
|
193
|
+
automation rules, and read on the client via `props.core_public_tags` (an
|
|
194
|
+
array of upper-cased tag strings) on the `props_change` event.
|
|
195
|
+
|
|
196
|
+
```js
|
|
197
|
+
_smartico.updatePublicTags('add', ['A', 'B']); // add A & B
|
|
198
|
+
_smartico.updatePublicTags('remove', ['A']); // remove A
|
|
199
|
+
_smartico.updatePublicTags('replace', ['C', 'D']); // replace all with C & D
|
|
200
|
+
_smartico.updatePublicTags('clear'); // clear all
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### `setUTMs(core_utm_source, core_utm_campaign)`
|
|
204
|
+
|
|
205
|
+
Attaches UTM attribution to the user's profile.
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Deep links & embedding the gamification UI
|
|
210
|
+
|
|
211
|
+
### `dp(deepLink)`
|
|
212
|
+
|
|
213
|
+
Executes a **deep link** — the primary way to open Smartico gamification
|
|
214
|
+
surfaces from your own UI (buttons, menu entries, etc.). Pass a deep-link
|
|
215
|
+
string such as:
|
|
216
|
+
|
|
217
|
+
| Deep link | Opens |
|
|
218
|
+
|---|---|
|
|
219
|
+
| `dp:gf` | Gamification main widget |
|
|
220
|
+
| `dp:gf_missions` | Missions screen |
|
|
221
|
+
| `dp:gf_badges` | Badges screen |
|
|
222
|
+
| `dp:gf_store` | Store screen |
|
|
223
|
+
| `dp:gf_tournaments` | Tournaments screen |
|
|
224
|
+
| `dp:gf_board` | Leaderboard |
|
|
225
|
+
| `dp:gf_bonuses` | Bonuses screen |
|
|
226
|
+
| `dp:inbox` | Inbox |
|
|
227
|
+
|
|
228
|
+
```js
|
|
229
|
+
// Open the gamification hub when the user taps your "Rewards" button.
|
|
230
|
+
document.querySelector('#rewards-btn').addEventListener('click', () => {
|
|
231
|
+
_smartico.dp('dp:gf');
|
|
232
|
+
});
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Works for identified users, and for visitors when visitor mode is enabled.
|
|
236
|
+
If called before the user is ready, it logs a console error and no-ops.
|
|
237
|
+
|
|
238
|
+
Special deep links beyond the gamification screens include
|
|
239
|
+
`dp:ask_push_permissions` (trigger the browser push-permission dialog) and
|
|
240
|
+
`dp:action&action=YOUR_ACTION` (fire a named client action).
|
|
241
|
+
|
|
242
|
+
**Triggering a deep link from a URL**: pass a URL-encoded deep link in the
|
|
243
|
+
page URL hash as `_smartico_dp=...` and the SDK executes it automatically
|
|
244
|
+
after the user is identified — handy for triggering a campaign when a user
|
|
245
|
+
lands on a specific page:
|
|
246
|
+
|
|
247
|
+
```text
|
|
248
|
+
https://mycasino.com/deposit.html#_smartico_dp=dp%3Aaction%26action%3DDEPOSIT_OPENED
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### `miniGame(saw_template_id, params?, pending_message_id?)`
|
|
252
|
+
|
|
253
|
+
Opens a specific mini-game (Spin-a-Wheel / lootbox / etc.) by its template id.
|
|
254
|
+
Requires an identified user — for mini-games on landing pages to visitors, use
|
|
255
|
+
`showVisitorGame` instead.
|
|
256
|
+
|
|
257
|
+
### `showWidget(widgetType, params?)`
|
|
258
|
+
|
|
259
|
+
Embeds a pre-built Smartico widget. `widgetType` is one of:
|
|
260
|
+
|
|
261
|
+
`'achievements'`, `'short_info'`, `'tournaments'`, `'store'`, `'inbox'`,
|
|
262
|
+
`'missions'`, `'mini-game'`, `'match-x-2'`, `'quiz'`, `'custom-section'`,
|
|
263
|
+
`'inbox-widget'`, `'ui-widget'`, `'liquid'`.
|
|
264
|
+
|
|
265
|
+
`params` controls embedding (e.g. `iframe` target element id, `height`,
|
|
266
|
+
`theme`, `inline`, `force_mobile`). Requires an identified user.
|
|
267
|
+
|
|
268
|
+
### `gamificationBlock({ dom_id, url })`
|
|
269
|
+
|
|
270
|
+
Mounts a Smartico landing-page widget bundle (built in the LP IDE) into a host
|
|
271
|
+
element on your page. `dom_id` is the id of the container; `url` is the
|
|
272
|
+
absolute URL of the published `widget.js`. Re-calling with the same `dom_id`
|
|
273
|
+
cleanly remounts (the previous widget is torn down first). Requires `init`
|
|
274
|
+
to have run.
|
|
275
|
+
|
|
276
|
+
### `showBanner({ dom_id, placement_key })` · `sendDataToBanner({ placement_key, data })`
|
|
277
|
+
|
|
278
|
+
Renders an operator-configured banner into a host element, and pushes runtime
|
|
279
|
+
data into a rendered banner placement.
|
|
280
|
+
|
|
281
|
+
### `suspendPopups(flag)` · `suspendInbox(flag)` · `suspendMiniGames(flag)`
|
|
282
|
+
|
|
283
|
+
Temporarily suppress (or re-enable) automatically-triggered surfaces — popups,
|
|
284
|
+
inbox prompts, and server-triggered mini-game pop-ups respectively. Pass `true`
|
|
285
|
+
to suspend, `false` to resume. Useful while the user is mid-flow (e.g. on a
|
|
286
|
+
deposit page or completing a KYC form) and you don't want Smartico surfaces
|
|
287
|
+
interrupting. Require an identified user.
|
|
288
|
+
|
|
289
|
+
```js
|
|
290
|
+
_smartico.suspendPopups(true); // on a checkout page
|
|
291
|
+
// ...later...
|
|
292
|
+
_smartico.suspendPopups(false); // back to a safe screen
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
When suspension is turned off, the first surface that was missed while
|
|
296
|
+
suspended is shown — provided the session is still active (the user hasn't
|
|
297
|
+
refreshed or navigated away).
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## Events & analytics
|
|
302
|
+
|
|
303
|
+
### `event(eventType, payload?)`
|
|
304
|
+
|
|
305
|
+
Sends a client event to Smartico (drives automation rules, missions, etc.).
|
|
306
|
+
|
|
307
|
+
### `action(actionValue, extraPayload?)`
|
|
308
|
+
|
|
309
|
+
Sends a named client action — a lightweight event keyed by an action string,
|
|
310
|
+
with optional custom payload you can evaluate later in journeys / automation
|
|
311
|
+
rules / missions.
|
|
312
|
+
|
|
313
|
+
```js
|
|
314
|
+
_smartico.action('CashierSubmitClicked');
|
|
315
|
+
_smartico.action('PIGGY-BANK-CLICK', { prize: 'ABC' });
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### `setLoginEntry(core_last_login_entry)`
|
|
319
|
+
|
|
320
|
+
Records the entry point / context of the user's current login (e.g.
|
|
321
|
+
`'LOBBY'`, `'MOBILE_APP'`) so you can segment / react by it. Any string is
|
|
322
|
+
accepted, but a label is limited to 50 distinct entry-point values.
|
|
323
|
+
|
|
324
|
+
```js
|
|
325
|
+
_smartico.setLoginEntry('LOBBY');
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### `sendAnalytics(activity_id, view_time_sec?)`
|
|
329
|
+
|
|
330
|
+
Reports a screen/activity impression for analytics.
|
|
331
|
+
|
|
332
|
+
### `on(key, handler, params?)` · `off(key, handler)`
|
|
333
|
+
|
|
334
|
+
Subscribe / unsubscribe to lifecycle and engagement events (`identify`,
|
|
335
|
+
`props_change`, `mini_game_win`, `jackpot_win`, …). Registered handlers fire in
|
|
336
|
+
both authenticated and visitor mode. See the **Event callbacks reference**
|
|
337
|
+
(`docs/Callbacks.md`) for the full event list and handler arguments.
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
## Push notifications
|
|
342
|
+
|
|
343
|
+
### `requestPushPermissions()`
|
|
344
|
+
|
|
345
|
+
Prompts the user for web-push permission and registers the subscription. Works
|
|
346
|
+
for an identified user OR an anonymous visitor — the push token is registered
|
|
347
|
+
automatically on the Smartico side once the user is identified. Can also be
|
|
348
|
+
triggered as a deep link: `_smartico.dp('dp:ask_push_permissions')`.
|
|
349
|
+
|
|
350
|
+
### `registerNativePushToken(token, platform?, app_package_id?)`
|
|
351
|
+
|
|
352
|
+
Registers a native (mobile app) push token for the identified user.
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
## Visitor games
|
|
357
|
+
|
|
358
|
+
### `showVisitorGame(params)`
|
|
359
|
+
|
|
360
|
+
Plays a mini-game for an unidentified visitor (visitor mode must be enabled).
|
|
361
|
+
`params`: `{ template_id, frame_id, onBeforePlay, onWin }` — `onBeforePlay`
|
|
362
|
+
returns a boolean to gate the play; `onWin(prize)` receives the won prize.
|
|
363
|
+
|
|
364
|
+
### `convertVisitorGame(visitor_win_uuid)`
|
|
365
|
+
|
|
366
|
+
Attaches a visitor's win to a now-identified account — call after the visitor
|
|
367
|
+
registers / logs in, passing the `visitor_win_uuid` from the visitor win (also
|
|
368
|
+
delivered on the `mini_game_win` event).
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## Data API access
|
|
373
|
+
|
|
374
|
+
### `api`
|
|
375
|
+
|
|
376
|
+
The gamification data/mutation API object — `_smartico.api.getMissions()`,
|
|
377
|
+
`_smartico.api.buyStoreItem(...)`, etc. Available once the user is identified.
|
|
378
|
+
See the API reference for the full method catalogue.
|
|
379
|
+
|
|
380
|
+
### `vapi(language)`
|
|
381
|
+
|
|
382
|
+
Returns a visitor-mode data API object for the given language —
|
|
383
|
+
`_smartico.vapi('EN').getLevels()`. Use when running in visitor mode. Returns
|
|
384
|
+
`null` if the SDK isn't initialized.
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## Utilities
|
|
389
|
+
|
|
390
|
+
### `isMobile()`
|
|
391
|
+
|
|
392
|
+
Returns `true` on mobile user agents.
|
|
393
|
+
|
|
394
|
+
### `parseUrl()` · `parseUrlHash()`
|
|
395
|
+
|
|
396
|
+
Parse the current page URL / URL hash into an object (helpers for reading
|
|
397
|
+
query / hash parameters).
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
## Setup notes
|
|
402
|
+
|
|
403
|
+
### IFrame bridge (B2B)
|
|
404
|
+
|
|
405
|
+
When the integrated platform is loaded inside an iframe and is NOT the owner of
|
|
406
|
+
the main window, the host (main-window) site loads only `smartico.js` without
|
|
407
|
+
initializing, and the iframe loads `smartico_inframe.js` and makes the same
|
|
408
|
+
calls against a **`_smartico_inframe`** object instead of `_smartico`:
|
|
409
|
+
|
|
410
|
+
```html
|
|
411
|
+
<script>
|
|
412
|
+
(function(d,r,b,h,s){h=d.getElementsByTagName('head')[0];s=d.createElement('script');s.onload=b;s.src=r;h.appendChild(s);})
|
|
413
|
+
(document, 'https://libs.smartico.ai/smartico_inframe.js', function() {
|
|
414
|
+
_smartico_inframe.init('__your_label_key', { brand_key: '__your_brand_key__' });
|
|
415
|
+
_smartico_inframe.online('some_user_id', 'fr');
|
|
416
|
+
_smartico_inframe.dp('dp:gf');
|
|
417
|
+
});
|
|
418
|
+
</script>
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
Contact your Customer Success Manager to confirm whether your setup needs this.
|
|
422
|
+
|
|
423
|
+
### Local development
|
|
424
|
+
|
|
425
|
+
By default the SDK refuses to run on `localhost` (to avoid creating "phantom"
|
|
426
|
+
users from dev/QA environments). To run against a real/production user during
|
|
427
|
+
local development:
|
|
428
|
+
|
|
429
|
+
```js
|
|
430
|
+
window._smartico_allow_localhost = true;
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
## Notes
|
|
434
|
+
|
|
435
|
+
- Most methods require `init` to have completed; calls made too early log a
|
|
436
|
+
console error and no-op rather than throwing (except `online` / `identify`,
|
|
437
|
+
which throw on an empty `ext_user_id`, and `changeLanguage`, which throws on
|
|
438
|
+
a missing language).
|
|
439
|
+
- Client events (`event` / `action`) travel over a public, untrusted channel —
|
|
440
|
+
use them only for non-sensitive signals (screen views, clicks). Custom events
|
|
441
|
+
must be registered with your Customer Success Manager before use.
|
|
442
|
+
- The method argument shapes above reflect current behavior; treat optional
|
|
443
|
+
`params` objects defensively as they can gain fields over time.
|
|
444
|
+
- For runnable, copy-pasteable widget code built on `_smartico.api.*`, see
|
|
445
|
+
[expo.smartico.ai](https://expo.smartico.ai/widgets/intro).
|