@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/dist/index.modern.mjs
CHANGED
|
@@ -1918,7 +1918,10 @@ class WSAPI {
|
|
|
1918
1918
|
on(ClassId.ACHIEVEMENT_CLAIM_PRIZE_RESPONSE, () => this.updateMissions());
|
|
1919
1919
|
on(ClassId.RELOAD_ACHIEVEMENTS_EVENT, () => this.updateMissions());
|
|
1920
1920
|
on(ClassId.TOURNAMENT_REGISTER_RESPONSE, () => this.updateTournaments());
|
|
1921
|
-
on(ClassId.BUY_SHOP_ITEM_RESPONSE, () =>
|
|
1921
|
+
on(ClassId.BUY_SHOP_ITEM_RESPONSE, () => {
|
|
1922
|
+
this.updateStorePurchasedItems();
|
|
1923
|
+
this.updateStoreItems();
|
|
1924
|
+
});
|
|
1922
1925
|
on(ClassId.CLIENT_ENGAGEMENT_EVENT_NEW, () => this.updateInboxMessages());
|
|
1923
1926
|
on(ClassId.LOGOUT_RESPONSE, () => OCache.clearContext(ECacheContext.WSAPI));
|
|
1924
1927
|
on(ClassId.IDENTIFY_RESPONSE, () => OCache.clearContext(ECacheContext.WSAPI));
|
|
@@ -2112,6 +2115,9 @@ class WSAPI {
|
|
|
2112
2115
|
/**
|
|
2113
2116
|
*
|
|
2114
2117
|
* Returns all the store items available the current user
|
|
2118
|
+
* The returned store items are cached for 30 seconds. But you can pass the onUpdate callback as a parameter.
|
|
2119
|
+
* Note that each time you call getStoreItems with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
2120
|
+
* The onUpdate callback will be called on purchase of the store item.
|
|
2115
2121
|
*
|
|
2116
2122
|
* **Example**:
|
|
2117
2123
|
* ```
|
|
@@ -2126,8 +2132,15 @@ class WSAPI {
|
|
|
2126
2132
|
* console.log(result);
|
|
2127
2133
|
* });
|
|
2128
2134
|
* ```
|
|
2135
|
+
* @param params
|
|
2136
|
+
* @param params.onUpdate - callback function that will be called when the store items are updated
|
|
2129
2137
|
*/
|
|
2130
|
-
async getStoreItems(
|
|
2138
|
+
async getStoreItems({
|
|
2139
|
+
onUpdate
|
|
2140
|
+
} = {}) {
|
|
2141
|
+
if (onUpdate) {
|
|
2142
|
+
this.onUpdateCallback.set(onUpdateContextKey.StoreItems, onUpdate);
|
|
2143
|
+
}
|
|
2131
2144
|
return OCache.use(onUpdateContextKey.StoreItems, ECacheContext.WSAPI, () => this.api.storeGetItemsT(null), CACHE_DATA_SEC);
|
|
2132
2145
|
}
|
|
2133
2146
|
/** Buy the specific shop item by item_id. Returns the err_code in case of success or error.
|
|
@@ -2601,6 +2614,10 @@ class WSAPI {
|
|
|
2601
2614
|
const payload = await this.api.storeGetPurchasedItemsT(null, 20, 0);
|
|
2602
2615
|
this.updateEntity(onUpdateContextKey.StoreHistory, payload);
|
|
2603
2616
|
}
|
|
2617
|
+
async updateStoreItems() {
|
|
2618
|
+
const payload = await this.api.storeGetItemsT(null);
|
|
2619
|
+
this.updateEntity(onUpdateContextKey.StoreItems, payload);
|
|
2620
|
+
}
|
|
2604
2621
|
async updateInboxMessages() {
|
|
2605
2622
|
const payload = await this.api.getInboxMessagesT(null);
|
|
2606
2623
|
this.updateEntity(onUpdateContextKey.InboxMessages, payload);
|