@smartico/public-api 0.0.379 → 0.0.380

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 (99) hide show
  1. package/.nvmrc +1 -1
  2. package/README.md +31 -2
  3. package/dist/Store/BuyStoreItemErrorCode.d.ts +9 -1
  4. package/dist/Tournaments/TournamentRegistrationError.d.ts +3 -1
  5. package/dist/WSAPI/WSAPI.d.ts +13 -1235
  6. package/dist/WSAPI/WSAPIAvatars.d.ts +78 -0
  7. package/dist/WSAPI/WSAPIBase.d.ts +71 -0
  8. package/dist/WSAPI/WSAPIBonuses.d.ts +26 -0
  9. package/dist/WSAPI/WSAPIClans.d.ts +388 -0
  10. package/dist/WSAPI/WSAPIGamePick.d.ts +308 -0
  11. package/dist/WSAPI/WSAPIGeneral.d.ts +30 -0
  12. package/dist/WSAPI/WSAPIInbox.d.ts +126 -0
  13. package/dist/WSAPI/WSAPIJackpots.d.ts +109 -0
  14. package/dist/WSAPI/WSAPILeaderBoard.d.ts +25 -0
  15. package/dist/WSAPI/WSAPIMiniGames.d.ts +94 -0
  16. package/dist/WSAPI/WSAPIMissions.d.ts +517 -0
  17. package/dist/WSAPI/WSAPIRaffles.d.ts +119 -0
  18. package/dist/WSAPI/WSAPIStore.d.ts +656 -0
  19. package/dist/WSAPI/WSAPITournaments.d.ts +501 -0
  20. package/dist/WSAPI/WSAPITypes.d.ts +145 -85
  21. package/dist/WSAPI/WSAPIUser.d.ts +383 -0
  22. package/dist/index.js +3818 -1528
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.modern.mjs +3180 -981
  25. package/dist/index.modern.mjs.map +1 -1
  26. package/docs/api/README.md +56 -2
  27. package/docs/api/classes/WSAPIAvatars.md +116 -0
  28. package/docs/api/classes/WSAPIBonuses.md +50 -0
  29. package/docs/api/classes/WSAPIClans.md +66 -0
  30. package/docs/api/classes/WSAPIGamePick.md +181 -0
  31. package/docs/api/classes/WSAPIGeneral.md +63 -0
  32. package/docs/api/classes/WSAPIInbox.md +277 -0
  33. package/docs/api/classes/WSAPIJackpots.md +185 -0
  34. package/docs/api/classes/WSAPILeaderBoard.md +39 -0
  35. package/docs/api/classes/WSAPIMiniGames.md +175 -0
  36. package/docs/api/classes/WSAPIMissions.md +611 -0
  37. package/docs/api/classes/WSAPIRaffles.md +195 -0
  38. package/docs/api/classes/WSAPIStore.md +744 -0
  39. package/docs/api/classes/WSAPITournaments.md +104 -0
  40. package/docs/api/classes/WSAPIUser.md +200 -0
  41. package/docs/api/enumerations/AchievementClaimPeriodTypeId.md +13 -0
  42. package/docs/api/enumerations/BuyStoreItemErrorCode.md +32 -0
  43. package/docs/api/interfaces/ClanPrizePublicMeta.md +41 -0
  44. package/docs/api/interfaces/ClanPrizeStructureEntry.md +7 -1
  45. package/docs/api/interfaces/ClanPublicMeta.md +4 -0
  46. package/docs/api/interfaces/SAWTemplateUI.md +10 -0
  47. package/docs/api/interfaces/TAchCategory.md +19 -4
  48. package/docs/api/interfaces/TBuyStoreItemResult.md +26 -8
  49. package/docs/api/interfaces/TMissionClaimRewardResult.md +14 -3
  50. package/docs/api/interfaces/TMissionOptInResult.md +10 -3
  51. package/docs/api/interfaces/TMissionOrBadge.md +6 -2
  52. package/docs/api/interfaces/TStoreItem.md +21 -1
  53. package/docs/api/interfaces/TTournamentDetailed.md +8 -0
  54. package/docs/api/interfaces/UserAchievement.md +1 -1
  55. package/docs/ui/clans/UIGuide_getClanInfo.md +153 -0
  56. package/docs/ui/clans/UIGuide_getClans.md +172 -0
  57. package/docs/ui/clans/UIGuide_joinClan.md +196 -0
  58. package/docs/ui/missions/UIGuide_getAchCategories.md +17 -0
  59. package/docs/ui/missions/UIGuide_getBadges.md +237 -0
  60. package/docs/ui/missions/UIGuide_getMissions.md +268 -0
  61. package/docs/ui/missions/UIGuide_requestMissionClaimReward.md +21 -0
  62. package/docs/ui/missions/UIGuide_requestMissionOptIn.md +16 -0
  63. package/docs/ui/store/UIGuide_buyStoreItem.md +133 -0
  64. package/docs/ui/store/UIGuide_getStoreCategories.md +19 -0
  65. package/docs/ui/store/UIGuide_getStoreItems.md +264 -0
  66. package/docs/ui/store/UIGuide_getStorePurchasedItems.md +122 -0
  67. package/docs/ui/tournaments/UIGuide_getClanTournamentPlayers.md +140 -0
  68. package/docs/ui/tournaments/UIGuide_getTournamentInstanceInfo.md +265 -0
  69. package/docs/ui/tournaments/UIGuide_getTournamentsList.md +236 -0
  70. package/docs/ui/tournaments/UIGuide_registerInTournament.md +156 -0
  71. package/docs/ui/user/UIGuide_getLevels.md +162 -0
  72. package/docs/ui/user/UIGuide_getUserProfile.md +213 -0
  73. package/package.json +3 -3
  74. package/scripts/postdoc-cleanup.js +195 -0
  75. package/src/Missions/MissionsUtils.ts +5 -2
  76. package/src/Store/BuyStoreItemErrorCode.ts +8 -0
  77. package/src/Store/StoreItem.ts +1 -0
  78. package/src/Store/StoreItemPurchased.ts +1 -0
  79. package/src/Store/StoreItemType.ts +1 -1
  80. package/src/Tournaments/TournamentRegistrationError.ts +4 -0
  81. package/src/WSAPI/WSAPI.ts +27 -2007
  82. package/src/WSAPI/WSAPIAvatars.ts +127 -0
  83. package/src/WSAPI/WSAPIBase.ts +93 -0
  84. package/src/WSAPI/WSAPIBonuses.ts +54 -0
  85. package/src/WSAPI/WSAPIClans.ts +417 -0
  86. package/src/WSAPI/WSAPIGamePick.ts +382 -0
  87. package/src/WSAPI/WSAPIGeneral.ts +57 -0
  88. package/src/WSAPI/WSAPIInbox.ts +222 -0
  89. package/src/WSAPI/WSAPIJackpots.ts +212 -0
  90. package/src/WSAPI/WSAPILeaderBoard.ts +40 -0
  91. package/src/WSAPI/WSAPIMiniGames.ts +181 -0
  92. package/src/WSAPI/WSAPIMissions.ts +572 -0
  93. package/src/WSAPI/WSAPIRaffles.ts +175 -0
  94. package/src/WSAPI/WSAPIStore.ts +732 -0
  95. package/src/WSAPI/WSAPITournaments.ts +541 -0
  96. package/src/WSAPI/WSAPITypes.ts +145 -87
  97. package/src/WSAPI/WSAPIUser.ts +456 -0
  98. package/tsconfig.json +17 -1
  99. package/docs/api/classes/WSAPI.md +0 -1927
