@smartico/public-api 0.0.291 → 0.0.293
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/Inbox/GetInboxMessagesResponse.d.ts +1 -0
- package/dist/WSAPI/WSAPI.d.ts +9 -1
- package/dist/index.js +100 -79
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +19 -2
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +1 -0
- package/docs/classes/WSAPI.md +11 -1
- package/docs/enums/AchCustomSectionType.md +6 -0
- package/docs/enums/LiquidEntityData.md +61 -0
- package/docs/interfaces/TUICustomSection.md +32 -0
- package/package.json +1 -1
- package/src/Inbox/GetInboxMessagesResponse.ts +1 -0
- package/src/WSAPI/WSAPI.ts +18 -2
package/docs/README.md
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
- [AchCustomLayoutTheme](enums/AchCustomLayoutTheme.md)
|
|
8
8
|
- [AchMissionsTabsOptions](enums/AchMissionsTabsOptions.md)
|
|
9
9
|
- [AchOverviewMissionsFilter](enums/AchOverviewMissionsFilter.md)
|
|
10
|
+
- [LiquidEntityData](enums/LiquidEntityData.md)
|
|
10
11
|
- [InboxCategories](enums/InboxCategories.md)
|
|
11
12
|
- [JackpotContributionType](enums/JackpotContributionType.md)
|
|
12
13
|
- [JackPotTemparature](enums/JackPotTemparature.md)
|
package/docs/classes/WSAPI.md
CHANGED
|
@@ -241,9 +241,12 @@ ___
|
|
|
241
241
|
|
|
242
242
|
### getStoreItems
|
|
243
243
|
|
|
244
|
-
▸ **getStoreItems**(): `Promise`\<[`TStoreItem`](../interfaces/TStoreItem.md)[]\>
|
|
244
|
+
▸ **getStoreItems**(`params?`): `Promise`\<[`TStoreItem`](../interfaces/TStoreItem.md)[]\>
|
|
245
245
|
|
|
246
246
|
Returns all the store items available the current user
|
|
247
|
+
The returned store items are cached for 30 seconds. But you can pass the onUpdate callback as a parameter.
|
|
248
|
+
Note that each time you call getStoreItems with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
249
|
+
The onUpdate callback will be called on purchase of the store item.
|
|
247
250
|
|
|
248
251
|
**Example**:
|
|
249
252
|
```
|
|
@@ -259,6 +262,13 @@ _smartico.vapi('EN').getStoreItems().then((result) => {
|
|
|
259
262
|
});
|
|
260
263
|
```
|
|
261
264
|
|
|
265
|
+
#### Parameters
|
|
266
|
+
|
|
267
|
+
| Name | Type |
|
|
268
|
+
| :------ | :------ |
|
|
269
|
+
| `params` | `Object` |
|
|
270
|
+
| `params.onUpdate?` | (`data`: [`TStoreItem`](../interfaces/TStoreItem.md)[]) => `void` |
|
|
271
|
+
|
|
262
272
|
#### Returns
|
|
263
273
|
|
|
264
274
|
`Promise`\<[`TStoreItem`](../interfaces/TStoreItem.md)[]\>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Enumeration: LiquidEntityData
|
|
2
|
+
|
|
3
|
+
## Enumeration Members
|
|
4
|
+
|
|
5
|
+
### Missions
|
|
6
|
+
|
|
7
|
+
• **Missions** = ``1``
|
|
8
|
+
|
|
9
|
+
___
|
|
10
|
+
|
|
11
|
+
### Store
|
|
12
|
+
|
|
13
|
+
• **Store** = ``2``
|
|
14
|
+
|
|
15
|
+
___
|
|
16
|
+
|
|
17
|
+
### Tournaments
|
|
18
|
+
|
|
19
|
+
• **Tournaments** = ``3``
|
|
20
|
+
|
|
21
|
+
___
|
|
22
|
+
|
|
23
|
+
### MiniGames
|
|
24
|
+
|
|
25
|
+
• **MiniGames** = ``4``
|
|
26
|
+
|
|
27
|
+
___
|
|
28
|
+
|
|
29
|
+
### Levels
|
|
30
|
+
|
|
31
|
+
• **Levels** = ``5``
|
|
32
|
+
|
|
33
|
+
___
|
|
34
|
+
|
|
35
|
+
### Jackpots
|
|
36
|
+
|
|
37
|
+
• **Jackpots** = ``6``
|
|
38
|
+
|
|
39
|
+
___
|
|
40
|
+
|
|
41
|
+
### Bonus
|
|
42
|
+
|
|
43
|
+
• **Bonus** = ``7``
|
|
44
|
+
|
|
45
|
+
___
|
|
46
|
+
|
|
47
|
+
### Leaderboard
|
|
48
|
+
|
|
49
|
+
• **Leaderboard** = ``8``
|
|
50
|
+
|
|
51
|
+
___
|
|
52
|
+
|
|
53
|
+
### Badges
|
|
54
|
+
|
|
55
|
+
• **Badges** = ``9``
|
|
56
|
+
|
|
57
|
+
___
|
|
58
|
+
|
|
59
|
+
### Tournament
|
|
60
|
+
|
|
61
|
+
• **Tournament** = ``10``
|
|
@@ -87,3 +87,35 @@ ___
|
|
|
87
87
|
• `Optional` **overview\_missions\_count**: `number`
|
|
88
88
|
|
|
89
89
|
Quantity of missions to be shown in overview
|
|
90
|
+
|
|
91
|
+
___
|
|
92
|
+
|
|
93
|
+
### liquid\_entity\_data
|
|
94
|
+
|
|
95
|
+
• `Optional` **liquid\_entity\_data**: [`LiquidEntityData`](../enums/LiquidEntityData.md)[]
|
|
96
|
+
|
|
97
|
+
Data to be used for Liquid templates
|
|
98
|
+
|
|
99
|
+
___
|
|
100
|
+
|
|
101
|
+
### ach\_tournament\_id
|
|
102
|
+
|
|
103
|
+
• `Optional` **ach\_tournament\_id**: `number`
|
|
104
|
+
|
|
105
|
+
Tournament ID to be used for Liquid templates
|
|
106
|
+
|
|
107
|
+
___
|
|
108
|
+
|
|
109
|
+
### show\_raw\_data
|
|
110
|
+
|
|
111
|
+
• `Optional` **show\_raw\_data**: `boolean`
|
|
112
|
+
|
|
113
|
+
Indicates if the data should be shown as raw data (for Liquid templates)
|
|
114
|
+
|
|
115
|
+
___
|
|
116
|
+
|
|
117
|
+
### liquid\_template
|
|
118
|
+
|
|
119
|
+
• `Optional` **liquid\_template**: `number`
|
|
120
|
+
|
|
121
|
+
Liquid template id to be used for Liquid templates
|
package/package.json
CHANGED
package/src/WSAPI/WSAPI.ts
CHANGED
|
@@ -116,7 +116,10 @@ export class WSAPI {
|
|
|
116
116
|
on(ClassId.ACHIEVEMENT_CLAIM_PRIZE_RESPONSE, () => this.updateMissions());
|
|
117
117
|
on(ClassId.RELOAD_ACHIEVEMENTS_EVENT, () => this.updateMissions());
|
|
118
118
|
on(ClassId.TOURNAMENT_REGISTER_RESPONSE, () => this.updateTournaments());
|
|
119
|
-
on(ClassId.BUY_SHOP_ITEM_RESPONSE, () =>
|
|
119
|
+
on(ClassId.BUY_SHOP_ITEM_RESPONSE, () => {
|
|
120
|
+
this.updateStorePurchasedItems();
|
|
121
|
+
this.updateStoreItems();
|
|
122
|
+
});
|
|
120
123
|
on(ClassId.CLIENT_ENGAGEMENT_EVENT_NEW, () => this.updateInboxMessages());
|
|
121
124
|
on(ClassId.LOGOUT_RESPONSE, () => OCache.clearContext(ECacheContext.WSAPI));
|
|
122
125
|
on(ClassId.IDENTIFY_RESPONSE, () => OCache.clearContext(ECacheContext.WSAPI));
|
|
@@ -332,6 +335,9 @@ export class WSAPI {
|
|
|
332
335
|
/**
|
|
333
336
|
*
|
|
334
337
|
* Returns all the store items available the current user
|
|
338
|
+
* The returned store items are cached for 30 seconds. But you can pass the onUpdate callback as a parameter.
|
|
339
|
+
* Note that each time you call getStoreItems with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
340
|
+
* The onUpdate callback will be called on purchase of the store item.
|
|
335
341
|
*
|
|
336
342
|
* **Example**:
|
|
337
343
|
* ```
|
|
@@ -346,9 +352,14 @@ export class WSAPI {
|
|
|
346
352
|
* console.log(result);
|
|
347
353
|
* });
|
|
348
354
|
* ```
|
|
355
|
+
* @param params
|
|
356
|
+
* @param params.onUpdate - callback function that will be called when the store items are updated
|
|
349
357
|
*/
|
|
350
358
|
|
|
351
|
-
public async getStoreItems(): Promise<TStoreItem[]> {
|
|
359
|
+
public async getStoreItems({ onUpdate }: { onUpdate?: (data: TStoreItem[]) => void } = {}): Promise<TStoreItem[]> {
|
|
360
|
+
if (onUpdate) {
|
|
361
|
+
this.onUpdateCallback.set(onUpdateContextKey.StoreItems, onUpdate);
|
|
362
|
+
}
|
|
352
363
|
return OCache.use(
|
|
353
364
|
onUpdateContextKey.StoreItems,
|
|
354
365
|
ECacheContext.WSAPI,
|
|
@@ -936,6 +947,11 @@ export class WSAPI {
|
|
|
936
947
|
this.updateEntity(onUpdateContextKey.StoreHistory, payload);
|
|
937
948
|
}
|
|
938
949
|
|
|
950
|
+
private async updateStoreItems() {
|
|
951
|
+
const payload = await this.api.storeGetItemsT(null);
|
|
952
|
+
this.updateEntity(onUpdateContextKey.StoreItems, payload);
|
|
953
|
+
}
|
|
954
|
+
|
|
939
955
|
private async updateInboxMessages() {
|
|
940
956
|
const payload = await this.api.getInboxMessagesT(null);
|
|
941
957
|
this.updateEntity(onUpdateContextKey.InboxMessages, payload);
|