@smartico/public-api 0.0.138 → 0.0.139
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/Store/StoreItemType.d.ts +13 -1
- 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 +29 -14
- package/dist/index.modern.mjs.map +1 -1
- package/docs/classes/WSAPI.md +11 -2
- package/docs/interfaces/TStoreItem.md +2 -2
- package/package.json +1 -1
- package/src/Store/StoreItem.ts +3 -8
- package/src/Store/StoreItemPurchased.ts +4 -8
- package/src/Store/StoreItemType.ts +23 -1
- package/src/WSAPI/WSAPITypes.ts +2 -2
package/docs/classes/WSAPI.md
CHANGED
|
@@ -201,7 +201,7 @@ ___
|
|
|
201
201
|
|
|
202
202
|
### getStorePurchasedItems
|
|
203
203
|
|
|
204
|
-
▸ **getStorePurchasedItems**(): `Promise`<[`TStoreItem`](../interfaces/TStoreItem.md)[]\>
|
|
204
|
+
▸ **getStorePurchasedItems**(`«destructured»?`): `Promise`<[`TStoreItem`](../interfaces/TStoreItem.md)[]\>
|
|
205
205
|
|
|
206
206
|
Returns purchased items based on the provided parameters. "Limit" and "offset" indicate the range of items to be fetched.
|
|
207
207
|
The maximum number of items per request is limited to 20.
|
|
@@ -210,9 +210,18 @@ Example usage:
|
|
|
210
210
|
```
|
|
211
211
|
_smartico.api.getStorePurchasedItems().then((result) => {
|
|
212
212
|
console.log(result);
|
|
213
|
-
|
|
213
|
+
});
|
|
214
214
|
```
|
|
215
215
|
|
|
216
|
+
#### Parameters
|
|
217
|
+
|
|
218
|
+
| Name | Type |
|
|
219
|
+
| :------ | :------ |
|
|
220
|
+
| `«destructured»` | `Object` |
|
|
221
|
+
| › `limit?` | `number` |
|
|
222
|
+
| › `offset?` | `number` |
|
|
223
|
+
| › `onUpdate?` | (`data`: [`TStoreItem`](../interfaces/TStoreItem.md)[]) => `void` |
|
|
224
|
+
|
|
216
225
|
#### Returns
|
|
217
226
|
|
|
218
227
|
`Promise`<[`TStoreItem`](../interfaces/TStoreItem.md)[]\>
|
|
@@ -38,9 +38,9 @@ ___
|
|
|
38
38
|
|
|
39
39
|
### type
|
|
40
40
|
|
|
41
|
-
• **type**: ``"
|
|
41
|
+
• **type**: ``"unknown"`` \| ``"bonus"`` \| ``"tangible"`` \| ``"minigamespin"`` \| ``"changelevel"`` \| ``"prizedrop"``
|
|
42
42
|
|
|
43
|
-
Type of the store item. Can be 'bonus' or '
|
|
43
|
+
Type of the store item. Can be 'bonus' or 'tangible' or different others.
|
|
44
44
|
|
|
45
45
|
___
|
|
46
46
|
|
package/package.json
CHANGED
package/src/Store/StoreItem.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TStoreItem } from "../WSAPI/WSAPITypes";
|
|
2
2
|
import { StoreItemPublicMeta } from "./StoreItemPublicMeta";
|
|
3
|
-
import { StoreItemType } from "./StoreItemType";
|
|
3
|
+
import { StoreItemType, StoreItemTypeNamed } from "./StoreItemType";
|
|
4
4
|
|
|
5
5
|
export interface StoreItem {
|
|
6
6
|
id: number;
|
|
@@ -23,15 +23,10 @@ export const StoreItemTransform = (items: StoreItem[]): TStoreItem[] => {
|
|
|
23
23
|
description: r.itemPublicMeta.description,
|
|
24
24
|
ribbon: r.itemPublicMeta.label_tag === 'custom' ? r.itemPublicMeta.custom_label_tag : r.itemPublicMeta.label_tag,
|
|
25
25
|
limit_message: r.itemPublicMeta.limit_message,
|
|
26
|
-
priority: r.itemPublicMeta.priority,
|
|
26
|
+
priority: r.itemPublicMeta.priority ?? 0,
|
|
27
27
|
related_item_ids: r.itemPublicMeta.related_items,
|
|
28
28
|
hint_text: r.itemPublicMeta.hint_text,
|
|
29
|
-
|
|
30
|
-
type: {
|
|
31
|
-
[StoreItemType.Bonus]: 'bonus',
|
|
32
|
-
[StoreItemType.Manual]: 'manual'
|
|
33
|
-
}[r.itemTypeId] as 'bonus' | 'manual',
|
|
34
|
-
|
|
29
|
+
type: StoreItemTypeNamed(r.itemTypeId),
|
|
35
30
|
can_buy: r.canBuy,
|
|
36
31
|
category_ids: r.categoryIds ?? [],
|
|
37
32
|
pool: r.shopPool,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IntUtils } from "../IntUtils";
|
|
2
2
|
import { TStoreItem } from "../WSAPI/WSAPITypes";
|
|
3
3
|
import { StoreItem } from "./StoreItem";
|
|
4
|
-
import {
|
|
4
|
+
import { StoreItemTypeNamed } from "./StoreItemType";
|
|
5
5
|
|
|
6
6
|
interface StoreItemPurchased extends StoreItem {
|
|
7
7
|
purchase_ts: number;
|
|
@@ -26,15 +26,10 @@ export const StoreItemPurchasedTransform = (items: StoreItemPurchased[]): TStore
|
|
|
26
26
|
description: r.itemPublicMeta.description,
|
|
27
27
|
ribbon: r.itemPublicMeta.label_tag === 'custom' ? r.itemPublicMeta.custom_label_tag : r.itemPublicMeta.label_tag,
|
|
28
28
|
limit_message: r.itemPublicMeta.limit_message,
|
|
29
|
-
priority: r.itemPublicMeta.priority,
|
|
29
|
+
priority: r.itemPublicMeta.priority ?? 0,
|
|
30
30
|
related_item_ids: r.itemPublicMeta.related_items,
|
|
31
31
|
hint_text: r.itemPublicMeta.hint_text,
|
|
32
|
-
|
|
33
|
-
type: {
|
|
34
|
-
[StoreItemType.Bonus]: 'bonus',
|
|
35
|
-
[StoreItemType.Manual]: 'manual'
|
|
36
|
-
}[r.itemTypeId] as 'bonus' | 'manual',
|
|
37
|
-
|
|
32
|
+
type: StoreItemTypeNamed(r.itemTypeId),
|
|
38
33
|
can_buy: r.canBuy,
|
|
39
34
|
category_ids: r.categoryIds ?? [],
|
|
40
35
|
pool: r.shopPool,
|
|
@@ -44,6 +39,7 @@ export const StoreItemPurchasedTransform = (items: StoreItemPurchased[]): TStore
|
|
|
44
39
|
purchased_this_week: purchasedThisWeek,
|
|
45
40
|
purchased_this_month: purchasedThisMonth,
|
|
46
41
|
}
|
|
42
|
+
|
|
47
43
|
return x;
|
|
48
44
|
});
|
|
49
45
|
|
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
export enum StoreItemType {
|
|
2
2
|
Bonus = 1,
|
|
3
|
-
|
|
3
|
+
Tangible = 2,
|
|
4
|
+
MiniGameSpin = 3,
|
|
5
|
+
ChangeLevel = 4,
|
|
6
|
+
PrizeDrop = 5,
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export enum StoreItemTypeName {
|
|
10
|
+
Bonus = "bonus",
|
|
11
|
+
Tangible = "tangible",
|
|
12
|
+
MiniGameSpin = "minigamespin",
|
|
13
|
+
ChangeLevel = "changelevel",
|
|
14
|
+
PrizeDrop = "prizedrop",
|
|
15
|
+
Unknown = "unknown"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const StoreItemTypeNamed = (type: StoreItemType): StoreItemTypeName => {
|
|
19
|
+
return {
|
|
20
|
+
[StoreItemType.Bonus]: StoreItemTypeName.Bonus,
|
|
21
|
+
[StoreItemType.Tangible]: StoreItemTypeName.Bonus,
|
|
22
|
+
[StoreItemType.MiniGameSpin]: StoreItemTypeName.MiniGameSpin,
|
|
23
|
+
[StoreItemType.ChangeLevel]: StoreItemTypeName.ChangeLevel,
|
|
24
|
+
[StoreItemType.PrizeDrop]: StoreItemTypeName.PrizeDrop,
|
|
25
|
+
}[type] || StoreItemTypeName.Unknown;
|
|
4
26
|
}
|
|
5
27
|
|
package/src/WSAPI/WSAPITypes.ts
CHANGED
|
@@ -355,8 +355,8 @@ export interface TStoreItem {
|
|
|
355
355
|
description: string;
|
|
356
356
|
/** URL of the image of the store item */
|
|
357
357
|
image: string;
|
|
358
|
-
/** Type of the store item. Can be 'bonus' or '
|
|
359
|
-
type: 'bonus' | '
|
|
358
|
+
/** Type of the store item. Can be 'bonus' or 'tangible' or different others. */
|
|
359
|
+
type: 'bonus' | 'tangible' | 'minigamespin' | 'changelevel' | 'prizedrop' | "unknown";
|
|
360
360
|
/** The price of the store item in the gamification points */
|
|
361
361
|
price: number;
|
|
362
362
|
/** The ribbon of the store item. Can be 'sale', 'hot', 'new', 'vip' or URL to the image in case of custom ribbon */
|