@@ -0,0 +1,104 @@
1
+ # Class: WSAPITournaments
2
+ ## Methods
3
+
4
+ ### getTournamentsList()
5
+
6
+ > **getTournamentsList**(`__namedParameters?`): `Promise`\<[`TTournament`](../interfaces/TTournament.md)[]\>
7
+
8
+ #### Parameters
9
+
10
+ ##### \_\_namedParameters?
11
+
12
+ ###### onUpdate?
13
+
14
+ (`data`) => `void`
15
+
16
+ #### Returns
17
+
18
+ `Promise`\<[`TTournament`](../interfaces/TTournament.md)[]\>
19
+
20
+ ***
21
+
22
+ ### getTournamentInstanceInfo()
23
+
24
+ > **getTournamentInstanceInfo**(`tournamentInstanceId`): `Promise`\<[`TTournamentDetailed`](../interfaces/TTournamentDetailed.md)\>
25
+
26
+ Returns detailed information for a specific tournament instance; the response includes tournament info and the leaderboard of players
27
+
28
+ **Example**:
29
+ ```
30
+ _smartico.api.getTournamentsList().then((result) => {
31
+ if (result.length > 0) {
32
+ _smartico.api.getTournamentInstanceInfo(result[0].instance_id).then((result) => {
33
+ console.log(result);
34
+ });
35
+ }
36
+ });
37
+ ```
38
+
39
+ **Example in the Visitor mode**:
40
+ ```
41
+ _smartico.vapi('EN').getTournamentsList().then((result) => {
42
+ if (result.length > 0) {
43
+ _smartico.vapi('EN').getTournamentInstanceInfo(result[0].instance_id).then((result) => {
44
+ console.log(result);
45
+ });
46
+ }
47
+ });
48
+ ```
49
+
50
+ #### Parameters
51
+
52
+ ##### tournamentInstanceId
53
+
54
+ `number`
55
+
56
+ #### Returns
57
+
58
+ `Promise`\<[`TTournamentDetailed`](../interfaces/TTournamentDetailed.md)\>
59
+
60
+ ***
61
+
62
+ ### getClanTournamentPlayers()
63
+
64
+ > **getClanTournamentPlayers**(`tournamentInstanceId`, `clanId`): `Promise`\<[`TClanTournamentPlayers`](../interfaces/TClanTournamentPlayers.md)\>
65
+
66
+ Returns the players of a specific clan in a clan-based tournament.
67
+
68
+ **Visitor mode: not supported**
69
+
70
+ #### Parameters
71
+
72
+ ##### tournamentInstanceId
73
+
74
+ `number`
75
+
76
+ ##### clanId
77
+
78
+ `number`
79
+
80
+ #### Returns
81
+
82
+ `Promise`\<[`TClanTournamentPlayers`](../interfaces/TClanTournamentPlayers.md)\>
83
+
84
+ ***
85
+
86
+ ### registerInTournament()
87
+
88
+ > **registerInTournament**(`tournamentInstanceId`): `Promise`\<[`TTournamentRegistrationResult`](../interfaces/TTournamentRegistrationResult.md)\>
89
+
90
+ Requests registration for the specified tournament instance. Returns the err_code.
91
+
92
+ **Visitor mode: not supported**
93
+
94
+ #### Parameters
95
+
96
+ ##### tournamentInstanceId
97
+
98
+ `number`
99
+
100
+ #### Returns
101
+
102
+ `Promise`\<[`TTournamentRegistrationResult`](../interfaces/TTournamentRegistrationResult.md)\>
103
+
104
+ ***
@@ -0,0 +1,200 @@
1
+ # Class: WSAPIUser
2
+ ## Methods
3
+
4
+ ### getUserProfile()
5
+
6
+ > **getUserProfile**(): [`TUserProfile`](../interfaces/TUserProfile.md)
7
+
8
+ #### Returns
9
+
10
+ [`TUserProfile`](../interfaces/TUserProfile.md)
11
+
12
+ ***
13
+
14
+ ### checkSegmentMatch()
15
+
16
+ > **checkSegmentMatch**(`segment_id`): `Promise`\<`boolean`\>
17
+
18
+ Check if user belongs to specific segments
19
+ **Example**:
20
+ ```
21
+ _smartico.api.checkSegmentMatch(1).then((result) => {
22
+ console.log(result);
23
+ });
24
+ ```
25
+
26
+ **Visitor mode: not supported**
27
+
28
+ #### Parameters
29
+
30
+ ##### segment\_id
31
+
32
+ `number`
33
+
34
+ #### Returns
35
+
36
+ `Promise`\<`boolean`\>
37
+
38
+ ***
39
+
40
+ ### checkSegmentListMatch()
41
+
42
+ > **checkSegmentListMatch**(`segment_ids`): `Promise`\<[`TSegmentCheckResult`](../interfaces/TSegmentCheckResult.md)[]\>
43
+
44
+ Check if user belongs to specific list of segments
45
+ **Example**:
46
+ ```
47
+ _smartico.api.checkSegmentListMatch([1, 2, 3]).then((result) => {
48
+ console.log(result);
49
+ });
50
+ ```
51
+ **Visitor mode: not supported**
52
+
53
+ #### Parameters
54
+
55
+ ##### segment\_ids
56
+
57
+ `number`[]
58
+
59
+ #### Returns
60
+
61
+ `Promise`\<[`TSegmentCheckResult`](../interfaces/TSegmentCheckResult.md)[]\>
62
+
63
+ ***
64
+
65
+ ### getLevels()
66
+
67
+ > **getLevels**(): `Promise`\<[`TLevel`](../interfaces/TLevel.md)[]\>
68
+
69
+ Returns all the levels available to the current user
70
+ **Example**:
71
+ ```
72
+ _smartico.api.getLevels().then((result) => {
73
+ console.log(result);
74
+ });
75
+ ```
76
+
77
+ **Example in the Visitor mode**:
78
+ ```
79
+ _smartico.vapi('EN').getLevels().then((result) => {
80
+ console.log(result);
81
+ });
82
+ ```
83
+
84
+ #### Returns
85
+
86
+ `Promise`\<[`TLevel`](../interfaces/TLevel.md)[]\>
87
+
88
+ ***
89
+
90
+ ### getCurrentLevel()
91
+
92
+ > **getCurrentLevel**(): `Promise`\<[`TLevelCurrent`](../interfaces/TLevelCurrent.md)\>
93
+
94
+ Returns the current level of the user with extended information including ordinal position and progress.
95
+
96
+ **Example**:
97
+ ```
98
+ _smartico.api.getCurrentLevel().then((result) => {
99
+ console.log(result);
100
+ });
101
+ ```
102
+
103
+ **Visitor mode: not supported**
104
+
105
+ #### Returns
106
+
107
+ `Promise`\<[`TLevelCurrent`](../interfaces/TLevelCurrent.md)\>
108
+
109
+ ***
110
+
111
+ ### getUserLevelExtraCounters()
112
+
113
+ > **getUserLevelExtraCounters**(): `Promise`\<[`UserLevelExtraCountersT`](../interfaces/UserLevelExtraCountersT.md)\>
114
+
115
+ Returns the extra counters for the current user level.
116
+ These are counters that are configured for each Smartico client separately by request.
117
+ For example 1st counter could be total wagering amount, 2nd counter could be total deposit amount, etc.
118
+
119
+ **Example**:
120
+ ```
121
+ _smartico.api.getUserLevelExtraCounters().then((result) => {
122
+ console.log(result);
123
+ });
124
+ ```
125
+
126
+ **Visitor mode: not supported**
127
+
128
+ #### Returns
129
+
130
+ `Promise`\<[`UserLevelExtraCountersT`](../interfaces/UserLevelExtraCountersT.md)\>
131
+
132
+ ***
133
+
134
+ ### getActivityLog()
135
+
136
+ > **getActivityLog**(`params`): `Promise`\<[`TActivityLog`](../interfaces/TActivityLog.md)[]\>
137
+
138
+ Returns the activity log for a user within a specified time range.
139
+ The response includes both points changes and gems/diamonds changes.
140
+ Each log entry contains information about the change amount, balance, and source.
141
+ The returned list is cached for 30 seconds.
142
+ You can pass the onUpdate callback as a parameter, it will be called every time the activity log is updated and will provide the updated list of activity logs for the last 10 minutes.
143
+
144
+ **Example**:
145
+ ```
146
+ const startTime = Math.floor(Date.now() / 1000) - 86400 * 30; // 30 days ago
147
+ const endTime = Math.floor(Date.now() / 1000); // now
148
+
149
+ _smartico.api.getActivityLog({
150
+ startTimeSeconds: startTime,
151
+ endTimeSeconds: endTime,
152
+ from: 0,
153
+ to: 50,
154
+ onUpdate: (data) => console.log('Updated:', data)
155
+ }).then((result) => {
156
+ console.log(result);
157
+ });
158
+ ```
159
+
160
+ **Visitor mode: not supported**
161
+
162
+ #### Parameters
163
+
164
+ ##### params
165
+
166
+ Activity log parameters
167
+
168
+ ###### startTimeSeconds
169
+
170
+ `number`
171
+
172
+ Start time in seconds (epoch timestamp)
173
+
174
+ ###### endTimeSeconds
175
+
176
+ `number`
177
+
178
+ End time in seconds (epoch timestamp)
179
+
180
+ ###### from
181
+
182
+ `number`
183
+
184
+ Start index of records to return
185
+
186
+ ###### to
187
+
188
+ `number`
189
+
190
+ End index of records to return
191
+
192
+ ###### onUpdate?
193
+
194
+ (`data`) => `void`
195
+
196
+ Optional callback function that will be called when the activity log is updated
197
+
198
+ #### Returns
199
+
200
+ `Promise`\<[`TActivityLog`](../interfaces/TActivityLog.md)[]\>
@@ -0,0 +1,13 @@
1
+ # Enumeration: AchievementClaimPeriodTypeId
2
+
3
+ ## Enumeration Members
4
+
5
+ ### RelativePeriod
6
+
7
+ > **RelativePeriod**: `0`
8
+
9
+ ***
10
+
11
+ ### ExactPeriod
12
+
13
+ > **ExactPeriod**: `1`
@@ -2,6 +2,22 @@
2
2
 
