@smartico/public-api 0.0.71 → 0.0.73
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/SAWTemplate.d.ts +1 -1
- package/dist/Missions/AchievementPublicMeta.d.ts +1 -0
- package/dist/WSAPI/WSAPI.d.ts +12 -1
- package/dist/index.js +39 -13
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +17 -1
- package/dist/index.modern.mjs.map +1 -1
- package/docs/classes/WSAPI.md +11 -20
- package/package.json +1 -1
- package/src/MiniGames/SAWTemplate.ts +1 -1
- package/src/Missions/AchievementPublicMeta.ts +1 -1
- package/src/WSAPI/WSAPI.ts +19 -2
package/docs/classes/WSAPI.md
CHANGED
|
@@ -28,18 +28,14 @@ ___
|
|
|
28
28
|
|
|
29
29
|
### getMissions
|
|
30
30
|
|
|
31
|
-
▸ **getMissions**(
|
|
32
|
-
|
|
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.
|
|
31
|
+
▸ **getMissions**(`params?`): `Promise`<[`TMissionOrBadge`](../interfaces/TMissionOrBadge.md)[]\>
|
|
36
32
|
|
|
37
33
|
#### Parameters
|
|
38
34
|
|
|
39
35
|
| Name | Type |
|
|
40
36
|
| :------ | :------ |
|
|
41
|
-
|
|
|
42
|
-
|
|
|
37
|
+
| `params` | `Object` |
|
|
38
|
+
| `params.onUpdate?` | (`data`: [`TMissionOrBadge`](../interfaces/TMissionOrBadge.md)[]) => `void` |
|
|
43
39
|
|
|
44
40
|
#### Returns
|
|
45
41
|
|
|
@@ -85,18 +81,17 @@ ___
|
|
|
85
81
|
|
|
86
82
|
### getMiniGames
|
|
87
83
|
|
|
88
|
-
▸ **getMiniGames**(
|
|
84
|
+
▸ **getMiniGames**(`params?`): `Promise`<[`TMiniGameTemplate`](../interfaces/TMiniGameTemplate.md)[]\>
|
|
89
85
|
|
|
90
|
-
|
|
91
|
-
|
|
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.
|
|
86
|
+
/**
|
|
87
|
+
*
|
|
93
88
|
|
|
94
89
|
#### Parameters
|
|
95
90
|
|
|
96
91
|
| Name | Type |
|
|
97
92
|
| :------ | :------ |
|
|
98
|
-
|
|
|
99
|
-
|
|
|
93
|
+
| `params` | `Object` |
|
|
94
|
+
| `params.onUpdate?` | (`data`: [`TMiniGameTemplate`](../interfaces/TMiniGameTemplate.md)[]) => `void` |
|
|
100
95
|
|
|
101
96
|
#### Returns
|
|
102
97
|
|
|
@@ -124,18 +119,14 @@ ___
|
|
|
124
119
|
|
|
125
120
|
### getTournamentsList
|
|
126
121
|
|
|
127
|
-
▸ **getTournamentsList**(
|
|
128
|
-
|
|
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.
|
|
122
|
+
▸ **getTournamentsList**(`params?`): `Promise`<[`TTournament`](../interfaces/TTournament.md)[]\>
|
|
132
123
|
|
|
133
124
|
#### Parameters
|
|
134
125
|
|
|
135
126
|
| Name | Type |
|
|
136
127
|
| :------ | :------ |
|
|
137
|
-
|
|
|
138
|
-
|
|
|
128
|
+
| `params` | `Object` |
|
|
129
|
+
| `params.onUpdate?` | (`data`: [`TTournament`](../interfaces/TTournament.md)[]) => `void` |
|
|
139
130
|
|
|
140
131
|
#### Returns
|
|
141
132
|
|
package/package.json
CHANGED
package/src/WSAPI/WSAPI.ts
CHANGED
|
@@ -24,6 +24,8 @@ export class WSAPI {
|
|
|
24
24
|
constructor(private api: SmarticoAPI) {
|
|
25
25
|
const on = this.api.tracker.on;
|
|
26
26
|
on(ClassId.SAW_SPINS_COUNT_PUSH, (data: SAWSpinsCountPush) => this.updateOnSpin(data));
|
|
27
|
+
on(ClassId.SAW_SPINS_COUNT_PUSH, (data: SAWSpinsCountPush) => this.updateOnSpin(data));
|
|
28
|
+
on(ClassId.SAW_SHOW_SPIN_PUSH, () => this.updateOnAddSpin());
|
|
27
29
|
on(ClassId.SAW_DO_SPIN_RESPONSE, (data: SAWDoSpinResponse) => on(ClassId.SAW_AKNOWLEDGE_RESPONSE, () => this.updateOnPrizeWin(data)));
|
|
28
30
|
on(ClassId.MISSION_OPTIN_RESPONSE, () => this.updateMissionsOnOptIn());
|
|
29
31
|
on(ClassId.TOURNAMENT_REGISTER_RESPONSE, () => this.updateTournamentsOnRegistration());
|
|
@@ -47,7 +49,10 @@ export class WSAPI {
|
|
|
47
49
|
|
|
48
50
|
/** Returns all the missions available the current user.
|
|
49
51
|
* 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. */
|
|
52
|
+
* The onUpdate callback will be called on mission OptIn and the updated missions will be passed to it. */
|
|
53
|
+
/**
|
|
54
|
+
* @param params
|
|
55
|
+
*/
|
|
51
56
|
public async getMissions({ onUpdate }: { onUpdate?: (data: TMissionOrBadge[]) => void } = {}): Promise<TMissionOrBadge[]> {
|
|
52
57
|
if (onUpdate) {
|
|
53
58
|
this.onUpdateCallback.set(onUpdateContextKey.Missions, onUpdate);
|
|
@@ -73,7 +78,11 @@ export class WSAPI {
|
|
|
73
78
|
|
|
74
79
|
/** Returns the list of mini-games available for user
|
|
75
80
|
* 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. */
|
|
81
|
+
* 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, also if the spins were issued to the user manually in the BO. Updated templates will be passed to onUpdate callback. */
|
|
82
|
+
/**
|
|
83
|
+
/**
|
|
84
|
+
* @param params
|
|
85
|
+
*/
|
|
77
86
|
public async getMiniGames({ onUpdate }: { onUpdate?: (data: TMiniGameTemplate[]) => void } = {}): Promise<TMiniGameTemplate[]> {
|
|
78
87
|
if (onUpdate) {
|
|
79
88
|
this.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
|
|
@@ -99,6 +108,9 @@ export class WSAPI {
|
|
|
99
108
|
/** Returns all the active instances of tournaments
|
|
100
109
|
* 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
110
|
* The onUpdate callback will be called when the user has registered in a tournament. Updated list will be passed to onUpdate callback.*/
|
|
111
|
+
/**
|
|
112
|
+
* @param params
|
|
113
|
+
*/
|
|
102
114
|
public async getTournamentsList({ onUpdate }: { onUpdate?: (data: TTournament[]) => void } = {}): Promise<TTournament[]> {
|
|
103
115
|
if (onUpdate) {
|
|
104
116
|
this.onUpdateCallback.set(onUpdateContextKey.TournamentList, onUpdate);
|
|
@@ -119,6 +131,11 @@ export class WSAPI {
|
|
|
119
131
|
this.updateEntity(onUpdateContextKey.Saw, templates)
|
|
120
132
|
}
|
|
121
133
|
|
|
134
|
+
private async updateOnAddSpin() {
|
|
135
|
+
const payload = await this.api.sawGetTemplatesT(null);
|
|
136
|
+
this.updateEntity(onUpdateContextKey.Saw, payload)
|
|
137
|
+
}
|
|
138
|
+
|
|
122
139
|
private async updateOnPrizeWin(data: SAWDoSpinResponse) {
|
|
123
140
|
if (data.errCode === SAWSpinErrorCode.SAW_OK) {
|
|
124
141
|
const templates: TMiniGameTemplate[] = await OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, () => this.api.sawGetTemplatesT(null), CACHE_DATA_SEC);
|