@smartico/public-api 0.0.68 → 0.0.70
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/MiniGames/SAWTemplateUI.d.ts +1 -0
- package/dist/OCache.d.ts +3 -1
- package/dist/SmarticoAPI.d.ts +3 -1
- package/dist/WSAPI/WSAPI.d.ts +24 -6
- package/dist/WSAPI/WSAPITypes.d.ts +3 -0
- package/dist/index.js +242 -84
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +99 -15
- package/dist/index.modern.mjs.map +1 -1
- package/docs/classes/WSAPI.md +33 -6
- package/docs/interfaces/TMiniGameTemplate.md +12 -0
- package/package.json +1 -1
- package/src/MiniGames/SAWGetTemplatesResponse.ts +2 -2
- package/src/MiniGames/SAWTemplateUI.ts +1 -0
- package/src/OCache.ts +12 -5
- package/src/SmarticoAPI.ts +14 -4
- package/src/WSAPI/WSAPI.ts +93 -13
- package/src/WSAPI/WSAPITypes.ts +3 -3
package/docs/classes/WSAPI.md
CHANGED
|
@@ -28,9 +28,18 @@ ___
|
|
|
28
28
|
|
|
29
29
|
### getMissions
|
|
30
30
|
|
|
31
|
-
▸ **getMissions**(): `Promise`<[`TMissionOrBadge`](../interfaces/TMissionOrBadge.md)[]\>
|
|
31
|
+
▸ **getMissions**(`«destructured»`): `Promise`<[`TMissionOrBadge`](../interfaces/TMissionOrBadge.md)[]\>
|
|
32
32
|
|
|
33
|
-
Returns all the missions available the current user
|
|
33
|
+
Returns all the missions available the current user.
|
|
34
|
+
The returned missions is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getMissions with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
35
|
+
The onUpdate callback will be called on mission OptIn and the updated missions will be passed to it.
|
|
36
|
+
|
|
37
|
+
#### Parameters
|
|
38
|
+
|
|
39
|
+
| Name | Type |
|
|
40
|
+
| :------ | :------ |
|
|
41
|
+
| `«destructured»` | `Object` |
|
|
42
|
+
| › `onUpdate?` | (`data`: [`TMissionOrBadge`](../interfaces/TMissionOrBadge.md)[]) => `void` |
|
|
34
43
|
|
|
35
44
|
#### Returns
|
|
36
45
|
|
|
@@ -76,9 +85,18 @@ ___
|
|
|
76
85
|
|
|
77
86
|
### getMiniGames
|
|
78
87
|
|
|
79
|
-
▸ **getMiniGames**(): `Promise`<[`TMiniGameTemplate`](../interfaces/TMiniGameTemplate.md)[]\>
|
|
88
|
+
▸ **getMiniGames**(`«destructured»`): `Promise`<[`TMiniGameTemplate`](../interfaces/TMiniGameTemplate.md)[]\>
|
|
89
|
+
|
|
90
|
+
Returns the list of mini-games available for user
|
|
91
|
+
The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getMiniGames with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
92
|
+
The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or wined prize is spin/jackpot and if max count of the available user spin equal one . Updated templates will be passed to onUpdate callback.
|
|
80
93
|
|
|
81
|
-
|
|
94
|
+
#### Parameters
|
|
95
|
+
|
|
96
|
+
| Name | Type |
|
|
97
|
+
| :------ | :------ |
|
|
98
|
+
| `«destructured»` | `Object` |
|
|
99
|
+
| › `onUpdate?` | (`data`: [`TMiniGameTemplate`](../interfaces/TMiniGameTemplate.md)[]) => `void` |
|
|
82
100
|
|
|
83
101
|
#### Returns
|
|
84
102
|
|
|
@@ -106,9 +124,18 @@ ___
|
|
|
106
124
|
|
|
107
125
|
### getTournamentsList
|
|
108
126
|
|
|
109
|
-
▸ **getTournamentsList**(): `Promise`<[`TTournament`](../interfaces/TTournament.md)[]\>
|
|
127
|
+
▸ **getTournamentsList**(`«destructured»`): `Promise`<[`TTournament`](../interfaces/TTournament.md)[]\>
|
|
110
128
|
|
|
111
|
-
Returns all the active instances of tournaments
|
|
129
|
+
Returns all the active instances of tournaments
|
|
130
|
+
The returned list is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getTournamentsList with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
131
|
+
The onUpdate callback will be called when the user has registered in a tournament. Updated list will be passed to onUpdate callback.
|
|
132
|
+
|
|
133
|
+
#### Parameters
|
|
134
|
+
|
|
135
|
+
| Name | Type |
|
|
136
|
+
| :------ | :------ |
|
|
137
|
+
| `«destructured»` | `Object` |
|
|
138
|
+
| › `onUpdate?` | (`data`: [`TTournament`](../interfaces/TTournament.md)[]) => `void` |
|
|
112
139
|
|
|
113
140
|
#### Returns
|
|
114
141
|
|
|
@@ -56,12 +56,24 @@ ___
|
|
|
56
56
|
|
|
57
57
|
• **buyin\_cost\_points**: `number`
|
|
58
58
|
|
|
59
|
+
in case of charging type 'Points', what is the points amount will be deducted from user balance
|
|
60
|
+
|
|
59
61
|
___
|
|
60
62
|
|
|
61
63
|
### spin\_count
|
|
62
64
|
|
|
63
65
|
• `Optional` **spin\_count**: `number`
|
|
64
66
|
|
|
67
|
+
in case of charging type 'Spin attempts', shows the current number of spin attempts that user has
|
|
68
|
+
|
|
69
|
+
___
|
|
70
|
+
|
|
71
|
+
### next\_available\_spin\_ts
|
|
72
|
+
|
|
73
|
+
• **next\_available\_spin\_ts**: `number`
|
|
74
|
+
|
|
75
|
+
if the game is limit to the number of spins that user can do during period of time, this property shows the epoch time in UTC when the next attempt will be available
|
|
76
|
+
|
|
65
77
|
___
|
|
66
78
|
|
|
67
79
|
### over\_limit\_message
|
package/package.json
CHANGED
|
@@ -31,8 +31,8 @@ export const SAWTemplatesTransform = (items: SAWTemplate[]): TMiniGameTemplate[]
|
|
|
31
31
|
over_limit_message: r.saw_template_ui_definition.over_limit_message,
|
|
32
32
|
no_attempts_message: r.saw_template_ui_definition.no_attempts_message,
|
|
33
33
|
jackpot_symbol: r.saw_template_ui_definition.jackpot_symbol,
|
|
34
|
-
saw_game_type: SAWGameTypeNamed
|
|
35
|
-
saw_buyin_type: SAWBuyInTypeNamed
|
|
34
|
+
saw_game_type: SAWGameTypeNamed(r.saw_game_type_id),
|
|
35
|
+
saw_buyin_type: SAWBuyInTypeNamed(r.saw_buyin_type_id),
|
|
36
36
|
buyin_cost_points: r.buyin_cost_points,
|
|
37
37
|
jackpot_add_on_attempt: r.jackpot_add_on_attempt,
|
|
38
38
|
jackpot_current: r.jackpot_current,
|
package/src/OCache.ts
CHANGED
|
@@ -3,7 +3,8 @@ import { NodeCache } from "./NodeCache";
|
|
|
3
3
|
|
|
4
4
|
export enum ECacheContext {
|
|
5
5
|
Translations,
|
|
6
|
-
LabelInfo
|
|
6
|
+
LabelInfo,
|
|
7
|
+
WSAPI,
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
const WITH_REF_CACHE = [
|
|
@@ -12,15 +13,19 @@ const WITH_REF_CACHE = [
|
|
|
12
13
|
|
|
13
14
|
export class OCache {
|
|
14
15
|
|
|
15
|
-
private static cache: { [key: string]
|
|
16
|
+
private static cache: { [key: string]: NodeCache } = {};
|
|
17
|
+
|
|
18
|
+
private static init(cacheContext: ECacheContext) {
|
|
19
|
+
if (this.cache[cacheContext] === undefined) {
|
|
20
|
+
this.cache[cacheContext] = new NodeCache();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
16
23
|
|
|
17
24
|
public static get<T>(oKey: any, cacheContext: ECacheContext): T | undefined {
|
|
18
25
|
|
|
19
26
|
const key = cacheContext.toString() + '_' + JSON.stringify(oKey);
|
|
20
27
|
|
|
21
|
-
|
|
22
|
-
this.cache[cacheContext] = new NodeCache( );
|
|
23
|
-
}
|
|
28
|
+
this.init(cacheContext);
|
|
24
29
|
|
|
25
30
|
return this.cache[cacheContext].get(key);
|
|
26
31
|
}
|
|
@@ -29,6 +34,8 @@ export class OCache {
|
|
|
29
34
|
|
|
30
35
|
const key = cacheContext.toString() + '_' + JSON.stringify(oKey);
|
|
31
36
|
|
|
37
|
+
this.init(cacheContext);
|
|
38
|
+
|
|
32
39
|
this.cache[cacheContext].set(key, o, ttlSeconds);
|
|
33
40
|
}
|
|
34
41
|
|
package/src/SmarticoAPI.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { SAWGetTemplatesResponse } from './MiniGames/SAWGetTemplatesResponse';
|
|
|
5
5
|
import { SAWGetTemplatesRequest } from './MiniGames/SAWGetTemplatesRequest';
|
|
6
6
|
import { IntUtils } from './IntUtils';
|
|
7
7
|
import { ILogger } from './ILogger';
|
|
8
|
-
import { SAWDoSpinRequest, SAWDoSpinResponse, SAWSpinErrorCode, SAWTemplatesTransform } from './MiniGames';
|
|
8
|
+
import { SAWDoAknowledgeRequest, SAWDoAknowledgeResponse, SAWDoSpinRequest, SAWDoSpinResponse, SAWSpinErrorCode, SAWTemplatesTransform } from './MiniGames';
|
|
9
9
|
import { ECacheContext, OCache } from './OCache';
|
|
10
10
|
import { CoreUtils, GetTranslationsRequest, GetTranslationsResponse, ResponseIdentify, TranslationArea } from './Core';
|
|
11
11
|
import { GetLabelInfoResponse } from './Core/GetLabelInfoResponse';
|
|
@@ -27,6 +27,7 @@ const DEFAULT_LANG_EN = "EN";
|
|
|
27
27
|
interface Tracker {
|
|
28
28
|
label_api_key: string;
|
|
29
29
|
userPublicProps: any;
|
|
30
|
+
on: (callBackKey: ClassId, func: (data: any) => void) => void;
|
|
30
31
|
}
|
|
31
32
|
interface IOptions {
|
|
32
33
|
logger?: ILogger;
|
|
@@ -293,13 +294,22 @@ class SmarticoAPI {
|
|
|
293
294
|
|
|
294
295
|
public async sawGetTemplatesT(user_ext_id: string): Promise<TMiniGameTemplate[]> {
|
|
295
296
|
return SAWTemplatesTransform((await this.sawGetTemplates(user_ext_id)).templates);
|
|
296
|
-
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
public async doAcknowledgeRequest(user_ext_id: string, request_id: string): Promise<SAWDoAknowledgeResponse>{
|
|
300
|
+
const message = this.buildMessage<SAWDoAknowledgeRequest, SAWDoAknowledgeResponse>(user_ext_id, ClassId.SAW_AKNOWLEDGE_REQUEST, {
|
|
301
|
+
request_id
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
return await this.send<SAWDoAknowledgeResponse>(message, ClassId.SAW_AKNOWLEDGE_RESPONSE);
|
|
305
|
+
}
|
|
297
306
|
|
|
298
307
|
public async sawSpinRequest(user_ext_id: string, saw_template_id: number, round_id?: number): Promise<SAWDoSpinResponse> {
|
|
308
|
+
const request_id = IntUtils.uuid();
|
|
299
309
|
|
|
300
310
|
const message = this.buildMessage<SAWDoSpinRequest, SAWDoSpinResponse>(user_ext_id, ClassId.SAW_DO_SPIN_REQUEST, {
|
|
301
311
|
saw_template_id,
|
|
302
|
-
request_id
|
|
312
|
+
request_id
|
|
303
313
|
});
|
|
304
314
|
|
|
305
315
|
const spinAttemptResponse = await this.send<SAWDoSpinResponse>(message, ClassId.SAW_DO_SPIN_RESPONSE);
|
|
@@ -321,7 +331,7 @@ class SmarticoAPI {
|
|
|
321
331
|
round_id,
|
|
322
332
|
});
|
|
323
333
|
|
|
324
|
-
return spinAttemptResponse;
|
|
334
|
+
return {...spinAttemptResponse, request_id };
|
|
325
335
|
}
|
|
326
336
|
|
|
327
337
|
public async inboxGetMessages(user_ext_id: string, limit: number = 10, offset: number = 0): Promise<GetInboxMessagesResponse> {
|
package/src/WSAPI/WSAPI.ts
CHANGED
|
@@ -1,13 +1,32 @@
|
|
|
1
|
+
import { ClassId } from "../Base/ClassId";
|
|
1
2
|
import { CoreUtils } from "../Core";
|
|
3
|
+
import { MiniGamePrizeTypeName, SAWDoSpinResponse, SAWSpinErrorCode, SAWSpinsCountPush } from "../MiniGames";
|
|
4
|
+
import { ECacheContext, OCache } from "../OCache";
|
|
2
5
|
import { SmarticoAPI } from "../SmarticoAPI";
|
|
6
|
+
import { TLevel, TMiniGamePlayResult, TMiniGamePrize, TMiniGameTemplate, TMissionOrBadge, TStoreItem, TTournament, TTournamentDetailed, TUserProfile } from "./WSAPITypes";
|
|
7
|
+
|
|
8
|
+
/** @hidden */
|
|
9
|
+
const CACHE_DATA_SEC = 30;
|
|
10
|
+
/** @hidden */
|
|
11
|
+
enum onUpdateContextKey {
|
|
12
|
+
Saw = 'saw',
|
|
13
|
+
Missions = 'missions',
|
|
14
|
+
TournamentList = 'tournamentList',
|
|
15
|
+
}
|
|
3
16
|
|
|
4
|
-
import { TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionOrBadge, TStoreItem, TTournament, TTournamentDetailed, TUserProfile } from "./WSAPITypes";
|
|
5
17
|
|
|
6
18
|
/** @group General API */
|
|
7
19
|
export class WSAPI {
|
|
8
20
|
|
|
21
|
+
private onUpdateCallback: Map<onUpdateContextKey, (data: any) => void> = new Map();
|
|
22
|
+
|
|
9
23
|
/** @private */
|
|
10
24
|
constructor(private api: SmarticoAPI) {
|
|
25
|
+
const on = this.api.tracker.on;
|
|
26
|
+
on(ClassId.SAW_SPINS_COUNT_PUSH, (data: SAWSpinsCountPush) => this.updateOnSpin(data));
|
|
27
|
+
on(ClassId.SAW_DO_SPIN_RESPONSE, (data: SAWDoSpinResponse) => on(ClassId.SAW_AKNOWLEDGE_RESPONSE, () => this.updateOnPrizeWin(data)));
|
|
28
|
+
on(ClassId.MISSION_OPTIN_RESPONSE, () => this.updateMissionsOnOptIn());
|
|
29
|
+
on(ClassId.TOURNAMENT_REGISTER_RESPONSE, () => this.updateTournamentsOnRegistration());
|
|
11
30
|
}
|
|
12
31
|
|
|
13
32
|
/** Returns information about current user */
|
|
@@ -19,16 +38,22 @@ export class WSAPI {
|
|
|
19
38
|
} else {
|
|
20
39
|
throw new Error('Tracker is not initialized, cannot getUserProfile');
|
|
21
40
|
}
|
|
22
|
-
}
|
|
41
|
+
}
|
|
23
42
|
|
|
24
43
|
/** Returns all the levels available the current user */
|
|
25
44
|
public async getLevels(): Promise<TLevel[]> {
|
|
26
45
|
return this.api.levelsGetT(null);
|
|
27
46
|
}
|
|
28
47
|
|
|
29
|
-
/** Returns all the missions available the current user
|
|
30
|
-
|
|
31
|
-
|
|
48
|
+
/** Returns all the missions available the current user.
|
|
49
|
+
* The returned missions is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getMissions with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
50
|
+
* The onUpdate callback will be called on mission OptIn and the updated missions will be passed to it. */
|
|
51
|
+
public async getMissions({ onUpdate }: { onUpdate?: (data: TMissionOrBadge[]) => void }): Promise<TMissionOrBadge[]> {
|
|
52
|
+
if (onUpdate) {
|
|
53
|
+
this.onUpdateCallback.set(onUpdateContextKey.Missions, onUpdate);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return OCache.use(onUpdateContextKey.Missions, ECacheContext.WSAPI, () => this.api.missionsGetItemsT(null), CACHE_DATA_SEC);
|
|
32
57
|
}
|
|
33
58
|
|
|
34
59
|
/** Returns all the badges available the current user */
|
|
@@ -44,17 +69,23 @@ export class WSAPI {
|
|
|
44
69
|
/** Returns store categories */
|
|
45
70
|
public async getStoreCategories(): Promise<TStoreItem[]> {
|
|
46
71
|
return this.api.storeGetItemsT(null);
|
|
47
|
-
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Returns the list of mini-games available for user
|
|
75
|
+
* The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getMiniGames with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
76
|
+
* The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or wined prize is spin/jackpot and if max count of the available user spin equal one . Updated templates will be passed to onUpdate callback. */
|
|
77
|
+
public async getMiniGames({ onUpdate }: { onUpdate?: (data: TMiniGameTemplate[]) => void }): Promise<TMiniGameTemplate[]> {
|
|
78
|
+
if (onUpdate) {
|
|
79
|
+
this.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
|
|
80
|
+
}
|
|
48
81
|
|
|
49
|
-
|
|
50
|
-
public async getMiniGames(): Promise<TMiniGameTemplate[]> {
|
|
51
|
-
return this.api.sawGetTemplatesT(null);
|
|
82
|
+
return OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, () => this.api.sawGetTemplatesT(null), CACHE_DATA_SEC);
|
|
52
83
|
}
|
|
53
84
|
|
|
54
85
|
/** Plays the specified by template_id mini-game on behalf of user and returns prize_id or err_code */
|
|
55
86
|
public async playMiniGame(template_id: number): Promise<TMiniGamePlayResult> {
|
|
56
|
-
|
|
57
87
|
const r = await this.api.sawSpinRequest(null, template_id);
|
|
88
|
+
this.api.doAcknowledgeRequest(null, r.request_id)
|
|
58
89
|
|
|
59
90
|
const o: TMiniGamePlayResult = {
|
|
60
91
|
err_code: r.errCode,
|
|
@@ -65,9 +96,15 @@ export class WSAPI {
|
|
|
65
96
|
return o;
|
|
66
97
|
}
|
|
67
98
|
|
|
68
|
-
/** Returns all the active instances of tournaments
|
|
69
|
-
|
|
70
|
-
|
|
99
|
+
/** Returns all the active instances of tournaments
|
|
100
|
+
* The returned list is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getTournamentsList with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
101
|
+
* The onUpdate callback will be called when the user has registered in a tournament. Updated list will be passed to onUpdate callback.*/
|
|
102
|
+
public async getTournamentsList({ onUpdate }: { onUpdate?: (data: TTournament[]) => void }): Promise<TTournament[]> {
|
|
103
|
+
if (onUpdate) {
|
|
104
|
+
this.onUpdateCallback.set(onUpdateContextKey.TournamentList, onUpdate);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return OCache.use(onUpdateContextKey.TournamentList, ECacheContext.WSAPI, () => this.api.tournamentsGetLobbyT(null), CACHE_DATA_SEC);
|
|
71
108
|
}
|
|
72
109
|
|
|
73
110
|
/** Returns details information of specific tournament instance, the response will includ tournamnet info and the leaderboard of players */
|
|
@@ -75,4 +112,47 @@ export class WSAPI {
|
|
|
75
112
|
return this.api.tournamentsGetInfoT(null, tournamentInstanceId);
|
|
76
113
|
}
|
|
77
114
|
|
|
115
|
+
private async updateOnSpin(data: SAWSpinsCountPush) {
|
|
116
|
+
const templates: TMiniGameTemplate[] = await OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, () => this.api.sawGetTemplatesT(null), CACHE_DATA_SEC);
|
|
117
|
+
const index = templates.findIndex(t => t.id === data.saw_template_id);
|
|
118
|
+
templates[index].spin_count = data.spin_count;
|
|
119
|
+
this.updateEntity(onUpdateContextKey.Saw, templates)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
private async updateOnPrizeWin(data: SAWDoSpinResponse) {
|
|
123
|
+
if (data.errCode === SAWSpinErrorCode.SAW_OK) {
|
|
124
|
+
const templates: TMiniGameTemplate[] = await OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, () => this.api.sawGetTemplatesT(null), CACHE_DATA_SEC);
|
|
125
|
+
const template: TMiniGameTemplate = templates.find(t => t.prizes.find(p => p.id === data.saw_prize_id));
|
|
126
|
+
const prizeType = template.prizes.find(p => p.id === data.saw_prize_id)?.prize_type;
|
|
127
|
+
|
|
128
|
+
if (
|
|
129
|
+
template.jackpot_add_on_attempt ||
|
|
130
|
+
template.spin_count === 1 ||
|
|
131
|
+
prizeType === MiniGamePrizeTypeName.JACKPOT ||
|
|
132
|
+
prizeType === MiniGamePrizeTypeName.SPIN
|
|
133
|
+
) {
|
|
134
|
+
const updatedTemplates = await this.api.sawGetTemplatesT(null);
|
|
135
|
+
this.updateEntity(onUpdateContextKey.Saw, updatedTemplates)
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
private async updateMissionsOnOptIn() {
|
|
141
|
+
const payload = await this.api.missionsGetItemsT(null);
|
|
142
|
+
this.updateEntity(onUpdateContextKey.Missions, payload)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
private async updateTournamentsOnRegistration() {
|
|
146
|
+
const payload = await this.api.tournamentsGetLobbyT(null);
|
|
147
|
+
this.updateEntity(onUpdateContextKey.TournamentList, payload)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
private async updateEntity(contextKey: onUpdateContextKey, payload: any) {
|
|
151
|
+
OCache.set(contextKey, payload, ECacheContext.WSAPI);
|
|
152
|
+
|
|
153
|
+
const onUpdate = this.onUpdateCallback.get(contextKey);
|
|
154
|
+
if (onUpdate) {
|
|
155
|
+
onUpdate(payload);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
78
158
|
}
|
package/src/WSAPI/WSAPITypes.ts
CHANGED
|
@@ -54,12 +54,12 @@ export interface TMiniGameTemplate {
|
|
|
54
54
|
/** How the user is charged for each game attempt e.g. Free, Points or Spin attempts */
|
|
55
55
|
saw_buyin_type: SAWBuyInTypeName;
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
/** in case of charging type 'Points', what is the points amount will be deducted from user balance */
|
|
58
58
|
buyin_cost_points: number;
|
|
59
|
-
|
|
59
|
+
/** in case of charging type 'Spin attempts', shows the current number of spin attempts that user has */
|
|
60
60
|
spin_count?: number;
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
/** if the game is limit to the number of spins that user can do during period of time, this property shows the epoch time in UTC when the next attempt will be available */
|
|
63
63
|
next_available_spin_ts: number;
|
|
64
64
|
|
|
65
65
|
|