3
3
  ## Enumeration Members
4
4
 
5
+ ### SHOP\_FAILED\_GENERIC
6
+
7
+ > **SHOP\_FAILED\_GENERIC**: `1`
8
+
9
+ Generic server error / control-group rejection
10
+
11
+ ***
12
+
13
+ ### SHOP\_WRONG\_LABEL\_PRECHECK
14
+
15
+ > **SHOP\_WRONG\_LABEL\_PRECHECK**: `106`
16
+
17
+ Label mismatch detected before purchase transaction
18
+
19
+ ***
20
+
5
21
  ### SHOP\_NO\_BALANCE
6
22
 
7
23
  > **SHOP\_NO\_BALANCE**: `11000`
@@ -58,6 +74,14 @@ Failed to buy item because of limit of max items is reached
58
74
 
59
75
  ***
60
76
 
77
+ ### SHOP\_FAILED\_BONUS\_REDEMPTION
78
+
79
+ > **SHOP\_FAILED\_BONUS\_REDEMPTION**: `11007`
80
+
81
+ Bonus was issued but a follow-up redemption step failed
82
+
83
+ ***
84
+
61
85
  ### SHOP\_FAILED\_POOL\_EMPTY
62
86
 
63
87
  > **SHOP\_FAILED\_POOL\_EMPTY**: `11009`
