@smartico/public-api 0.0.348 → 0.0.350
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/dist/Base/ClassId.d.ts +6 -0
- package/dist/SmarticoLib/index.d.ts +5 -0
- package/dist/WSAPI/WSAPI.d.ts +3 -4
- package/dist/WSAPI/WSAPITypes.d.ts +2 -2
- package/dist/index.js +24 -7
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +18 -7
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/classes/WSAPI.md +3 -4
- package/docs/api/interfaces/TLevel.md +8 -0
- package/docs/api/interfaces/TLevelCurrent.md +4 -0
- package/package.json +1 -1
- package/src/Base/ClassId.ts +7 -0
- package/src/Level/GetLevelMapResponse.ts +11 -1
- package/src/SmarticoAPI.ts +0 -1
- package/src/SmarticoLib/index.ts +5 -0
- package/src/WSAPI/WSAPI.ts +3 -4
- package/src/WSAPI/WSAPITypes.ts +2 -2
|
@@ -7,12 +7,11 @@
|
|
|
7
7
|
▸ **getUserProfile**(): [`TUserProfile`](../interfaces/TUserProfile.md)
|
|
8
8
|
|
|
9
9
|
Returns information about current user
|
|
10
|
-
|
|
10
|
+
Pay attention that this method is synchronous and returns the user profile object immediately, not a promise.
|
|
11
11
|
**Example**:
|
|
12
12
|
```
|
|
13
|
-
_smartico.api.getUserProfile
|
|
14
|
-
|
|
15
|
-
});
|
|
13
|
+
var p = _smartico.api.getUserProfile);
|
|
14
|
+
console.log(p);
|
|
16
15
|
```
|
|
17
16
|
**Visitor mode: not supported**
|
|
18
17
|
|
|
@@ -88,3 +88,11 @@ ___
|
|
|
88
88
|
Custom data as string or JSON string that can be used in API to build custom UI
|
|
89
89
|
You can request from Smartico to define fields for your specific case that will be managed from Smartico BackOffice
|
|
90
90
|
Read more here - https://help.smartico.ai/welcome/products/general-concepts/custom-fields-attributes
|
|
91
|
+
|
|
92
|
+
___
|
|
93
|
+
|
|
94
|
+
### ordinal\_position
|
|
95
|
+
|
|
96
|
+
• **ordinal\_position**: `number`
|
|
97
|
+
|
|
98
|
+
The ordinal position of the level
|
package/package.json
CHANGED
package/src/Base/ClassId.ts
CHANGED
|
@@ -102,6 +102,13 @@ export enum ClassId {
|
|
|
102
102
|
GET_POINT_HISTORY_REQUEST = 545,
|
|
103
103
|
GET_POINT_HISTORY_RESPONSE = 546,
|
|
104
104
|
|
|
105
|
+
GET_AVATARS_LIST_REQUEST = 560,
|
|
106
|
+
GET_AVATARS_LIST_RESPONSE = 561,
|
|
107
|
+
GET_AVATARS_CUSTOMIZED_REQUEST = 562,
|
|
108
|
+
GET_AVATARS_CUSTOMIZED_RESPONSE = 563,
|
|
109
|
+
GET_AVATAR_PROMPTS_REQUEST = 564,
|
|
110
|
+
GET_AVATAR_PROMPTS_RESPONSE = 565,
|
|
111
|
+
|
|
105
112
|
/*
|
|
106
113
|
!Important, if adding new messages that are 'acting' on behalf of the client,
|
|
107
114
|
you need to include them in the CLASS_ID_IGNORE_FOR_SIMULATION
|
|
@@ -8,7 +8,9 @@ export interface GetLevelMapResponse extends ProtocolResponse {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export const GetLevelMapResponseTransform = (levels: GetLevelMapResponse): TLevel[] => {
|
|
11
|
-
|
|
11
|
+
if (!levels?.levels) return [];
|
|
12
|
+
|
|
13
|
+
const mapped = levels.levels.map((l) => ({
|
|
12
14
|
id: l.level_id,
|
|
13
15
|
name: l.level_public_meta.name,
|
|
14
16
|
description: l.level_public_meta.description,
|
|
@@ -18,5 +20,13 @@ export const GetLevelMapResponseTransform = (levels: GetLevelMapResponse): TLeve
|
|
|
18
20
|
required_level_counter_1: l.required_level_counter_1,
|
|
19
21
|
required_level_counter_2: l.required_level_counter_2,
|
|
20
22
|
custom_data: IntUtils.JsonOrText(l.level_public_meta?.custom_data),
|
|
23
|
+
ordinal_position: 0,
|
|
21
24
|
}));
|
|
25
|
+
|
|
26
|
+
const ordinalById = new Map<number, number>();
|
|
27
|
+
[...mapped]
|
|
28
|
+
.sort((a, b) => a.required_points - b.required_points)
|
|
29
|
+
.forEach((l, index) => ordinalById.set(l.id, index + 1));
|
|
30
|
+
|
|
31
|
+
return mapped.map((l) => ({ ...l, ordinal_position: ordinalById.get(l.id) }));
|
|
22
32
|
};
|
package/src/SmarticoAPI.ts
CHANGED
package/src/SmarticoLib/index.ts
CHANGED
|
@@ -50,6 +50,7 @@ declare enum PublicLabelSettings {
|
|
|
50
50
|
GAMIFICATION_WIDGET_BG_OPACITY = 'GAMIFICATION_WIDGET_BG_OPACITY',
|
|
51
51
|
GAMIFICATION_POPUP_BG_OPACITY = 'GAMIFICATION_POPUP_BG_OPACITY',
|
|
52
52
|
GAMIFICATION_POPUP_BG_BLUR = 'GAMIFICATION_POPUP_BG_BLUR',
|
|
53
|
+
FRONT_DISABLE_POPUP_INBOX_ON_URLS = 'FRONT_DISABLE_POPUP_INBOX_ON_URLS',
|
|
53
54
|
GAMIFICATION_LEVELS_LOGIC2 = 'GAMIFICATION_LEVELS_LOGIC2',
|
|
54
55
|
GAMIFICATION_LEVELS_LOGIC3 = 'GAMIFICATION_LEVELS_LOGIC3',
|
|
55
56
|
AVATAR_CUSTOM_IMAGE_MAX_ID = 'AVATAR_CUSTOM_IMAGE_MAX_ID',
|
|
@@ -187,6 +188,10 @@ declare enum ClassId {
|
|
|
187
188
|
ACHIEVEMENT_CLAIM_PRIZE_RESPONSE = 540,
|
|
188
189
|
ACH_SHOP_ITEM_HISTORY_REQUEST = 541,
|
|
189
190
|
ACH_SHOP_ITEM_HISTORY_RESPONSE = 542,
|
|
191
|
+
GET_AVATARS_LIST_REQUEST = 560,
|
|
192
|
+
GET_AVATARS_LIST_RESPONSE = 561,
|
|
193
|
+
GET_AVATAR_PROMPTS_REQUEST = 564,
|
|
194
|
+
GET_AVATAR_PROMPTS_RESPONSE = 565,
|
|
190
195
|
GET_BONUSES_REQUEST = 600,
|
|
191
196
|
GET_BONUSES_RESPONSE = 601,
|
|
192
197
|
CLAIM_BONUS_REQUEST = 602,
|
package/src/WSAPI/WSAPI.ts
CHANGED
|
@@ -164,12 +164,11 @@ export class WSAPI {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
/** Returns information about current user
|
|
167
|
-
*
|
|
167
|
+
* Pay attention that this method is synchronous and returns the user profile object immediately, not a promise.
|
|
168
168
|
* **Example**:
|
|
169
169
|
* ```
|
|
170
|
-
* _smartico.api.getUserProfile
|
|
171
|
-
*
|
|
172
|
-
* });
|
|
170
|
+
* var p = _smartico.api.getUserProfile);
|
|
171
|
+
* console.log(p);
|
|
173
172
|
* ```
|
|
174
173
|
* **Visitor mode: not supported**
|
|
175
174
|
* */
|
package/src/WSAPI/WSAPITypes.ts
CHANGED
|
@@ -281,6 +281,8 @@ export interface TLevel {
|
|
|
281
281
|
* Read more here - https://help.smartico.ai/welcome/products/general-concepts/custom-fields-attributes
|
|
282
282
|
*/
|
|
283
283
|
custom_data: string;
|
|
284
|
+
/** The ordinal position of the level */
|
|
285
|
+
ordinal_position: number;
|
|
284
286
|
}
|
|
285
287
|
|
|
286
288
|
/**
|
|
@@ -288,8 +290,6 @@ export interface TLevel {
|
|
|
288
290
|
*/
|
|
289
291
|
|
|
290
292
|
export interface TLevelCurrent extends TLevel {
|
|
291
|
-
/** The ordinal position of the level */
|
|
292
|
-
ordinal_position: number;
|
|
293
293
|
/** The progress of the user towards next level in the percents to complete */
|
|
294
294
|
progress: number;
|
|
295
295
|
}
|