@smartico/public-api 0.0.296 → 0.0.298
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/Raffle/RafflePrize.d.ts +4 -0
- package/dist/SmarticoAPI.d.ts +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +10 -0
- package/dist/index.modern.mjs.map +1 -1
- package/docs/interfaces/RafflePrizePublicMeta.md +8 -0
- package/package.json +1 -1
- package/src/Raffle/RafflePrize.ts +4 -0
- package/src/SmarticoAPI.ts +1 -0
- package/src/WSAPI/WSAPI.ts +11 -0
package/package.json
CHANGED
|
@@ -8,6 +8,10 @@ interface RafflePrizePublicMeta {
|
|
|
8
8
|
description: string;
|
|
9
9
|
/** URL of the image that represents the prize */
|
|
10
10
|
image_url: string;
|
|
11
|
+
/**
|
|
12
|
+
* Indicates whether the chance to win should be hidden in the UI.
|
|
13
|
+
*/
|
|
14
|
+
hide_chance_to_win: boolean;
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
/**
|
package/src/SmarticoAPI.ts
CHANGED
|
@@ -138,6 +138,7 @@ interface Tracker {
|
|
|
138
138
|
userPublicProps: any;
|
|
139
139
|
on: (callBackKey: ClassId, func: (data: any) => void) => void;
|
|
140
140
|
getLabelSetting: (key: PublicLabelSettings) => any;
|
|
141
|
+
triggerExternalCallBack: (callBackKey: string, payload: any) => void;
|
|
141
142
|
}
|
|
142
143
|
interface IOptions {
|
|
143
144
|
logger?: ILogger;
|
package/src/WSAPI/WSAPI.ts
CHANGED
|
@@ -102,6 +102,8 @@ export class WSAPI {
|
|
|
102
102
|
OCache.clearAll();
|
|
103
103
|
if (this.api.tracker) {
|
|
104
104
|
const on = this.api.tracker.on;
|
|
105
|
+
const triggerExternalCallback = this.api.tracker.triggerExternalCallBack;
|
|
106
|
+
|
|
105
107
|
on(ClassId.SAW_SPINS_COUNT_PUSH, (data: SAWSpinsCountPush) => this.updateOnSpin(data));
|
|
106
108
|
on(ClassId.SAW_SHOW_SPIN_PUSH, () => this.reloadMiniGameTemplate());
|
|
107
109
|
on(ClassId.SAW_AKNOWLEDGE_RESPONSE, () => {
|
|
@@ -135,6 +137,15 @@ export class WSAPI {
|
|
|
135
137
|
this.updateRaffles();
|
|
136
138
|
OCache.clear(ECacheContext.WSAPI, onUpdateContextKey.Raffles);
|
|
137
139
|
});
|
|
140
|
+
on(ClassId.GET_INBOX_MESSAGES_RESPONSE, (res) => {
|
|
141
|
+
const unreadCountInProfile = this.api.tracker?.userPublicProps?.core_inbox_unread_count;
|
|
142
|
+
|
|
143
|
+
if (res.unread_count && triggerExternalCallback && unreadCountInProfile !== res.unread_count) {
|
|
144
|
+
triggerExternalCallback('props_change', {
|
|
145
|
+
core_inbox_unread_count: res.unread_count,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
})
|
|
138
149
|
}
|
|
139
150
|
}
|
|
140
151
|
|