@@ -87,3 +111,11 @@ User doesn't have enough diamonds on balance
87
111
  > **SHOP\_FAILED\_PURCHASE\_LIMITATION**: `11014`
88
112
 
89
113
  Failed to buy item because of purchase limitation
114
+
115
+ ***
116
+
117
+ ### SHOP\_UNEXPECTED\_EXCEPTION
118
+
119
+ > **SHOP\_UNEXPECTED\_EXCEPTION**: `9999`
120
+
121
+ Uncaught server exception
@@ -0,0 +1,41 @@
1
+ # Interface: ClanPrizePublicMeta
2
+
3
+ ## Extends
4
+
5
+ - [`ClanPublicMeta`](ClanPublicMeta.md)
6
+
7
+ ## Properties
8
+
9
+ ### name
10
+
11
+ > **name**: `string`
12
+
13
+ #### Inherited from
14
+
15
+ [`ClanPublicMeta`](ClanPublicMeta.md).[`name`](ClanPublicMeta.md#name)
16
+
17
+ ***
18
+
19
+ ### description
20
+
21
+ > **description**: `string`
22
+
23
+ #### Inherited from
24
+
25
+ [`ClanPublicMeta`](ClanPublicMeta.md).[`description`](ClanPublicMeta.md#description)
26
+
27
+ ***
28
+
29
+ ### image\_url
30
+
31
+ > **image\_url**: `string`
32
+
33
+ #### Inherited from
34
+
35
+ [`ClanPublicMeta`](ClanPublicMeta.md).[`image_url`](ClanPublicMeta.md#image_url)
36
+
37
+ ***
38
+
39
+ ### prize\_name?
40
+
41
+ > `optional` **prize\_name?**: `string`
@@ -22,6 +22,12 @@
22
22
 
23
23
  ***
24
24
 
25
+ ### prize\_pool\_currency\_code
26
+
27
+ > **prize\_pool\_currency\_code**: `string`
28
+
29
+ ***
30
+
25
31
  ### activity\_type\_id
26
32
 
27
33
  > **activity\_type\_id**: `number`
@@ -36,7 +42,7 @@
36
42
 
37
43
  ### public\_meta
38
44
 
39
- > **public\_meta**: [`ClanPublicMeta`](ClanPublicMeta.md)
45
+ > **public\_meta**: [`ClanPrizePublicMeta`](ClanPrizePublicMeta.md)
40
46
 
41
47
  ***
42
48
 
@@ -1,5 +1,9 @@
1
1
  # Interface: ClanPublicMeta
2
2
 
3
+ ## Extended by
4
+
5
+ - [`ClanPrizePublicMeta`](ClanPrizePublicMeta.md)
6
+
3
7
  ## Properties
4
8
 
5
9
  ### name
@@ -563,3 +563,13 @@ controlling obstacle frequency and game speed.
563
563
  | `SAWGameDifficultyType.EASY = 1` | Easy |
564
564
  | `SAWGameDifficultyType.MEDIUM = 2` | Medium |
565
565
  | `SAWGameDifficultyType.HARD = 3` | Hard |
566
+
567
+ ***
568
+
569
+ ### voyager\_seed\_window\_min?
570
+
571
+ > `optional` **voyager\_seed\_window\_min?**: `number`
572
+
573
+ Minutes for the Voyager seed window.
574
+ The seed window is the range of seeds that can be used to generate the map.
575
+ The seed window is used to ensure that the map is generated the same way for each player.
@@ -1,6 +1,14 @@
1
1
  # Interface: TAchCategory
2
2
 
3
- TAchCategory describes the badge category item. Each badge item can be assigned to 1 or more categories
3
+ TAchCategory describes a mission/badge category. Categories are
4
+ operator-defined groupings, configured per-label by the brand operator,
5
+ shared across BOTH missions and badges — the same list is returned for
6
+ both entity types. A mission or badge can belong to **zero or more**
7
+ categories (many-to-many) via its `category_ids: number[]` field on
8
+ `TMissionOrBadge`.
9
+
10
+ Returned by `_smartico.api.getAchCategories()`. See that method's TSDoc
11
+ for translation, refresh, and rendering details.
4
12
 
5
13
  ## Properties
6
14
 
@@ -8,7 +16,8 @@ TAchCategory describes the badge category item. Each badge item can be assigned
8
16
 
9
17
  > **id**: `number`
10
18
 
11
- ID of the badge category
19
+ Stable numeric ID of the category. Used as the key when joining to
20
+ `TMissionOrBadge.category_ids: number[]`.
12
21
 
13
22
  ***
14
23
 
@@ -16,7 +25,10 @@ ID of the badge category
16
25
 
17
26
  > **name**: `string`
18
27
 
19
- Name of the badge category
28
+ Display name of the category. **Pre-translated server-side** to the authenticated
29
+ user's stored language (or to the language passed to `_smartico.vapi(lang)` in
30
+ visitor mode). Falls back to the EN base name when a translation is missing — never
31
+ null. Consumers should NOT translate this further.
20
32
 
21
33
  ***
22
34
 
@@ -24,4 +36,7 @@ Name of the badge category
24
36
 
25
37
  > **order**: `number`
26
38
 
27
- Order of the badge category among other categories. Default value is 1
39
+ Relative position among other categories (lower = appears first). The server does
40
+ NOT pre-sort by this value — the consumer must sort:
41
+ `categories.sort((a, b) => a.order - b.order)`. Default value is 1 when the
42
+ operator did not configure an explicit order.
@@ -6,15 +6,29 @@
6
6
 
7
7
  > **err\_code**: [`BuyStoreItemErrorCode`](../enumerations/BuyStoreItemErrorCode.md)
8
8
 
9
- Error code representing the result of the purchase of the shop item. Successful purchase if err_code is 0
9
+ Outcome of the store-item purchase. `0` means the purchase succeeded
10
+ (funds debited, reward delivered server-side); any non-zero value
11
+ signals a failure.
12
+
13
+ The typed values are the named codes in the [BuyStoreItemErrorCode](../enumerations/BuyStoreItemErrorCode.md)
14
+ enum. Always branch on known codes first and fall back to a generic
15
+ error handler for anything else.
16
+
17
+ See the `buyStoreItem` TSDoc for the full error-code table, the
18
+ Buy-button decision matrix, and per-code UI guidance.
10
19
 
11
20
  Example for error handling:
12
- ```javascript
13
- SmarticoAPI.buyStoreItem(item_id).then(res => {
14
- if (res.err_code !== 0) {
15
- // YOUR LOGIC HERE, you can use res.err_message, but it's optional and not always present
16
- }
17
- });
21
+ ```ts
22
+ const res = await window._smartico.api.buyStoreItem(item_id);
23
+ if (res.err_code === 0) {
24
+ console.log('[smartico] purchase succeeded — close the detail modal, show a success toast; the SDK auto-refreshes getStoreItems and the purchased-items list');
25
+ } else if (res.err_code === 11000 || res.err_code === 11011 || res.err_code === 11012) {
26
+ console.error('[smartico] insufficient balance — show insufficient-balance UI for the item.purchase_type');
27
+ } else if (res.err_code === 11009) {
28
+ console.error('[smartico] sold out — show a "Sold out" message');
29
+ } else {
30
+ console.error('[smartico] purchase failed — show a generic error with this message:', res.err_message);
31
+ }
18
32
  ```
19
33
 
20
34
  ***
@@ -23,4 +37,8 @@ SmarticoAPI.buyStoreItem(item_id).then(res => {
23
37
 
24
38
  > **err\_message**: `string`
25
39
 
26
- Optional error message
40
+ Optional server-side error message describing the failure. Present
41
+ only on non-zero `err_code`, and even then can be empty. For codes
42
+ that have operator-defined copy on the item itself (`11006` →
43
+ `limit_message`, `11014` → `purchase_limit_message`), prefer the
44
+ item-level copy and use `err_message` only as a fallback.
@@ -1,6 +1,9 @@
1
1
  # Interface: TMissionClaimRewardResult
2
2
 
3
- TMissionClaimRewardResult describes the response of call to _smartico.api.requestMissionClaimReward(mission_id, ach_completed_id) method
3
+ Response of `_smartico.api.requestMissionClaimReward(mission_id, ach_completed_id)`.
4
+
5
+ See `requestMissionClaimReward` TSDoc for the full table of `err_code`
6
+ values, preconditions, side effects, and recommended UI handling.
4
7
 
5
8
  ## Properties
6
9
 
@@ -8,7 +11,15 @@ TMissionClaimRewardResult describes the response of call to _smartico.api.reques
8
11
 
9
12
  > **err\_code**: `number`
10
13
 
11
- Error code that represents outcome of the claim request. Successful claim reward in case err_code is 0
14
+ Error code that represents outcome of the claim request.
15
+ `0` = success (rewards have been credited);
16
+ `40017` = already claimed (treat as idempotent success);
17
+ `40015` = claim window expired;
18
+ `40016` = mission not completed yet (stale local state);
19
+ `1` = generic server error (stale `ach_completed_id`, archived/draft
20
+ mission, label mismatch, completion older than 6 months, or
21
+ `requires_prize_claim=false` on the server). See
22
+ `requestMissionClaimReward` TSDoc for the full table.
12
23
 
13
24
  ***
14
25
 
@@ -16,4 +27,4 @@ Error code that represents outcome of the claim request. Successful claim reward
16
27
 
17
28
  > **err\_message**: `string`
18
29
 
19
- Optional error message
30
+ Optional error message; populated on non-zero `err_code`.
@@ -1,6 +1,9 @@
1
1
  # Interface: TMissionOptInResult
2
2
 
3
- TMissionOptInResult describes the response of call to _smartico.api.requestMissionOptIn(mission_id) method
3
+ Response of `_smartico.api.requestMissionOptIn(mission_id)`.
4
+
5
+ See `requestMissionOptIn` TSDoc for the full table of `err_code` values
6
+ and recommended UI handling.
4
7
 
5
8
  ## Properties
6
9
 
@@ -8,7 +11,11 @@ TMissionOptInResult describes the response of call to _smartico.api.requestMissi
8
11
 
9
12
  > **err\_code**: `number`
10
13
 
11
- Error code that represents outcome of the opt-in request. Successful opt-in in case err_code is 0
14
+ Error code. `0` = success; `40010` = already opted-in (treat as
15
+ idempotent success); `40013` = mission not opt-in-able (draft /
16
+ archived / out of window); `40014` = locked (show unlock tasks);
17
+ `105` = wrong id or visibility-condition rejection. See
18
+ `requestMissionOptIn` TSDoc for the full table.
12
19
 
13
20
  ***
14
21
 
@@ -16,4 +23,4 @@ Error code that represents outcome of the opt-in request. Successful opt-in in c
16
23
 
17
24
  > **err\_message**: `string`
18
25
 
19
- Optional error message
26
+ Optional error message; populated on non-zero `err_code`.
@@ -236,7 +236,11 @@ The ribbon of the mission/badge item. Can be 'sale', 'hot', 'new', 'vip' or URL
236
236
 
237
237
  > `optional` **ach\_completed\_id?**: `number`
238
238
 
239
- ID of the completion fact from ach_completed or ach_completed_recurring tables
239
+ Stable identifier of the specific completion of this mission. Pass this
240
+ value to `requestMissionClaimReward()` alongside the mission id. Always
241
+ read from a fresh `getMissions()` result; never synthesise or cache
242
+ across sessions. Undefined for badges and for missions that have not
243
+ yet completed.
240
244
 
241
245
  ***
242
246
 
@@ -363,7 +367,7 @@ The date/timestamp indicating when the mission claim will expire
363
367
 
364
368
  ### prize\_claim\_period\_type\_id?
365
369
 
366
- > `optional` **prize\_claim\_period\_type\_id?**: `AchievementClaimPeriodTypeId`
370
+ > `optional` **prize\_claim\_period\_type\_id?**: [`AchievementClaimPeriodTypeId`](../enumerations/AchievementClaimPeriodTypeId.md)
367
371
 
368
372
  The type of the prize claim period (Relative or Exact time and date)
369
373
 
@@ -125,7 +125,19 @@ The list of IDs of the categories where the store item is assigned, information
125
125
 
126
126
  > `optional` **pool?**: `number`
127
127
 
128
- Number of items in the pool avaliable for the purchase.
128
+ Number of items remaining in the pool available for purchase.
129
+ `null` means unlimited supply (no pool configured for this item).
130
+ A positive integer is the remaining stock.
131
+ `0` means sold out — the item is still returned by `getStoreItems` so a
132
+ "Sold out" state can be rendered. Operators may instead choose to hide
133
+ pool-empty items entirely (per-item operator flag), in which case
134
+ sold-out items simply disappear from the catalog rather than appearing
135
+ with `pool === 0`.
136
+
137
+ Pool is decremented server-side on a successful purchase; the client
138
+ observes the new value via the `onUpdate` callback on `getStoreItems`
139
+ (which fires only for the buyer's own purchases — other users'
140
+ concurrent purchases do not push).
129
141
 
130
142
  ***
131
143
 
@@ -201,6 +213,14 @@ The date when the store item will be available till
201
213
 
202
214
  ***
203
215
 
216
+ ### show\_timer?
217
+
218
+ > `optional` **show\_timer?**: `boolean`
219
+
220
+ Should countdown timer be shown when `active_till_date` is present
221
+
222
+ ***
223
+
204
224
  ### discounted\_price?
205
225
 
206
226
  > `optional` **discounted\_price?**: `number`
@@ -707,6 +707,10 @@ Per-clan prize structure; null for non-clan tournaments
707
707
 
708
708
  > **prize\_pool\_amount**: `number`
709
709
 
710
+ #### prize\_pool\_currency\_code
711
+
712
+ > **prize\_pool\_currency\_code**: `string`
713
+
710
714
  #### activity\_type\_id
711
715
 
712
716
  > **activity\_type\_id**: `number`
@@ -731,6 +735,10 @@ Per-clan prize structure; null for non-clan tournaments
731
735
 
732
736
  > **image\_url**: `string`
733
737
 
738
+ ##### public\_meta.prize\_name?
739
+
740
+ > `optional` **prize\_name?**: `string`
741
+
734
742
  #### tiers
735
743
 
736
744
  > **tiers**: `object`[]